I bought three CO2 sensors and Arduino-nanos and gave one to high school students and one to my collegue Ilja Feschenko who designed a great-looking electrochemical CO2 sensor box using SolidWorks and printed it on a 3D printer. There is USB output to a PC and a line with color LEDs. Simple LED indication is particulary suitable for checking air at home during nights. It is powered from external 9V supply and contains a miniature fan. After initial try Ilja saw that readings are temperatuire dependent and he actively stabilized the CO2 sensor temperature by an external heater transistor and a thermistor in Arduino PID loop. This decreased the temperature dependence, but there is still humidity dependence and warm-up time of hours. Ilja callibrated CO2 sensor against a commercial infrared photoaccoustic CO2 monitor. High school students managed to make a setup on a breadboard, learned programming and averaging ADC reradings, but did not have time to make a box.
After digging into more scintific articles we understood that not only the air temperature but also air pressure has to be taken into account requirng to put more sensors into the box. And that is the story of the multi-sensor box described below that I built for In-the-Air-Challenge.
Here is a presentation of air quality sensor to measure air quality in school classes. There are up to 30 students in a classroom. In winter windows are kept closed and air quickly deteriorates without forced-air heat-recovery ventilation. Carbon dioxide (CO2) in air is responsible for tiredness. Dust and smog is a problem in large cities. In winter might be too cold and in summer too hot and moist to feel comfortable. Knowing air quality might help teacher to optimize window opening. Besides that it will play a large educational role teaching young people about sensors, programming microcontrollers and Internet of Things.
Idea was inspired by a sensor cube: http://habrahabr.ru/post/243669/ where all possible sensors were mounted in a plastic cube. Probably not all the existing sensors are needed at the same time. Commercial sensors exist: https://www.netatmo.com/. Here are the sensors that I decided to use:
- CO2 concentration
- Dust concentration
- Air temperature
- Air humidity
- Air pressure
- Sound level
- Light level
Arduino micro pro is used because of small occupied space and availability of libraries for sensors and LCD. Arduino is the microcontroller that school students who attend robotics club are familiar with. So they can modify the program. Two-line LCD display displays sequentially 8 values from sensors. Values from Arduino serial port are read on a PC by Processing 2.2.1 that is plotting data saving to disk and and uploading to the Internet of Things. Code is attached. I used a ready made library for IoT server Xively. Feed will not be available all the time: https://xively.com/feeds/1192364524
I tried bluetooth connection to a PC but it was unreliable and lost connection after several days. Idea was to run Processing scetch on an Android phone or tablet, but the sketch that run OK on a PC did not run on Android as Bluetooth serial port was named differently.
Dust sensor GP2Y1010AU0F made by Sharp is sensitive to average dust level not for counting individual particles. There is a significant output offset from photodiode amplifier noise and from light scattered from the black sidewalls. This background has to be subtracted. Dust sensor feels when the room is swept and the broom brings dust to air. It is very sensitive to (cigarette) smoke.
Sensor output voltage depends on supply voltage. In the datasheet calibration curve was showed for 5V sensor supply. When supplied from 3.3V the output signal is smaller. Internal IR LED is driven in pulsed mode 100 short pulses per second. This allows to have more light in IR LED emission peak as scattering effect is relatively weak.
Fan glued behind the sensor box is sucking air through the sensor. It is a 25x25 mm low noise (18 dB) fan operated from 5V with 100 Ohm resistor in series to reduce speed. Visible dust layer accumulated on the propeller blades in a week.
Arduino 5V voltage from USB is not stable. It changes with USB connection at different PCs and wire length. So I had to use a 3.3V LDO regulator (LM1117 with two 1uF blocking capacitors) that powers Sharp dust sensor and Arduino reference voltage.
Dust in air can be cleaned using HEPA filters. Such HEPA filters are used in industrial and research cleanrooms, hospital surgery halls and airplanes. HEPA13 class filters are used in Electrolux dust cleaners stopping 99.95% of dust. When using such dust cleaner the room air stays pleasant after cleaning and there is no fine dust smell in the air. Electrostatic filters pose an interesting alternative.
CO2 is a greenhouse gas and it's concentration has increased from 300 to 400 ppm in last 70 years. See graph at co2now.org
Carbon dioxide (CO2) is responsible for tiredness. So we probably feel more tired than 70 years ago. Inside lungs CO2 concentration is up to 4%. If ambient air contains more CO2 we are breathing more frequently.
Among electrochemical sensors CO2 sensor is relatively expensive ca 30 USD because it contains gold and platin. Parallax CO2 sensor board with 7.67x preamplifier uses the CO2 gas sensor module MG811. In electrochemical sensors the gas diffuses into the sensor, through the back of the porous membrane to the working electrode where it is oxidized or reduced. This electrochemical reaction results in an electric current that passes through the external circuit. There is no indication of sensor life-time in the data sheet. From comparison with a photoacoustic gas analyser got formula
I have placed CO2 sensor board inside the air quality box after the dust sensor fan.
CO2 sensor needs 6V for the internal heater. It is more practical to to use a step-up regulator to raise USB voltage than an external power supply. I wanted to use some of the multitude of inductor coils donated by Wurth Elektronik for the Air Challenge, but found on Ebay cheap step-up modules. So I step up the USB voltage to 8V that is sent to CO2 sensor board. 8V is supplied also to the 3.3V LDO. CO2 sensor draws relatively much current and USB voltage drops to 4.2V not enough for 3.3V LDO.
Voltage from the CO2 sensor decreases with increasing CO2 concentration. CO2 sensor output voltage also strongle decreases with increasing temperature which is unfortunate artefact. CO2 sensor temperature is measured by 1-wire DS18B20 sensor taped with aluminum tape to the CO2 sensor. In principle, one would need to implement active temperature stabilization of the sensor. Electrochemical sensor output voltage is quite unreliable at small CO2 values. CO2 sensors need burn-in time 12-24 hours to dry the moisture accumulated inside the sensor.
Calibration could be done using 100% CO2 from sparkling water and further diluting it with normal air. If a water tank is used to measure volume there should be oil layer on the water surface as CO2 dissolves in water.
Better would be to use near infrared CO2 sensors, for example, Telaire 6613 CO2 Module 400...2000 ppm, 50ppm or 5% . Or T7000 Series Handheld Indoor Air Quality (IAQ) Monitor sold by Farnell.
Measuring pollutant concentrations in ppm and ug/m3
Part per million (ppm) means parts per million. 1ppm is one pollutant molecule among 1 million air molecules.
ppm is a mixture ratio that does not change in mountains where the air pressure is low due to high altitude. ppm value does not change with gas temperature. When ppm is specified in sensor datasheet it is assumed that sensor is at normal conditions 25 deg.C and 1000 mbar.
Chemical sensors and living organisms sense number of molecules that enter the volume and ug/m3 concentration units are more practical to use. ug/m3 value is sensitive to ambient pressure. (Imagine that if the measurement volume was evacuated then there would be no signal at all). So ug/m3 value needs to be corrected for ambient pressure. ug/m2 needs to be corrected for temperature as well. Concentration n enters ideal gas law equation
where p is pressure, V is volume, n is concentration, k is Boltzman’s constant and T is temperature in degrees Kelvin.
At elevated temperature molecules move faster and push other molecules further apart. Intermolecular separation increases and there are less molecules in a volume unit.
Formulae how to convert ppm to ug/m3 are here.
In the sensor box C02 sensor generated voltage is measured together with the temperature of sensor’s enclosure and ambient pressure.
Temperature sensors. In summer it gets quite hot inside. And one would need air conditioning. But summers in Europe are short so most buildings do not have air conditioning. Digital temperature sensors DS18B20 provide 0.125 deg. C resolution and can be connected in parallel at 1-wire data line. One sensor is taped to the CO2 sensor and the second sensor measuring room temperature is outside the sensor box.
Humidity sensor Honeywell HIH5031 produces linear output voltage proportional to humidity, minus some DC offset. According to a datasheet slope is quite linear, but has a 2% hysteresis at 25C. Air humidity is important to know not only in school class but also at home in bathrooms, kitchens, basements. High humidity values can cause appearance of mold.
Air pressure sensor BMP180 is extremely tiny and very sensitive pressure sensor with 0.1 mbar resolution. Output can be compared and coincides well with actual meteorological data. Besides pressure it includes also a temperature sensor.
Ambient sound level is measured by amplifying microphone signal and sending with a diode to a capacitor with 10s time constant. You can find circuit here: http://www.instructables.com/files/orig/FB6/Q5DZ/H1QMLEJ0/FB6Q5DZH1QMLEJ0.pdf
Photodiode allows to monitor indoor light use in winter time and count sunny hours. It is reverse biased from 5V and loaded with 10 k resistor. In principle it would be better to use logarithmic digital light sensor from SiLabs as illumination changes by several orders of magnitude in sunny conditions.
Tight packaging of many sensors in one box caused some contradictions.
- It gets warm inside because CO2 sensor heats up to +40…+50C. So the room temperature sensor is placed outside the box at the end of 10 cm cable.
- Humidity value is influenced by elevated temperature inside the box. So the humidity sensor is placed directly after the fan where air has not heated up yet.
- Pressure sensor BMP180 might feel increased pressure inside the box by the fan. To cope with that the fan rotates at slow speed.
- Fan produces some noise that is felt by the microphone that measures sound level. Fan is mounted on the dust sensor and that is glued not directly to the wall but via a rubber pad to reduce vibration transfer.
It might be good to include bad-air sensor into the air quality box. However this sensor is more appropriate for restrooms and farms.
It might be good to use near-infrared CO2 sensor that would have much better long-term stability compared to electrochemical sensor. NIR CO2 sensor is available at Element14 for ca 200 USD.
Could also add oxygen (O2) sensor for 200 $.
As a dust sensor it would be optimal to count dust particles illuminated by powerful1-10W LED or a laser. As it is visible by eye there are around 25 particles per cm3 or 25000000 per m3. I will try to use Beaglebone with a webcam and image processing to count dust particles and size.
Could use a I2C controlled graphical display, Nokia5110 84x64LCD or larger to graph the signals for the past hour(s).
Could add Wi-Fi connectivity and a rotary encoder to enter Wi-Fi credentials on the LCD display.
By measuring air quality we can not directly improve it, but only learn how often to ventilate the room. Modern windows do not have gaps that were ventilating rooms in old times. Modern windows allow to save heat. For saving heat it is good that windows are completely closed when no one is at home. But when people are in the room it is necessary to open some gap in window for ventilation.
One thing would be to automate window opening that would for example ventilate a bedroom briefly during the night when a person is too lazy to stand up and open the window.
Commercial window openers can be bought on Ebay for ca 100 EUR from Germany and 60 EUR from Italy. We plan to try to make our own window actuator using a stepper motor, gearbox and threaded stick similar as in home-made 3D printers.
Tests at school class
I gave the sensor box to a student who took it to Riga 1st Gimnasium to measure air quality in the class. Test at school was tried for 3 days and only the last day was successfull. First day there was no Wi-Fi connectivity. Second day GSM-USB Internet adapter was used to bring notebook to the Internet, but Processing script stopped working as there COM port settings had changed. Below is the picture of the sensor readings at school. Live: https://xively.com/feeds/1192364524
Measurement was started on Dec. 18 at 8 am. CO2 sensor needed 1-hour warm up.
CO2 levels changed dramatically during the middle of the day when window was open. But this change was mainly due to decreased temperature.
Note that plotted is not the CO2 concentration, but voltage in ADC units. This voltage decreases with increasing CO2.
One could see slightly elevated dust level, but not too much.
Box was placed on the window aisle near heaters and room temperature reading was elevated.
After the school day around 2:30 pm the student took the sensor and notebook home. So there are no values for the time when noone was in the class.
After the Christmas and New Year holidays we need to install Wi-Fi or GSM module into the air sensor box. So that it can be left operatig at school 24/7 without a PC. Minimum would be to add a SD/card with RTC.
1) There were some interesting results analysing the sensor data, for example CO2 increase during every lesson and dust from floor sweeping after the classes.
2) A webcam would greatly simplify the analysis showing the number of people in the class and state of the windows, but webcam is not legal to use without permission from authorities.
3) Wi-Fi at school was problematic to arrange as one needed to register MAC address by the webadmin. GSM module would be best to use.
4) At school students were not allowed to leave electronics running during the night. So background data could not be collected.
5) Electrochemical CO2 module needs too much warm-up time. NDIR CO2 sensor described in the following blogposts is more accurate and has only few minutes of warm up time.