Skip to Content

RS-485 with Arduino and ESP32 based PLCs

Configure RS-485 half-duplex and full-duplex communication with M-Duino, Ardbox, and ESP32 PLCs — wiring, switch setup, and Arduino code
June 19, 2026 by
RS-485 with Arduino and ESP32 based PLCs
Boot & Work Corp. S.L, Martí Schnabel

Introduction

In this tutorial, we will guide you through the process of configuring and utilizing RS-485 communication with Industrial Shields' Arduino and ESP32-based PLCs. RS-485 is a robust and widely used standard for industrial communication, ideal for connecting devices over long distances in noisy environments. Whether you're integrating your PLC into a Modbus network or enabling communication with other RS-485-compatible devices, this guide covers all the essential steps for both hardware setup and software programming.


This tutorial is tailored for the following Industrial Shields PLC families, ensuring compatibility and ease of use:

  • M-Duino PLC Family
  • Ardbox PLC Family
  • ESP32 PLC Family
  • ESP32 PLC 14

By the end of this guide, you will have a complete understanding of how to configure RS-485 communication, including wiring, configuring software libraries, and implementing your first communication program. Whether you are a seasoned professional or new to PLCs, this tutorial provides the foundation you need to leverage RS-485 in your automation projects.

Hardware

M-Duino PLC Family Hardware

The M-Duino PLC features one RS-485 port formed by pins A+, B-, Y+ and Z-.

This means that the communication with another device using RS-485 can be either:

  • Half-Duplex (HD) using A+ and B-.
  • Full-Duplex (FD) using A+, B-, Y+ and Z-.

Switch configurations

To use the RS-485 communication, configure the communications switch as follows:

  • Set bottom switch 1 to OFF to use HD communication
  • Set bottom switch 1 to ON to use FD communication

Connections

Typically, the connections between devices are:

  • For HD communication: A+ with A+ and B- with B-
  • For FD communication: A+ with Y+, B- with Z-, Y+ with A+ and Z- with B-.

For more information, check the Technical Features

Ardbox PLC Family Hardware

The Ardbox family PLCs features one RS-485 port formed by pins A+, B-, Y+ and Z-.

This means that the communication with another device using RS-485 can be either:

  • Half-Duplex (HD) using A+ and B-.
  • Full-Duplex (FD) using A+, B-, Y+ and Z-

Switch configurations

To use the RS485 communication of the Ardbox Relay, configure the communications switch as follows:

  • Set top switch 1 to ON
  • Set top switch 2 to OFF
  • Set top switch 3 to ON
  • Set top switch 4 to OFF
  • Set right top switch 2 to select between HD and FD
  • Set right bottom switch 1 to ON
  • Set right bottom switch 2 to OFF
  • Set right bottom switch 3 to ON
  • Set right bottom switch 4 to OFF

To use the RS485 communication of the Ardbox Analog, configure the communications switch as follows:

  • Set top switch 1 to OFF
  • Set top switch 2 to ON
  • Set top switch 3 to OFF
  • Set top switch 4 to ON
  • Set right top switch 1 to select between HD and FD

Connections

Typically, the connections between devices are:

  • For HD communication: A+ with A+ and B- with B-.
  • For FD communication: A+ with Y+, B- with Z-, Y+ with A+ and Z- with B-.

For more information, check the Technical Features.

ESP32 PLC Family Hardware

The ESP32 PLC features one RS485 port formed by pins A+ and B-.

Switch Configurations

To use this port, ensure that switch 3 is set to OFF on the communications switch.

Connections

Connect the A+ and B- pins to your desired device for RS485 communication. Typically, the connections between devices are: A+ with A+ and B- with B-.

For more information, check the Technical Features

ESP32 PLC 14 Hardware

The ESP32 PLC features one RS485 port formed by pins A+ and B-.

Switch Configurations

There are no switch configurations needed for this device.

Connections

Connect the A+ and B- pins to your desired device for RS485 communication. Typically, the connections between devices are: A+ with A+ and B- with B-.

For more information, check the Technical Features

Software

Install the industrialshields-avr board on the Arduino IDE. You can do it by following this tutorial.

Select your board and model:

  1. For M-Duino PLC Family: Tools > Board > Industrial Shields AVR Boards > M-Duino [Extension] family and Tools > Model > M-Duino [Module]
  2. For Ardbox PLC Family: Tools > Board > Industrial Shields AVR Boards > Ardbox [Extension] family and Tools > Model > Ardbox [Module] HF+ w/HW RS-485
  3. For ESP32 PLC Family: Tools > Board > Industrial Shields ESP32 Boards > ESP32 PLC Family and Tools > Model > ESP32 PLC [Module]
  4. For ESP32 PLC 14: Tools > Board > Industrial Shields ESP32 Boards > 14 IOS PLC Family

Include the RS485 library in your code and use RS485 to refer to the RS485 port.

Make sure that the baudrate and duplex mode is the same in the all the devices.

Some basic functions

1. Begin RS485 port:

RS485.begin(BAUDRATE, HALFDUPLEX);

2. Send data:

RS485.write(tx);

3. Check if data is available to read and read the data

if (RS485.available()) {
	byte rx = RS485.read();
}

Check out the following RS-485 test code:


RS-485 example



​Search in our Blog

RS-485 with Arduino and ESP32 based PLCs
Boot & Work Corp. S.L, Martí Schnabel June 19, 2026
Share this post
Tags

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

PLC Comparison