RS232 communication help needed

Hello forum,

I am at my wits end.

I am trying to read a data stream coming in over RS232. Arduino or ESP is not seeing data..

Here is what I have done thus far.

I confirm data is coming in from scanner using Hercules(com4 9600 8N1). So I know the data stream is OK.

I can send data using hercules to arduino rs232 shield (com3 9600 8N1). Using serial monitor (com1 9600) I can see data coming from Hercules.

When I connect the rs232 from the scanner to the rs232 shield, I see the light coming on (on the shield) but I do not see any data coming into arduino using serial monitor.

1.In my mind I have proven that I do have TX to RX connected.
2. I have proven that I have used the correct pin allocation on the UNO.
3. My code seems to be working well.

So in conclusion, using Hercules I can see the data from the scanner, and I can send data to arduino. So I have isolated the two legs and they seem to be working perfectly. Thereby proving all hardware to be ok.

When I remove hercules from the equation and I connect the scanner direct, I do not see the incoming stream on arduino serial monitor.

So you have RX to TX and TX to RX and GND to GND and it's not to the same serial port that is used for Serial Monitor comms, so that cuts wiring and port conflicts right out?

Hello akading

Post a picture of the hardware setup.

1 Like

Not sure what you mean or if this is a question at all, but I suspect you confirm that the wiring is ok

I'm guessing its not this chap
hercules

but this

do you have the handshaking correctly wired?

Yes not the guy😁

How do I wire handshaking?

Null Modem? Not sure I understand. Could you please explain like I am 5?:rofl:
What I have done is take the cable out of the equation and connect the rs232 shield directly to the serial hub. Not sure if this removed the cable crossover issue?

The data sheet doesnt say, but I'd assume the shield is already connected as a null modem.
Can you post your code please?

#include <SoftwareSerial.h>

SoftwareSerial mySerial(6, 7); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() { // run over and over
  if (mySerial.read()) {
    //mySerial.write();
    Serial.println("Data available");
    Serial.println(mySerial.read());
  }

  if (Serial.available()) {
    mySerial.write(Serial.read());
  }
  delay(1000);
}

1. Check that the UNO and RS232<--->TTL Module connection agrees with Fig-1.


Figure-1:

2. Upload the following sketch (yours' one of post #9 with slight modification.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(6, 7); // RX, TX

void setup() 
{
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(9600);
}

void loop() 
{ 
     byte n = mySerial.available();
     if(n !=0)
     {
          char y = mySerial.read();
          Serial.print(y);
     }
}

I can't see anything connected to pins 6 and 7 in your photo.

i have confirmed ground is passed all the way through.

using a multimeter, should TX and RX have passthrough? i guess not. 12V vs 5V TTL



1. Check the following connections:

RS232<---->TTL Module              Arduino UNO
TXD-pin                            DPin-7 (DPin = Digital Pin)
RXD-pin                            DPin-6
VCC-pin                            5V-pin
GND-pin                            GND-pin

2. What do you expect to see on the Serial Monitor -- digits (0 - 9, A - F) or alphabets (A - Z, a - z, etc.) or both?

Confirmed with 1 change. VCC is 3.3V.

At this stage, plain text is good. I have also tried HEX.

Difficult to make proper photo but here we go.

1 Like

i have also uploaded the code as you can see...

Better to apply VCC = 5V instead of 3.3V as you have iterfaced RS232/TTL Module with UNO which is 5V device.

Is your system working the way you want?

Well, i still cannot read data direct from scanner if that is what you are asking?

changing to 5V made no change

Is your system working