My home environment and air quality monitoring system

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

Code can be found on the GitHub repository.

Schematics

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.

Data

There are four places to view real-time data:

In the long term, all data is stored on the ThingSpeak channel.

Display view:

Serial Monitor view:

Simple local website:

ThingSpeak view:

Notes

  • 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.

Links

Main board: WeMos D1 mini (ESP8266)

Default I2C SDA/SCL pins:

  • D2 – GPIO4 – SDA
  • D1 – GPIO5 – SCL

BMP280 Humidity, temperature, barometric pressure and altitude sensor

Pins

BMP280 ESP8266
VCC 3V3
GND GND
SCL D1
SDA D2
CSE
SDD

APDS-9960 Proximity, RGB and gesture sensor

  • I2C Address: 0x39
  • ambient light
  • colour measuring
  • proximity detection
  • touchless gesture. Operating range 10-20cm.

Pins

APDS9960 ESP8266
VIN 3V3
GND GND
SCL D1
SDA D2
INT

Library

CCS-811 (CJMCU-811) Digital gas sensor monitoring indoor air quality

  • I2C Address: 0x5A or 0x5B
  • Needs pull-up resistors
  • eCO2
  • eTVOCs

Pins

CCS811 ESP8266
VCC 3V3
GND GND
SDA D2
SCL D1
nWAKE D3 or GND
INT
RST
ADD

Library

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);

Link to the store: https://www.digitspace.com/1-3-oled-display-module-128-64-i2c?2e40f3ca70399010

Pins

OLED ESP8266
GND GND
VCC 5V
SCL D1
SDA D2

Library

AM2320 Temperature and humidity sensor

Sensor will work normally a couple of hours. After that will not respond anymore. Needs power off restart.

Pins

AM2320 ESP8266
GND GND
VCC 3V3
SDA D2
SCL D1

Library

Nova PM SDS011 Dust sensor

Can measure fine dust and smoke = particulate matter (MP) concentrations in two categories:

Pins

SDS011 ESP8266
TXD D7
RXD D8
GND GND
25um
5V 5V
1um
NC

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.