How to Measure ROOM CO2 concentration with 20$ sensor "MH-Z19" and Raspberry Pi

MH-Z19 CO2 concentration Sensor

This blog post is outdated. The updated version is here.

MH-Z19 is a small, low-cost, weigh 15g CO2 sensor module product by 郑州炜盛电子科技.
You can buy it at an online shop like eBay or aliexpress about 20$.

The electrical interface of this sensor is compatible with Raspberry Pi. So you can make your D.I.Y. CO2 Monitor with MH-Z19, Raspberry Pi, and MONITOR™.

The normal CO2 concentration is about 400ppm. In a poorly ventilated room, the CO2 concentration will soon increase and make you feel drowsy.

By ventilation, co2 concentration soon decrease and you can get your head refreshed.

You can check your room air freshness by yourself and can protect your health with this.


Connect RPi & mh-z19 as:

- 5V on RPi and Vin on mh-z19
- GND(0v) on RPi and GND on mh-z19
- TxD and RxD are connected to cross between RPi and mh-z18 

The following are an example of cabling, you can free to use other 5v and 0v Pin on the RPi. 

Activate a value element on the MONITOR™

MONITOR™ has one active view element for the display of image data, and 3 inactive value element for the display of sensor data. First of all, you should activate one of these value elements for your CO2 data.

Go to MONITOR™, then open Elements menu

 At first, only one View Element is active

Change one of your Value Elements to Active and Save this setting.

Then, the blank Value Element will soon open.

Keep this "value_id" to post the Sensor Data to this.

Install & setting MH-Z19 software on your Raspberry Pi

The software is available here. Install & it on your Raspberry Pi by following the steps here.
Please note that you should use the value_id which you get at the last step, as the parameter of command.

After Raspberry Pi power on, MH-Z19 software running on the Raspberrry Pi, send CO2 concentration data to the MONITOR™ service at 5 minute interval.

On your Web Browser, MONITOR™ keep refresh the time-series chart.

That it!


Popular posts from this blog

How to Measure ROOM CO2 concentration with 20$ sensor "MH-Z19" and Raspberry Pi, 2nd edition.

Monitoring all over the world with 3G Network for not more than 10$ monthly payment