Electronic – arduino – RS-422 distance sensor with arduino

arduinointegrated-circuitrs422rs485

I need to make a converter to go from RS422 full duplex to my Arduino. I have found lots of different chips which I think can do this, but am slightly confused by the terminology. The RS422 device is a laser distance sensor (Micro-Epsilon optoNCDT 1302). It has RX+, RX-, TX+, TX-. So I have two lines for input and two lines for output.

I could use two RS485 line drivers to achieve the full duplex comms which I need. There are a lot of chips to do that.

But then on my Arduino (clone: chipkit max32) would I need to use two UART channels? And then alternate which one I am sending each byte on?

The device uses 4 byte instructions. So if I wanted to send an instruction would I send Serial1(firstByte) then Serial2(secondByte), Serial1(thirdByte), Serial2(fourthByte)?

And then receive data the same way? I feel like I am missing something and can do this on one UART channel but am not sure how.

Best Answer

In normal serial communications links, you actually need two wires - one is the signal and one is the ground. The ground stays at zero volts and the signal wire swings between 2 voltages that represent data bits 0 and 1 respectively (in RS232, the signal swings between +25 volt and -25 volts).

Using voltage to signal is not great for long wires going though noisy environments because the wires act like antennas and the voltage difference can get lost in the noise.

RS422 uses current direction rather than voltage to transmit bits. Current going one way is a 1, reversed the other way is a 0. This is much more resistant to noise.

The RX+ and RX- are the two wires that that current for received data. You can imaging sending data down this wire using a battery as a transmitter. Connect the battery one way to send a 1, or flip it the other way to send a 0. Two wires, but they carry one bit of data. You can connect this one bit of data to a single serial input (using the the correct drivers to turn the current direction on thew wires in a voltage to show the pin).

Same goes for the TX+ and TX- wires. They carry a single bit. The driver will take a single bit of data represented as a voltage on your sereial send pin, and convert it to a current flowing one way or the other on the two TX wires.

ADVICE: Unless you are making lots of these, don't mess around with driver chips (unless you want to!). You can cheaply get prepackaged current loop dongles that have screw terminals and are very easy to use. They use the same chips you are looking at, but do all save you the hassles of figuring it all out. If you get one that uses TTL level signals, you can connect it directly to your Ardunio and treat it as just a regular serial connection. Here is an example of one (I've never used this one but looks as good as any other)...

http://www.amazon.com/INBOARD-RS422-DRIVER-ET-MINI-SHIPPING/dp/B00EXUGRUK/ref=sr_1_1?ie=UTF8&qid=1392255264&sr=8-1&keywords=ttl+rs422