Grove Pi+ CO2 MH-Z16 sensor

Hi everyone!

I am using a Raspberry Pi 3 B model with a Grove Pi+ (1.2.2 firmware), and Raspbian for Robots Image.
I have plugged in the CO2 MH-Z16 sensor in RPISER port, and I am trying
to execute the code that is available in Dexter´s Github
(https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_co2_sensor/grove_co2_example.py).
I am getting the following issues:

First time I tried the code, it was working but it was getting very strange results as you can see in the file that I upload output.txt (6.6 KB) It call the sensor every 18 second.
Now, when I plugged-in the sensor in de RPISER port (with the rpi on), the raspberry pi get frozen. If I tried to restart it, it is not restarting until the sensor is plugged out the rpi. I do not know what is going on, and how to solve this issue. Sometimes, the rpi does not get frozen but the mouse and the keyboard suddenly stop working. If I try to restart the rpi whith the sensor, the rpi is not restarting, it get stucks.

Can I use this sensor in another port?

Any help or any hint?

Thanks in advance

@Shoban answer me in another post that If I am using the Raspbian for robots image from Dexter then I will have to use the Advanced communication option from the desktop in the Raspberry GUI and click Enable UART option. I tried it, and I enable UART. I put the answer here in order to help others

I continue with issues when I plugged-in the sensor in grovepi+, the rpi3 restarted and it is not able to start until I plugged out the sensor. What is going on? What do you think?

Hey @aitor,
How are you powering the entire setup. Are you using a good enough power supply capable of supplying 2A at 5V. We have seen a lot of problems where the Pi freezes because of a power supply which is not good enough. Also, the sensor can only be used in the RPISER port. Can you also post the example code that you used to generate the output.txt file

Hi @karan

I just tried adding a 2A at 5V power supply and it is not working. It happens the same, when I plugged in the MH-Z16 sensor to the RPISER port on the Grove Pi, the rpi3 get restarted and it never powers in. I need to plugged out the sensor from the Grove Pi.

I checked sensor specifications, and I can not find anywhere that it needs 2A, but it is not working with 2A.

Any hint?

thanks in advance

Hi @karan @Shoban

I changed my grovepi, now I am using the version v 3.0 7/30/2015. I was using v1.0 of 11/04/2014, and I get restarted issues when I plugged in my MH-z16 sensors.

Now with v3.0 of grovepi+ I am not facing restarting issues when I plugged in C02 sensor, but I am not able to get the data from the sensor. I am running the code that is on Dexter´s github I am getting “Unable to read” error, and I can not get data from the sensor. I have UART enabled and everything looks to work, but it is no data available…

Why is different behavior in v1.0 and v3.0? I have just bought 5 on the official site, and you send me 5 of then with version v1.0 … I do not know why.

Thanks in adavance

@aitor: can you post a few pictures of the GrovePi’s that you have received. Do you have another variant of the Pi like the Pi2 or B+ by any chance. Do you have a few jumper wires to try connect the CO2 sensor directly to the Pi3 port to see if the problem is with the sensor or the GrovePi.

Hi @karan
I receive 5 grovepi+ v1.0 of 11/04/2014, I do not know why I get this old version, because I got v3.0 5 months ago. I can send you pictures if you want, but it is not going to solve the issue.

I realize that when I have the grovepi+ without this c02 sensor I get the foloowing:

sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – 04 – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

But, when I plugged-in the Co2, MH16 sensor I get this (as the connection with grovepi has disappeared)

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

I am trying to read the sensor data using rpi3 GPIO´s. I realize that the black cable I need to put in GND, the red one in 5V, yellow in RX and white in TX in RPI, and that I can do the same with an Arduino Uno, but I do not know how to read this data. What I need to use?

I also find another code for this sensor, but it is not working because the sensor is not detected and I think that is a little bit different, because it has a small board.

Any hint?

Why is different behavior in v1.0 and v3.0? I have just bought 5 on the official site, and you send me 5 of then with version v1.0 … I do not know why.

When you say “Official site” where did you buy this from? What website?

Do you have a second or third CO2 sensor? It sounds like the power is being drawn heavily, causing the erratic behaviour with the GrovePi and Raspberry Pi. It sounds like you have a defective sensor; if you have a second one, I would test to see if you get the same behavior.

Also, pictures of your hardware would be helpful.

Hi @JohnC @karan

I also bought 5 sensor of Co2 Mh-z16 and neither of them are working. I read that they were not suported by rpi, but I found some code and people that make they works. I tried the sensors in rpi2 and rpi3, and not working

I finally get an Arduino with a board Can-Bus(http://wiki.seeed.cc/CAN-BUS_Shield_V1.2/) where I can plugged in the sensor, and it is not working. I get junk data. I get Arduino code from this source http://wiki.seeedstudio.com/wiki/Grove_-_CO2_Sensor, and I get junk data. I tried other sensors and the are working ok in this shield.

I attach the picture that you ask me.

Thanks in advance.

Hello @aitor, I’m sorry to say it, but I think that whoever shipped you the CO2 sensors sent you a damaged batch of them. I would get in touch with them and either ask for a replacement. I don’t think you could have gotten these sensors from us; we don’t sell the CO2 sensor.

Again, I’m sorry this happened to you, but I’m sure that Seeed will support the sensor and help you get a replacement (or two replacements) for the defective sensors.