Problem in getting serial data via rs232 adapter form arduino

Hi, I am trying to get receive data to computer using a USB to serial adapter( Model :CADYCE CA-US9) from a Arduino uno, I have send "I am Pradeep" but in the serial terminal I receive this "[����[���=55��[" .
Trouble shooting Performed till now:

  1. tried to used different USB to serial adapter based on CH340G but got the same result.
  2. Tried it using another Arduino in reset mode i.e. as a adapter , which works fine.

I need to send the command to printer via rs232 for printing the barcode, but the data that I am sending is getting converted to gibberish.

void setup() {
 Serial.begin(9600);
}
void loop(){
Serial.println("I am Pradeep");
delay(1000);
}

Both my adapter and the adapter works on ttl logic levels.

Regards
Swapnil Diwakar

never mind.

Post code that sends data but the data gets turn into gibberish.

edit: sorry, I see that it turns into gibberish, so @awneil has the answer most likely.

Please say to what you are sending this data, and what it might say back to you.

What is the exact device you are hooking your Arduino to?

a7

That usually indicates a baud rate error...

Serial Communication - SparkFun Learn.

1 Like

First guess is mismatched baudrates.

1 Like

I have conformed the baud rate it 9600 on both side. And I am hooking it to CADYCE CA-US9 usb to serial adapter.
Thanks

Okay, what is being hooked to what with what?

If you are saying that the simple sketch you listed, that just prints directly to the serial window in the IDE is resulting in gibberish, and you have the correct baud rate selected in the serial monitor so window, I have no clues.

The cable you have is USB on one end and RS-232 on the other.

Please draw a block diagram showing all the devices involved in whatever it is you are trying to do, and how they are hooked up that does not work.

I need to send the command to printer via rs232

Say more.

Also, if you don't have or aren't using PuTTY or CoolTerm or other terminal emulator, you may want to consider doing. It can make finding mistakes and reverse engineering things very much easier.

a7

1 Like

The adapter you listed cannot be connected to you Arduino. Read what the adapter is for: "USB to Serial Convertor operates as a bridge between one USB port & standard RS-232 serial port ". Your Arduino DOES NOT have an RS-232 connection. It only has a serial connection to your PC that uses USB connection.
The output of your adapter is a + and - voltage greater than 3 volts and up to 12 volts and is definitely NOT TTL which is 0 and 5 volts.

I am hooking the Rx,Tx and ground pin of the Arduino at the designated pins of the usb to serial adapter. And my adapter works at TTL logic level.

Thanks

Then, by definition, it is NOT RS-232.

1 Like

Ok now , is there any way to implement 232 protocol via software like softserial library.

Is this the cable? https://us.cadyce.com/shop/cables-adapters/usb-2-0/ca-us9-usb-to-serial-converter-or-com-port/. If you connected the DB9 directly to the Arduino, you might have damaged the Arduino; just be prepared for that.

If you want to communicate from an Arduino to a RS232 device, you need something like SparkFun RS232 Shifter - SMD - SparkFun Electronics. It handles the required level conversion. You will have to look at the printer specs to see what is exactly required as there might be handshake involved.

No; you will need hardware. RS232 is not a protocol.

Just buy a new USB/Serial adapter that has TTL levels.
They've become incredibly cheap.

OTOH, many current "rs232" adapters actually seem to provide simply "inverted TTL", in which case a SWSerial solution might in fact be possible without risking damaged hardware.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.