Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria
Learning the basics about RS485 of an industrial PLC
Introduction
RS-485, also known as EIA-485, is defined as a differential multi-point bus system; it is perfect to transmit data with high speed to ranges until 12m. One of its most important characteristics is that the twisted pair of cables reduce the noise induced in the transmission line. Multiple receivers may be connected to such a network in a linear, multi-drop bus. These characteristics make RS-485 useful in industrial control systems and similar applications.
Our PLCs for industrial automation have insinde the integrated circuit MAX485. This one is a low power transceiver used for the communication RS-485 that works with a single power supply of 5V and the average current is 300μA. Using half-duplex communication to convert the TTL level in RS-485 level, it can reach the maximum speed of transmission of 2.5Mbps. Internally we can find a half duplex transceiver MAX485 and also a MAX485, in the way that, if we are in full duplex, it will use the half duplex MAX485 to receive data and the transmitter MAX485 will send it.
Previous reading
We recommend you to read the following posts in order to understand the program of this blog. We used the following blog posts to do this example:
How to program our industrial PLC with Arduino IDE: Installing the Industrial Shields's boards in the Arduino ID
Requirements
In order to work with RS-485 protocol, you will need any of our industrial PLC controllers for industrial automation:
Industrial Shields controllers: Wifi & Bluetooth Controller Family, Ethernet Controller Family, GPRS / GSM Controller Family or 20IOs Controller Arduino Family
Configuring the switches and jumpers
We have 2 families of PLCs: Mduino and Ardbox.
On the Mduino family you will always have activated the RS-485 by default, so you will not need to activate it using any switch. The only thing is that you need to select between Full-Duplex and Half-Duplex, using the last switch (FD/HD).
For the Ardbox family programmable logic controllers, we have the two subfamilies:
In this one, we need to choose between RS-232 and RS-485 using the switches and jumpers as we show in the following image.
IMPORTANT : THE CONFIGURATION OF THE COMMUNICATION IS ALREADY DONE, YOU JUST NEED TO CHOOSE IT WHEN YOU BUY THE DEVICE
Ardbox Analog HF+
Jumper zone 1: RS-232 / RS-485 HW.
Jumper zone 2: RS-232 SW / Q0.8 and Q0.9.
Ardbox Relay HF+
Jumper zone 1: RS-485 FD / A0.0 and A0.1.
Jumper zone 2: RS-232 SW / I0.2 and I0.3.
Jumper zone 3: RS-232 / RS-485.
Hardware
The first thing we need to do is to be sure that the industrial arduino PLC is supplied with 12-24Vdc.
Mduino family :
The pins of the PLC that we have to use for RS-485 communication.
Ardbox family :
Ardbox Analog HF+ :
Ardbox Relay HF+ :
Software
The first step is downloading the Arduino based PLC boards for Arduino IDE.
After making the hardware configuration, we need to continue with the software configuration and also how we use it. To begin this process, it is necessary to include the library RS485.h founded in our website. After this, in the function setup, please take care to do the right implementation of your communication
For all families:
Software configuration
#include <RS485.h>
To check the RS-485 activation you only have to use the serial monitor from the Arduino IDE using the right sentence inside the setup() function.
Serial.begin(9600);
It is also important to implement the initialization on the setup() function.
RS485.begin(38400);
IMPORTANT : CHECK THE SPEED OF TRANSMISSION OF PLC-LAPTOP AND PLC-DEVICES .