Serial communication Send and Receive Error

Hello everybody,

I have the following problem with the serial communication of an Arduino UNO:

I need to send and receive data through the serial port to a PC, through the default pins (0,1) for this communication through a USB TO RS485 converter.

The project consists of sending a command to a PC and it responds to another command,
In the tests that I have done, the arduino sends the communication, but when the PC responds the arduino does not receive it, when I exchange the RX and TX pins of physical position, the arduino does not send the communication but it does receive it. In other words, there is only one way communication. But when I do the tests through the USB cable it does send and receive without problems, The problem is when I do it through the physical pins of the arduino

What could be the problem? The USB to RS485 module ?, the configuration of the serial port
These are the lines I use for the connection, and they work, but only one option at a time, and when I swap pins 0 and 1

SoftwareSerial mySerial(0, 1); //your pins to serial communication

mySerial.begin(9600); //Inicializar comunicacion serial

 mySerial.print(isla+codigo+"*$"); //comando que se envia

 size_t count = mySerial.readBytesUntil(',', data, 3); //Recive datos

If this is an UNO, why are you using software serial on pins 0 and 1 ?


You need a common GND between the Arduino and the PC.

Hi LarryD, thanks for your reply, But then the Module you are using (USB to rs485) would not work, since it only has 2 connections (TX, RX), it does not have GND, which module should I use on the computer.

The problem is tha TTL Serial (used by the Arduino on Pins 0 and 1) is NOT the same a RS485. To use a USB to RS485 adapter like this you will need an RS485 to TTL Serial adapter.

Most people use a USB to TTL Serial adapter, like the one built into the UNO, NANO, and MEGA.

1 Like

Thank you very much for your answer, I thought that the protocol that the arduino handles is rs485, how wrong I was. I am going to use this module and I will tell you the result. Note: Sorry for my English, I use the translator.
Captura.PNG

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