THE THINGS NETWORK LoRaWAN COVERAGE TRACKER - MEDIALAB_ LPWAN: LORA TRACKER TO MEASURE COVERAGE PROVIDED BY OPEN GATEWAYS CONNECTED TO TTN
Introduction ↩️
With the objective of studying LoRa coverage quality at Gijón EPI Campus a physical device was required to send a message to all gateways conected to The Things Network and store the values for RSSI and SNR.
In this repo, you will find all the files and teaching guides required to fully understand and even take the creative freedom to improve this project. Folders and files have been given a self-explanatory name to make navigation more intuituve.
Main features ↩️
-
Developed using LilyGO LoRa32 OLED v2.1_1.6 (ESP32 based board with built-in LoRa capabilities that supports solar recharging and battery management)
-
Custom PCB
[!TIP] Consider soldering female pin connectors so the electronic components can simply be plugged in and unplugged if a repair has to be done
-
Custom housing to fit all the elements in the most efficient way (Container + Solar panel holder + USB protector)
Assembly example:
[!WARNING] Clear colour PETG 3D printing filament is recommended to survive sun radiation and plastic deformations. An O-ring is also a good choice to fix and stabilize the sensor inside of the bell. Four M3 screws are needed to fix the assembly
Component list ↩️
Component | Model |
---|---|
Dev Module | LilyGO LoRa32 OLED v2.1_1.6 |
Button | Generic press-button |
Battery | 18650 |
PCB | Custom (file included) |
Housing | Custom (file included) |
Connection list ↩️
LilyGO | Button | Battery |
---|---|---|
GPIO25 |
Crossed-pin |
- |
GND |
Crossed-pin |
- |
BAT CONN |
- | BAT CONN |
Sketched it looks the following way:
Flowchart (Simplified!) ↩️
graph TD;
A[Turn on] -->|1| B(Wake up if in deep sleep)
B -->|2| C(Get distance and battery measurement)
C -->|3| D(Send bytes to TTN)
D -->|4| E(Time data transmission rate)
E -->|5| F(Go to deep sleep)
F -->|6| B
Code files ↩️
In this section, a brief description on how the code is distributed among files in medialablpwan/lorawaterlevelmonitoring/main/
, where the code is available and ready to flash or edit, is given:
main.ino
/* Definition of global functions Variables to be stored in the RTC memory 'setup()' and 'loop()' functions */
sensor.ino
/* Functions and variables needed to make a sensor work */
ddc.ino
/* Functions and variables for the implementation of the dynamic data transfer rate */
sleep.ino
/* Functions to activate ESP32's deep sleep mode */
ttn.ino
/* Functions from LMIC library */
configuration.h
/* Sensor macros and boolean toggles */
credentials.h
/* OTAA keys for TTN synchronization */
lmic_project_config.h
/* LoRa frequency band and radio chip selector */
A more in depth analysis is given in the code itself as comments explain what each function does.
[!TIP] The most important files to edit are
sensor.ino
, where any sensor can be implemented, andconfiguration.h
, where the peripherals' macros are declared
[!CAUTION] Additional code may be needed if implementing I2C I/O. The functions to make them work are in the original project in
TTGO-PAXCOUNTER-LoRa32-V2.1-TTN/main/main.ino
Libraries ↩️
-
LilyGO board library (Paste the link on the
Preferences
tab and chooseTTGO LoRa32 OLED
asBoard
in Arduino IDE): https://github.com/Xinyuan-LilyGO/LilyGo-LoRa-Series/blob/master/boards/t3_s3_v1_x.json -
LMIC (Copy the contents of the project file
main/lmic_project_config.h
to the library filearduino-lmic/project_config/lmic_project_config.h
and uncomment the proper frequency for your region. The sketch does always look at the library folder for the configured region!): https://github.com/mcci-catena/arduino-lmic -
QuickMedianLib (To obtain more solid distance values): https://github.com/luisllamasbinaburo/Arduino-QuickMedian
-
ESP sleep (To reduce battery consumption): https://github.com/pycom/pycom-esp-idf/blob/master/components/esp32/include/esp_sleep.h
[!NOTE] Other libraries, like SPI library, are easily downloadable from Arduino IDE
License ↩️
This project is licensed under the GPL-3.0 license. Contains code from rwanrooy/TTGO-PAXCOUNTER-LoRa32-V2.1-TTN
Contact ↩️
[!IMPORTANT] We will kindly answer doubts and read suggestions:
Authors: Daniel Rodríguez Moya, Óscar Gijón, Ramón Rubio and MediaLab_ LPWAN Workgroup