HAB Watch

One of the nice things about LoRa vs traditional radio modulation techniques used by high altitude balloons, is that LoRa chips include decoders.  So whereas RTTY and APRS generally require a PC to decode the signal, LoRa only needs a basic microcontroller.  So LoRa receivers are cheap and small.


I’ve made several different LoRa receivers, from Raspberry Pi gateways down to a handheld Arduino-based receiver.  The latter is battery powered, quick to start, lightweight and portable.  It shows distance and direction to the payload so it’s ideal for the “last mile” chase of a balloon on foot, which is typically across a field, but it’s long been a dream of mine to make something even smaller that can be worn like a watch.

TTGO T-Watch


One option for this is a Smartwatch linked to a LoRa receiver, but suitable watches are expensive.  So I was very interested to discover the LilyGo T-Watch which is about £50 delivered including a GPS/LoRa board.  So that makes the watch a completely self-contained LoRa chase watch.

lilygo® ttgo t-watch upgraded version sim800l gps lora ...
Lilygo TTGO T-Watch



It packs a lot of devices into a rather thick but still practical watch – not something you’d want to wear all the time but absolutely fine for an activity like chasing a balloon.  The watch contains:

  • ESP32 processor running at 240MHz
  • 16 MB flash
  • 8 MB PSRAM
  • WiFi
  • Bluetooth / BLE
  • 180mAh battery
  • AXP202x battery management
  • 240×240 IPS backlit LCD touch-screen
  • micro-SD
  • I2C port
  • RTC
  • 3-axis accelerometer
  • power and custom buttons
  • (optional) LoRa + GPS board (S78G for 434Mhz).

Of those, the CPU, battery and power management, touchscreen and LoRa/GPS are what we need.

S78G LoRa/GPS Board

Rather than having those devices connect directly to the ESP32 on the main board, they connect to a small STM32 processor.  The GPS connects to the STM32 by serial, the SX1276 LoRa chip connects via SPI, and the STM32 connects back to the ESP32 over another serial connection.

The STM32 comes programmed with stock LoRaWAN firmware.  This firmware does not provide access to all LoRa modes, does not report GPS altitude, and is generally unsuitable for our purposes.  There does exist alternate firmware as part of the SoftRF system, which helps on the GPS side by sending raw NMEA packets from the GPS, but does not solve the LoRa limitations.  So I had to write my own firmware.

Programming

Both the main (ESP32) and backplane (STM32) processors can be programmed using the Arduino IDE, and LilyGo supply a library with examples for the ESP32.

To program the ESP32, install an ESP32 board package into the IDE, install the Lilygo library, and connect the watch to host computer via the supplied USB C cable.  In the IDE, choose the “TTGO T-Watch” board option, select the correct serial port, and then load one of the sample programs.  Note that to test the GPS you must use the S7XG/GPS example and not the regular GPS example.

To program the STM32, install an STM32 board package and select the Nucleo 64 / L073RZ board.  There are some other board settings which have to be set correctly, since the S78G uses different serial port connections to those on the L073RZ board; my S7XG firmware on github shows the options.  Also, you need to buy and connect an ST-Link USB programmer (inexpensive) and make up a custom cable to connect from the programmer to the 5 programming pins on the S78G.

S78G Firmware

The aim here is to provide the the following capabilities for the host ESP32:

  1. Receive GPS latitude, longitude, altitude and direction
  2. Receive packets received by the LoRa module
  3. Set the LoRa module frequency and other settings

Item (1) is something that any balloon tracker does, so I wasn’t short of code to borrow.  However, the S78G uses a Sony GPS and not the usual UBlox, so I had to use code that handles standard NMEA messages instead of the UBlox custom protocol.

Items (2) and (3) I’ve also already coded, for example in my LoRa OTG device for phones and tablets.  This code provides a serial protocol which I can use here to allow the ESP32 to set frequency etc. and to receive LoRa packets.

So it didn’t take long to merge my existing source code together and have something that should work on the S78G, assuming I knew the pin allocations for STM32 to GPS and LoRa.  Documentation on this proved elusive, but fortunately the SoftRF firmware I mentioned is open source on github, so I searched that code for the information I needed.

If you want to program your own T-Watch S78G with my firmware, download it from github.

TTGO Firmware

This firmware has these functions:

  • Display various screens, chosen by the user:
    • Logo screen with version etc.
    • GPS screen with current GPS data
    • LoRa screen with current balloon telemetry
    • Direction screen showing distance and direction to balloon
    • Settings screen allowing change of LoRa frequency and mode
  • Display status bar (GPS status, LoRa status, Battery status) at all times
  • Communicate with S78G board:
    • Receive GPS position
    • Receive LoRa telemetry
    • Send LoRa frequency and mode on startup and when changed
  • Monitor user button and touchscreen for swipes (screen change) and presses (settings buttons)
  • Store settings in EEPROM after changing them, and load from EEPROM on startup

If you want to program your own T-Watch S78G with my firmware, download it from github.

Operation

The watch starts up with this logo screen:


Note the status bar with:

  • GPS status bar
  • Battery level
  • LoRa signal strength bar
  • LoRa status bar

To change to the next screen, swipe up or left, or press the user button briefly (less than 0.5 seconds); to change to previous screen swipe down or left, or press the user button for at least 0.5 seconds.  The screen sequence is:

Logo –> GPS –> LoRa –> Direction –> Settings

The screens are in a loop so going “back” from Logo takes you to the Settings screen.

GPS Screen

LoRa Screen

Direction Screen

Note that the direction relies on knowing the user’s direction as reported by the GPS, so if you have not moved recently then take a few steps forward so that the GPS can measure your direction.

Settings Screen

Just touch the buttons to adjust the LoRa mode up/down.

Touch the frequency up/down buttons to adjust the frequency in 1kHz (</>) or 25kHz (<</>>) steps.

Video


This entry was posted in Weather Balloon. Bookmark the permalink.

8 Responses to HAB Watch

  1. Pingback: Custom Firmware Makes a LoRA-Enabled HAB Tracker Watch | 3d print ......errori ed esperienze,

  2. Pingback: Custom Firmware Makes A LoRA-Enabled HAB Tracker Watch – Satoshi Nakamoto Blog

  3. Pingback: Custom Firmware Makes a LoRA-Enabled HAB Tracker Watch

  4. Thorsten says:

    Very cool and thanks for sharing! One question, how long does the battery last while tracking?

  5. Joel says:

    I’m not fully versed on LoRa, so I might be missing something. What is the transciever for the LoRa object you are tracking? I’m wondering if you could potentially track the location of multiple objects, switching between them on the watch.

  6. Vlad YO3IHG says:

    Hi Dave,

    Do you have any software available for the TTGO LoRa32 2.1_1.6 or T-Beam v1.0 boards?

    Thanks,
    Vlad YO3IHG

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.