
I. Overview of Communication Protocol
1. Default Communication Parameters
- Baud Rate:
9600 - Data Bits:
8 - Check Bits: None
- Stop Bit:
1(i.e.9600/8/N/1) - Default Device Address:
0x01 - Response Time:<100ms
2. CRC Check
- Algorithm: CRC-16/Modbus (Polynomial
0x8005) - checksum format: 2 bytes, with the high-order bits first (e.g.
CRC_H CRC_L). - Calculation tool: Refer toCRCToolOr the code in Chapter IX of the specification sheet.
2, Detailed explanation of protocol functions
1. Read device address and firmware version
FunctionObtain the current device address and firmware version number.
Request format (host → sensor)
| Byte position | data | Explanation |
|---|---|---|
| 0 | 0xFE | Broadcast address (all devices respond) |
| 1 | 0x11 | Function code (read address) |
| 2-5 | 0x00 | Fixed padding |
| 6-7 | CRC | CRC check code |
Example command:
FE 11 00 00 00 01 28 06Response format (sensor → host)
| Byte position | data | Explanation |
|---|---|---|
| 0 | 0x01 | Device address |
| 1 | 0x11 | function code |
| 2 | 0x02 | Data length (2 bytes) |
| 3 | 0x12 | Firmware version (such as0x12=V1.2) |
| 4 | 0x01 | Current address |
| 5-6 | CRC | CRC check code |
Example response:
01 11 02 12 01 70 5C
Parse:
- Firmware Version:
V1.2 - Device address:
0x01
2. Modify device address
Function: Change the Modbus address of the device (range1~247).
Request format (host → sensor)
| Byte position | data | Explanation |
|---|---|---|
| 0 | Current address | Original address (such as0x01) |
| 1 | 0x06 | Function code (modify address) |
| 2-4 | 0x00 | Fixed padding |
| 5 | New address | Target address (e.g.0x02) |
| 6-7 | CRC | CRC checksum |
Example command(modify address to0x02):
01 06 00 00 00 02 08 0BResponse format (sensor → host)
Consistent with the request format, return the modified address confirmation.
Example Response:
01 06 00 00 00 02 08 0B
Explanation: If the response data is the same as the request, it indicates that the modification was successful.
3. Read sensor data
functionRead sensor data from a specified register (supports reading multiple sensors at once).
Request format (host → sensor)
| Byte position | data | Explanation |
|---|---|---|
| 0 | Device address | Like 0x01 |
| 1 | 0x03 | Function code (reading data) |
| 2-3 | starting address | Register starting address (high-order) |
| 4-5 | number of registers | Number of registers to be read |
| 6-7 | CRC | CRC check code |
Example Command(Read All 11 Sensor Data):
01 03 00 00 00 0B C5 CDResponse Format (Sensor → Host)
| Byte Position | Data | Description |
|---|---|---|
| 0 | Device Address | As 0x01 |
| 1 | 0x03 | Function Code |
| 2 | Data Length | Byte Count (Register Count × 2) |
| 3~N | Sensor Data | Each register is 2 bytes long (with the highest bit first) |
| N+1~N+2 | CRC | CRC check code |
Example response(Partial data):
01 03 16 00 96 00 64 00 32 00 30 00 28 00 1E 01 2C 00 0A 00 14 70 5C
Parse:
00 96→ eCO₂ = 150 ppm00 64→ TVOC = 100 ppb00 32→ CH₂O = 50 μg/m³- Temperature and humidity data:
- Humidity
0x012C→ 300 → 300/100 = 30.0%RH - Temperature:
0x000A→ 10 → 10/100=0.10 ℃
4. System Parameter Configuration (Advanced Function)
4.1 Read/Set Baud Rate
Register Address: 0x0103(Baud Rate Code See Appendix Table).
Read baud rate request:
01 03 01 03 00 01 CRC
Set baud rate request(set to 115200):
01 06 01 03 00 07 CRC4.2 Calibration sensor data
Register address:
- Temperature calibration:
0x011D - Humidity Calibration:
0x011C
Example Command(Temperature Calibration+2.5 ℃):
01 06 01 1D 00 FA 98 73
Explanation:
00 FA→ 250 (i.e. 250/100=2.5 ℃)- Negative values need to be converted to complement codes (such as
0xFF9C→ -100 → -1.00 ℃).
III. Data Analysis Method
1. Calculation Formula
| Sensor Type | Formula | Example |
|---|---|---|
| eCO ₂ | CO₂ = (CO₂_H << 8) + CO₂_L | 0x0096→ 150 ppm |
| Temperature | 温度 = 有符号值 / 100 | 0xFF9C→ -100 → -1.00 ℃ |
| Illumination | Lux = (Lux_H << 8) + Lux_L | 0x01F4→ 500 Lux |
2. Symbolic number processing
- Method 1: Directly convert to a signed integer (such as
0xFF9C→ -100). - Method 2: If the value is greater than 32767, then
真实值 = (原始值 - 65536) / 100.
IV. Precautions
- Preheating Time: The VOC module needs to be preheated for at least 3 minutes, and other sensors can be used immediately after power on.
- Installation Requirements:
- Installation height should be ≥ 15cm to avoid ground dust pollution.
- Avoid high dust (>300 μ g/m ³), oil fumes, or high humidity environments.
- Calibration Warning:
- Advanced functions should be operated with caution, as incorrect modifications may result in abnormal data.
- The calibration value needs to be adjusted according to the actual environment, and it is recommended to record the factory default value.
- CRC Check: All commands must contain the correct CRC, otherwise the device will not respond.
V. Appendix
1. Sensor Register Address Table
| Register Address | Sensor Type | Data Format |
|---|---|---|
0x0000 | eCO ₂ | 2-byte unsigned integer (ppm) |
0x0001 | TVOC | 2-byte unsigned integer (ppb) |
0x0002 | CH ₂ O | 2-byte unsigned integer (μ g/m ³) |
0x0003 | PM2.5 | 2-byte unsigned integer (μ g/m ³) |
0x0004 | Humidity | 2-byte (true value x 100) |
0x0005 | Temperature | 2-byte (true value x 100) |
0x0006 | PM10 | 2-byte unsigned integer (μ g/m ³) |
0x0007 | PM1.0 | 2-byte unsigned integer (μ g/m ³) |
0x0008 | Illumination | 2-byte unsigned integer (Lux) |
0x0009 | MCU Temperature | 2-byte (true value x 100) |
0x000A | Noise | 2-byte unsigned integer (dB) |
2. Baud rate code table
| code | Baud rate |
|---|---|
0 | 1200 |
1 | 2400 |
2 | 4800 |
3 | 9600 |
4 | 19200 |
5 | 38400 |
6 | 57600 |
7 | 115200 |
3. CRC calculation code (C language example)
uint16_t CRC16_Check(const uint8_t *pushMsg, uint8_t usDataLen) {
uint8_t uchCRCHi = 0xFF, uchCRCLo = 0xFF;
uint8_t uIndex;
while (usDataLen--) {
uIndex = uchCRCLo ^ *pushMsg++;
uchCRCLo = uchCRCHi ^ auchCRCHi[uIndex];
uchCRCHi = auchCRCLo[uIndex];
}
return (uint16_t)(uchCRCHi << 8 | uchCRCLo);
}Product purchase:https://item.taobao.com/item.htm?ft=t&id=675637355531
Leave a Reply