Skip to main content

Modbus Instructions

Our Modbus functions are seperated into the following types:

Function TypeNotes
Measurement settingsSet mode, Set salinity, Set interval time etc.
CommandStart, stop
Measurement outputGet pH, Get Temp etc.
AdminGet serial number, Get firmware version etc.

Steps to deploying your sensor using Modbus communication

  1. Connect sensor to power and control system.
  2. Select correct com port.
  3. Select Baudrate = 57600 (default setting), Data = 8,N,1 (8 Bit, 0 Parity, 1 Stop Bit).
  4. Make sure the sensor is in modbus mode. This can be done in terminal mode via anb_utils, or via modbus.
  5. Set-up the sensor with it's measurement settings. This can be done in terminal mode via anb_utils or via modbus.
  6. Once the measurement settings are applied, use the command functions to start/stop the sensor.
  7. To call the data, use the measurement output functions.
tip

The modbus address is set to 0x55, but can be user configured via terminal or modbus

On closing anb_utils the sensor will automatically return to modbus interface

Measurement Setting Functions

Note: All values are in hex

ObjectiveNotesModbus FunctionCommandExample Response (if available)SourceType
Set ModeRequires power cycle to invoke autonomous655 06 00 35 00 0n [CRCL:CRCH]55 06 00 35 00 0n [CRCL:CRCH]Input registerwhere n = 1 Controlled, or n = 2 Autonomous
Set SalinityBefore scanning set expected salinity655 06 00 3E 00 0n [CRCL:CRCH]55 06 00 3E 00 0n [CRCL:CRCH]Input registerwhere n = 1 Low salinity, n = 2 High salinity
Set Power StyleBefore scanning set power style655 06 00 3F 00 0n [CRCL:CRCH]55 06 00 3F 00 0n [CRCL:CRCH]Input registerwhere n = 1 Always powered, n = 2 Turned off between measurements
Set Interval Time0 for continuous, or minimum 10 mins for interval655 06 00 36 00 nn [CRCL:CRCH]55 06 00 36 00 nn [CRCL:CRCH]Input registerwhere nn = 00 for continuous, or 10-240 mins for interval
Set Immersion RuleEffective immediately655 06 00 3C 00 0n [CRCL:CRCH]55 06 00 3C 00 0n [CRCL:CRCH]Input registerwhere n = 1 on, or n = 2 off

Command Functions

ObjectiveNotesModbus FunctionCommandExample Response (if available)SourceType
Start scanOnly this coil can be on555 05 01 00 FF 00[CRCL:CRCH]55 05 01 00 FF 00[CRCL:CRCH]CoilHex 16bit
Start scan with abraded functionOnly this coil can be on555 05 01 80 FF 00[CRCL:CRCH]55 05 01 80 FF 00[CRCL:CRCH]CoilHex 16bit
Stop scanTurn off any coil that is on555 05 00 00 00 00[CRCL:CRCH]55 05 00 00 00 00[CRCL:CRCH]CoilHex 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

ObjectiveNotesModbus FunctionCommandExample Response (if available)SourceType
Get Current pH ValuepH value options355 03 00 00 00 02 [CRCL:CRCH]55 03 04 41 00 00 00 [CRCL:CRCH]HoldingFloating point 32bit
Get Current TemperatureLatest Temperature (in C)355 03 00 02 00 02 [CRCL:CRCH]55 03 04 41 94 00 00 [CRCL:CRCH]HoldingFloating point 32bit
Get SalinityLatest Salinity355 03 00 04 00 02 [CRCL:CRCH]55 03 04 41 94 00 00 [CRCL:CRCH]HoldingFloating point 32bit
Get ConductivityLatest Conductivity355 03 00 06 00 02 [CRCL:CRCH]55 03 04 41 94 00 00 [CRCL:CRCH]HoldingFloating point 32bit
Get Transducer Health StatusTransducer Health options355 03 00 08 00 01 [CRCL:CRCH]55 03 02 00 0n [CRCL:CRCH]Holdingn = Single digit integer, see table
Get Actual ConductivityLatest Actual Conductivity355 03 00 43 00 02 [CRCL:CRCH]55 03 04 41 94 00 00 [CRCL:CRCH]HoldingFloating point 32bit
Get Sensor DiagnosticsSensor Diagnostics options355 03 00 09 00 01 [CRCL:CRCH]55 03 02 00 nn [CRCL:CRCH]HoldingDouble digit integer, see table
Get Bulk ResultsAll data from scan (pH, temp, salinity, conductivity, actual conductivity)355 03 00 00 00 0B [CRCL:CRCH]55 03 16 [22 bytes][CRCL:CRCH]HoldingFloating point 32bit

Admin Functions

