Advanced Setup

Modbus Setup Guide

This guide explains how to set up Atmocube for Modbus connectivity. 

Modbus is a serial communication protocol, used widely throughout many industries.

Known for its easy deployment and maintenance, Modbus is used widely throughout many sectors because it is relatively easy to deploy and maintain compared to other standards. 

There are two Atmocube-supported Modbus realizations: 

• Modbus TCP/IP runs on Ethernet cables or via Wi-Fi. 

• Modbus RTU which runs typically on RS-485.

Atmocube provides Modbus TCP/IP support via Wi-Fi or the Ethernet port on the device. 

Atmocube provides Modbus RTU support via the dry contact input module on the back of the device.

1. Using the Atmocube configuration tool to enable Modbus on Atmocube

The Modbus feature is turned off by default. The feature can be enabled using the Atmocube configuration tool.

Note: The minimum frequency of Modbus requests is 1 second and the recommended frequency is 2 seconds or more.

Enabling Modbus RTU

To enable Modbus RTU, open the configuration menu by clicking on the RS-485 tab. 

Check the “Enabled” option and enter/select the details including 

  • Device ID - please customize the Device ID, and make sure each device in the same line has a unique Device ID. The range of allowed Device ID is 1 to 247.
  • Baud Rate 
  • Data Bits 
  • Parity - it can be configured to be odd, even, or none by selecting from the drop-down menu in the Atmocube Configuration Tool. The default setting for Parity is “none”. If the Modbus network does not use parity checking, select “none”. The Modbus network admin or BMS admin should be consulted to confirm the parity type of your local network. Please note that all devices in the same network should have the same parity type set. 
  • Stop bits 

All parameters, except Device ID, should be the same for all Atmocubes on the RS-485 line.

Enabling Modbus TCP/IP

To enable Modbus TCP/IP, open the configuration menu by clicking on the Modbus IP tab. Check the Enabled option and enter the Modbus IP (TCP) port. The default port number is 502. The range allowed is 0 to 65535.

Note: If you want to use Modbus on a local network without an internet connection, disable the MQTT connection by going to the MQTT tab and unchecking the Enabled option as seen below. 

After Modbus has been enabled, follow the steps below to generate a configuration file:

  1. Select the model code (SKU) for the Atmocube from the drop-down selection menu on the Atmocube configuration tool page.
  1. After all details have been entered, click on the “Generate config” button to generate the configuration file. 
  1. Save the generated config.json file to the root of a USB flash drive formatted with the FAT file system.
  1. Disconnect Atmocube from the power source (if powered on).
  1. Insert the USB flash drive into the USB-A slot in Atmocube.
  1. Re-connect Atmocube to the power source.
  1. Once the Atmocube is turned on, Atmocube will access the config.json file from the USB flash drive. The power status LED will turn a solid purple color to indicate that the USB flash drive has been detected.
  1. After the configuration is successful, remove the USB flash drive from Atmocube.

Atmocube is ready for the Modbus connection. 

2. Testing the Modbus TCP/IP and RTU connection via Python Script

Please find the example code and input register format at the link here: https://github.com/atmotube/atmocube-levoit-demo

3. Testing the Modbus connection via Modbus Poll (Windows only)

Download and install Modbus Poll.

3.1 Modbus TCP/IP connection settings

Open the Connection menu and choose Connect from the submenu. Configure the Modbus TCP/IP connection in the following way:

3.2 Modbus RTU connection settings

Open the Connection menu and choose Connect from the submenu. Configure the Modbus RTU connection in the following way:

3.3 Reading data

Download the template file here for setup and open it by going to the File menu and choosing Open from the submenu. Or set up registers manually.

For manual setup, open the Setup menu and choose Read/Write Definition… from the submenu. 

All data will be fetched in raw format:

The user manual for Modbus Poll is available here.