We often hide the electronics in a box. And cases can be done well and nicely. But when our main interest is electronics then it is sad to hide it. That is way like to do it the opposite way.
Sensors will measure particulate matter (Ultrafine dust PM2.5 and fine dust PM10), co2, TVOC, ambient light, humidity, temperature and barometric pressure.
Most sensors use I2C to communicate. That makes it super easy to build.
Why and what
We spend much of our lives indoors. And that is why it is important that our main living environment is healthy.
- CO2 level should be less than <1000 ppm
- TVOC is the concentration of Volatile organic compounds (VOCs) present in the air. Should be less than <100 ppm.
- PM2.5 refers to atmospheric particulate matter (PM) that have a diameter of less than 2.5 micrometres. The 24-hour concentration of PM2.5 is considered unhealthy when it rises above 35.4 (60) μg/m3.
- PM10 refers to atmospheric particulate matter (PM) that have a diameter of less than 10 micrometres. < 100 μg/m3.
- Humidity 40-60 %
- Temperature 21-25 °C
Code can be found on the GitHub repository.
This is the basic schematics.
Because I still had free pins, I added four LEDs.
My power supply is 9V. This is a circuit to make 3.3C and 5V what my MCU and sensors need.
There are four places to view real-time data:
- On display
- Via serial monitor
- Local webpage
- ThingSpeak channel. Publick view: https://thingspeak.com/channels/1099844
In the long term, all data is stored on the ThingSpeak channel.
Serial Monitor view:
Simple local website:
- First, test all sensors separately to make sure they all work properly.
- There are different libraries. Test them to be sure they will work with your MCU and sensor.
- Keep code modular. So you can easily add and remove sections.
- Wear gloves. The wires may become hot during soldering.
Main board: WeMos D1 mini (ESP8266)
- Link to the store: https://www.digitspace.com/d1-mini-node-mcu-lua-wifi-esp-12f-esp8266?2e40f3ca70399010
- Pinout reference
Default I2C SDA/SCL pins:
- D2 – GPIO4 – SDA
- D1 – GPIO5 – SCL
BMP280 Humidity, temperature, barometric pressure and altitude sensor
- I2C Address: 0x76 or 0x77
- Link to the store: https://www.digitspace.com/gy-bmp280-3-3-high-precision-atmospheric-sensor-module?2e40f3ca70399010
- Library: https://github.com/adafruit/Adafruit_BMP280_Library
APDS-9960 Proximity, RGB and gesture sensor
- I2C Address: 0x39
- ambient light
- colour measuring
- proximity detection
- touchless gesture. Operating range 10-20cm.
- It works when you comment out //_wire.end();
CCS-811 (CJMCU-811) Digital gas sensor monitoring indoor air quality
- I2C Address: 0x5A or 0x5B
- Needs pull-up resistors
|nWAKE||D3 or GND|
Update sensor firmware: https://github.com/maarten-pennings/CCS811/tree/master/examples/ccs811flash
1.3″ Oled display module 128×64
Unknown manufacturer. After trial and error, I discovered my display driver is SH1106. Not SSD1306 like Adafruit uses. But when I use SH1106 constructor:
U8X8_SH1106_128X64_NONAME_HW_I2C display (/* reset=*/ U8X8_PIN_NONE);
Display will look good. But the AM2320 sensor will not work for unknown reason. I2C communication problem?
That’s why I still use SSD1306 constructor. The fonts do not look nice and on the screen right side has white scratched strip.
U8X8_SSD1306_128X64_NONAME_SW_I2C display(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
AM2320 Temperature and humidity sensor
- I2C Address: 0x5C
- Link to the store: https://www.digitspace.com/am2320-digital-temperature-humidity-sensor-module-for-arduino?2e40f3ca70399010
Sensor will work normally a couple of hours. After that will not respond anymore. Needs power off restart.
- https://github.com/adafruit/Adafruit_AM2320 (works 2h then returns nan)
Nova PM SDS011 Dust sensor
Can measure fine dust and smoke = particulate matter (MP) concentrations in two categories:
- Ultrafine dust particles with a diameter of 0 – 2.5 micrometres (μm/m3). Output PM2.5
- Fine dust particles with a diameter 2.5 – 10 micrometres (μm/m3). Output PM10
- RX UART data (3.3V)
- TX UART data (3.3V)
- Link to the store: https://www.digitspace.com/sds011-air-quality-sensor-module?2e40f3ca70399010
- Library: https://github.com/lewapek/sds-dust-sensors-arduino-library