TTN Ulm particulate matter sensor
A Arduino sketch to measure particulates in the air via the SDS011 sensor and sending them to TheThingsNetwork.
- Connect the SDS011 to the PINs configured in the sketch (PIN 8 and 9 are preconfigured)
- Connect the 5V and GND pins
- Connect the DHT sensor to PIN 10, 3.3v and GND or connect the BME280 sensor to PIN SCL, SDA, 3.3V and GND.
- Copy the file "configuration.h.default" to "configuration.h"
- Fill in your TTN credentials in the "configuration.h"
- If you are using a BME280 sensor, uncomment the "#define BME280" line in the "configuration.h"
- Make sure you have the TheThingsNetwork, DHT library and BME280 library installed, you can get them from the Arduino Library Manager (see below)
- Write the sketch to the The Things Uno
Quick explanation what this does
- sleeps for a given amount of time.
- spins up the fan for some time to clean the fan and the housing (1 minute recommened).
- takes 10 samples of sensor data (pm2.5 and pm10)
- calculates the median of each to avoid outlier
- takes the current humidity and temperature values
- encodes the values into bytes
- send them to the given TTN app
Install the following libraries through the Arduino Library Manager:
- Adafruit Unified Sensor (scroll wayyy down)
- DHT sensor library
- Adafruit BME280 library
GNU Affero General Public License v3 (AGPL-3.0) See LICENSE file
Other code used
TheThingsNetwork library by Johan Stokking (email@example.com) https://github.com/TheThingsNetwork/arduino-node-lib