RS232 Barcode scanner interfacing

Hi all, new guy here... I have an RS232 barcode scanner and I am trying to read its data from my arduino (I have the Wboard Pro, which is basically the same as the Mega with wifi). So I have connected the 5v and the GND pins and its powering on just fine and also connected the scanner's RX-TX pins to the TX-RX of the board respectively. How can I read the scanner's data? I have tried to use the SoftwareSerial example but nothing comes on the monitor when I scan....

Thank you in advance.

The TX and RX pins on the Arduino are not RS232 compatible. They use the same serial data but the voltages are incompatible.

You can sometimes get it to work with SoftwareSerial, using the invert option.

You probably need a proper RS232 converter which uses a MAX232 chip.

Hi Morgan, thanks for the reply. I am now trying to include the invert option in my code like that (I added the “true”… Am I doing it right? I don’t get anything back… Can it be a baud setting or is it incorrect voltage levels?

#include <SoftwareSerial.h>

SoftwareSerial barcode = SoftwareSerial(10, 8, true); // RX, TX (TX not used, but the constructor wants a number anyway)

void setup()
{  
  Serial.begin(9600);
  Serial.println("Barcode Scanner Test!");
  
  // Open the SoftwareSerial port of the barcode scanner
  barcode.begin(9600);
  
  delay(1000);
}

void loop()
{
  if(barcode.available())
  {
    Serial.println("Read");
    char data = barcode.read();
    Serial.write(data);
  }
}

So if this does not work do I have to get something like this?