Tag Archives: Arduino

ESP32 LoRa GPS Range Tracker – Part 1

The outset

A few months ago, I installed a LoRa Gateway and I was able to talk a friend into setting up a second gateway. Both are connected the TheThingsNetwork.org.

The idea is to build cheap, simple sensors for all sorts of stuff (temperature, rain, wind, usage of the football goals) and place them around our village (garden, school, commons, etc.).

The problem

But we do not know the range of our gateways just yet. Of course, we could get in our car with a simple module and drive until we lose connectivity. But where is the fun in that?

So the plan is to build a GPS enabled LoRa module, that logs the signal strength and allows us to draw a heat map of LoRa coverage in our area. It should also allow us to test different antennas and understand better how they influence the range.

The solution

An ESP32 with LoRa and display was sitting in my drawer and I ordered a GPS/GLONASS module from AliExpress. Everything us assembled on an impromptu test rack, ready to e powered by a USB power bank.

 

(The big yellow knob is a rotary encoder)

Next Steps:

 

    • Get the GPS to work (fuGPS library)
    • Get the display to work (U8g2lib library)
    • Connect the rotary encoder
    • Implement a menu system for parameter editing and control (ArduinoMenu library)
    • Figure out how to derive meaningful signal strength data from the LoRa transceiver
    • Connect an SD Card reader and log GPS and LoRa data
    • Do some wardriving and create a heat map of the area

Wemos TTGO ESP8266 with 0.91 Inch OLED

Sites in China and eBay sell an ESP8266 module with 4MB flash and a build-in 0.91″ monochrome OLED display and a rechargeable battery port.

TTGO OTA Demo

Display

The display is a 128×32 pixel display connected via an SSD1306 controller.
It took me a while to figure out how to get the display to work – the Chinese sellers provide a rubbish demo script that uses the wrong pins for the I2C interface to the display controller.

The following pins and library combination works well:

U8g2 library: https://github.com/olikraus/u8g2
Data= pin 2
Clock= pin 14
Reset= pin 4

A demo program is available here: ESP8266_LCD_Demo

TTGO pinout

Drivers

As often, the board requires additional USB UART drivers.
I found suitable drivers for my Mac here – they also offer Windows and linux drivers:

https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers

WiFi

The antenna gain seems to be quite poor – I noticed the module loses connection to my AP about at half the distance that my ESP8266-12 or ESP8266-01 modules tolerate.
I successfully managed to run OTA updatable code (see example).

 Layout

The board layout is a bit unfortunate as so far as the micro USB connector is mounted on the top, protruding in height above the display, which will not allow to mount the module flush against the top of a case.

Two buttons (reset and GPIO01) allow to invoke flash mode and reset the device, which comes in handy during development.

The pins are labelled both on the front and back side of the board.

TTGO frontTTGO back

Price

At time of writing, the board can be bought between $9 and $12 from Chinese sellers and for $15-$20 from Western distributors. The ones I bought came with a plastic box, a battery cable and connector and pin headers (not soldered)