Modbus Instructions
Our Modbus functions are seperated into the following types:Function Type | Notes |
---|---|
Measurement settings | Set mode, Set salinity, Set interval time etc. |
Command | Start, stop |
Measurement output | Get pH, Get Temp etc. |
Admin | Get serial number, Get firmware version etc. |
Steps to deploying your sensor using Modbus communication
- Connect sensor to power and control system.
- Select correct com port.
- Select Baudrate = 57600 (default setting), Data = 8,N,1 (8 Bit, 0 Parity, 1 Stop Bit).
- Make sure the sensor is in modbus mode. This can be done in terminal mode via anb_utils, or via modbus.
- Set-up the sensor with it's measurement settings. This can be done in terminal mode via anb_utils or via modbus.
- Once the measurement settings are applied, use the command functions to start/stop the sensor.
- To call the data, use the measurement output functions.
Measurement Setting Functions
Note: All values are in hex
Objective | Notes | Modbus Function | Command | Example Response (if available) | Source | Type |
---|---|---|---|---|---|---|
Set Mode | Requires power cycle to invoke autonomous | 6 | 55 06 00 35 00 0n [CRCL:CRCH] | 55 06 00 35 00 0n [CRCL:CRCH] | Input register | where n = 1 Controlled, or n = 2 Autonomous |
Set Salinity | Before scanning set expected salinity | 6 | 55 06 00 3E 00 0n [CRCL:CRCH] | 55 06 00 3E 00 0n [CRCL:CRCH] | Input register | where n = 1 Low salinity, n = 2 High salinity |
Set Power Style | Before scanning set power style | 6 | 55 06 00 3F 00 0n [CRCL:CRCH] | 55 06 00 3F 00 0n [CRCL:CRCH] | Input register | where n = 1 Always powered, n = 2 Turned off between measurements |
Set Interval Time | 0 for continuous, or minimum 10 mins for interval | 6 | 55 06 00 36 00 nn [CRCL:CRCH] | 55 06 00 36 00 nn [CRCL:CRCH] | Input register | where nn = 00 for continuous, or 10-240 mins for interval |
Set Immersion Rule | Effective immediately | 6 | 55 06 00 3C 00 0n [CRCL:CRCH] | 55 06 00 3C 00 0n [CRCL:CRCH] | Input register | where n = 1 on, or n = 2 off |
Command Functions
Objective | Notes | Modbus Function | Command | Example Response (if available) | Source | Type |
---|---|---|---|---|---|---|
Start scan | Only this coil can be on | 5 | 55 05 01 00 FF 00[CRCL:CRCH] | 55 05 01 00 FF 00[CRCL:CRCH] | Coil | Hex 16bit |
Start scan with abraded function | Only this coil can be on | 5 | 55 05 01 80 FF 00[CRCL:CRCH] | 55 05 01 80 FF 00[CRCL:CRCH] | Coil | Hex 16bit |
Stop scan | Turn off any coil that is on | 5 | 55 05 00 00 00 00[CRCL:CRCH] | 55 05 00 00 00 00[CRCL:CRCH] | Coil | Hex 16bit |
First Scan Command Delay
After sending the first scan command there is a 2-3 min delay before the sensor will return a valid pH value. In this 90s the sensor will output an Exception which is signified by setting the MSB in the command byte and adding a payload byte that specifies the reason for the exception.
i.e. for the request:
< ADDRESS >< 03 >< 00 >< 00 >< 00 >< 02 >< CRC >
The exception reply when there is currently not a pH value to return is:
< ADDRESS >< 83 >< 05 >< CRC >
Where 05 = ACKNOWLEDGE This exception signifies that the sensor has received the Modbus communication but cannot currently perform the requested function. For example, requesting the current pH value when the sensor is not scanning.
or
< ADDRESS >< 83 >< 06 >< CRC >
Where 06 = BUSY This exception is transmitted when the sensor needs more time before it can perform the requested function. It will be necessary to re-transmit the request again at a later time. For example, requesting the current pH value, before the sensor has been able to calculate the value.
NB. All data is big endian
Measurement Output Functions
Objective | Notes | Modbus Function | Command | Example Response (if available) | Source | Type |
---|---|---|---|---|---|---|
Get Current pH Value | pH value options | 3 | 55 03 00 00 00 02 [CRCL:CRCH] | 55 03 04 41 00 00 00 [CRCL:CRCH] | Holding | Floating point 32bit |
Get Current Temperature | Latest Temperature (in C) | 3 | 55 03 00 02 00 02 [CRCL:CRCH] | 55 03 04 41 94 00 00 [CRCL:CRCH] | Holding | Floating point 32bit |
Get Salinity | Latest Salinity | 3 | 55 03 00 04 00 02 [CRCL:CRCH] | 55 03 04 41 94 00 00 [CRCL:CRCH] | Holding | Floating point 32bit |
Get Conductivity | Latest Conductivity | 3 | 55 03 00 06 00 02 [CRCL:CRCH] | 55 03 04 41 94 00 00 [CRCL:CRCH] | Holding | Floating point 32bit |
Get Transducer Health Status | Transducer Health options | 3 | 55 03 00 08 00 01 [CRCL:CRCH] | 55 03 02 00 0n [CRCL:CRCH] | Holding | n = Single digit integer, see table |
Get Actual Conductivity | Latest Actual Conductivity | 3 | 55 03 00 43 00 02 [CRCL:CRCH] | 55 03 04 41 94 00 00 [CRCL:CRCH] | Holding | Floating point 32bit |
Get Sensor Diagnostics | Sensor Diagnostics options | 3 | 55 03 00 09 00 01 [CRCL:CRCH] | 55 03 02 00 nn [CRCL:CRCH] | Holding | Double digit integer, see table |
Get Bulk Results | All data from scan (pH, temp, salinity, conductivity, actual conductivity) | 3 | 55 03 00 00 00 0B [CRCL:CRCH] | 55 03 16 [22 bytes][CRCL:CRCH] | Holding | Floating point 32bit |
Admin Functions
Objective | Notes | Modbus Function | Command | Example Response (if available) | Source | Type |
---|---|---|---|---|---|---|
Set to Modbus | Set to Modbus. Active after the response | 6 | 55 06 01 40 01 0D [CRCL:CRCH] | 55 06 01 40 01 0D [CRCL:CRCH] | Set to Modbus | |
Set RTC | Set new RTC time | 16 | 55 10 00 3D 00 06 0C 00 00 00 30 00 17 00 02 00 07 00 28 [CRCL:CRCH] | 55 10 00 3D 00 06 [CRCL:CRCH] | Holding | 6 x 16bit bytes ss mm hh dd mm yy |
Set Baudrate | Change Baudrate. Active on next bootup | 6 | 55 06 00 3A 00 0n [CRCL:CRCH] | 55 06 00 3A 00 0n [CRCL:CRCH] | Input register | where n = 1 = 9600 2 = 14400 3 = 19200 4 = 28800 5 = 38400 6 = 56000 7 = 57600 8 = 115200 |
Set Modbus Address | Set address on next bootup | 6 | 55 06 00 39 00 nn [CRCL:CRCH] | 55 06 00 39 00 nn [CRCL:CRCH] | Input register | where nn = modbus address |
Change to Terminal Mode | Change from modbus to terminal. Active on next bootup | 6 | 55 06 00 3B 00 01 [CRCL:CRCH] | 55 06 00 3B 00 01 [CRCL:CRCH] | Input register | change to terminal mode |
Get Sensor Serial Number | Serial number = 000000 | 3 | 55 03 00 0A 00 03 [CRCL:CRCH] | 55 03 06 3n 3n 3n 3n 3n 3n [CRCL:CRCH] | Holding | 6 digit integer, where n = 0-9 |
Get Sensor Manufacturer | Manufacturer = ANB Sensors | 3 | 55 03 00 0D 00 08 [CRCL:CRCH] | 55 03 10 41 4E 42 53 65 6E 73 6F 72 73 00 00 00 00 00 00 [CRCL:CRCH] | Holding | 16 Alphanumeric characters |
Get Sensor Name | Name = DEVICE_NAME | 3 | 55 03 00 15 00 08 [CRCL:CRCH] | 55 03 10 44 65 76 69 63 65 5F 4E 61 6D 65 [CRCL:CRCH] | Holding | 16 Alphanumeric characters |
Get Sensor Sub Name | Sub Name = DEVICE_SUB_NAME | 3 | 55 03 00 1D 00 08 [CRCL:CRCH] | 55 03 10 44 65 76 69 63 65 5F 53 75 62 5F 4E 61 6D 65 [CRCL:CRCH] | Holding | 16 Alphanumeric characters |
Get IF Firmware Version | Version = I35.0 | 3 | 55 03 00 25 00 08 [CRCL:CRCH] | 55 03 10 56 33 35 30 2E 30 41 20 20 20 20 20 20 20 20 20 [CRCL:CRCH] | Holding | 16 Alphanumeric characters |
Get DV Firmware Version | Version = D23.7 | 3 | 55 03 00 2D 00 08 [CRCL:CRCH] | 55 03 10 44 56 52 56 32 33 2E 37 0D 00 00 00 00 00 00 0D [CRCL:CRCH] | Holding | 16 Alphanumeric characters |
Get Interval Time | Minutes between successive array scans | 3 | 55 03 00 36 00 01 [CRCL:CRCH] | 55 03 02 00 nn [CRCL:CRCH] | Holding | Hex 16bit |
Get Immersion Rule | Effective immediately | 3 | 55 03 00 3C 00 01 [CRCL:CRCH] | 55 03 02 00 01 [CRCL:CRCH] | Holding | Hex 16bit |
Get RTC | Current RTC | 3 | 55 03 00 3D 00 06 [CRCL:CRCH] | 55 03 0C 00 39 00 26 00 16 00 31 00 05 00 23 [CRCL:CRCH] | Holding | 6 x 16bit bytes ss mm hh dd mm yy |
Sensor Diagnostics
Sensor diagnostics is a two digit number. The first digit gives information about the sensor's current status and the second digit gives information about any errors found in the sensor.
First Digit | Status | Explanation |
---|---|---|
0 | Sleep | Sensor is idle and/or following its pre-set interval routine |
1 | Interval Scanning | pH will be updated when measurement completes |
2 | Continuous Scanning | pH will be automatically updated as per our continuous sequence |
Second Digit | Status | Action |
0 | Healthy Sensor | None |
1 | Clock Battery Error | If there is no external power to the sensor the real time clock will not hold the programmed time - If the sensor is powered, the time set and data streamed, this failure is not an issue - If the sensor is in automonous mode the clock will fail if disconnected from the power when it was programmed and placed on an external battery -Users can record when the sensor was first switched on (where the sensor's time will be set to 0) and calculate the times externally, or, if this is not viable, contact support@anbsensors.com |
2 | SD Card Error | Either SD Card has been disabled or A failing in the internal data save has occurred and no new data can be saved to the internal memory - If the sensor is connected to an external communications system the sensor will continue to stream data, however no data will be saved in autonomous mode - Please contact support@anbsensors.com |
3 | System Error | Contact support@anbsensors.com |
Legacy commands
These legacy commands will work for the sensor, but are not recommended.
Objective | Notes | Modbus Function | Command | Example Response | Source | Type |
---|---|---|---|---|---|---|
Start Fresh water scan | Fresh water value 0x0003 | 6 | 55 06 00 00 00 03[CRCL:CRCH] | 55 06 00 00 00 03[CRCL:CRCH] | Input register | Hex 16bit |
Only this coil can be on | 5 | 55 05 00 0A FF 00[CRCL:CRCH] | 55 05 00 0A FF 00[CRCL:CRCH] | Coil | Hex 16bit | |
Start Fresh water scan with abraded function | Informs sensor transducer has been abraded | 6 | 55 06 00 00 00 83[CRCL:CRCH] | 55 06 00 00 00 83[CRCL:CRCH] | Input register | Hex 16bit |
Start Ocean water scan | Ocean water value 0x0004 | 6 | 55 06 00 00 00 04[CRCL:CRCH] | 55 06 00 00 00 04[CRCL:CRCH] | Input register | Hex 16bit |
Only this coil can be on | 5 | 55 05 00 0C FF 00[CRCL:CRCH] | 55 05 00 0C FF 00[CRCL:CRCH] | Coil | Hex 16bit | |
Start Ocean water scan with abraded function | Informs sensor transducer has been abraded | 6 | 55 06 00 00 00 84[CRCL:CRCH] | 55 06 00 00 00 84[CRCL:CRCH] | Input register | Hex 16bit |
Start Fresh water single result, interval >60mins | Fresh water single value 0x0005 | 6 | 55 06 00 00 00 05[CRCL:CRCH] | 55 06 00 00 00 05[CRCL:CRCH] | Input register | Hex 16bit |
Only this coil can be on | 5 | 55 05 00 0B FF 00[CRCL:CRCH] | 55 05 00 0B FF 00[CRCL:CRCH] | Coil | Hex 16bit | |
Start Fresh water single result with abraded function | Informs sensor transducer has been abraded | 6 | 55 06 00 00 00 85[CRCL:CRCH] | 55 06 00 00 00 85[CRCL:CRCH] | Input register | Hex 16bit |
Start Ocean water single result, interval >60mins | Ocean water single value 0x0006 | 6 | 55 06 00 00 00 06[CRCL:CRCH] | 55 06 00 00 00 06[CRCL:CRCH] | Input register | Hex 16bit |
Only this coil can be on | 5 | 55 05 00 0D FF 00[CRCL:CRCH] | 55 05 00 0D FF 00[CRCL:CRCH] | Coil | Hex 16bit | |
Start Ocean water single result with abraded function | Informs sensor transducer has been abraded | 6 | 55 06 00 00 00 86[CRCL:CRCH] | 55 06 00 00 00 86[CRCL:CRCH] | Input register | Hex 16bit |
Start Fresh water single result, interval <60mins | Fresh water single value 0x0005 | 6 | 55 06 00 00 00 85[CRCL:CRCH] | 55 06 00 00 00 85[CRCL:CRCH] | Input register | Hex 16bit |
Start Ocean water single result, interval <60mins | Ocean water single value 0x0006 | 6 | 55 06 00 00 00 86[CRCL:CRCH] | 55 06 00 00 00 86[CRCL:CRCH] | Input register | Hex 16bit |
Stop scan | 6 | 55 06 00 00 00 00[CRCL:CRCH] | 55 06 00 00 00 00[CRCL:CRCH] | Input register | Hex 16bit | |
Set Modbus Address | Set address to 0xAA (170dec) on next bootup | 5 | 55 05 00 39 00 AA [CRCL:CRCH] | 55 05 00 39 00 AA [CRCL:CRCH] | Holding | |
Set Baudrate | Change Baudrate | 5 | 55 05 00 3A 00 07 [CRCL:CRCH] | 55 05 00 3A 00 07 [CRCL:CRCH] | Holding | Single digit integer |
Set Interface Mode | Change Interface mode | 5 | 55 05 00 3B 00 0n [CRCL:CRCH] | 55 06 3B 00 0n | Holding | where n = 1 terminal, n = 2 modbus |
Set Immersion Rule | Effective immediately | 5 | 55 05 00 3C 00 02 [CRCL:CRCH] | 55 05 00 3C 00 02 [CRCL:CRCH] | Holding | Single digit integer |