All Collections
Connect your Devices
Connect IOTBITS ModbusBox to Ubidots
Connect IOTBITS ModbusBox to Ubidots

Learn how to connect the ModbusBox to Ubidots in just a few steps

Sergio M avatar
Written by Sergio M
Updated over a week ago

The ModbusBox is a device designed and manufactured by IOTBITS to bring Modbus RTU devices to the IoT world. In other words, the ModbusBox allows the integration of Modbus RTU networks to a WiFi connection. It is able to read data registers from Modbus slaves and send data periodically to the cloud or local IoT services using the MQTT protocol. As data is serialized using a JSON format, it's easy to parse the information on the IoT server. The ModbusBox has been focused primarily on be used with VFD (Variable Frequency Drive) but it can be used with any device that handles Modbus RTU.

Requirements

Step-By-Step

  1. Hardware Overview

  2. Connecting the ModbusBox to a Wi-Fi Network

  3. ModbusBox General Configuration

  4. ModbusBox Slave Configuration

  5. ModbusBox and Ubidots integration

1. Hardware Overview

The following image shows the internal components, LEDs, connectors and buttons of the ModbusBox for usage and setup.

IOTBITS provides two different commercial model of the ModbusBox:

  • MB-B1W - Supports only 1 slave

  • MB-A4W - Supports up to 4 slaves

Both devices are identical from the hardware point of view. What makes them different is the the firmware variation inside the micro-controller. Model MB-B1W supports only one slave while MB-A4W supports up to four slaves, being able to read from all of them at the time.

The figure below shows the required wiring to connect the ModbusBox to a Eastron Energy meter. Please notice that in order to power the ModbusBox, a 12v - 24v DC power supply is required. 

Control Buttons

As you can see in the next image, there are three control buttons located on the PCB. These control buttons allows the user to switch between operation modes and to perform other advanced procedures.

The Setup control button is used to put the device in Setup Mode and the Reset control button is used to perform a Factory Reset. 

When the ModbusBox is started with its factory configuration, there is no procedure required to enter in setup mode, in such scenario the device enters automatically in setup mode as soon it powers on. Once in Setup Mode, a Wi-Fi network search can take place in your Android/iOS mobile device or PC and look for SSID name MB-B1W or MB-A4W followed by other characters that represent the unique identification of the chip as shown bellow.

Setup Mode: Press and hold the Setup button and then press and release the Reset button while holding the Setup button for 3 seconds, or until the status LED changes from fading pattern to fast green, then search for the Wi-Fi SSID name in your phone or PC as described previously.

Programing Mode: This mode is only for developers that get the ModbusBox without any firmware loaded on it and whoever wants to upload their own firmware. To enter into this mode, press and hold the Programming button and quickly press and release the Reset button. 

Factory Reset : To perform a factory reset, press and hold the Setup button then quickly press the Reset button, keeping pressed the Setup button for about 10 seconds until status LED turns off and quick turn on back again with the LED fading in green color. After performing a factory reset, the ModbusBox enters automatically in Setup Mode and any previous configuration from the device is removed. 

LEDs indicators

LEDs indicators on the device are very useful to quickly understand the operational status of the ModbusBox. They also help to troubleshoot any problem with the device operation. 

The following tables shows the LEDs behaviors.

Status LED Colors

The Status LED, labeled as D2 on the PCB and marked with number 7 is color-dependent upon device status and alarms.

The following tables shows the color patterns of different status and alarms indications of the Status LED on the ModbusBox.

Status Color Patterns

Alarm Color Patterns

2.Connecting ModbusBox to a Wi-Fi Network

When the device is brand new or Wi-Fi hasn’t been set, it can be configured as an access point mode (AP). Client mode is running all the time after it's connected to your local Wi-Fi network, which makes it very convenient to re-configure the device remotely while connected to your local Wi-Fi network.

Before going ahead with the next instructions, make sure the ModbusBox is powered following the instruction on section 2.2. 

Setup Mode allows the following:

  • Connect the ModbusBox to the Wi-Fi

  • Edit the ModbusBox name

  • Add and configure the Modbus Slaves

  • Check and test the Modbus Slaves readings and functions

  • Setup cloud connectivity to Ubidots

  • Backup/Restore the ModbusBox settings 

  • Backup/Restore the Modbus Slaves configuration 

  • Download the Modbus Slaves manifest 

  • Upload new or modified Slave manifest

