That’s just a pure analog transmitter and receiver. You may be better off getting a serial scanner from ebay and hooking that up to the imp (may need a level shifter)
Is laser required/preferred (Honeywell type) for your purposes or could an image-based scanner be used as I know there are 3v3 options available and many would also provide a simpler serial comms interface, otherwise usb host shield/module may also be required. I believe Zebra Technologies offer a few 3v3 OEM image based options which may be worth investigating (thereby avoiding level shifter interface).
Thank you very much for your help. It helps me a lot.
Based on your recommandation (serial scanner) i found this one : http://www.gotronic.fr/art-lecteur-de-code-barres-dfr0314-22399.htm
But i can’t make it works with Electric Imp as the barcode communicate over RS-232.
I’m using this converter (http://www.gotronic.fr/art-convertisseur-rs232-ttl-mr211-19893.htm) to translate RS232 to TTL and use the TXD output of the converter with an UART pin of electricimp 002. Unfortunatly, it doesn’t works : i have random values everytime i scan the same barcode, although i’m sure the parameter “baudRate, wordSize, parity & stopBits” are well configured.
Did i missed something ?
How can we communicated with electric imp from RS-232 to UART ?
@mlseim : i think i would have the same issue with the ones you recommend (https://www.adafruit.com/?q=barcode) as they have USB or PS2 output (need to be converted as well).
Heh, annoyingly it seems the module actually outputs the right signal for an imp (TTL levels would be ok) but then it runs it through a converter on the baseboard to get to real RS232 levels
It should be fine - seems like it’s 9600bps. Can you take a picture of your setup and attach your code?
`uart <- hardware.uart1289;
line <- "";
// Accumulate data into a line, print it when we have a whole one
function handler() {
local b = uart.read();
while(b >= 0) {
if (b == 0x0d) {
server.log("received: "+line);
line = "";
} else {
line += b.tochar();
}
b = uart.read();
}
}
// Configure uart
uart.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS, handler);
`
Thank you for you code. Yes the barcode is sending : 9600bps, 8 data bits, 1 stop bit, no parity, no handshaking (NO_CTSRTS)
I did my test in 4 different situation :
1/ Without any converter, imp directly connected to the pin 2 of RS232
Setup : General view Zoom on RS232 (pin 2, RDX)
Code & log : http://cloud.kiliweb.fr/11Vml
I got some data out (14 line = 13 digits on the barcode + carriage return), but the numbers change from one barcode to another. There is no correspondance we can establish.
You may well have blown up the imp pin with your test number (1). RS232 is +/- 5v or higher, depending on the buffer being used, which is out of range for the imp pins.
In picture 2, you have not connected power to the converter board. You need to attach VCC to 3.3v and GND to GND as well as connecting the data line to pin 9 on the imp.
Picture 3/4 are just wrong. Power goes in on the breadboard side to the converter. You cannot supply power to the converter via the DB9 interface. The GND of the supply must be attached to the GND of the imp, so it’s generally best just to attach the VCC/GND of the converter to the 3.3v/GND of the imp breakout.
Summary: you must use a converter. You must also power the converter (from 3.3v) and ensure that the ground reference is the same as the imp.
Here is an update about the tests i did.
Thank you again for your precious help. It seems that i was doing all wrong !
I followed your advices : i power the converter with 3.3v from the imp and the ground reference is now the same as the imp. I also tried with an other imp (April card) as you suggested that my previous tests might have destroy the imp.
Even with a fresh new imp, it doesn’t works better.
It seems that the barcode works well : connecting the DB9 plug to a led show activity on RX pin.
My conclusion is that the RS232 to TTL converter is broken (maybe because of my previous tests). I’m waiting the delivery of a fresh new RS232 to TTL converter. As soon as i receive it, i will post update.