In this tutorial, we will discuss how to communicate between two ARIES boards with the help of the RS485 (Modbus RTU) serial data communication protocol.  We will follow the RS485 master-slave communication method. For demonstration purposes, we will create a project that will ON or OFF a LED connected to a Slave ARIES from Master ARIES by sending some commands through RS485 Module. The master ARIES uses a push button to control the LED attached to the slave device.

MAX485 TTL to RS485 Module

For using RS-485 in ARIES, a module called MAX485 TTL to RS485 which is based on Maxim MAX485 IC is needed as it allows serial communication over long distance.The MAX485 TTL to RS-485 Interface Module allows MCUs to use the RS-485 differential signaling for robust long distance serial communications. ARIES boards doesn’t have any peripherals for Modbus communication. We will use an RS485-based sensor module called MAX485 for communication between two ARIES boards. The MAX485 pin description is given in the following table:

Pin NameDescriptionFunction
ROReceiver OutputConnects to a serial RX pin on the microcontroller
REReceiver Enable Active LOW.  Connects to a digital output pin on a microcontroller. Drive LOW to enable receiver, HIGH to enable Driver
DEDriver Enable  Active  HIGH.  Typically jumpered to RE Pin.
DIDriver InputConnects to serial TX pin on the microcontroller
VCCVoltage Common Collectorsupply pin
AData ‘A’ Non-Inverted Line Used as non-inverting receiver input and inverting driver output
BData ‘B’ Inverted LineUsed as inverting receiver input and inverting driver output
GNDGroundGround

Modbus Protocol

Modbus is a serial communication protocol developed by Modicon published by Modicon in 1979 for use with its programmable logic controllers (PLCs). In simple terms, it is a method used for transmitting information over serial lines between electronic devices. The device requesting the information is called the Modbus Client and the devices supplying information are Modbus Servers. 

RS485

Modbus communicates over different types of physical media and they are:

  • RS232: serial communication protocol
  • RS485: serial communication protocol
  • RS422: serial communication protocol
  • Ethernet: LAN (Local Area Network) Technology

RS485 is an asynchronous half-duplex serial communication protocol that communicates over devices by using the master-salve method. It can connect a maximum of 32 devices on the same line. RS485 is used more industrially where many devices need to be interconnected together for a system. Advantages of RS485 over RS232 includes, its longer distances (up to 1200 meters), higher data transfer rate (Up to 30Mbps), and allow for multiple devices connection on a single network by using only two wires.

Prerequisites

Components Required

ComponentQuantity
ARIES v3.0 Board1
ARIES v2.0 Board1
USB type B to USB type A cable1
USB type C to USB type A cable1
MAX485 TTL to RS485 converter module 2
Jumper WiresMany
Bread Board1
Push Button1
LED1

Connection Diagram

MAX485 (Master side)ARIES v3 (Master)
RORX1
DITX1
DE,REGPIO-7
VCC3.3 V
GNDGND
APin A of another MAX485
BPin Bof another MAX485
Push ButtonARIES v3 (Master)
One sideGPIO-2 of ARIES board
Other sideGND
10K Resistor
One sidePush Button and GPIO-2
Other sideVCC (3.3 V)
Table: Connection pins of MAX485 & ARIES v3.0 Board as Master


MAX485 (Slave side)ARIES v2 (Slave)
RORX1
DITX1
DE,REGPIO-7
VCC3.3 V
GNDGND
APin A of another MAX485
BPin Bof another MAX485
LEDARIES v2 (Slave)
+ve100 K Resistor
-veGND
100K Resistor
One sideLED +ve terminal
Other sideGPIO-8 of ARIES board
Table: Connection pins of MAX485 & ARIES v2.0 Board as Slave

Procedure

1. Master Side:

Open and set up the Arduino IDE as described in Getting Started with ARIES v3.0.

Check whether the ARIES v3 board, BOOT-SEL pin is shorted or not

ARIES v3 board with BOOT SEL pin not shorted

ARIES v3 board with BOOT SEL pin shorted

  • If
    BOOT-SEL jumper (J12) is not shorted :
  • Click on Tools – Burn Bootloader and wait for the “uploading completed” message in IDE
  • Once the program got uploaded, Connect the BOOT SEL pin in ARIES board using a shorting jumper / Female-Female connector (NOTE: Shorting jumper is always preferred. This is a one time step only.)
  • Make sure you have selected ARIES v3 Board from Tools -> Board -> VEGA Processor: ARIES Boards -> ARIES v3
  • Select Flash Mode -> Enabled
  • Select Programmer as VEGA FLASHER from Tools -> Programmer -> VEGA FLASHER
  • Also select appropriate port from Tools -> Port -> COM* (ARIES v3)

If

  • BOOT-SEL jumper (J12) is already shorted :
  • Select Flash Mode -> Enabled
  • Make sure you have selected ARIES v3 Board from Tools -> Board -> VEGA Processor: ARIES Boards -> ARIES v3
  • Select Programmer as VEGA FLASHER from Tools -> Programmer -> VEGA FLASHER
  • Also select appropriate port from Tools -> Port -> COM* (ARIES v3)
  • Above mentioned steps are needed to flash the program to ARIES board permanently.

Now, Open Files -> Examples -> Under Examples for ARIES v3 -> UART-> Max485_Master

Upload the code in ARIES v3 board which is set as Master in this example.

2. Slave side

Open and set up the Arduino IDE as described in Getting Started with ARIES v2.0

Let’s power up the ARIES v2 board via the USB port of a Laptop/Desktop/PC and burning the code into the ARIES v2 board, we have to use a micro-USB type B to USB type A cable. The cable should be connected to UART-0 port of the ARIES v2 board, and the Laptop/Desktop/PC should be preinstalled with Arduino IDE and VEGA ARIES boards of latest version.

  • Now, open the Arduino IDE
  • Make sure you have selected ARIES v2 Board from Tools -> Board -> VEGA Processor: ARIES Boards -> ARIES v2
  • Select Programmer as VEGA XMODEM from Tools -> Programmer -> VEGA XMODEM
  • Also select appropriate port, Tools -> Port -> COM* (ARIES v2)

Now, Open Files -> Examples -> Under Examples for ARIES v3 -> UART-> Max485_Slave

Finally Upload the code in ARIES v2 board.

Output

In this sketch, the slave ARIES (ARIES v2) receives the command from the master (ARIES v3) through the MAX485 module by using the RS485 protocol. In Master device we connected a push button and in slave device we connected an LED. If the slave (ARIES v2) receives command “1” then LED will Turn OFF and print “1” to the Arduino IDE serial monitor or, if slave receives command “0” then LED will turn ON and print “0” to the serial monitor.

Demonstration


By mydhily

Leave a Reply

Your email address will not be published. Required fields are marked *