Industrial Smart.Hubs™ include a Modbus TCP client that can be used to create a 2 way connection between any Modbus TCP enabled device and the Whisker.io® web portal, allowing users to remotely monitor and manage automation technologies from anywhere in the world.


Introduction


Modbus is the most popular and well-supported communication protocol for industrial automation applications.  It is used for:


  • Programmable Logic Controllers (PLC)
  • Human Machine Interfaces (HMI)
  • Variable Frequency Drives (VFD)
  • Remote I/O
  • Sensors
  • Building Automation
  • and more...


Smart.Hub™ IoT gateways include a Modbus Client that allows a two-way connection between any of these devices and our cloud platform.


Once the Modbus Client is configured, the Smart.Hub immediate begins to read data from the configured devices and report it to the cloud, where it can be used in HMI user-interfaces, dashboards, and the alerting system.


In this article, we will explain how the Modbus Client works and how it is configured.


Smart.Hub Modbus Client Operation

The Smart.Hub Modbus Client communicates with one or more Modbus devices to collect data on assets and equipment in the field.


The Smart.Hub Modbus Client is configured using the concept of slots.  A slot definition contains all of the information needed to collect a reading from a Modbus enabled device and display it in the cloud using NexusHMI.


Slot configuration is separated into two parts: Modbus and Scaling & Units.


Modbus configuration parameters include everything needed to access a value in a Modbus enabled device.  Each slot can be configured to read from a different device, table, and register.


Slot Modbus Parameters


ParameterDescription
IP AddressTCP/IP Address of device on the network
PortModbus Port (usually 502)
TableTable (Coils,Discrete In,Input Regs, Holding Regs)
Data TypeSize and format of the data.  16/32 bit words, bitfields, and floating point are supported.
Start AddressThe starting address of the register containing the desired value
WritableSet to true if the value is writable.   This allows the value to be changed in the cloud.


Scaling & Units parameters are used by the cloud to properly scale and display the values read from Modbus devices.  The parameters vary with the data type.


Slot Scaling & Units Parameters (Float and Word types)


ParameterDescription
NameThis is used to identify a value when displayed
GainUsed to scale the incoming value.  The displayed value is the measured value multiplied by the gain and then added to the offset (standard slope formula).
OffsetSee above
Gauge MinDetermines the minimum range of a gauge when used to display a value
Gauge MaxDetermines the maximum range of a gauge when used to display a value
UnitsSet to a string representing the units of the scaled value
Decimal PlacesNumber of decimal places to displaying a value



Slot Scaling & Units Parameters (Bitfield16 type)


ParameterDescription
ActiveDetermines whether the bit is used as a tag.
NameName of bit tag
High TextText to display when bit is high
Low TextText to display when bit is low
High ColorColor to display when bit is high
Low ColorColor to display when bit is low

The above parameters are for each bit in the bitfield.

The Modbus and Scaling & Units parameters are grouped together into a slot to save time during configuration.  


When Modbus slot configuration is changed in the cloud, the changes are immediately pushed to the Smart.Hub and, within a few seconds, the Smart.Hub will begin gathering values and reporting them to the cloud.


Data Types for Modbus Slots


Data TypeDescriptionCoilsDiscrete InInput RegsHolding Regs
Bitfield1616 bits packed into a word.  Treated as individual channels/tags in Whisker.io® portal.



Word1616-bit word



Word3232-bit word constructed from two 16-bit registers



Word32SSame as Word32, but with the 16-bit words swapped



Float32-bit floating point 



FloatSBFloat with bytes swapped in each word



FloatSW
Float with words swapped



FloatSBWFloat with bytes and words swapped



Multiselect16-bit word used to select mode/status.  Each unique values represents a status or mode




Configuring Smart.Hub Modbus Client


Every Industrial Smart Hub includes a Modbus Client, but it must be enabled and configured.  It is important to note that enabling a Modbus Client will add monthly or annual charges to your account (see Subscription Agreement and Offer Details).


The Smart.Hub Modbus Client is configured using the Whisker.io® web portal.  To get started, log into www.whisker.io and navigate to the Location View for the location that contains the Smart.Hub you wish to configure.


