The following post was sent to us by the reader Miguel Torres Gordo. After Bernd Albrecht the bloggers Started on a similar theme with MQ-2 and DHT22 on ESP8266, here is an alternative for ATmega328 microcontrollers and MQ-135 / DHT11 sensors. Have fun reading and rewriting:
As it is very important to know the saturation rate of the environment, for example at the workplace, I have looked on the Internet for a sensor that can be used with Arduino to measure the CO2 content. Luckily, I found a sensor that measures air quality. This is the MQ-135, which, as can be seen in the data sheet, can measure certain substances, such as NH3, alcohol, benzene, smoke, CO2, etc. That's how I came across this sensor.
Because I knew there was a chance that he and our ATmega328 Microcontrols I first looked for the safety limit values for CO2 in parts per million (ppm) for apartments, rooms and buildings, which according to various studies can lie between 400 and 800 ppm. Now that I knew the right sensor and the safety limits, it was time to design a useful project that shows us this information and also informs us about temperature and humidity.
The aim of this project is therefore to measure the CO2 concentration in parts per million, to display it on a screen and to give us an acoustic warning when it reaches a dangerous concentration, as well as to inform us about the temperature and humidity. In order to extend the duration of the screen, I thought it would be a good option to install three different color LEDs that give us quick visual information about the level of CO2 concentration without having to see the data. After all this is installed, we can get to work.
The required software
- Arduino IDE
- MQ135 Calibration Sketch
- CO2 monitoring sketch
- Wire Library
- Adafruit GFX and Adafruit SSD1306 Library
Description of the operation of the circuit
The operation of this circuit is very simpleThere, there. MQ-135 sensor measures CO2 concentration in parts per million, DHT-11 sensor measures temperature and humidity. These three data are fed to a two-colour OLED screen with 0,96 Customs sent to show each value for three seconds in intervals of one minuteI. Dthe screen stays off during this time. These time values can be configured. While the screen remains off, the three LEDs visually inform us about the existing CO2 valuesI. Dit lights green LED if the concentration is equal to or less than 550I. DIf the concentration is between 551 and 799 parts per million CO2, the red LED is lit together with a summerton if the concentration exceeds 799 parts per million. These three values can also be configured.
Preparation and termination of the RZERO resistance reference for atmospheric CO2 content
First, the MQ-135 sensor must be prepared to measure the correct values that we will use in the next step. For this purpose, the sensor in its new state must be operated with five volts for approximately two hours in order to eliminate the impurities generated during production. After that it is best to perform the reference balancing of the RZERO resistance in the final circuit, as this is done with the normal supply and operating voltages used and the measurement is optimal.
The purpose of this calibration is to adjust the resistance of the atmospheric CO2 level so that the MQ-135 sensor measures a concentration between 300 and 450 ppm corresponding to the normal concentration of this gas in the environment. It is very important to supply the sensor independently with 5 VDC, as it consumes 850 mW.
When everything is connected, we start the Arduino IDE, load and start the Sketch. "MQ135 calibration.ino". The MQ135 library must be installed firstYeah. We open the serial monitor and see the ppm measurement value; we need to change and store the RZERO value in the MQ135.h file in the Arduino IDE library folder until the ppm measurement value is the one we want to leave as the working reference of the circuit. The value to be changed is the green coloured value.
To do this, we need to change the value of RZERO, save changes to the MQ135.h file of the library in its Arduino IDE folder and reload the calibration sketch, review the new value of the CO2 concentration in the serial monitor and repeat the process to set RZERO to the value, which we want to leave as a reference for the CO2 concentration in the air for the alert limits in the sketch of our project.
If we have read the CO2 concentration in parts per million correctly, it is time to load the CO2 monitor.ino sketch, which provides us with the information about this concentration, humidity and temperature on site, where we want to measure the values.
Sketch. CO2 monitordownload):
Thank you to Miguel Torres Gordo for his contribution.