📜 ⬆️ ⬇️

Air quality control (CO2 and temperature) in the office and at home, with their own hands

It all started with the fact that I work in an office where, as usual, there is no normal ventilation. But there are a lot of people, someone is hot all the time, others are constantly blowing.

To control the quality of indoor air, knowing the temperature is not enough. Even with air conditioning it is often cool, but stuffy. Stale air. It turned out that this is most affected by the concentration of co2. When I found out the cost of ready-made appliances I wanted to give up this idea. But by chance I saw a description of an optical co2 concentration sensor MH-Z19.

image

The price of course is also not small, but still close to reasonable limits. And my hands itched for a long time on a soldering iron. As a controller, I decided to use ESP8266. Firstly it is cheap, and secondly, that would transfer information to a computer, one's own and anyone in the room. After I assembled and tested the first version, with a monitor program on my computer, I decided to add a screen. Firstly it is beautiful. Secondly, in many cases it is convenient.
')
The device is built on the module ESP8266 NodeMcu Lua wi-fi. For him, a program was written in the script language LUA. The firmware for the Lua interpreter for my device was generated on the on-line server nodemcu-build.com. I chose only those modules that I needed to create the project.

Then I took up the assembly of the device. Connected temperature sensors. ds18b20. They work on the 1-wire interface:

image

Then the actual carbon dioxide sensor MH-Z19. It can use two PWM and UART interfaces. I decided to try the PWM first, and as a result, I was satisfied with the reliability and accuracy of the readings.

image

And I connected the display via the ISP bus:

image

This program was written under Windows. On Delphi XE8:

image

The controller I use has a built-in WIFI module that sends the information received from the sensors as UDP broadcast packets throughout the office network. And users who have a monitor program receive information about the state of the air in the room and warnings if the situation becomes critical.

And now the actual impressions.

The device was much more useful and more interesting than I expected. First of all, there are no more problems with airing, no one is indignant, since everyone has a warning that pops up and they agree quite well with personal feelings. Well, just observations showed that on a sunny day the level of co2 is much lower than on cloudy and rainy, in the morning air pollution is higher than during the day. At first glance, you can understand what to do, to ventilate, if it goes off scale 2, or turn on the air conditioner, if the temperature is high. The temperature sensor on the street well shows whether it will turn out to be cooled by airing, or just an air conditioner. It became obvious and understandable what was happening in the room and how to live in it. There was a case when they decided to air, opened the window, and immediately closed it, the sensor literally went off scale, And the device turned out to be very useful at home, especially in the children's room, especially since you can monitor the readings remotely via WiFi.

As a result, it all looks something like this:



There are links to sources and all that is needed to repeat this construction.
USB driver for Windows: www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
The program for the firmware ESP8266: github.com/nodemcu/nodemcu-flasher
MCU firmware lua: drive.google.com/file/d/0B4KYGXb6-nxpOUdXdTFpcjlFZXM/view

Here you can take the lua scripts: drive.google.com/file/d/0B4KYGXb6-nxpeGNNbGM0U2g2dEU/view
ESPlorer for downloading scripts on esp8266 and debugging: esp8266.ru/esplorer/#download

Windows application written in Delphi XE8. Here are the sources: drive.google.com/file/d/0B4KYGXb6-nxpei1RUWhHVXV5aTQ/view

Additional components required:

JEDI:

wiki.delphi-jedi.org/index.php?title=JEDI_Code_Library
sourceforge.net/projects/jvcl/files

SDL Delphi Component Suite:

www.lohninger.com/sdlindex.html

Compiled program for windows: drive.google.com/file/d/0B4KYGXb6-nxpUmVXcElLektOQXM/view

On my site you can get more information on this device and a more advanced version.

Source: https://habr.com/ru/post/301296/


All Articles