# Photon and opensensemap.org Tinkered on Jun 28 2018 ![](https://i.imgur.com/yHkgxG7.jpg) This is a tutotial on how to get started with a SDS011 air quality sensor and a DHT22 sensor and post your data on the web. ## BOM - 1 x [DHT22](https://www.aliexpress.com/item/DHT22-Digital-Temperature-and-Humidity-Sensor-Temperature-and-Humidity-Module-AM2302-Replace-SHT11-SHT15-DHT11/32884816378.html) temp & humidity sensor - 1 x [SDS011](https://www.aliexpress.com/item/Nova-PM2-5-PM10-sensor-SDS011-High-precision-laser-air-quality-detection-sensor-module-Super-dust/32795231620.html) High precision laser air quality detection sensor - 1 x [Particle Photon](https://store.particle.io/products/photon) - 1 x 100K resistor ## Setting up the hardware Follow the tutorial on https://luftdaten.info/en/construction-manual/ but skip the part of the microcontroller. Connect the sensors ot the Photon board as indicated on the sketch: ``` GND -> GND on SDS011 & DHT22 Vin -> Vcc on SDS011 TX -> RX on SDS011 RX -> TX on SDS011 3v3 -> Vcc on DHT22 D1 -> Data on DHT22 ``` Note that the DHT22 needs a pullup resistor ## Setting up the software ### Create an opensensemap account Go to https://opensensemap.org/account and register. Then add a new sensor. In model I choose the Luftdaten.info SDS011 + DHT22. ![](https://i.imgur.com/fkIR1Of.png) Finish the setup of your sensor, and when ready - head over to the Dashboard (https://opensensemap.org/account). When you click your newly created sensor, you can go to Edit -> Sensors to see the individual `sensor ID`'s. The `Box ID` can be found in the URL. You will need these values in the next steps. ![](https://i.imgur.com/U8tggQo.png) ### Create a webhook Go to the console of the Photon IDE (https://console.particle.io/integrations) create a new integration ![](https://i.imgur.com/GreIDZp.png) and select `webhook` ![](https://i.imgur.com/WNbWC2s.png) Click on `custom template` ![](https://i.imgur.com/AdyFMO1.png) And paste the following data: ``` { "event": "LuftDaten.info", "url": "https://api.opensensemap.org/boxes/<box ID>/data", "requestType": "POST", "noDefaults": true, "rejectUnauthorized": true, "json": { "<sensorID>": "{{p10}}", "<sensorID>": "{{p25}}", "<sensorID>": "{{t}}", "<sensorID>": "{{h}}" } } ``` Fill in the correct `<box id>` and `<sensorID>`'s from the opensensemap account screen earlier. And save the integration. ### Flash your Photon Copy/clone this Photon project https://go.particle.io/shared_apps/5b348eab5fb7ff751f000e30 in your web IDE (https://build.particle.io/) and flash the software on your device. If your hardware is set up correctly, the device should now start posting data to opensensemap. # Verifying if everything works To verify that your events are generated - and your webhook integration is set up correctly - go to https://console.particle.io/events and verify that 1. The events are coming in 2. The post to opensensemap.org returns success. ![](https://i.imgur.com/OkMQFYW.png) ## Troubleshooting - If the wiring is not OK - the Photon code will not generate events. So if you don't receive `LuftDaten.info` events - check your wiring. - If the API where the webhook posts his data returns an error, you can go to the details of the integration and scroll down to see the event log. If you click on a line you will see more details about the HTTP request that might help you figure out what is wrong. # Links - https://www.particle.io/ - https://luftdaten.info/en/construction-manual/ - https://opensensemap.org/ That's it. With love ♡ from the IoT Dept.