Weather Station
Link to GitHub Repository
GitHub - jhughes1010/weather_v4_lora: LoRa based weather station
NOTE: Certainly not ready for public consumption quite yet
Software Goals
Minimal use of RTC variables
TX data to the receiver for stable storage
RTC will be used for rain gauge count and will be zeroed out after every send
Creative way to sync TOD or calibrate RTC on weather station
RTC is present on ESP32, but not good enough for long term time keeping (+/- 5% tolerance)
Try to send raw data structure, not human readable txt
minimize TX byte count. This will matter more for LoRaWAN TX budget
Software Milestones
Software Configuration
changes are needed in defines.h
LoRa radio band
This configures the radio to TX/RX on the desired legal frequency for your locale.
//===========================================
//LoRa band
//===========================================
#define BAND 915E6 //you can set band here directly,e.g. 868E6,915E6
Wake Frequency
//===========================================
//Set how often to wake and read sensors
//===========================================
const int UpdateIntervalSeconds = 30; //Sleep timer (30s) for my normal operation
#define SEND_FREQUENCY_LORA 5
UpdateIntervalSeconds is set to define how often the station wakes. In the example above, we wake every 30s, and transmit every 5 wake operations. We also alternate the hardware and sensors data sends on the LoRa send.
Why wake, but not send. This lets us get improved resolution on the wind speed and gusting.
WAKE CYCLE | Activity |
---|---|
0 | LoRa sensor send. Zero out gusting/max wind speed. |
1 | Wind speed measure and update max wind speed. |
2 | Wind speed measure and update max wind speed. |
3 | Wind speed measure and update max wind speed. |
4 | Wind speed measure and update max wind speed. |
5 | LoRa hardware send. |
6 | Wind speed measure and update max wind speed. |
7 | Wind speed measure and update max wind speed. |
8 | Wind speed measure and update max wind speed. |
9 | Wind speed measure and update max wind speed. |
Every cycle is an opportunity to gather max wind speed data. Max speed and single sample speed data are sent on every bootCount%10==0 cycle. Not only do we receive instantaneous wind speed, but max wind speed over the last 10 measurement cycles ( or 5 minutes in my default case).