Modbus Register Definitions
Modbus Register Definitions for Gravity: Offline Edge AI Gesture & Face Detection Sensor
Modbus Register Definitions
For customizing device addresses, querying firmware versions, or adjusting core parameters, the following registers can be utilized (suitable for advanced development scenarios):
| Register Type | Device Address (Decimal) | Modbus Address Offset (Hexadecimal) | Name | Read/Write | Data Range | Default Value | Description |
|---|---|---|---|---|---|---|---|
| Input Register | 3001 | 0x0000 | VID | R | 0x0000-0xFFFF | 0x0272 | VID (Vendor ID) |
| Input Register | 3002 | 0x0001 | PID | R | 0x0000-0xFFFF | 0x3343 | PID (Product ID) |
| Input Register | 3003 | 0x0002 | Hardware Version | R | 0x0000-0xFFFF | 0x1000 | Hardware version: 0x1000 represents V1.0.0.0 |
| Input Register | 3004 | 0x0003 | Software Version | R | 0x0000-0xFFFF | 0x1000 | Software version: 0x1000 represents V1.0.0.0 |
| Input Register | 3005 | 0x0004 | Number of Faces | R | 0x0000-0x000A | 0x0000 | Number of faces detected by the sensor, up to 10 |
| Input Register | 3006 | 0x0005 | Face X Coordinate | R | 0x0000-0x000A | 0xFFFF | X coordinate of the detected face. 0xFFFF: no face detected. X coordinate range: 0-640 |
| Input Register | 3007 | 0x0006 | Face Y Coordinate | R | 0x0000-0x000A | 0xFFFF | Y coordinate of the detected face. 0xFFFF: no face detected. Y coordinate range: 0-640 |
| Input Register | 3008 | 0x0007 | Face Score | R | 0x0000-0x0064 | 0x0000 | Face score. 0% - 100% corresponds to values 0-100 |
| Input Register | 3009 | 0x0008 Gesture Type | R | 0x0000-0x0005 | 0x0000 | Gesture type: - 0x0000: other gestures; - 0x0001: Good ?; - 0x0002: OK ?; - 0x0003: STOP ?; 0x0004: Victory ✌️; - 0x0005: Call me ? |
|
| Input Register | 3010 | 0x0009 | Gesture Score | R | 0x0000-0x0064 | 0x0000 | Gesture score. 0% - 100% corresponds to values 0-100 |
| Holding Register | 4001 | 0x0000 | Device Address | R/W | 0x0001-0x00F7 | 0x0072 | Module device address (1-247) [When the sensor address is unknown, write register operations can be performed via the broadcast address 0x00, and the sensor will not output data at this time]. DFRobot assigns different addresses to each product at the factory. Saved when power is off, takes effect immediately |
| Holding Register | 4002 | 0x0001 | Serial Port Parameter Control Register 1 | R/W | 0x0000-0xFFFF | 0x0004 | Module baud rate: - 0x0001-1200; - 0x0002-2400; - 0x0003-4800; - 0x0004-9600 (default); - 0x0005-14400; - 0x0006-19200; - 0x0007-38400; - 0x0008-57600; - 0x0009-115200; - 0x000A-230400; - 0x000B-460800; - 0x000C-921600; - Other-9600. If modified successfully, it will reply at the current baud rate, and switch to the new baud rate after reply. Saved when power is off, takes effect after restart. The device is recommended to work below 115200 |
| Holding Register | 4004 | 0x0003 | Set Target Face Detection X Coordinate Range Threshold | R/W | 0x0000-0x0064 | 0x0064 | Value range: 0-100, the smaller the value, the narrower the detection range. 100 represents the entire visible range of the camera |
| Holding Register | 4005 | 0x0004 | Set Target Face Detection Score Threshold | R/W | 0x003C-0x0064 | 0x003C | Value range: 60-100, representing 60%-100%. Default value: 60 |
| Holding Register | 4006 | 0x0005 | Set Gesture Detection Score Threshold | R/W | 0x003C-0x0064 | 0x003C | Value range: 60-100, representing 60%-100%. Default value: 60 |
Note:
- The default device address is 0x0072. If the address is modified, the I2C address will be updated accordingly.
- The face detection range is the area above the human shoulders.
Common Modbus-RTU Function Codes
| Function Code | Name | Function |
|---|---|---|
| 0x03 | Read Multiple Registers | Read integers, characters, status words, floating-point numbers (read N words) - read holding registers, byte operation |
| 0x04 | Read Input Registers | Read integers, status words, floating-point numbers (read N words) - read input registers, byte operation |
| 0x06 | Write Single Holding Register | Write integers, characters, status words, floating-point numbers (write one word) - write holding registers, byte operation |
| 0x10 | Write Multiple Holding Registers | Write multiple holding registers - load specific binary values into a series of consecutive holding registers |
Input registers and holding registers can be read and written via the above commands.
Register Read/Write Examples
Hardware Preparation
- SEN0626 AI Visual Gesture/Face Detection Sensor ×1
- TEL0185 RainbowLink USB Protocol Converter ×1
Recommended Serial Debugging Tools and Downloads
For serial port-related debugging work, professional serial debugging tools are required. Here are several commonly used and feature-rich tools recommended for you:
- xcom Serial Debug Assistant V2.0: An efficient and easy-to-use serial communication assistant. Available at this link.
- SSCOM3.2 Serial Assistant: Designed specifically for embedded development, IoT communication, and daily serial debugging. Download address is project repository.
Example 1: Read Number of Faces (Read Input Register Operation)
Function: Read the number of faces currently detected by the sensor via the Modbus RTU protocol.
Sending Command and Analysis
|Field Name| Hexadecimal Value |Description
|---|---|
|Device Address| 72| Sensor default UART address 0x72
|Function Code| 4| Read input registers (fixed command)
|Starting Register Address| 00 04| Register address corresponding to the number of faces
|Number of Registers |00 01| Read 1 register (only the number of faces)
|CRC Check |7B 08 |Command check value (to ensure transmission correctness)
Complete sending command: 72 04 00 04 00 01 7B 08
Operation Steps
-
Hardware Connection: Connect the sensor to the host (computer) via the RainbowLink USB protocol converter, and switch the sensor communication mode to UART.
-
Parameter Configuration: Set parameters in the serial debugging tool (must be consistent with the sensor):
- Baud rate: 9600 (default)
- Data bits: 8 bits
- Stop bits: 1 bit
- Parity: None
-
Send Command: Enter the above hexadecimal command in the "Send Area" of the debugging tool, check "Send in Hexadecimal" and send.
Return Data and Analysis
After receiving the command, the sensor returns the number of faces data, as shown in the example below:
|Field Name| Hexadecimal Value| Description
|---|---|
|Device Address |72| Consistent with the device address in the sending command
|Function Code| 4| Confirm execution of "read input register" operation
|Number of Bytes |2 |Total number of returned data bytes (2 bytes)
|Read Data |00 01| Indicates that 1 face is currently detected (the value corresponds to the number of faces)
|CRC Check |7D 3B| Check value of the returned data
Complete return data: 72 04 02 00 01 7D 3B
Schematic diagram as follows:

