Go Down

Topic: [Project] Air Quality Logger: CO2, Temperature & Humidity (Read 1 time) previous topic - next topic

drsnugglesja

Feb 07, 2020, 07:01 pm Last Edit: Feb 07, 2020, 07:04 pm by drsnugglesja
How good is the air quality? Is there enough ventilation in my living room, bedroom or car?

These were the questions I had. Especially regarding the carbon dioxide (CO2) level at home. It could effect my sleeping comfort. A commercial device for just measuring CO2 costs around 300 euro/dollar, so I decided to make my own. This post is to share my experience, setup and code, since I used a lot of free libraries as well.

Learning goals: learn about the ESP8266, wifi and networking, FTP, Oled, I2C, Uart, webservers, 3D design and 3D printing and get up to date again with the Arduino IDE, which has improved quite a lot!

This is it:










Features:
  • CO2 measurement, up to 10,000ppm and automatic range scaling
  • Temperature, humidity and pressure measurments.
  • OLED display, to present results
  • Wifi connection
  • Automatic time set for each measurements, from NTP server.
  • Webserver, to see results in one single graph, optimized for normal and dark theme browers.
  • CSV file with results uploaded to FTP server


My experience developing this device was very nice. I had lots of fun finding a good library, try out the examples and putting it all together, both hard- and software. Some things took me a bit more time to figure out: I2C noise from the display wires does influence the Uart wires of the CO2 sensor, resulting in bad reading sometimes: a re-read fixes it, but proper cables with shielding should fix it as well. Getting a proper FTP library took me some time as well, so I included all libraries I used below. Included is a link to the enclosure I designed as well. It's a simple one with lots of air vents. You can 3D print it or modify it to your needs.

Use case:
  • Use at home, connect to regular wifi and upload results to FTP. Check results by phone browser.
  • Use in the car or in the office, connect to wifi hotspot of phone. No FTP upload, but results can be checked in the browser.


Hardware


Sources


Libraries used:

Thanks to everyone who created all these great examples and libraries!

On a side note: this project can also be done in microPython. I tried it after finishing the c++ implementation. I was positively surprised by the design speed. There is only one catch so far: you need to rewrite an existing MH-Z19 library from python or C++ to micropython. All other libraries can easily be found online.

I hope I inspired someone with this device. Thanks for reading :).


richa1510

Nice project.
Have a look at the sensirion SCD30 sensor. I used a lolin d1 mini pro too. I used the ESP8266 DeepSleep function to but the board to sleep to preserve battery power and woke it up every 20 minutes to take a reading.


drsnugglesja

Nice project.
Have a look at the sensirion SCD30 sensor. I used a lolin d1 mini pro too. I used the ESP8266 DeepSleep function to but the board to sleep to preserve battery power and woke it up every 20 minutes to take a reading.
Sounds good! Lets share some experiences: how does the SCD30 sensor perform? Is it accurate and precise enough to check indoor CO2?

And what did you use it for: check CO2 indoors as well?

authgabor

How good is the air quality? Is there enough ventilation in my living room, bedroom or car?
Similar project here! With dust sensor and VOC gas sensor, without CO2 and display... :)



Open source everything: https://github.com/IoTGuruLive/dust_box
Live example: https://iotguru.cloud/field/srcPlk78rcpgCgCgKWcR6g/gas
Details: https://www.facebook.com/IoTGuruLive/posts/1072809553055971
https://iotguru.cloud - the IoT backend company

authgabor

Sounds good! Lets share some experiences: how does the SCD30 sensor perform? Is it accurate and precise enough to check indoor CO2? And what did you use it for: check CO2 indoors as well?
I am more interested in how this can be done?

"Sensirion recommends 7 days of continuous readings with at least 1 hour a day of 'fresh air' for self-calibration to complete."
https://iotguru.cloud - the IoT backend company

drsnugglesja

#5
Feb 13, 2020, 09:59 pm Last Edit: Feb 13, 2020, 10:02 pm by drsnugglesja
Similar project here! With dust sensor and VOC gas sensor, without CO2 and display... :)



Open source everything: https://github.com/IoTGuruLive/dust_box
Live example: https://iotguru.cloud/field/srcPlk78rcpgCgCgKWcR6g/gas
Details: https://www.facebook.com/IoTGuruLive/posts/1072809553055971
That looks like a proper project for measuring polution. I am looking for a dust sensor as well to measure PM2.5 from cars, if I manage to fit it in the box. Why did you choose the SDS011?

A nice sensor overview is given here: http://aqicn.org/sensor/ but cant see any conclusion.

authgabor

That looks like a proper project for measuring polution.
It is. :)

I am looking for a dust sensor as well to measure PM2.5 from cars, if I manage to fit it in the box. Why did you choose the SDS011?
Based on the LuftDaten project R&D: https://luftdaten.info/messgenauigkeit/

A nice sensor overview is given here: http://aqicn.org/sensor/ but cant see any conclusion.
It is an interesting page, thank you! :)
https://iotguru.cloud - the IoT backend company

drsnugglesja

#7
Feb 14, 2020, 10:43 pm Last Edit: Feb 14, 2020, 11:45 pm by drsnugglesja
Based on the LuftDaten project R&D: https://luftdaten.info/messgenauigkeit/
Wow, didn't know there was that much research already done for these sensors. Thanks to website you mentioned, I got to this github site, and this comparison. The SDS11 seems to be a really good one, if you correct for humidity like you do in your code.

I'll go for the PMS7003, since it seems to have less issues with humidity (70 to 90% where I live!). I'll use the correction y(ppm reality) = a⁎x(ppm measured) + b, where a = 0.29 as mentioned in the comparison. The sensor is also a bit smaller, so I might be able to sneek it in the box I already made :).

Talking about humidity correction: what was the reason you use this formula if I may ask?
Code: [Select]
pm.pm25 = pm.pm25 / (1.0 + 0.48756 * pow((humidity / 100.0), 8.60068));
The document describing the comparison found this correction:
Quote
Data: RH ≤ 80% (n = 1824)
Fitted curve: y = a⁎x + b (a = 0.47; b = 5.08)
Data: 80% < RH ≤ 90% (n = 1482)
Fitted curve: y = a⁎x + b (a = 0.41; b = 3.32)
Data: RH > 90% (n = 425)
Fitted curve: y = a⁎x + b (a = 0.37; b = 2.63)
Another annoying thing I see is the effect of a self-heating BME280. Apparently it is normal to have an offset of around 2 degrees Celcius, even if you put the sensor to sleep and run it in Force mode. But the offset will be bigger if it is colder.

Go Up