ObjectiveNotesModbus FunctionCommandExample Response (if available)SourceType
Set to ModbusSet to Modbus. Active after the response655 06 01 40 01 0D [CRCL:CRCH]55 06 01 40 01 0D [CRCL:CRCH]Set to Modbus
Set RTCSet new RTC time1655 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]Holding6 x 16bit bytes ss mm hh dd mm yy
Set BaudrateChange Baudrate. Active on next bootup655 06 00 3A 00 0n [CRCL:CRCH]55 06 00 3A 00 0n [CRCL:CRCH]Input registerwhere n =
1 = 9600
2 = 14400
3 = 19200
4 = 28800
5 = 38400
6 = 56000
7 = 57600
8 = 115200
Set Modbus AddressSet address on next bootup655 06 00 39 00 nn [CRCL:CRCH]55 06 00 39 00 nn [CRCL:CRCH]Input registerwhere nn = modbus address
Change to Terminal ModeChange from modbus to terminal. Active on next bootup655 06 00 3B 00 01 [CRCL:CRCH]55 06 00 3B 00 01 [CRCL:CRCH]Input registerchange to terminal mode
Get Sensor Serial NumberSerial number = 000000355 03 00 0A 00 03 [CRCL:CRCH]55 03 06 3n 3n 3n 3n 3n 3n [CRCL:CRCH]Holding6 digit integer, where n = 0-9
Get Sensor ManufacturerManufacturer = ANB Sensors355 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]Holding16 Alphanumeric characters
Get Sensor NameName = DEVICE_NAME355 03 00 15 00 08 [CRCL:CRCH]55 03 10 44 65 76 69 63 65 5F 4E 61 6D 65 [CRCL:CRCH]Holding16 Alphanumeric characters
Get Sensor Sub NameSub Name = DEVICE_SUB_NAME355 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]Holding16 Alphanumeric characters
Get IF Firmware VersionVersion = I35.0355 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]Holding16 Alphanumeric characters
Get DV Firmware VersionVersion = D23.7355 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]Holding16 Alphanumeric characters
Get Interval TimeMinutes between successive array scans355 03 00 36 00 01 [CRCL:CRCH]55 03 02 00 nn [CRCL:CRCH]HoldingHex 16bit
Get Immersion RuleEffective immediately355 03 00 3C 00 01 [CRCL:CRCH]55 03 02 00 01 [CRCL:CRCH]HoldingHex 16bit
Get RTCCurrent RTC355 03 00 3D 00 06 [CRCL:CRCH]55 03 0C 00 39 00 26 00 16 00 31 00 05 00 23 [CRCL:CRCH]Holding6 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 DigitStatusExplanation
0SleepSensor is idle and/or following its pre-set interval routine
1Interval ScanningpH will be updated when measurement completes
2Continuous ScanningpH will be automatically updated as per our continuous sequence
Second DigitStatusAction
0Healthy SensorNone
1Clock Battery ErrorIf 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
2SD Card ErrorEither 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
3System ErrorContact support@anbsensors.com

Legacy commands

These legacy commands will work for the sensor, but are not recommended.

ObjectiveNotesModbus FunctionCommandExample ResponseSourceType
Start Fresh water scanFresh water value 0x0003655 06 00 00 00 03[CRCL:CRCH]55 06 00 00 00 03[CRCL:CRCH]Input registerHex 16bit
Only this coil can be on555 05 00 0A FF 00[CRCL:CRCH]55 05 00 0A FF 00[CRCL:CRCH]CoilHex 16bit
Start Fresh water scan with abraded functionInforms sensor transducer has been abraded655 06 00 00 00 83[CRCL:CRCH]55 06 00 00 00 83[CRCL:CRCH]Input registerHex 16bit
Start Ocean water scanOcean water value 0x0004655 06 00 00 00 04[CRCL:CRCH]55 06 00 00 00 04[CRCL:CRCH]Input registerHex 16bit
Only this coil can be on555 05 00 0C FF 00[CRCL:CRCH]55 05 00 0C FF 00[CRCL:CRCH]CoilHex 16bit
Start Ocean water scan with abraded functionInforms sensor transducer has been abraded655 06 00 00 00 84[CRCL:CRCH]55 06 00 00 00 84[CRCL:CRCH]Input registerHex 16bit
Start Fresh water single result, interval >60minsFresh water single value 0x0005655 06 00 00 00 05[CRCL:CRCH]55 06 00 00 00 05[CRCL:CRCH]Input registerHex 16bit
Only this coil can be on555 05 00 0B FF 00[CRCL:CRCH]55 05 00 0B FF 00[CRCL:CRCH]CoilHex 16bit
Start Fresh water single result with abraded functionInforms sensor transducer has been abraded655 06 00 00 00 85[CRCL:CRCH]55 06 00 00 00 85[CRCL:CRCH]Input registerHex 16bit
Start Ocean water single result, interval >60minsOcean water single value 0x0006655 06 00 00 00 06[CRCL:CRCH]55 06 00 00 00 06[CRCL:CRCH]Input registerHex 16bit
Only this coil can be on555 05 00 0D FF 00[CRCL:CRCH]55 05 00 0D FF 00[CRCL:CRCH]CoilHex 16bit
Start Ocean water single result with abraded functionInforms sensor transducer has been abraded655 06 00 00 00 86[CRCL:CRCH]55 06 00 00 00 86[CRCL:CRCH]Input registerHex 16bit
Start Fresh water single result, interval <60minsFresh water single value 0x0005655 06 00 00 00 85[CRCL:CRCH]55 06 00 00 00 85[CRCL:CRCH]Input registerHex 16bit
Start Ocean water single result, interval <60minsOcean water single value 0x0006655 06 00 00 00 86[CRCL:CRCH]55 06 00 00 00 86[CRCL:CRCH]Input registerHex 16bit
Stop scan655 06 00 00 00 00[CRCL:CRCH]55 06 00 00 00 00[CRCL:CRCH]Input registerHex 16bit
Set Modbus AddressSet address to 0xAA (170dec) on next bootup555 05 00 39 00 AA [CRCL:CRCH]55 05 00 39 00 AA [CRCL:CRCH]Holding
Set BaudrateChange Baudrate555 05 00 3A 00 07 [CRCL:CRCH]55 05 00 3A 00 07 [CRCL:CRCH]HoldingSingle digit integer
Set Interface ModeChange Interface mode555 05 00 3B 00 0n [CRCL:CRCH]55 06 3B 00 0nHoldingwhere n = 1 terminal, n = 2 modbus
Set Immersion RuleEffective immediately555 05 00 3C 00 02 [CRCL:CRCH]55 05 00 3C 00 02 [CRCL:CRCH]HoldingSingle digit integer