Skip to content

ESP8266-based air quality sensor with ThingSpeak integration

License

Notifications You must be signed in to change notification settings

grotter/ArduinoAQI

Repository files navigation

ArduinoAQI

This device continuously monitors atmospheric particulate matter. It sends sensor data to a registered ThingSpeak channel and displays realtime Air Quality Index calculations. It was designed to be cheap and efficient.

Hardware

  • ESP8266 Arduino-compatible microcontroller. I‘m using a WeMos D1 mini, pins will need to be transposed for other controllers
  • Plantower PMS5003 laser particle concentration sensor
  • TM1637 seven segment LED display module
  • A momentary switch for resetting the wifi configuration

Dependencies

Configuration

ArduinoAQI uses ThingSpeak for both uploading sensor data and for reading configuration. You will need a ThingSpeak account and least two channels: a registration channel to store configuration and a data channel to write sensor data to. The registration channel should have three fields:

  1. Device MAC Address
  2. Data Channel ID
  3. Data Channel Write API Key

The data channel should have four fields:

  1. PM 1.0 (µg/m³)
  2. PM 2.5 (µg/m³)
  3. PM 10.0 (µg/m³)
  4. AQI

You will need to upload or import data into the registration channel, with one data point per device containing the desired data channel ID and corresponding Write API Key.

Copy config.h to private/config.h and fill in at least THINGSPEAK_REGISTRY_CHANNEL_NUMBER and THINGSPEAK_REGISTRY_API_KEY with the ID of the ThingSpeak registration channel ID and corresponding Read API Key.

You can use the shell command addSensor.sh to partially automate the creation and registration processes above.

Usage

To setup wifi connectivity, the device will create an ArduinoAQI Setup access point when first run. Connect to this network with a phone or computer to set your wifi credentials.

The device powers up in spinup mode for an initial ten seconds. Set wifi mode to off by clicking the reset button during spinup. In wifi mode, the reset button will clear your network credentials and relaunch the configuration access point.

View detailed setup instructions for a new device.

WeMos D1 mini Wiring Diagram

ArduinoAQI wiring diagram Also tested with a WeMos D1 R2 development board. Note: Pin labels on the D1 R2 fritzing component are wonky.

JavaScript Chart

See ChartAQI to view your sensor data and any optional PurpleAir sensors.

💨💨💨