So i have a symbol barcode scanner we use at work, if i plug it into a standard pc and open word or textpad whatever and scan an item it prints the numeric value of the barcode. I have hooked the tx pin to the rx serial pin and power and ground, this is a db9 rs232 serial interface, .I have the following sketch. which when i scan a barcode it outputs
?æææææ¦ââÄD¦¬
#include <LiquidCrystal.h>
int i;
// initialize the library with the numbers of the interface pins
//LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
if i plug it into a standard pc and open word or textpad whatever and scan an item it prints the numeric value of the barcode. I have hooked the tx pin to the rx serial pin
...which are inverted and level-shifted with respect to standard RS232 voltage levels.
Hope you haven't damaged your Arduino.
Have a look at some add-on hardware based on the Maxim MAX232 chip family.
Which scanner do you have? It may not be sending data at 9600 baud.
The bytes that you do receive may be correct, but you are printing them as though they were ASCII characters. You could add ,DEC to the Serial.print statement:
Serial.print(i, DEC);
There is no reason to cast i as a byte before printing it.
The scanner powers up no problem and arduino is fine as well, the scanner is a MS 3207 motorola/symbol. If i change the cast to DEC it prints out three numbers for each number recieved...
...which are inverted and level-shifted with respect to standard RS232 voltage levels.
Hope you haven't damaged your Arduino.
Have a look at some add-on hardware based on the Maxim MAX232 chip family.
All of the Max232 boards i can find are shipped from china, i dont want to deal with that.. there is this product form Sparkfun will this work ? or do i really need the max 232 ?
No, it doesn't have to be a MAX232, other solutions are available, but yes, you have to translate the RS232 levels, which could swing between as much as +/- 15V (or even higher, although this is unlikely) to normal TTL levels.