Skip to content

Luc3as/Air-quality-Sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Air quality sensor

This simple, fancy looking, ESP8266 based sensor measures values of CO2 and TVOC air pollutants. As output there is addressable RGB led strip, and/or optional OLED display which can show real time levels.

Material needed

And of course some soldering iron and generic tools.

3D printed case

You can download latest version of case on thingiverse. There will be updated side cover with hole for display soon.

Schematic

Connection diagram

Final sensor assembly

wiring 1 2 3

Configuration

There is source code attached, I am using WiFi Manager, so after burning firmware, there will be WiFi hotspot, you can connect with password "config123". After that you should open address 192.168.4.1 and there will be configuration manager where you can enter details about your SSID, password, MQTT broker address, port, username and password, as well as MQTT topic where should sensor publish the data.

I connected 4 pieces of WS2812b LEDS, if you have different number, you should edit following line in main.cpp and compile project in platformio.

#define NUMPIXELS      4

Measuring

I don't know it I received bad piece of CCS811 sensor, but I spent few nights discovering why it stops reading data after few hours of operation, and only thing that helped to recover it was to unplug power source and plug it back. I realized that in default it takes reading every second. So I found out how to set to take reading every 10 seconds with line

ccs.setDriveMode(CCS811_DRIVE_MODE_10SEC);

I am taking 6 readings, calculate average and then print and publish data, so sensor sends data every minute.

Burning the firmware

I precompiled firmware for Wemos D1 mini you can download it here GitHub version

You can use attached burner from easy esp, you just have to select COM port of ESP and select burn.

Burning the firmware

HomeAssistant example configuration

This example shows sensor configuration for reading ppm values, and it shows other values as json attributes so it can be viewed after opening sensor details.

# CO2 sensor
  - platform: mqtt
    state_topic: 'stat/air-quality-monitor'
    name: 'CO2 sensor'
    unit_of_measurement: 'ppm'
    value_template: '{{ value_json.eCO2 }}'
    json_attributes:
      - TVOC
      - temperature

About

Simple WiFi based Air quality sensor

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages