LoRaWanWeatherStation
Introduction
This is an example of a nice LoRa application. The weather station contains a temperature sensor, air pressure sensor and humidity sensor. The data is read out and sent to Cayenne Mydevices and Weather Underground using LoRa and The Things Network.
The Hardware
- Arduino Pro Mini 328 - 3.3V/8MHz (https://www.sparkfun.com/products/11114)
- RFM95W (http://www.hoperf.com/rf_transceiver/lora/RFM95W.html) (https://www.aliexpress.com/item/RFM95W-20dBm-100mW-868Mhz-915Mhz-DSSS-spread-spectrum-wireless-transceiver-module-SPI-SMD/32799536710.html)
- DHT22 (https://www.aliexpress.com/item/High-Precision-AM2302-DHT22-Digital-Temperature-Humidity-Sensor-Module-For-arduino-Uno-R3/32759158558.html)
- BME280 (https://www.aliexpress.com/item/I2C-SPI-BMP280-3-3-BMP280-3-3-Digital-Barometric-Pressure-Altitude-Sensor-High-Precision-Atmospheric/32775855945.html)
The Wiring
The wiring is based on the scheme of this story: https://www.thethingsnetwork.org/labs/story/build-the-cheapest-possible-node-yourself
Follow the instrucitons of BUILD THE CHEAPEST POSSIBLE NODE YOURSELF to add the RFM95W to the Arduino Pro Mini. If successful, add the sensors as shown in the scheme above.
Finally, solder a 86 millimetre wire to the RFM95W antenna pin to increase the range.
The Casing
To place the weather station somewhere, I drew a case and printed it with the 3d printer.
The models can be found on Thingiverse. Of course you can of course make your own variant.
https://www.thingiverse.com/thing:2594618
The Software
The code I have used can be found on GitHub: https://github.com/henri98/LoRaWanWeatherStation
I used Atom with PlatformIO to realize this project, so this is a PlatformIO project.
I used the folowing libarys:
- LoraMAC-in-C for Arduino thank to Thomas Telkamp and Matthijs Kooijman (https://github.com/matthijskooijman/arduino-lmic)
- CayenneLPP of The Things Network Arduino Library (https://github.com/TheThingsNetwork/arduino-device-lib)
- Adafruit DHT Humidity & Temperature Unified Sensor Library (https://github.com/adafruit/DHT-sensor-library)
- Low-Power: Lightweight low power library for Arduino (https://github.com/adafruit/DHT-sensor-library)
Weather Underground
To send data to Weather underground, create an HTTP integration in the Console of The Things Network. The data will be sent to the URL with a POST or a GET. The following script captures the data and sends it to Weather Underground. Register your own Personal Weather Station on https://www.wunderground.com/personal-weather-station/signup
<?php echo time();file_put_contents('json/post'.time().'.json', file_get_contents('php://input')); $json = file_get_contents('php://input'); $data = json_decode($json); // take the data out of the json $temperature_1 = $data->payload_fields->temperature_1; $barometric_pressure_2 = $data->payload_fields->barometric_pressure_2; $relative_humidity_3 = $data->payload_fields->relative_humidity_3; // tempc to tempf $tempf = ($temperature_1 * 9/5) + 32; // pressure $pressure = $barometric_pressure_2/33.863886666667;<br> if( isset($pressure) && !empty($pressure) && isset($tempf) && !empty($tempf) && isset($relative_humidity_3) && !empty($relative_humidity_3)){ <br> file_get_contents("<a href="https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=XXXXXXX&PASSWORD=XXXXXXXX&dateutc=now&tempf=" rel="nofollow" target="_blank">https://rtupdate.wunderground.com/weatherstation/updateweatherstation.php?ID=XXXXXXX&PASSWORD=XXXXXXXX&dateutc=now&tempf=</a>" . $tempf . "&humidity=" . $relative_humidity_3 . "&baromin=" . $pressure); }