Communicate/Manage Modbus Sensors using IO Ninja
Hardware Requirements:
BP Sensor or any Modbus Sensor
Power source to power Modbus Sensors
Jumper cables and 120 Ohm terminal resistors
USB-to-RS485 cable
WEB485 Board for comparison (Not necessary)
USB-to-Type C cable for WEB485 board
Software Requirements:
TDST (Tibbo Device Server Toolkit)
BP Sensor firmware file of version v1.03
Device Explorer application preinstalled on your PC
IO Ninja application pre-installed
Drivers of USB-to-RS485 cable pre-installed
Drivers of WEB485 board pre-installed
Connection Layout:
To communicate any Modbus sensor with IO Ninja, you need to have a USB-to-RS485 cable and the respective drivers installed on your system. I used the FTDI cable and the individual drivers, for which you can find the details here.
In your case, you might have some different company cable, so you have to be careful to install the respective drivers and check the correct pin assignments on the DB9 connector of that cable.
As for me, the FTDI pin assignment for the USB-to-RS485 cable is shown as below:
So in my case, I have connected the DATA+ and DATA- pins to pin3 and pin8 accordingly and powered the sensors with an external power supply.
NOTE: Please don't forget to use 120 Ohm termination resistors on both ends of the RS485 bus.
After installing the respective USB-to-RS485 cable drivers, I will request you all to check if the COM port is detected or not on your system. Open the Windows Device Manager and check under "Ports (COM & LPT)" you should get "USB Serial Port (COMx)"; in my case, it is COM5.
If you cannot detect the COM port, I will request you to download the correct drivers from a good source. I mean to say download the drivers from the respective company website or upload the drivers manually.
Before continuing, please upload the latest BP sensor firmware version v1.03. You can download the BP firmware file from Tibbo's website here.
WEB485 board and an online firmware updater application (here) will help you upload the latest BP sensor firmware. Still, If you don't have a WEB485 board, you can achieve the same using the Device Explorer application with Serial COM Port (USB-to-RS485). You need to use the X-Modem feature in Device Explorer and select the correct COM Port to upload the firmware.
Open IO Ninja's Serial session and add the Modbus Analyzer layer to it. You can visit the online documentation manual for more details on adding the layer in the Serial session, and How to upload the BP Sensor firmware using the IO Ninja? here.
Please select the RS485 Serial parameters as 38400-8-N-1, because Tibbo's BP Sensors are able to communicate default at 38400-8-N-1, while any third-party Modbus sensors can have different parameters. Tibbo have four different BP sensors; these sensors have separate register addresses for communication and different checksums. To get the correct response in IO Ninja, you need to send the request of 8 bytes to the respective sensor in the RS485 bus, for which you need to mention
- Sensor ID (1 byte)
- Register request (Read/Write) (1 byte)
- Register Address (2 bytes)
- Sensor Reading (2 bytes)
- Checksum (2 bytes)
in the same order, the request string (HEX Format) for Tibbo's BP sensors will look like this:
- 0A 04 01 2C 00 01 F0 84 (BP #01)
- 0A 04 01 90 00 05 30 A3 (BP #02)
- 0A 04 01 F4 00 01 70 BF (BP #03)
- 0A 04 02 58 00 05 B1 19 (BP #04)
For BP #02 sensor, I have shown you the fragmented part of the request as:
- 0A is the Sensor ID (In decimal it is 10)
- 04 is the read register request
- 01 90 is the register address to be read (In decimal it is 400 => here)
- 00 05 means 5 register values to be read from the respective sensor
- 30 A3 is the checksum (calculated using the bytes in the request string)
In the same way, you need to input this request string in the "Binary" tab of IO Ninja to get the sensor data.
IMPORTANT: Please take a note here I am using register address as (Decimal) "400" <=> "01 90" (HEX). This gives us processed data bytes, which means we can directly convert the response bytes to decimal format to know the exact sensor values.
In the above snapshot of IO Ninja, the BP sensor #02 response is captured that gives us nearly 15 bytes of data "0A 04 0A 00 EC 18 AD 00 00 00 00 02 68 2B DC". The fragmented part of the data bytes, mostly the Temperature reading and Humidity reading and Checksum, are marked in colour.
- 00 EC is the Temperature reading converted to 236 in decimal format (23.6 °C)
- 02 68 is the Humidity reading converts to 616 in decimal format (61.6%)
- 2B DC is the Checksum value last 2 bytes
In the above snapshot of IO Ninja, the BP sensor #03 response is captured that gives us nearly 7 bytes of data "0A 04 02 02 2F 5C 4D". The fragmented part of the response data bytes consisting of the sensor's luminance and Checksum are marked in colour.
- 02 2F is the processed luminance data converts to 559 in decimal format (559 LUX)
- 5C 4D is the Checksum value last 2 bytes
With this, you can fragment the response data bytes of all the available Tibbo BP sensors in IO Ninja and your third party Modbus sensors. For third party Modbus sensor, I will request the user to check the respective manufacturer's datasheet before comparing the response bytes.
And for Tibbo's available BP sensors, you can visit the documentation here to know the respective register address.
Comments
0 comments
Please sign in to leave a comment.