This sensor measures the fine dust concentration in the air and sends data over TTN LoRaWAN network. Via a data forwarder the data is pushed to the luftdaten servers
This is the firmware for a Influencair LoRaWan sensor based on a Honeywell HPM series pm sensor, ESP8266 and RFM95W. For the LoRaWAN network we use The Things Network.
This repo contains the firmware and the helper tools necessary for flashing these sensors.
This sensor assembly is based on a NodeMcu ESP8266-e12, RFM95W lora transeiver, HPM pm sensor, DHT22 humidity/temperature sensor.
- Node.js
- Yarn dependencie manager
- IDE (VS-Code, Atom) with Platformio
- pin 1: Not connected
- pin 2: NodeMCU UV (USB Voltage = 5V)
- pin 3: Not connected
- pin 4: Not connected
- pin 5: Not connected
- pin 6: NodeMCU D3
- pin 7: NodeMCU D4
- pin 8: NodeMCU GND
- pin 1: NodeMCU UV (USB Voltage = 5V)
- pin 2: NodeMCU D1
- pin 3: Not connected
- pin 4: GND
- GND : GND
- MISO: NodeMCU D6
- MOSI: NodeMCU D7
- SCK : NodeMCU D5
- NSS : NodeMCU D8
- RST : Not connected
- GND : GND
- DIO2: Not connected
- DIO1: NodeMCU D2
- DIO0: NodeMCU D0
- 3.3V: NodeMCU 3.3V
- DIO4: Not connected
- DIO3: Not connected
- GND : GND
- ANT : ANTENNA
You will need an account at https://console.thethingsnetwork.org and create an application. In the application go to payload formats and add this decode function:
function Decoder(bytes, port) {
var decoded = {};
// Decode bytes to int
var p10int = (bytes[0] << 8) | bytes[1];
var p25int = (bytes[2] << 8) | bytes[3];
var hum = (bytes[4] << 8) | bytes[5];
var temp = (bytes[6] << 8) | bytes[7];
// Decode int to float
decoded.pm10 = p10int / 100;
decoded.pm25 = p25int / 100;
decoded.humidity = hum / 100;
decoded.temperature = temp / 100;
return decoded;
}
Next create a new 'ABP' device in TTN console https://console.thethingsnetwork.org/applications/your_appID and copy the 'deviceId'
- open this project within Platformio.
- Run
yarn
in the project root - Go to TTN console and open your TTN application
- Copy your appID
- Set your TTN appID in your environment variables
export appID=your_appID
- Copy your application accessKey, make sure this key has access to 'devices' & 'settings'
- set your TTN accessKey in your environment variables
export accessKey=your_accessKey
- Create a new 'ABP' device in the TTN console and copy the 'deviceId'
- Run
deviceId='deviceId' node getDevice.js