Using Rx, Tx pin of arduino to send command and read response

Hi,
All these time I have used USB port to send serial commands and get reply from arduino UNO. Now I need to do the same from a long distance say 20 ft. As USB cable cannot be used this long, I wanted to use Rx, Tx pin of UNO and a Serial to USB converter.
I can see my device responding from Serial monitor when connected to USB port of PC. But then I disconnect USB cable and connect Rx, Tx pin to converter Tx, Rx pin respectively. On sending command, UNO does not respond at all. What am I doing wrong?

IS your device looking for RS-232 type data, which is +- switching 3 to 12 volts. That is NOT what the Rx, Tx pins are sending.

@ak_jains

Make your hardware (needs good amount of works) setup between your UNO and 20-ft apart PC2 as per Fig-1. You will be able to do all the communications with UNO over the Arduino IDE.


Figure-1:

Procedures:
1. Powe OFF UNO.
2. Place MAX232 chip one the bread board.
3. Connect C1 to C5 capacitors with MAX232 chip as close as possible. Note down the polarities of the capas.

4. Connect 5V and GND of UNO with MAX232 chip.
5. Connect Pin-11 and 12 of MAX232 with UNO's TX-pin and RX-pin respectively as per Fig-1.
6. Get RS232/USB converter cable.
7. Short Pin-7, 8 and Pin-4, 6, 1 of RS232/USB converter cable as per Fig-1.
8. Connect Pin-2, 3 of RS232/USB converter cable with Pin-14, 13 of MAX232 respectively.
9. Apply 7V - 12V supply at power port of UNO as per Fig-1. Check that MAX 232 is not heated up. If so, disconnect power and check the wiring for any possible mistake. Cross check with MAX232's data sheets.

10. Connect the RS232/USB converter cable with a USB port of PC2.
11. Check that UNO has been detected at virtual COMX port.
12. Open IDE and upload Blink Led program from the Examples.
13. Check that Built-in L of UNO is blinking.

Dear Mostafa,
Thanks for your elaborate solution. Actually I had tried this same setup using readymade hardware. The image of setup is shown below:

The Arduino is separately powered and USB cable is disconnected. In the device manager I see is the USB to serial converter as virtual COM.
When I try to upload the Blink Led Example program, it is not responding. The IDE shows this error:

avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xf9

I don't know what is wrong.

Fine! You have used the TTL<---->RS232 converter Module. Which COM port has been assigned to your cable?

You may do the functionally check of the setup using software UART Port of the UNO.

I am trying to test your setup; but, I am missing the driver for my Z-TEK RS232/USB cable. If you can manage to find the driver in the net (for WIN10), please attach the copy.

You need the DTR signal as well for uploads to reset the Arduino to invoke the bootloader; not sure but it seems to be missing in your photo). Or press the reset button at exactly the right time.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project.

Right!
Probably, that functionality could not be easily achieved by the present setup of the OP as a wire is to be installed from DTR-pin (Pin-4 of DB connector of RS232/USB Cable) to RST-pin of the MCU.

You don't think so? Since the UNO uses only the lowest speed USB, it should work with a long cable. And I believe you can get "repeaters" to extend the cable. Using ready-built parts may be the best idea.

z-tek-usb-to-serial-comm-port-704363.zip (1.7 MB)
Attached. Driver for Z-TEK RS232/USB.

Thanks! I will test in the afternoon after returning from the varsity.

Ok.
For upload of the program, I can try to reset at right time. But is it possible to send and receive data without pressing RESET?

20ft is actually a very tight requirement for my project. With proper routing the length may go upto 40-50 ft. Since RS232 will easily handle 50ft length at 9600 bps, I wanted to explore that.
I also thought of other solution of using USB to LAN converter if RS232 protocol does not work. Kindly offer your suggestion.

After unzipping of the attached driver file, I don't find any setup file to do the installation.

RS485. 232 is painful; should have been obsoleted a decade ago. Cheap adapters to 485 abound.
C

DTR signal is only needed for upload. Lack of it has no effect on serial communication (e.g. Serial.print).

Sorry, I did not check after downloading. See the latest download attached.
pc driver.zip (3.3 MB)
It does not have driver for Windows 10 but for vista. Hope it work.

Hi all,
It worked. The connection is all same previously shared by me. I only powered the TTL to RS232 converter separately which I did not do last time.
Now I can directly communicate with the arduino using Rx, Tx pin.
Thank you all.

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