RS485 Hardware Network 2 – Multi-Byte Communication

Edit: I don’t really make a point of saying it, but the common ground between the modules isn’t nesesarry.

Here’s a video of the software running on the boards.

So for this example,  there are 4 bytes being transmitted from the master to the slaves.

  1. Start of Transmission (0xDB)
  2. ID of the slave to talk to
  3. The type of command
  4. The data that is transmitted

A transmission to set the pwm value of the green led on the slave with the ID 1 to 100 would be:

This is the schematic of the circuit for this example:

This is the code running on the master Arduino:

This is the code running on the slave Arduinos:

Hey! This post was written a long time ago, but I'm leaving it up on the off-chance it may help someone. Proceed with caution. It may not be a good idea to blindly integrate this code or work into your project, but instead use it as a starting point.


  1. Hi,

    I notice that you have a common ground between all three RS485 modules. My understanding is that RS485 is a balanced (longish range) two wire link, is that correct or have I confused it with RS232. I ask because I have a project in mind which uses some commercial RS485 modules and an arduino.

    Regards Alan

    1. Hi Alan,
      You’re correct, the common ground isn’t necessary. You are also not the first person to point out this error, I’ll make a post updating the schematic soon.

  2. Nice project, but can i use standard tx and rx pins on arduino instead of wasting some more pins? I’m trying with no luck

    1. No you can’t really do this because of the way that this protocol is implemented. This prints messages to serial which will also go out over the tx and rx pins and mess everything up.

  3. can we control other slaves, i mean slaves which are not arduino instead some other controller units including sensors and relays etc.

  4. Hi devon,
    This is good.please update or send code for multiply relay controls as a example master send A0001 the slave a re ponce this activate pin4 high, master we type B1000 and B slave response and pin one high . i use A,B,C,D,etc…slaves and 4 relay model,Can you help me????

  5. Hi Devon,
    I have a project where Arduino Mega should control several (more than 20 Attinys 44)
    Will this communication work with Attinys 44 ? Mega is the Master and Attinys are slaves.

    Please reply & advice,

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.