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


21 Replies to “HAB Watch”

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

  2. 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.

  3. Dear Dave, i have ordered an TTGO Watch and try to compilate the software – I get back an Error : ‘AXP20X_Class’ does not name a type.
    I have tried several AXP20 Libaries – without success. Do you have an Idea?
    Regards and many thanks -Dan

  4. ..and also in the S7xG Sketch I get :’PC11′ was not declared in this scope. I dont know what to do.
    Sorry for the stupid questions but a cant get any further.
    73 Dan

    1. It’s because S7xG sketch is ment to be compiled for STM32 (Nucleo-64) and uploaded via ST-Link USB programmer.

      You need to apply this settings in Arduino:
      | BOARD – Nucleo-64
      | BOARD PART NUMBER – Nucleo L073RZ
      | U(S)ART SUPPORT – Enabled (no generic serial)
      | USB SUPPORT – None
      | C RUNTIME LIBRARY – Newlib Nano + Float printf
      | UPLOAD METHOD – STM32CubeProgrammer(SWD)

      1. i have then the issue that ,..
        ST-LINK SN : 48FF70066578555530171967
        ST-LINK FW : V2J33S7
        Board : —
        Voltage : 3.28V
        Error: No STM32 target found!

        What di i wrong here?

    1. You need to ensure that the STM board is powered, and the easiest way to do that is to run firmware on the ESP32 that supplies power to the STM32. That could be my firmware or one of the GPS samples that TTGO supply.

      Otherwise the STM23 has no power and will be invisible to the programmer.

      1. Dave, do you need to power the STM32 in addition to the 5V on the ST-LINK? I am having the same problems with no target found. My S76G PCB is V1.6 with a small row of holes for 5V, RESET, GND, SCLK, SDIO which I am connecting the ST-LINK to. There is also a BOOT0 button on this PCB.

        I tried completely disconnecting this PCB from the ESP32 board with no difference.

        I can’t find reference to this specific PCB online, I only see v1.3.

        1. I found my issue. I had a bad solder joint on the pin headers I soldered to the ACSIP S7xG board for programming. After I fixed it, no problems.

          In case it helps anyone else, I was running example watch code that was powering the S7xG board and then connected GND, RST, SDCLK and SDIO to my STLINK and then STM32CubeProgrammer could see the board and I could download Dave’s code using the Arduino IDE.

          Now to go through Dave’s code to make the LoRa settings match my tracker 🙂

          1. I had another issue, I couldn’t program the STM32 when I was running Dave’s software on the watch. I kept getting no target found. If I loaded the example watch program again, then I could program the STM32 board. So my steps were to load the example program to the ESP, program Dave’s modified STM32 program to the ST and then program the ESP again.

  5. Today was bussy with the t-watch project en ttgo-tbeam everyting seems to work but if i want to connect to the app hab-explora its says no serial connection and close the app also no connection is possible t-watch what do iwrong with the config
    Marco van laarhoven
    Laarhoven@xs4all.nl

    1. There’s no connection coded between those programs.

      If that’s the original T-Watch with LoRa and GPS, it’s completely stand-alone.

      If that’s the T-Watch 2000 then it connects to a T-Beam LoRa/GPS receiver via BLE.

Leave a Reply

Your email address will not be published. Required fields are marked *

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