LoRaWAN Weather station created for VarnaLab in Micropython
За български език ТУК
This project uses the following libs:
- SDS011 dust sensor
- BME280 temperature, pressure and humidity sensor
- Microcontroller LILYGO TTGO LORA32
You should download the specific micropython firmware from here
bmе280 works over I2C bus. Connect to the following MCU pins sda = 21, scl= 22
Dust sensor works over UART. Connect to the following MCU pins rx = 16, tx = 17
Wifi and The Things Network settings are located in the file config.py
You have to create a device in TTN. It works only with ABP authentication since micropython driver doesn't support OTAA.
The file ttn_payload_formatter_function.js contains а javascript function which formats the payload for TTN processing. Don't forget to change above_sea_level
variable in that function to match your location's altitude in meters. This function has to be put in the following place in TTN:
Applications > [your application] > End devices > eui-[your device id] > Payload formatters > Uplink
This function is made to work with the struct, located in the MCU code.
It is important to upload the files on the MCU with the following file structure:
There is a class (esp32ble.py) in Extras folder, which class allows using the esp32 bluetooth. I still haven't implemented it in the main.py file, but it can be used for UART debug, while the weather station is working. There is sample code in the same folder.
Lilygo micropython formware doesn't have umqtt module preinstalled, so you have to upload the umqtt directory from the repo to your board.