WIRED SENSOR DEVELOPER REFERENCE
AG-RS485 & AG-RS232
Communication protocol.
Read fuel levels, configure communication, calibrate empty and full references, and manage tank calibration tables.
On this page
Read your first measurement.
For AG-RS485 and AG-RS232. Use the correct isolated USB/serial adapter or a compatible tracker interface. RS485, RS232 and TTL are different electrical interfaces; use the model’s wiring manual.
- Confirm the device address and baud rate using the supplied configuration or AoooG Portable Configurator Client 5.7.
- Open the serial port at 9600 baud, 8 data bits, no parity, 1 stop bit (8N1), no flow control if the device retains its default settings.
- Send the complete request as binary bytes. Do not send the printable text “31 01 06 6C”.
- Wait for the full response. Check its header, address, command, length and CRC before using the data.
RS485, address 1:
31 01 06 6C
RS232, address 0:
31 00 06 A8
Illustrative response, address 1:
3E 01 06 21 96 00 A7 E7 FDDefault address conventions: AG-RS485 uses 1; AG-RS232 uses 0. An installed device may have been configured differently. Do not assume the address from the model alone.
This public profile was reviewed against firmware identifying itself as AD_V4.81. Examples are calculated, illustrative frames, not hardware captures. Confirm behavior on the actual hardware/firmware before deploying configuration or calibration changes.
Connection and frame rules.
| Field | Request | Response |
|---|---|---|
| Start byte | 31 | 3E |
| Device address | 1 byte; known individual address | 1 byte |
| Command | 1 byte | 1 byte |
| Payload | Command-specific length | Command-specific length |
| CRC | CRC-8/MAXIM over every preceding byte | CRC-8/MAXIM over every preceding byte |
There is no general length byte or terminator in the proprietary frame. Multi-byte numeric fields in this public profile are little-endian unless explicitly stated otherwise. Do not use a generic 128-byte payload assumption.
- CRC: polynomial 0x31 (reflected implementation 0x8C), initial value 0x00, reflected input/output, final XOR 0x00. The checksum is one byte. ASCII test string “123456789” gives A1.
- One transaction at a time: send a frame in one serial write, await its response, then send the next. The reviewed receiver clears queued input after a completed transaction; pipelined requests can be lost.
- Frame timing: the reviewed proprietary parser abandons an incomplete frame after about 5 ms without further bytes. Do not send a request byte by byte with host-side sleeps.
- Host timeout: 1 s is a starting recommendation, not a guaranteed device response deadline. Allow longer for calibration and validate timing on your adapter. Do not automatically retry writes when the result is uncertain.
- RS485: use unique device addresses and master-controlled polling. Use an adapter with correct transmit/receive direction control. Do not broadcast calibration or configuration requests.
- Persistence: ACK confirms acceptance, not completed nonvolatile storage. Respect each command’s delay, allow a conservative 2 s margin, read back, and verify after a controlled power cycle where appropriate.
A status response has five bytes: 3E address command status CRC. Status 00 means accepted and 01 means rejected where that command implements an error response. Silence is not success and is not always an explicit rejection.
Decode the measurement correctly.
| Response offset | Meaning |
|---|---|
| 0–2 | 3E, device address, 06 |
| 3 | Signed int8 temperature in whole °C; FF = −1 °C |
| 4–5 | Unsigned 16-bit measurement, little-endian |
| 6–7 | Reserved for this public profile; ignore |
| 8 | CRC of bytes 0–7 |
| Configured output | Interpretation | Example raw value 150 |
|---|---|---|
| Normalized level | 0–4095; no scaling | 150 |
| Volume | Divide by 10 for liters; requires a valid tank table | 15.0 L |
| Height | Divide by 10 for millimeters; requires correct probe length | 15.0 mm |
| Percentage | Divide by 10 for percent | 15.0% |
The unit is not included in the response. Configure it and the probe length with the official PC tool, and keep the same setting in your application. Normalized level is not automatically volume percentage for an irregular tank.
Command 06 has only a 16-bit measurement field. The mathematical volume limit is 6553.5 L; larger encoded values are not safely represented. Do not treat wraparound as a valid low fuel level. The calibration table input uses whole liters, whereas the 06 volume output uses tenths of a liter.
Public command reference.
All command numbers and frame bytes below are hexadecimal. Address and payload examples are illustrative. The helpers and samples include only this explicit public command set.
12 / 12
02 Read serial number Read
Request payload
None.
Response
8 bytes: header + uint32 LE serial number + CRC. Treat it as an unsigned decimal device identifier. This operation is read-only.
Example identifier 150000; illustrative data only.
Request (address 1):
31 01 02 0D
Illustrative response:
3E 01 02 F0 49 02 00 8003 Set network address Configure
Request payload
New address: uint8
Response
5-byte status response. ACK uses the OLD address; subsequent requests must use the NEW address. This profile uses 1–253 for a new address (1–247 with Modbus). Configure one physically isolated sensor at a time.
Payload 02 selects address 2. Save is scheduled after 500 ms; allow at least 2 s, then read back at address 2. Do not resend to the old address after a timeout.
Request (address 1):
31 01 03 02 85
Illustrative response:
3E 01 03 00 A304 Read network address Read
Request payload
None.
Response
5 bytes: header + uint8 address + CRC. Send to the known current address.
Example address 1.
Request (address 1):
31 01 04 D0
Illustrative response:
3E 01 04 01 9306 Read measurement Read
Request payload
None.
Response
9 bytes. Temperature is signed int8; the measurement is uint16 little-endian. Use the unit table below. Ignore the final two data bytes in this public profile.
The same number means different physical quantities depending on the configured unit. The response does not identify its unit.
Request (address 1):
31 01 06 6C
Illustrative response:
3E 01 06 21 96 00 A7 E7 FD08 Calibrate empty Calibrate
Request payload
None.
Response
No payload. Captures the current empty reference asynchronously. A successful completion uses a 5-byte status response with command 08.
Keep the probe in the manual-specified empty condition with the intended fuel procedure. Wait for stable measurements before sending. Save is scheduled after completion (200 ms); allow at least 2 s and verify.
Request (address 1):
31 01 08 73
Illustrative response:
3E 01 08 00 8009 Calibrate full Calibrate
Request payload
None.
Response
No payload. Captures the current full reference asynchronously. A successful completion uses a 5-byte status response with command 09.
Use the full condition described in the product manual, not an arbitrary live tank level. Empty/full calibration changes the level scale: recheck or rebuild the tank table afterward. Allow at least 2 s after completion and verify.
Request (address 1):
31 01 09 2D
Illustrative response:
3E 01 09 00 440E Set baud rate Configure
Request payload
Baud rate: uint32 LE
Response
Allowed values: 2400, 4800, 9600, 19200, 38400, 57600, 115200. 5-byte status response at the CURRENT baud rate.
The reviewed implementation saves the new setting after 1500 ms and applies it on startup. Allow at least 2 s after ACK before power cycling; reopen the port at the new baud rate. Example payload 80 25 00 00 = 9600.
Request (address 1):
31 01 0E 80 25 00 00 C4
Illustrative response:
3E 01 0E 00 2A10 Write calibration point Calibrate
Request payload
Current index: uint8; Last index: uint8; Volume in whole liters: uint16 LE; Level value 0–4095: uint16 LE
Response
Request length is exactly 10 bytes including CRC. Use 0 ≤ current index ≤ last index ≤ 99. Each request writes ONE record. Writing index 0 clears the existing table first.
Intermediate valid records do not receive an ACK. Only current index = last index receives success and schedules a save after 500 ms. Invalid index/length checks can return status 01. See the full replacement workflow; do not use a generic retry-on-no-ACK loop.
Request (address 1):
31 01 10 02 02 C8 00 FF 0F C3
Illustrative response:
3E 01 10 00 1A11 Set filter parameter Configure
Request payload
Filter parameter: uint8
Response
Accepts 0–254. A 5-byte status response is returned; save is scheduled after 1500 ms. Preserve the current value unless the application requires a change.
This is a device parameter, not a guarantee of settling time in seconds. Compare readings under the intended operating conditions. Read back with command 14 after allowing at least 2 s.
Request (address 1):
31 01 11 3C 59
Illustrative response:
3E 01 11 00 DE12 Read calibration table Read
Request payload
Start index: uint8
Response
Use start index 0–99. Response is always 32 bytes: 3-byte header, seven 4-byte records, CRC. Each record is [uint16 LE liters, uint16 LE level].
Read starts 0, 7, 14, …, 98 to inspect all 100 slots. Slots beyond index 99 are zero padding. Neither the start index nor the active record count is echoed; match responses to outstanding requests and retain the count in your application.
Request (address 1):
31 01 12 00 11
Illustrative response:
3E 01 12 00 00 00 00 64 00 00 08 C8 00 FF 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6814 Read filter parameter Read
Request payload
None.
Response
5 bytes: header + uint8 filter parameter + CRC.
Example filter value 60 (3C).
Request (address 1):
31 01 14 4D
Illustrative response:
3E 01 14 3C 3C1C Read firmware version Read
Request payload
None.
Response
Header + printable ASCII version string + CRC. No length byte and no transmitted NUL terminator. Response length is version-dependent.
Use the product firmware label and this result to select documentation. The illustrative response below is AD_V4.81. Read until the response has ended, then validate CRC; do not guess the length from a different firmware release.
Request (address 1):
31 01 1C 8F
Illustrative response:
3E 01 1C 41 44 5F 56 34 2E 38 31 28Calibrate the probe, then the tank.
1. Establish empty and full references
- Prepare the probe and fuel conditions exactly as described in the installation manual. Let the sensor finish startup and wait until repeated 06 readings are stable.
- In the proper empty condition, send 08. Wait for its completion response. Do not move immediately to the next condition.
- In the proper full condition, send 09. Wait for its completion response and the save margin.
- Verify the readings at the reference points. These operations calibrate the probe; they do not teach the tank’s shape.
In the reviewed firmware, many write/calibration operations can stop responding after roughly 30 minutes of operation. Before a planned calibration session, perform a controlled power cycle, wait for stable readings and complete the operation within that window. Do not interpret silence as a successful calibration.
2. Build a tank calibration table
After probe calibration, select normalized level output using the PC tool. Add known volumes of the intended fuel and record stable 0–4095 readings. Use increasing level points with nondecreasing volumes; duplicate level coordinates can make interpolation invalid. Cover the tank’s usable range. The reviewed interpolation may return zero outside the covered range, so zero must not automatically be interpreted as an empty tank.
3. Replace the table safely
- Back up all 100 existing slots with 12 before changing anything. Keep the active record count in your own application; the response does not report it.
- Prepare and validate the full table before writing: 2–100 points recommended, whole liters 0–65535, normalized level 0–4095, strict increase in level, nondecreasing liters. The firmware does not enforce every one of these table-quality checks.
- Send index 0 first. This clears the existing table immediately. Every frame carries the same last index (point count minus 1).
- Send the other records in ascending order, one complete frame at a time. Intermediate valid writes do not ACK. A 50 ms inter-frame pause is a conservative starting point to verify on your hardware, not a firmware timing guarantee.
- Wait for status 00 on the last record, then allow at least 2 s for saving. An interruption can leave a partial or invalid table: this is not an atomic replacement transaction.
- Read the slots back with 12 and compare every record to your prepared table. If a retry is necessary, restart the entire replacement from index 0 after checking the configuration window. Do not blindly repeat arbitrary frames.
- Use a controlled power cycle and read back again to verify persistence. Select volume output using the PC tool and check against known quantities.
Illustrative 3-point table (not a tank recommendation):
Index 0: 0 L, level 0
31 01 10 00 02 00 00 00 00 48
Index 1: 100 L, level 2048
31 01 10 01 02 64 00 00 08 23
Index 2: 200 L, level 4095
31 01 10 02 02 C8 00 FF 0F C3
Final ACK only:
3E 01 10 00 1A
Read back from index 0:
31 01 12 00 11Modbus RTU compatibility: fixed read block.
The reviewed implementation accepts function 03 with CRC-16/MODBUS and returns a fixed block of four registers. It does not select registers based on the requested start address or register count. This is a restricted compatibility interface, not a general register map or a write interface.
Use an individual address 1–247 for Modbus, including when an RS232 device was originally configured with address 0. Use start address 0000 and count 0004 for the fixed read. Verify compatibility with your master on actual hardware.
01 03 00 00 00 04 44 09| Register in returned block | Meaning |
|---|---|
| 0 | Signed int16 temperature, whole °C |
| 1 | Integer fuel percentage (fractional part truncated) |
| 2 | Configured measurement: raw level, whole liters, height in 0.1 mm, or percent in 0.1% |
| 3 | Height in 0.1 mm |
Response: address, 03, byte count 08, eight data bytes, two CRC bytes. Register values are big-endian; the CRC is low byte first. CRC-16/MODBUS uses initial FFFF and reflected polynomial A001. In volume mode this block returns whole liters, unlike the proprietary 06 response. Do not reuse the same scaling blindly. The offline tools below handle the proprietary CRC-8 profile only.
Check frames before integration.
These tools run locally in your browser. They do not connect to a sensor or send commands. Read the full workflow before using a generated configuration frame in your own software.
Start with a read-only example.
Both samples send only command 06, handle partial reads and verify the address, command, length and CRC. Select the actual configured unit explicitly. They never perform calibration or change device settings.
Python
pip install pyserial
python aooog_wired_read.py COM3 --address 1 --baud 9600 --unit rawC#
Create a .NET console project, add System.IO.Ports, and replace Program.cs with the downloaded example.
dotnet new console -n WiredRead
cd WiredRead
dotnet add package System.IO.Ports
# Replace Program.cs with AoooGWiredRead.cs, then:
dotnet run -- COM3 1 9600 rawThe examples have been checked with calculated frames and simulated input, not with connected sensors. Replace COM3 with your actual port. Use a normal serial port driver for your adapter.
Resolve integration problems.
| Symptom | Check |
|---|---|
| No response | Power, electrical interface, wiring, current address, baud rate and binary transmission. Avoid broadcasting and parallel requests. |
| Write or calibration is silent | Check the configuration window and startup completion. Intermediate calibration-table records intentionally have no ACK. |
| Wrong units or surprising zero | The response carries no unit flag. Check the PC-tool unit setting, calibrated probe length and tank table coverage. |
| Unexpected CRC or short frame | Accumulate serial reads. Verify the complete response length; reject mismatched address/command and resynchronize. Do not parse a partial read. |
| Settings disappear after power-off | Acceptance ACK precedes storage. Wait for saving and read back before removing power. |
| RS232 periodically restarts | In the reviewed RS232 variants, measurement polling can enable a watchdog that resets the device after roughly 5 minutes without qualifying measurement requests. Maintain a suitable polling interval and test recovery. |
| Different firmware behaves differently | Read version with 1C and confirm the hardware label. Contact support rather than extrapolating these layouts to an undocumented release. |