WolkWriter
Published © GPL3+

Modbus RTU IoT Gateway

Read and write to multiple Modbus RTU slaves from the cloud through serial communication using WolkAbout IoT Platform.

IntermediateProtip1 hour6,218
Modbus RTU IoT Gateway

Things used in this project

Hardware components

IOT-GATE-RPi Industrial Raspberry Pi IoT Computer
×1

Software apps and online services

WolkAbout IoT Platform
WolkAbout IoT Platform

Story

Read more

Schematics

Connection schematic

Connecting Modbus slaves to IOT-GATE RPi

Code

devicesConfiguration.json

JSON
This is the Modbus register mapping used for DC motor slaves
{
    "devices": [
        {
            "name": "Flip Click 1",
            "key": "FC0",
	    "slaveAddress": 0,
            "template": "FlipClick"
        },
	{
	    "name": "Flip Click 2",
	    "key": "FC1",
	    "slaveAddress": 1,
	    "template": "FlipClick"
	}	
    ],
    "templates": [
        {
            "name": "FlipClick",
            "mappings": [
                {
                   "name":"Speed",
                   "reference": "speed",
          
                   "minimum": 0,
                   "maximum": 200,
          
                   "address": 0,
                   "registerType": "HOLDING_REGISTER",
                   "mappingType": "ACTUATOR",
                   "dataType": "UINT16"
                },
                {
                   "name":"Direction",
                   "reference": "direction",
          
                   "address": 0,
                   "registerType": "COIL",
                   "dataType": "BOOL"
                },
                {
                   "name":"Stop-Start",
                   "reference": "stop_start",
          
                   "address": 1,
                   "registerType": "COIL",
                   "dataType": "BOOL"
                },
                {
                   "name":"Short Brake",
                   "reference": "short_brake",
          
                   "address": 2,
                   "registerType": "COIL",
                   "dataType": "BOOL"
                },
                {
                   "name":"Standby",
                   "reference": "standby",
          
                   "address": 3,
                   "registerType": "COIL",
                   "dataType": "BOOL"
                }
             ]
        }
    ]
}

wolk_gateway.service

Plain text
Service that will run WolkGateway
[Unit]
 Description=Gateway for connecting non-IP enabled devices to WolkAbout IoT Platform
 After=multi-user.target

[Service]
 Type=idle
 WorkingDirectory=/home/<USER_NAME>/WolkGateway/out/
 ExecStart=/home/<USER_NAME>/WolkGateway/out/WolkGatewayApp gatewayConfiguration.json
 Restart=always

[Install]
 WantedBy=multi-user.target

modbus_module.service

Plain text
Service that will run WolkGatewayModule-Modbus
[Unit]
 Description=WolkAbout Gateway Module for Modbus devices
 After=multi-user.target

[Service]
 Type=idle
 WorkingDirectory=/home/<USER_NAME>/WolkGatewayModule-Modbus/out/
 ExecStart=/home/<USER_NAME>/WolkGatewayModule-Modbus/out/modbusModule deviceConfiguration.json modbusConfiguration.json modbusRegisterMapping.json
 Restart=always

[Install]
 WantedBy=multi-user.target

WolkGatewayModule-Modbus

Modbus DC motor slave

WolkGateway

Credits

WolkWriter

WolkWriter

17 projects • 33 followers
With WolkAbout IoT Platform, we give you proven technology to develop powerful IoT applications and control your business ecosystem.

Comments