Example 2: Modify Module Baud Rate (Write Holding Register Operation)
Function: Modify the UART baud rate of the sensor via the Modbus RTU protocol (default 9600, customizable).
Sending Command and Analysis
|Field Name| Hexadecimal Value |Description
|---|---|
|Device Address |72 |Sensor default address 0x72
|Function Code |6 |Write holding register (fixed command)
|Starting Register Address| 00 01| Register address corresponding to baud rate configuration
|Written Data| 00 09| Corresponding to baud rate 115200 bps (see the register table for the relationship between values and baud rates)
|CRC Check| 13 0F| Command check value
Complete sending command: 72 06 00 01 00 09 13 0F
Operation Steps
-
Hardware connection and basic parameter configuration are the same as "Reading the number of faces" (the current default baud rate 9600 must be used to send commands).
-
After sending the above command, if the returned data is consistent with the sending command, it indicates that the baud rate modification request has been received by the device.
Return Data and Analysis
Complete return data: 72 06 00 01 00 09 13 0F
|Field Name |Hexadecimal Value| Description
|---|---|
|Device Address |72| Consistent with the sending command
|Function Code| 6 |Confirm execution of "write holding register" operation
|Starting Register Address| 00 01| Baud rate configuration register address
|Written Data| 00 09| Confirm baud rate set to 115200 bps
|CRC Check| 13 0F |Check value of the returned data
Note:
-
The baud rate modification takes effect only after the sensor is powered off and restarted;
-
After restart, the serial debugging tool's baud rate must be modified to 115200 synchronously, otherwise communication cannot continue.

Was this article helpful?
