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

MH-Z19 CO2 concentration Sensor

This blog post is outdated. Updated version is here.

MH-Z19 is small, low-cost, weigh 15g CO2 sensor module product by 郑州炜盛电子科技.
You can buy it at 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™.

Normal CO2 concentration is about 400ppm. In a poorly ventilated room, 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 connect to cross between RPi and mh-z18 

Followings are 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 display of image data, and 3 inactive value element for display of sensor data. First of all, you should activate one of this value element for your CO2 data.

Go to MONITOR™, then open Elemens menu

 At first, only one View Element is active

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

Then, 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 shoud use the value_id which you get at last step, as 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