LIGO PRO BLE Protocol: Difference between revisions
| [checked revision] | [checked revision] |
Initial Release [release] |
change content |
||
| (One intermediate revision by the same user not shown) | |||
| Line 283: | Line 283: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Modbus RTU Register Mapping == | |||
The SOJI sensor is capable of communication via the RS-485 serial bus in the Modbus/RTU protocol. The sensor supports the Modbus function 03 – Read Holding Registers | |||
{| class="wikitable" | |||
!No | |||
!Address | |||
|'''Type''' | |||
|'''Description''' | |||
|'''Unit''' | |||
|- | |||
|1 | |||
|0x00 | |||
|U16 | |||
|Sensor address (slave ID) | |||
|– | |||
|- | |||
|2 | |||
|0x01 | |||
|U16 | |||
|Min calibration (Cmin) – '''Low word''' | |||
|– | |||
|- | |||
|3 | |||
|0x02 | |||
|U16 | |||
|Min calibration (Cmin) – '''High word''' | |||
|– | |||
|- | |||
|4 | |||
|0x03 | |||
|U16 | |||
|Fuel level data (12-bit / mm / liter) | |||
|raw / mm / L | |||
|- | |||
|5 | |||
|0x04 | |||
|U16 | |||
|Temperature | |||
|°C | |||
|- | |||
|6 | |||
|0x05 | |||
|U16 | |||
|Reserved | |||
|– | |||
|- | |||
|7 | |||
|0x06 | |||
|U16 | |||
|Reserved | |||
|– | |||
|- | |||
|8 | |||
|0x07 | |||
|U16 | |||
|Max calibration (Cmax) – '''Low word''' | |||
|– | |||
|- | |||
|9 | |||
|0x08 | |||
|U16 | |||
|Max calibration (Cmax) – '''High word''' | |||
|– | |||
|- | |||
|10 | |||
|0x09 | |||
|U16 | |||
|Sensor height (actual height, set via app) | |||
|mm | |||
|- | |||
|11 | |||
|0x0A | |||
|U16 | |||
|OSC current | |||
|– | |||
|- | |||
|12 | |||
|0x0B | |||
|U16 | |||
|OSC current | |||
|– | |||
|} | |||
'''Detailed register description''' | |||
<div class="noprint"> | '''🔹''' '''0x00 — Sensor address''' | ||
The slave address of the sensor. The master uses this value as the address byte in the request frame. | |||
'''🔹''' '''0x01 + 0x02 — Min calibration (Cmin) (32-bit)''' | |||
The '''minimum''' calibration value is a 32-bit value split across two 16-bit registers: | |||
* 0x01 = '''Low word''' (lower 16 bits) | |||
* 0x02 = '''High word''' (upper 16 bits) | |||
'''Combination formula:''' | |||
Cmin = (RegHigh << 16) | RegLow | |||
'''🔹''' '''0x07 + 0x08 — Max calibration (Cmax) (32-bit)''' | |||
Same scheme as min, this is the '''maximum''' calibration value: | |||
* 0x07 = Low word | |||
* 0x08 = High word | |||
Together, the min/max pairs define the '''calibration range''' of the capacitive sensor: | |||
* '''Empty''' tank ↔ Cmin | |||
* '''Full''' tank ↔ Cmax | |||
'''🔹''' '''0x03 — Fuel level data''' | |||
This register has '''3 output modes''', selectable by the user through the '''mobile configuration app:''' | |||
{| class="wikitable" | |||
|'''Mode''' | |||
|'''Value range''' | |||
|'''Meaning''' | |||
|'''Conversion''' | |||
|- | |||
|'''Raw (12-bit)''' | |||
|0 – 4095 | |||
|Raw value | |||
|0 = empty, 4095 = full (per min/max calibration) | |||
|- | |||
|'''mm (height)''' | |||
|0 – (Sensor_height × 10) | |||
|Fuel level height by actual height | |||
|Actual level (mm) = Value / 10 | |||
|- | |||
|'''Liter (volume)''' | |||
|0 – Vmax | |||
|Fuel volume | |||
|Per the calibration table/factor configured in the app | |||
|} | |||
'''Raw mode example:''' | |||
Reg = 2048 → 2048 / 4095 ≈ 50% of full scale | |||
'''mm mode example''' (output = Fuel level height × 10): | |||
Reg = 3500 → Fuel level height = 3500 / 10 = 350.0 mm | |||
'''Liter mode example:''' depends on tank geometry + the calibration chart the user enters in the app, e.g. Reg = 80 → 80 liters. | |||
'''🔹''' '''0x04 — Temperature''' | |||
Temperature measured at the sensor (°C). | |||
'''Example:''' Reg = 25 → 25 °C. | |||
'''🔹 0x09 — Sensor height (actual probe height)''' | |||
The physical height of the sensor probe, '''set by the user via the app'''. | |||
'''Example:''' | |||
Reg = 5000 → Sensor height = 5000/10 = 500 mm. | |||
'''🔹''' '''0x0A + 0x0B — OSC current''' | |||
Oscillator current/parameter. | |||
'''🔹''' '''0x05, 0x06 — Reserved''' | |||
Reserved for future expansion, currently unused.<div class="noprint"> | |||
== Related Documents == | == Related Documents == | ||
Latest revision as of 11:54, 30 June 2026
General Introduction
LLS Protocol is used in LIGO RS232 / RS485 fuel level sensor with the following parameters:
- Baud rate: 2400,4800,9600,19200,38400,115200 (can be configured by software on PC)
- Data bits: 8
- Parity: None
- Stop bits: 1
- Flow control: None
LIGO fuel level sensor has 2 working modes:
- Slave mode: In this mode, the sensor will respond to all requests from the external device (master device). Each sensor in the network will be distinguished by different addresses configured with the LIGO Configurator software
- Master mode: In this mode the sensor will automatically send data to the external device with a preset interval (message interval)
To enable this mode on the LIGO Configurator software, do the following:
- Automatic transmission: select HEX (binary) or ASCII or ASCII EXT
Error creating thumbnail: Unable to save thumbnail to destination
- Set the time of each transfer (Message interval)
Error creating thumbnail: Unable to save thumbnail to destination
Exchange Protocol Description
The LLS protocol supports two types of exchange protocols: binary (HEX) and character view (transmission of ASCII sequences). It is recommended to use binary exchange protocol.
Format of Binary Protocol Messages
All the commands of the binary communication protocol have the same standardized format which is given in the table:
| Sequential number of the field | Field name | Field size, byte | Description |
|---|---|---|---|
| 1 | Prefix | 1 | The field is a marker of the message beginning shall have prefix 31h, and an outcoming messages shall be displayed with 3Eh prefix by the program. |
| 2 | Network address | 1 | For prefix 31h specify the network address of the recipient. For prefix 3Eh specify the network address of the sender. |
| 3 | Operation code | 1 | For prefix 31h specify the code of operation which the program shall perform For Eh prefix specify the code of operation to which the response is given |
| 4 | Data | It depends on the operation code | Data composition and format of the field depends on the operation code |
| 5 | Checksum | 1 | The field is used to control over data integrity |
Single-Stage Data Reading (command 06h)
The command is designed for reading of the current data: relative level, temperature, frequency. The data are transmitted with a lower byte ahead.
Command format:
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 31h | Prefix |
| +1 | 1 | 00h..FFh | Network address of the recipient |
| +2 | 1 | 06h | Operation code |
| +3 | 1 | 00h..FFh | The checksum |
Response format:
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 3Eh | Prefix |
| +1 | 1 | 00h..FFh | Network address of recipient |
| +2 | 1 | 06h | Operation code |
| +3 | 1 | -128…127 | Temperature in in degrees Celsius |
| +4 | 2 | 0000h…FFFFh | Relative level |
| +6 | 2 | 0000h…FFFFh | Frequency value |
| +8 | 1 | 00h..FFh | Checksum |
Periodic Data Output (command 07h)
Command is designed to switch on periodic data output.
After the command is processed, the sensor starts sending data periodically — level, temperature, and frequency — with the time interval prescribed by the 13h command.
Turning off of the periodic data output is performed after receipt of any true command, reset of the processor or disconnection of power power supply (if the data output mode is not istalled by default).
Command format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 31h | Prefix |
| +1 | 1 | 00h..FFh | The Network address of the sender |
| +2 | 1 | 07h | Operation code |
| +3 | 1 | 00h..FFh | Checksum |
Response format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 3Eh | Prefix |
| +1 | 1 | 00h..FFh | Network address of recipient |
| +2 | 1 | 07h | Operation code |
| +3 | 1 | 00h | The command has been executed successfully |
| 01h | The command cannot be executed | ||
| +4 | 1 | 00h..FFh | Checksum |
Periodic data output format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 3Eh | Prefix |
| +1 | 1 | 00h..FFh | The Network address of the sender |
| +2 | 1 | 07h | Operation code |
| +3 | 1 | -128…127 | Temperature in in degrees Celsius |
| +4 | 2 | 0000h…FFFFh | Relative level |
| +6 | 2 | 0000h…FFFFh | Frequency value |
| +8 | 1 | 00h..FFh | Checksum |
Periodic Data Output Interval Adjustment (13h command)
Command is designed to set up interval of periodic data output.
Command format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 31h | Prefix |
| +1 | 1 | 00h..FFh | Network address of the recipient |
| +2 | 1 | 13h | Operation code |
| +3 | 1 | 0…255 | Interval of the data output in seconds |
| +4 | 1 | 00h..FFh | Checksum |
Response format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 3Eh | Prefix |
| +1 | 1 | 00h..FFh | The Network address of the sender |
| +2 | 1 | 13h | Operation code |
| +3 | 1 | 00h | The command has been executed successfully |
| 01h | The command cannot be executed | ||
| +4 | 1 | 00h..FFh | Checksum |
Default Data Output Mode (command 17h)
This command determines the order of data output after the sensor is powered on or the processor is reset. After the power is on or the processor is reset, the program will send data periodically via the interface at the time interval prescribed by the 13h command.
Command format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 31h | Prefix |
| +1 | 1 | 00h..FFh | Network address of the recipient |
| +2 | 1 | 17h | Operation code |
| +3 | 1 | 00h | The command has been executed successfully |
| 01h | The data are output in binary form | ||
| 02h | The data are output in character-coded form (ASCII mode) | ||
| 03h | The data are output in character-coded form (ASCII EXT mode) | ||
| +4 | 1 | 00h..FFh | Checksum |
Response format
| Offset, bytes | Field size, bytes | Value | Description |
|---|---|---|---|
| 0 | 1 | 31h | Prefix |
| +1 | 1 | 00h..FFh | Network address of the recipient |
| +2 | 1 | 17h | Operation code |
| +3 | 1 | 00h | The command has been executed successfully |
| 01h | The command cannot be executed | ||
| +4 | 1 | 00h…FFh | Checksum |
Description of Commands for the Text-Based Protocol
Data exchange via the text-based protocol includes receipt and sending of ASCII symbols sequence interpreted and the request and response commands.
Reading the Data
The command is designed for reading of the current data: relative level, temperature, frequency. The command is a sequence of symbols ASCII "D" and "O". After receipt of the "DO" command the program will response in the form of ASCII symbols sequence.
For example, F=0AF9 t=1A N=03FF.0 <CR><LF>, where F is the current frequency value, t is the current value of temperature in Celcius degrees, N is the level value. All values are in hexadecimal form.
In case the frequency value exceeds FFFh, the data are considered invalid.
Periodic Data Output
The command is designed to switch on periodic data output. After processing the command, the sensor performs periodic data output in the text-based form (ASCII codes) of the following data: relative level, temperature, frequency.
The data are being output periodically with an interval set up when cofiguring the sensor (LIGO Configurator software). In case the data output interval is set to zero, the data output won't be performed.
Switching on of the periodic data output is done by sending of the "DP" symbols in line. After processing of the command, the symbols line will be received. For example, F=0AF9 t=1A N=03FF.0 <CR><LF>, where F is the current frequency value, t is the current value of temperature in Celcius degrees, N is the level value. Turning off of the periodic data output is performed after receipt of any true command, reset of the processor or disconnection of power supply.
Checksum Calculation Algorithm
The checksum is calculated using Dallas APPLICATION NOTE 27 table method: Understanding and Using Cyclic Redundancy Checks with Dallas Semiconductor iButton Products. One can use the following algorithms to calculate the checksum with a polynom x^8 + x^5 + x^4 + 1 (C language):
U8 CRC8(U8 data, U8 crc)
{
U8 i = data ^ crc;
crc = 0;
if (i & 0x01) crc ^= 0x5e;
if (i & 0x02) crc ^= 0xbc;
if (i & 0x04) crc ^= 0x61;
if (i & 0x08) crc ^= 0xc2;
if (i & 0x10) crc ^= 0x9d;
if (i & 0x20) crc ^= 0x23;
if (i & 0x40) crc ^= 0x46;
if (i & 0x80) crc ^= 0x8c;
return crc;
}
Modbus RTU Register Mapping
The SOJI sensor is capable of communication via the RS-485 serial bus in the Modbus/RTU protocol. The sensor supports the Modbus function 03 – Read Holding Registers
| No | Address | Type | Description | Unit |
|---|---|---|---|---|
| 1 | 0x00 | U16 | Sensor address (slave ID) | – |
| 2 | 0x01 | U16 | Min calibration (Cmin) – Low word | – |
| 3 | 0x02 | U16 | Min calibration (Cmin) – High word | – |
| 4 | 0x03 | U16 | Fuel level data (12-bit / mm / liter) | raw / mm / L |
| 5 | 0x04 | U16 | Temperature | °C |
| 6 | 0x05 | U16 | Reserved | – |
| 7 | 0x06 | U16 | Reserved | – |
| 8 | 0x07 | U16 | Max calibration (Cmax) – Low word | – |
| 9 | 0x08 | U16 | Max calibration (Cmax) – High word | – |
| 10 | 0x09 | U16 | Sensor height (actual height, set via app) | mm |
| 11 | 0x0A | U16 | OSC current | – |
| 12 | 0x0B | U16 | OSC current | – |
Detailed register description
🔹 0x00 — Sensor address
The slave address of the sensor. The master uses this value as the address byte in the request frame.
🔹 0x01 + 0x02 — Min calibration (Cmin) (32-bit)
The minimum calibration value is a 32-bit value split across two 16-bit registers:
- 0x01 = Low word (lower 16 bits)
- 0x02 = High word (upper 16 bits)
Combination formula:
Cmin = (RegHigh << 16) | RegLow
🔹 0x07 + 0x08 — Max calibration (Cmax) (32-bit)
Same scheme as min, this is the maximum calibration value:
- 0x07 = Low word
- 0x08 = High word
Together, the min/max pairs define the calibration range of the capacitive sensor:
- Empty tank ↔ Cmin
- Full tank ↔ Cmax
🔹 0x03 — Fuel level data
This register has 3 output modes, selectable by the user through the mobile configuration app:
| Mode | Value range | Meaning | Conversion |
| Raw (12-bit) | 0 – 4095 | Raw value | 0 = empty, 4095 = full (per min/max calibration) |
| mm (height) | 0 – (Sensor_height × 10) | Fuel level height by actual height | Actual level (mm) = Value / 10 |
| Liter (volume) | 0 – Vmax | Fuel volume | Per the calibration table/factor configured in the app |
Raw mode example:
Reg = 2048 → 2048 / 4095 ≈ 50% of full scale
mm mode example (output = Fuel level height × 10):
Reg = 3500 → Fuel level height = 3500 / 10 = 350.0 mm
Liter mode example: depends on tank geometry + the calibration chart the user enters in the app, e.g. Reg = 80 → 80 liters.
🔹 0x04 — Temperature
Temperature measured at the sensor (°C).
Example: Reg = 25 → 25 °C.
🔹 0x09 — Sensor height (actual probe height)
The physical height of the sensor probe, set by the user via the app.
Example:
Reg = 5000 → Sensor height = 5000/10 = 500 mm.
🔹 0x0A + 0x0B — OSC current
Oscillator current/parameter.
🔹 0x05, 0x06 — Reserved
Reserved for future expansion, currently unused.
Revision History
Loading revision history...