Power up ModbusBox with a suitable 12v -24v power supply. Make sure the Status LED is fading green 🟩, if it's not, probably ModbusBox had been setup before. If that's the case, proceed to press Setup Button while quickly press and Release reset button, wait 2 seconds until the Status LED starts fading green 🟩.

Accessing ModbusBox WebUI in Setup Mode

  • Click on Wi-Fi connection and look for the Wi-Fi station that starts with MBOX.

  • Connect to the ModbusBox AP which is open by default, no password required to connect at the initial setup.

  • Open a browser and type the IP Address of the ModbusBox, which is 192.168.4.1 when the device is in Setup Mode.

  • Once the Web-UI opens, it will ask you to change the default password. The new password will be used to access the Web-UI through the LAN once the device is connected to the Wi-Fi network or in Setup Mode if required.

Connecting ModbusBox to a Wi-Fi network

  • Select Wi-Fi option on the vertical navbar. 

  • In the Networks section at the right side of the page, click on Scan to perform a Wi-Fi network scan. When the scanning process is completed, a list of available networks will show up. 

  • Select the one you have access to and enter the password, then click on Save. 

Please note that if you get the pending restart required, you may continue without restarting, as this is required to set other options that will facilitate connecting to the ModbusBox after it is connected to the Wi-Fi that you have selected. 

3. ModbusBox General Configuration

Let's move to the general configuration section by selecting the General tab on the vertical navbar.

This configuration section allows to change the host-name, update the admin password and import/export settings and the manifest file. 

At this time it will only change the device host-name to easily connect to the ModbusBox Web-UI once it connects to the Wi-Fi network. Please note that the assigned IP would remain private.

  • Change the host-name, then click apply to save the changes. If the ModbusBox resets for an unexpected reason while editing, make sure you are still connected to the ModbusBox Wi-Fi Access Point and check that the Status LED is still fading in green color. If not, please put the ModbusBox in Setup Mode by pressing the Setup Button and quickly pressing and releasing thr Reset Button.

The next step to follow is adding the Modbus Slaves and setup the cloud connectivity (MQTT). It’s perfectly possible to continue in Setup Mode to complete the entire setup, but at this point is better to just restart the ModbusBox and access the ModbusBox Web-UI via the IP assigned by the Wi-Fi router. 

Click restart on the Web-UI or press the Reset Button on the ModbusBox.

Finishing ModbusBox setup while connected to Wi-Fi network

As stated previously, the following instructions are to complete the configuration of the ModbusBox that we didn’t finish during setup mode. 

After resetting the device, the Status LED would fade in a light blue color indicating that it's connected to Wi-Fi, but isn’t connected to cloud service. 

Previously, the ModbusBox was connected to the Wi-Fi access point named "TPAHN", so it's necessary to connect the mobile device or computer to the same Wi-Fi network. 

To easily access to the Web-UI, just type in your browser the following host-name:

A popup window will appear asking for the username and password. The username is always admin and the password is the one you set previously.

After the credentials are entered successfully, you will be redirected to the dashboard as shown below:

Dashboard description

4. ModbusBox Slave Configuration

Let’s move now to the Slave section, and click in add.

5. ModbusBox and Ubidots integration

Before continuing, to integrate your data to Ubidots, first create an Ubidots account if you don't have one and get your account TOKEN from the API Credentials option, as shown below:

ModbusBox Cloud Configuration

Now let’s setup the ModbusBox cloud section with the data of Ubidots account.

Please make sure you set the following parameters:

  • Server Address: industrial.api.ubidots.com 

  • Server Port: 1883 

  • Data Cloud Mode: Ubidots Compatibility Mode

Device Visualization 

Finally, in a few seconds you should see in the Ubidots Devices Page, your device VLC automatically created and actively sending data to Ubidots.

By clicking on the device VLT, you can see your variables with their respective values. 

The names of the variables created are the same as the API labels, but their can be changed to make the devices and variables friendlier for your application. To learn how to rename your variables names, take a look at the article below:

Dashboard Setup

To visualize device's data and insights derived from the data, you can explore Ubidots Dashboard, where you’ll be able to create widgets to display the data as charts, indicators, controls, tables, graphs, and more.

To create your first dashboard, go to the Dashboard tab (Data →  Dashboards). Then, select the plus (+) icon in the top-right. Finally, select the desired widget type and create a similar dashboard as the one below.

If you're looking for a dashboard with even more customization, see the guide below:

Other readers have also found useful…

        

Did this answer your question?