Hello Tech support,
I ordered a Rapsberry Pi4 and GrovePi+ board + a collection of sensors some weeks ago.
Everything works fine except the Grove CO2 MH-Z16 sensor. The GrovePi installation package includes a Python script for reading the CO2 sensor. However, executing the script results in no response from the sensor, but also no errors. Debugging the Python code shows that executing of the script stops at the serial.Serial.write method from the pySerial library.
The code below summarizes my problem. The sensor is connected to the RPISER port of the GrovePI= board.
import serial
import time
ser = serial.Serial(’/dev/ttyAMA0’, 9600, timeout = 1)
values = bytearray([0xff, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79])
w_return=ser.write(values)
print(“w_return”, w_return)
Executing the code will never reach the print function.
The CO2 sensor requires writing these 9 bytes, before reading the C02 concentration.
Because the RPISER port opens without any errors, my conclusion is that the CO2 sensor is ‘dead’.
Is there any way to test if the CO2 sensor is functioning? The CO2 sensor manual only provides information about reading data form the sensor, but not for testing its correct functioning.
Can anyone help me?