User’s Manual for MH-Z Series Infrared CO2 Sensor Module Communication Protocol

1.Profile for the communication protocol

●All the data in this communication protocol is hexadecimal.

●The data length is fixed 9 bits.

●Baud rate:9600, data bit:8, stop bit:1, parity bit: none.

2.Command list and meaning.

3.Command list and meaning.

0x86- Read CO2 concentration (for 0-50000ppm range)

CO2 concentration = HIGH *256+ LOW Eg. 01 in hexadecimal is equals to 1 in decimal, F4 in hexadecimal is equals to 244 in decimal. CO2 concentration=01*256+244=500ppm

0x9C- Read CO2 concentration (for 0-150000ppm range)

CO2 concentration= Data 1 << 24 + Data 2 << 16 + Data 3 << 8 + Data 4

Checksum calculation method

Calculating Checksum:

1、Add Byte 1 to Byte 7: 0x01 + 0x86 + 0x00 + 0x00 + 0x00 + 0x00 + 0x00 = 0x87

2、Negative: 0xFF – 0x87 = 0x78

3、Then+1:0x78 + 0x01 = 0x79

C language

char getCheckSum(char *packet)
{
char i, checksum;
for( i = 1; i < 8; i++)
{
checksum += packet[i];
}
checksum = 0xff – checksum;

Leave a Reply

Your email address will not be published. Required fields are marked *