RS-485 node control for Arduino


Wanting to control a split flap display that was not near a computer [Tom] looked to a common solution for communicating over distances not practical for I2C or SPI. He developed his own hardware and packet format using the RS-485 protocol.

This is part of a larger project he has been working on to feed data to a split flap display that he plans to hang on the wall. RS-485 is designed to work over long distances and overcome noise issues. The core of the communications system is the board seen on the left. It uses a MAX1483 chip, a pair of RJ45 jacks for Ethernet cables, and two terminal blocks for power and communications. There are a few nice things about this. The board acts as a pass-through making it easy to chain nodes together, and the data structure is completely independent of the hardware itself. Because of this [Tom] developed his own packet format that will be a bit more resilient than the Arduino networking scheme we looked at the other day.

54 thoughts on “RS-485 node control for Arduino

  1. Any time I have a need for a simple protocol like this I use S.N.A.P.

    I’ve used it a lot and it has always served me well. I found it years ago.

    S.N.A.P is an free and open network protocol.

    – Easy to learn, use and implement.
    – Free and open network protocol.
    – Free development tools available.
    – Scaleable binary protocol with small overhead.
    – Requires minimal MCU resources to implement.
    – Up to 16.7 million node addresses.
    – Up to 24 protocol specific flags.
    – Optional ACK/NAK request.
    – Optional command mode.
    – 8 different error detecting methods (Checksum, CRC, FEC etc.).
    – Can be used in master/slave and/or peer-to-peer.

      1. POE exploits the fact that 10×100 baseT internet only uses 2 pairs.(out of 4).. so you can run power over the unused wires.

        RS485 is a 3 wire serial link. 8 wires – 3 wires = 5 wires not doing anything….so why not run power on them.

          1. You could still follow the POE standard even if the data lines were not technically Ethernet. You could also obviously understood what I meant, so why be a semantic douche?

          2. Matt: I don’t use childish name calling, so if you want that from me you’l be disappointed. POE is more than “run power on wires” and the reason for my comment is that enough people are perceiving this hack as somehow related to Ethernet.

            You, I’m sure, will insist on using the term POE incorrectly. That is your choice.

          3. That’s funny…I saw no confused statements about this being TCP/IP. The only confusing statements I see are the snarky “It’s not TECHNICALLY Ethernet” comments.

    1. There is no reason it couldn’t have a 5v power line but I wonder how the length cable runs might cause the power to drop off down the line, and also if there might be noise issues? Regardless for my needs each node will have a motor needing a fair chunk of power so it isn’t appropriate for the project, I have thrown it up on GitHub so you could always add it.

      1. If you want to send power through cat5 cable you will have to step up the voltage so that you minimize losses, and then step it down at the destination. The amount of power transferable is still rather limited.Sending 5V directly is not an option unless your calbe is short and you draw little current.

  2. Hmm, what’s the difference between the MAX1482 and the MAX485 (or TI’s equivalent: SN75176B)? Is it only that the former is full duplex? If so, then what’s the difference between the 1483 and the 485?

    1. The MAX1482 and indeed most of those RS-485 line driver chips from a number of manufacturers are pin for pin compatible but this one has 1/8th load meaning you can have 256 devices in theory on the same bus.

    2. The 75176 is older, made with bipolar transistors, consumes more power and it is about 6-7 times cheaper than the MAX1483 and about 4 times cheaper than the classic MAX485. (from where i buy my components).

    1. because the average (uneducated) thinks ethernet is defined by the wire and connectors. this hack uses rj45 connectors and twisted pair. the uneducated thinks this is ethernet when in fact, it is just the wiring he chose.

      1. The POE standard says nothing about the data connections. It just specifies how to run power through “Ethernet Cable”…you could just run power over twisted pair and have it considered POE. So it is not unreasonable to call it POE, since from the power point of view, that is what it would be. The fact that it is not Ethernet on the data side is regardless.

    2. I made the mistake of thinking it was Ethernet by looking at the picture and not actually reading the title RS485 or the article. Only skimmed it. I was also doing 6 different things at once but I should of known better as I created a implementation using the RS485 standard not to long ago. In other words I fail at doing several things at once and just skimming.

    3. This reminds me of an older gentleman that couldn’t send emails on his computer. The problem? The “email cable” fell out the back. Once he reattached the “email cable” then he could send emails again.

      People see the cable as an Ethernet cable and not as an RS485 connection. Hence adding power is POE despite the fact that there is no Ethernet going on here. The communication would be TCP/IP, despite the fact that it is not Ethernet.


  3. Couldn’t find the schematics for the RS485 board so can’t be sure but I didn’t see any termination. RS485 needs termination at each end, typical 120 ohm or so.

    In a multidrop configuration with duplex communication you also need pull up and pull down resistors to put the bus in a known state when there is no communication since there is no driver that is active. Failure to do this will result in lot of communication errors in a noisy environment.

    There are 4 pairs of wire in a CAT6 cable so one or two pairs could carry power to each device if the current consumption is low. Preferably higher voltage like 24V since there will be some voltage drop. With switching voltage regulators on each node it’s no problem to get 5V or 3.3V without having to use a heatsink.

    1. “multidrop configuration with duplex communication” should have been “multidrop configuration with HALV duplex communication” meaning only one master at a time.

      If there a several nodes that could initiate communication at any time you need some type of collision detect. Easiest way is to read from the bus at the same time as you send. If you don’t receive what you send wait a random time and then transmit again.

      IME the hardware with a RS485 bus is the easy part.It’s the software with error detection, retransmittion, timeouts etc that is the tricky part. At least when you put it in industrial environments.

      Ethernet is only 100m betwean nodes but you would just run some fiber when you need anything longer. I tink singlemode 1000base LX goes to 10 km or so.

      1. In reality, since he is using cat5 cable, he could implement RS422 instead, which would allow for full duplex and reduce collisions. The max148x family of chips even support 422 already, so it would only take a board revision (or some jumper wires) to change it.

      2. The 100m Ethernet limit is a function of the ethernet protocol + media (cat5(e), cat6). You can comfortably get 1000m+ over 485, in a noisy environment, provided you are willing to compromise on baud rate – it was designed specifically for this purpose, which is why it uses differential signalling.

    2. I have uploaded it to GitHub:

      I did a lot of reading about RS-422 and RS-485 and it turns out that you don’t always need a terminating resistor and as a result you shouldn’t use one by default but when actually needed as it can be bad. Additionally the use of a 120 ohm resistor isn’t always true either, it depends on the cable you use, CAT5 isn’t 120 ohm, it’s 100 ohm (if I recall correctly).

      RS-422 wouldn’t be suitable in this environment as it is intended to be used to extend RS-232 lines on a point-to-point basis, where as RS-485 is intended for multi-node communication, in my case I am using multi-drop but you could use the MAX1482 which has a separate line driver and line receiver allowing full duplex, however you’d need to figure out how to avoid collisions, using a variety of techniques.

      RS-485 is essentially what DMX uses and the DMX architecture was what I wanted to mirror, multiple fixtures in a ‘universe’ that listen, with one device barking orders out but not getting a response, only presuming that the fixtures heard the message. Using my simple protocol/messaging frame I haven’t had any messages interpreted incorrectly over 50 meters of CAT5.

  4. Additionally implementing the MCPM mode of the ATMega reduces the data nodes have to listen to. This can easily be found in the datasheet. In short – there is a 9 bit mode of the UART – the 9th bit means that the following byte is an address. Every packet ends with the address again. If a node sees it’s address it starts building a packet and if a timeout is not reached and the CRC is OK then the packet can be used further.
    I am using MCPM with SNAP like protocol and it works well.

  5. Dear Hack a day writers: please learn what a protocol is. RS 485 is not a protocol, it is a standard for a physical interface.
    Protocol is a set of rules regarding how information is exchanged. The same protocol can be used with different physical interfaces.

  6. Funny all the confusion over CAT5/6 cable and RJ45 connectors being used for something other than Ethernet. They’re a convenient choice whenever a robust multi-conductor cable and connector is needed. I’ve used them for carrying audio, video, I2C, SPI, power, and more.

  7. Simply want to say your article is as astounding. The clarity for your put
    up is just cool and i could assume you are a professional on this subject.

Leave a Reply


You are commenting using your account. Log Out / Change )

Twitter picture


Facebook photo


Google+ photo


Connecting to %s