If you work in the Automation Industry, you will know that automation equipment is very expensive. And many a time, especially for small applications, you simply cannot justify the use of very expensive equipment.
This is where the Arduino comes in!
The Arduino development board allows you to create very simple, but very powerful, Modbus client or server devices through the use of relatively simple “C” programming. With the Arduino, you have full custom control over the program design allowing you to create very lean and very efficient devices for very specific purposes.
Put simply, mastering Modbus on the Arduino is going to take your skill level and value in the Automation Industry to a whole new level.
That is what this course is going to do. At the end of the course, you will know how to:
1. Choose the appropriate Arduino hardware.
2. Interconnect Arduino hardware with other add-on hardware.
3. Write “C” applications to implement Modbus master and slave functionality.
4. Use software and hardware to test each application that you write.
All of the programs written in the course are freely downloadable and give you a perfect starting point for further development. At the end of the course, you will have the knowledge to create your own products, your own custom Modbus client and server hardware.
Looking forward to seeing you on the inside!
Introduction
The Hardware We Will Be Using
The hardware that is used in the course is listed and their purpose given
An overview of the Arduino Uno.
An overview of the Ethernet shield for Arduino Uno.
An overview of the simple network connection we will be using in all examples.
A look at the physical hardware set up.
The Software We Will Be Using
This lecture shows where to go on the web to download and install the free Arduino programming software.
Modbus libraries are used to simplify the implementation of the Modbus protocol on the Arduino.
Modsim32 is a Modbus TCP Server simulation application. Modscan32 is a Modbus TCP Client application.
Quick Start - Creating our First Arduino Modbus TCP Server Application
The Arduino IDE is briefly introduced.
An application is written to send the words "Hello World" serially to the serial monitor.
The code is modified to display the value of a variable via serial comms.
Additional code is added to send data values serially only when there is a change in those values.
The libraries and code that implement the Modbus TCP Server functionality are included in the application.
An edit is made to the ModbusIP.h to ensure that the TCP connection is maintained.
Using the laptop with Modscan32 as a Modbus TCP Client, the Arduino application is run and tested.
Extending the Arduino Modbus TCP Server Application
Code is added and the application updated to be able to read a holding register.
Code is added and the application updated to be able to read an input status.
Code is added and the application updated to be able to read a coil.
Programming the Arduino to be Modbus TCP Client
An overview of what will be done in the section is given and the goal in relation to the last two sections is given.
The Modbus TCP Client library is configured to be used in the Arduino IDE.
The latest application from the last section is used with the code that implements the Modbus TCP server services removed.
Setup code is added to the application to configure the network settings and create the Modbus TCP Client object.
Code is written to read a single input register from the Modbus TCP Server (Modsim32).
The Modbus TCP client application is tested - Modsim32 is set up with a single input register that the Modbus TCP Client will read.
Code is added to the application to read a holding register, input status and coil.
Removal of the acc = 0; line.
The expaned Modbus TCP client application is tested - Modsim32 is set up with a single input register that the Modbus TCP Client will read.