Thursday, September 20, 2018

Long Distance Serial with RS-422

PC's used to have RS-232 ports to connect things like mice, modems, printers, etc. Then technology moved on to USB. RS-232 had a maximum distance of 50', and USB is 9' (USB 3.0) to 16' (USB 2.0). If you really need to send data a long distance, RS-422 might be the trick. It uses two pair of wires, and CAT 5 is just fine. You communicate up to 4900'. Arduino's and other microcontrollers use TTL logic (3v to 5v for a HIGH, 0v for a low), and need a converter to work with other signals. We are using a inexpensive TTL to RS-422 converter called a YL-128. This module uses a Maxim 490 chip.

By connecting a Arduino to a YL-128 on each end of the wire, you can communicate as if the two Arduino's were side by side and connected directly.

Connect one Arduino RX1 to the YL-128 RXD pin (RO), and the Arduino TX1 to the YL-128 TXD pin (DI). Connect a second Arduino and YL-128 on the other end of the cable in the same manner.

Connect the two YL-128 modules Y-A, Z-B, A-Y. and B-Z.



You can then load a serial test sketch like the one at https://www.hackster.io/harshmangukiya/serial-communication-between-two-arduino-boards-d423e9

2 comments:

  1. Although CAT-5 may work with RS-485 as a medium, it is not 'fine'. There is a specification for RS-485 cables, and UTP does not meet that specification. I have been designing and implementing these circuits for over 30 years, and it is wrong to put forth a substitute as being fine without discussing why there is a requirement for cable impedance, shielding and grounding before throwing it to the wind. Specifications are created to improve reliability, not make questionable decisions 'fine'.

    ReplyDelete
    Replies
    1. This is Maxim's note on their RS-485 driver chip - "Cable construction: Cat5 24AWG twisted pair is a very common cable type used for RS-485 systems. Adding shielding to the cable enhances noise immunity, and thereby increases the data rate for a given distance."

      Delete

Related Posts Plugin for WordPress, Blogger...