Now, click the "gear" icon on the right side of the Smart.Hub's name in the Configured Products panel:


This will open the "Edit Gateway" dialog:





1Smart.Hub name.  This is used to identify the Hub in the cloud.
2Check to enable Modbus Client.  This will incur additional charges if this service is not already included in your Offer Details.
3Timeout in seconds for write commands.  Applies to Writable slots.
4Click to edit ethernet configuration parameters.
5Click to edit Modbus Client slots
6Ethernet Parameters

For the Modbus Client to work properly, you must ensure that the Ethernet settings are correct for your network.


The IP address is the fixed address of the Smart.Hub on your network.  This is in CIDR notation with the subnet being specified by a single number.  If you are not familiar with CIDR notation, this chart is a good cheat sheet for making the conversion.  Ensure that the ethernet IP address and subnet are configured properly or the Smart.Hub will not be able to communicate with your Modbus TCP devices.


The Smart.Hub must have access to the Whisker.io® MQTT and cloud servers which requires DNS service to be available.  Ensure that at least one name server  and the gateway IP are configured properly or the Smart.Hub will not be able to reach the servers on the Internet.  This is important even if you are using 4G cellular as your primary Internet connection because the Ethernet channel is used as backup if cellular is lost temporarily.


With the Ethernet interface configured properly, you can now configure the Modbus Client slots.  Click the "Modbus Client" tab to view the available slots:



The Modbus Client has 32 slots which are displayed here in a scrollable list.  If a slot is not configured, it will be marked "Inactive".  The Smart.Hub will ignore inactive slots.


To activate or edit a slot, click the "gear" icon for that slot to bring up the "Edit Slot" dialog:


This slot is not active.  To activate and configure the slot, check "Slot Active":


To add/edit alerts (alarms) for this slot, click the "View Alerts" button. 


These parameters where explained earlier in this article.  Please refer to the tables labeled "Slot Scaling & Units Parameters" and "Slot Modbus Parameters" for more information.


"Slot Type" is the datatype for this slot.  It is used by the Modbus Client to know how many words to read and how to organize the bytes, and by the Whisker.io® web portal to determine how Scaling & Units should be configured to properly display the value.  


The "Scaling & Units" parameter editor will change based on the value type.  For 16/32 bit words and floating point numbers, the editor will look as shown in the picture above.  This provides you with the ability to scale the incoming analog value.


If the type is "Multiselect", the editor will change to allow you to specify the selection parameters.  This is useful when you want to use a word to encode various states.  For example, you would use multiselect for a word that sets the A-H-O (Augo-Hand-Off) operating mode:



If the type is "Bitfield16", the edit will change to allow you to specify the parameters for each bit in a 16-bit word.  This datatype can be used with Coils, Discrete Inputs, and Holding Registers.  


When a slot is configured for Coils or Discrete Inputs, the datatype must be Bitfield16 and the Modbus Client will read 16 continuous bits starting with the Start Address for the specified device.  


When a slot is configured for Holding Registers and the datatype is Bitfield16, the Modbus Client treats it as a 16-bit word but the Whisker.io® portal treats it as individual bits, allowing you to pack status bits into a single register.


Since each bit is treated as a separate tag in the Whisker.io®, alerts are configured on a bit-by-bit basis.  Click the "View" button to add/edit alerts for a bit in the bitfield.


Once you have finished configuring a slot, click "Close" to return to the "Edit Gateway" dialog.


When all slots are configured the way you want them, click "Save Changes" to store the new configuration and send it to the Smart.Hub.  Within a few seconds, the Smart.Hub will begin acquiring values based on the new configuration and reporting those values to the cloud.


Generally, Smart.Hubs are configured to update the cloud once every minute, so it might take a minute before you start to see the values change in the cloud.


Each word and float type slot is treated as a channel (tag).  Each bit in a bitfield is also treated as a channel (tag).  You can view the Smart.Hub's channels in the Configured Devices panel in the Location View.  



The channels can now be used for Alerts, NexusHMI, and Dashboards.