Introduction: CO2 Sensor With Warning LED and Aerosol Indicator (Corona Virus)

Hello world and welcome to my first project!

While I'm working from home because of Corona, I detected that a lot of time there is very bad air in my homeoffice. So I decided that I need something that shows me, when my air is bad. After some reserches I found a recomidation of CO2 and a CO2 Sensor.

You can also use the CO2 value as an indicator how much aerosols are in the air. Just in times of the corona panemic this is a good indicator, if there could be too much aerosol and therewith corona viruses in the air. So use this tool to protect you and the people around you!

Step 1: What You Need

Here is the list of my used parts:

1x Wemos D1 mini (ESP8266)

1x MH-Z19 - CO2 Sensor

2x 18650 Li-Ion Cells

1x 134N3 - Charging device for Cells and 5V Converter

1x RGB LED 3x 100kOhm Resitors (or 1x 150kOhm)

1x Raw Board

1x Cell holder

Solder Iron and Solder

Housing (3D Printed)

IoBroker (Running on an Raspberry Pi)

Step 2: How to Connect

I build the first circuts on a breadboard, started with the simply ESP and the Sensor, added the charging board (134N3P), a RGB-LED and finally a voltage divider to measur the voltage of the cells

My hand made wire diagram shows roughly how most of the items work together.
The Circuit diagram was created with

Step 3: Build

Bring all your items together on one Perforated board (pic 1) and connet the parts like it's showen in the diagramm at Step 2.

Step 4: Setting Up the ESP8266

I run my ESP with ESP Easy.
This is a firmware which can directly connect the ESP with your WIFI and shows you a graphic interface.
How to set it up and config in general would be too much for this project but i'll show you the most important steps to run the CO2 Meter:

Picture 1: You have to add 2 devices: One Sensor and one analog input.
Picture 2: Settings of the Sensor; chose the MH-Z19 Sensor and set the showen setting
Picture 3: Configurate the Voltage devider to measure the Voltage (The Wemos D1 can handle only voltage up to 1V, so we have to "scale" the voltage). Configure the Input like showen except "Point 2". Now you have to measur the voltage of your 18650 cells and set them equal to the current input (in my exemple i had an input about 847 and i measured 4.12V)

You also have to set up your MQTT setting under the Controller Tab.

Step 5: Settings IoBroker and Script

If everything is set up correctly, your automation system (I use IoBroker) should show you the CO2 value as ppm (parts per million), a temperatur, a value U and your cell voltage. I added Quality (a value from 1-4 depending from the CO2 value) and a "switch value" to controll the RGB-LED.

My Blockly Script to control the value "Quality" looks like Picture 2:
It sets the quality to lvl1 if the CO2 value is under 800ppm, lvl 2 until 1000ppm, lvl 3 up to 1400ppm and lvl 4 over 1400ppm

Depending from the State of the RGL should light and the value of the quality the LED is controlled directly over the GPIO pins of the ESP8266. Pic 3-6 shows my (i think not that elegant - but it's workling) way.

After the configuration the LED should switch the light, when there is more CO2 (blow into it gently).
You also can see the red light inside the sensor that shows the running measurement.

Step 6: Visualisation

With the CO2 value, Voltge and the zones of excellent, good, poor, and bad CO2 concentration it's possible to visualize the CO2 and Voltage history. I used the tool Flot, but there are many ways to do that.

Step 7: Conclusion

I hope that I could show you a way to measure your CO2 for a good air qualitiy and implement it into your home automation.

Sure it's possible to use bigger LEDs, LED-Rings or acoustic signals to show you the CO2 value better or in an other way. Maybe also inside bigger offices or class rooms where a lot of people are together and the CO2 can rise even faster. There are also "traffic lights" for classrooms to show everyone if the air is good/fresh or you have to open your windows.

Battery Powered Contest

Participated in the
Battery Powered Contest