Project · Engineering
LoraSky Weather Station
Weather station for home use: sensors in a 3D-printed enclosure, readings sent over LoRaWAN to a desktop dashboard.
- Ref.
- 02.03
- Period
- Dec 2023
- Status
- Completed
- Organization
- Master — IMERIR
- Contributors
- Axel COLMANT and Jules DUTILLEUX
- Stack
- ESP32 (Heltec WiFi LoRa 32)
- LoRaWAN
- The Things Network
- MQTT
- JavaScript
- Python
- 3D printing
Key points
- Five sensors and two relays on an ESP32 LoRa board, in a 3D-printed enclosure.
- All readings packed into a 32-bit frame and sent over LoRaWAN.
- Decoding script on The Things Network, then MQTT to a Python dashboard with history and relay control.
- LoRa settings chosen from reliability tests at 50 m: SF7, 125 kHz, 14 dBm.
The idea
A weather station for home use (Fig. 1): measure the conditions outside, send them in real time, keep a history, and act on them, for example switching on a light.
The IoT course first had us study LoRaWAN, then apply it to a project of our own. We built LoraSky in a team of two, with Jules Dutilleux, and shared every part of it.
The system
Four steps take a reading from the garden to the screen (Fig. 2):
- Measure. The station reads its sensors.
- Pack. All readings fit in one 32-bit LoRaWAN frame.
- Decode. A LoRaWAN gateway provided for the course picks up the frame and forwards it to The Things Network, where a script turns the frame back into real values and publishes them over MQTT.
- Show and act. A desktop app keeps the history, draws the charts and drives the relays.
Studying LoRa first
Before building anything, we measured how reliable a LoRa link is depending on its settings, with two ESP32 LoRa boards talking directly to each other, one sending and one receiving. To test many configurations, the sender and the receiver switch to the next one together, and fall back to the last working one if they lose each other (Fig. 3).
We then measured the delivery rate at 50 m for spreading factors 7, 9 and 11, bandwidths of 125 and 250 kHz, and transmit powers from 1 to 19 dBm (Fig. 4).
We picked SF7, 125 kHz and 14 dBm for the station: short airtime, with a margin on power.
The station
The enclosure is 3D-printed in two parts, with the electronics at the top and the rain collector below; the soil probe sticks out underneath (Model 1).
Everything runs on a Heltec WiFi LoRa 32, an ESP32 board with a LoRa radio (Fig. 5).
The BMP280 sits on the I²C bus, the soil probe on an analog input, and the other sensors and the two relays each take one pin.
Each sensor gets just enough bits in the frame for the precision it needs (Table 1).
| Part | Measures | Bits |
|---|---|---|
| BMP280 | Temperature | 7 |
| BMP280 | Pressure, then altitude | 5 |
| Ultrasonic sensor | Water level in the collector, then rainfall | 6 |
| Soil probe | Soil moisture | 6 |
| Photoresistor | Light, day or night | 1 |
| Raindrop sensor | Rain, yes or no | 1 |
| Two relays | State of the light and of the window | 2 |
| Free | Room for another sensor | 4 |
Getting the data out
LoRaWAN messages are small, so every reading is packed into a single 32-bit frame (Fig. 6), with the bit budget of Table 1, then split into bytes for sending.
The course's LoRaWAN gateway receives the frame over the air and forwards it to The Things Network, where a JavaScript decoder receives the bytes, turns them back into real values, computes the extra ones (altitude from pressure, rainfall from the water level) and publishes the result over MQTT, where the app picks it up.
The app
A Python desktop app subscribes to MQTT, stores the readings and shows them as charts: temperature, rain, pressure and altitude, humidity and light, for any date (Fig. 7). A second tab drives the light and the window, by hand or automatically (Fig. 8).
Going further
A mobile app, a more compact enclosure, choosing how often the station measures from the app, and connecting it to other smart devices.