JulianSchroden / LoRaWanTracker

GPS tracker which transmits its location via LoRaWan to the "The Things Network"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LoRaWanTracker

GPS tracker which transmits its location via LoRaWan to the The Things Network (TTN).

The current setup of the LoRaWanTracker

The LoRaWanTracker was created to ease the process of range testing as it allows to set transmit parameters like the data rate or interval during runtime. A small OLED display is used to draw the UI and thanks to the rotary encoder a user can interact with it.

Table of contents

Setup

Hardware

Component name Source
ESP32 Development Board Amazon.de
Adafruit RFM95W LoRa Radio Transceiver Breakout - 868 or 915 MHz Exp-tech.de
868 MHz Antenna Amazon.de
NEO-6M GPS Modul Amazon.de
0,96" I²C 128x64 Pixel OLED Display Amazon.de
KY-040 Rotary Encoder Amazon.de
Battery Holder 2*AA Exp-tech.de
Step-Up Voltage Converter 1-5V to 5V Amazon.de

Connecting the hardware to the ESP32 board is straightforward because it offers all necessary interfaces and every component is compatible with the 3.3V voltage level. The modules are connected to the microcontroller as shown in the table below.

Pinout

Module ESP32 Module
3.3V (A) 3.3V GND GND (A)
EN GPIO23 MOSI MOSI (L)
GPIO36 GPIO22 SCL SCL (D)
GPIO39 GPIO1 TX0
GPIO34 GPIO3 RX0
GPIO35 GPIO21 SDA SDA (D)
GPIO32 GND
CLK (R) GPIO33 GPIO19 MISO MISO (L)
DT (R) GPIO25 GPIO18 SCK SCK (L)
SW (R) GPIO26 GPIO5 SS RST (L)
GPIO27 GPIO17 RX (G)
GPIO14 GPIO16 TX (G)
GPIO12 GPIO4
Power source - GND GPIO0
GPIO13 GPIO2 G0 (L)
GPIO9 GPIO15 G1 (L)
GPIO10 GPIO8
GPIO11 GPIO7
Power source + 5V GPIO6
Abbreviations:
A All modules
D Display
G GPS module
L LoRa transceiver
R Rotary encoder

Software

The Arduino software makes use of the Arduino core for ESP32 project and numerous libraries listed below. I use Visual Studio Code with the PlatformIO plugin to maintain the project.

If you want to set up the project on your own computer, you can follow these steps:

Required libraries

Library name Source
Adafruit-GFX-Library https://github.com/adafruit/Adafruit-GFX-Library
Adafruit_SSD1306 https://github.com/adafruit/Adafruit_SSD1306
TinyGPSPlus https://github.com/mikalhart/TinyGPSPlus
Arduino-LMIC library (slightly modified) https://github.com/JulianSchroden/arduino-lmic/tree/testing
activity-runtime-for-arduino https://github.com/JulianSchroden/activity-runtime-for-arduino

Device registration

Visit the TTN console, add a new application to your account and register a new device. Now you can replace the credentials in src/loraConfig.h with your keys. Afterwards, you only need to build and upload the code to your ESP32 and you are ready to go.

Usage

After powering up the LoRaWanTracker, the main screen is started. Turn the rotary encoder to choose, whether you want to use OTAA (Over The Air Activation), or ABP (Activation by Personalization) to register your device.

MainActivity

When you press the integrated pushbutton the mode is selected, and the setup screen is displayed, which shows the transmission settings as a scrollable list.

SetupActivity

Scroll through the entries by turning the encoder and push the button to select the attribute you want to modify. A screen is started as a result which lets you pick the attribute's value.

DataRateChooserActivity

After you have selected the desired value, you can go back to the setup screen by pressing the button for 1 second. Navigate to the "start" entry at the bottom of the setup screen when you are happy with the device settings and push the button once again to start the location transmission screen.

LoRaTesterActivity

If you have chosen the OTAA mode, the tracker will try to join the network at first. Afterwards, the display shows the current location and transmission parameters alongside the seconds since the last and till the next message. From now on the tracker will transmit its location continuously until you return to the upper screen (hold button for 1 second) or it is powered off.

Suggestions

The LoRaWanTracker could be improved by:

  • Adding a larger screen
  • Replacing the non-rechargeable battery with a rechargeable one
  • Adding a 3D printed housing

About

GPS tracker which transmits its location via LoRaWan to the "The Things Network"

License:MIT License


Languages

Language:C++ 93.1%Language:C 6.9%