Up to 3 RS485 Busses on One Arduino

In this instructable I will show how to connect up to 3 independent RS485 busses to one Arduino. This can be useful if you want to create a gateway between these busses or if you want to control devices in these busses (without to connecting the busses itself). Another application is the connection of a RS422 device (for example motor control) and a RS485 device (for example a sensor) to the same Arduino.

In any case you will need a RS485 shield with isolated interface to eleminate grounding problems and to protect the Arduino.

Step 1: Tools & Materials

Hardware:

Software:

  • Arduino IDE

Step 2: DIP Switch & Jumper Setting for BUS 1

Jumper:

  • UART RX to position 0
  • UART TX to position 1
  • Voltage to position 5V

DIP Switch:

  • S1 = OFF - ON - ON - OFF
  • S2 = OFF - OFF - ON - ON
  • S3 = ON - OFF - OFF - OFF

Step 3: DIP Switch & Jumper Setting for BUS 2

Jumper:

  • UART RX to position 2
  • UART TX to position 3
  • Voltage to position 5V

DIP Switch:

  • S1 = OFF - ON - ON - OFF
  • S2 = OFF - OFF - ON - ON
  • S3 = ON - OFF - OFF - OFF

Step 4: DIP Switch & Jumper Setting for BUS 3

Jumper:

  • UART RX to position 4
  • UART TX to position 5
  • Voltage to position 5V


DIP Switch:

  • S1 = OFF - ON - ON - OFF
  • S2 = OFF - OFF - ON - ON
  • S3 = ON - OFF - OFF - OFF

Step 5: Software Integration

The shield for bus 1 will use the hardware UART on PIN 0 and 1 of the Arduino. The both other shields will use software UARTs.

#include <SoftwareSerial.h>

SoftwareSerial RS485_BUS2(2,3);

SoftwareSerial RS485_BUS3(4,5);

void setup()

{

....

// init serial port for bus 1

Serial.begin(9600);

// init serial port for bus 2

RS485_BUS2.begin(9600);

// init serial port for bus 3

RS485_BUS3.begin(9600);

....

The transmittion data of these software UARTs is limited by the calculation power of the Arduino. Of course if you will use an ARM based Arduino or STM32 board this will not be really a problem, but for the UNO it is recommend to use only two shields at the same time and for the second shield not more as 9600 Baud as data rate.

Share

    Recommendations

    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest

    Discussions