Hi, im trying to trying to connect an RS232 barcode reader to an Arduino UNO using a RS232 Serial to TTL Converter (MAX3232 module). I’ve set up SoftwareSerial on pins 6 (RX) and 7 (TX) to receive data from the barcode reader, but I’m not receiving anything.
The barcode reader im using is a Honeywell IS3480. i have tested the barcode reader by connecting to the pc via a RS232-to-USB adapter using putty and and it successfully transmits data to Putty terminal.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(6, 7); // RX, TX
void setup() {
Serial.begin( 9600 );
Serial.println("USB Serial is ready");
mySerial.begin( 9600 );
}
void loop() {
// put your main code here, to run repeatedly:
if (mySerial.available() > 0) {
// Read the incoming data
String data = mySerial.readString();
// Print the received data to the Serial Monitor
Serial.print("Received: ");
Serial.println(data);
}
}
With that module, you need to connect RX to RX and TX to TX.
You also need to use a crosover (null modem) cable between the converter and barcode reader.
Did you remember to connect the grounds, and power the barcode reader?
More sensible code might look like this, especially if you set the serial monitor baud rate to 115200.
void loop() {
// put your main code here, to run repeatedly:
while (mySerial.available() > 0) {
// Relay the incoming data
Serial.write(mySerial.read());
}
}
Yes, I have connected the grounds and the barcode reader is powered using a 5V power supply that comes with the barcode reader. The barcode reader uses a 9600 baud rate, which I confirmed using the PuTTY terminal during testing. Additionally, I use a Serial RS232 DB9 to DB9 male cable, where the RS232 port from the barcode reader is a female port, and the MAX 3232 module also has a female port. Therefore, I use a male-to-male connector.
Using a crossover worked. I used jumper cables to build a crossover between the barcode reader and the TTL converter since I couldn't find a null modem. Additionally, I had to connect TX to TX and RX to RX from the TTL converter to the Arduino board. Thanks to your solution, it worked perfectly. I really appreciate your help.