Skip to content
NewA realistic 3D head for a free swim cap editor
Nov 16, 2026·4 MIN READ
One button on my GPS tracker now texts where I am

One button on my GPS tracker now texts where I am

I wired the BOOT button of the LILYGO T-A7670E to send an SMS with a map link. The code took minutes. A cold GPS, a wrong phone number and a busy serial port took the evening.

The tracker from the one-hour proof of concept can now send a text. I hold one button on the board, and two phones get an SMS with a Google Maps link to where I am. The live map is good for someone who wants to watch a run. The text is for the moment I want to say "I am here" and nobody has the map open.

The first text with a real position arrived the same evening. Four texts before it said only this:

the SMS thread on the phone
Tracker is on, but there is no GPS fix yet.
Tracker is on, but there is no GPS fix yet.
Tracker is on, but there is no GPS fix yet.
Tracker is on, but there is no GPS fix yet.
I am here: https://maps.google.com/?q=51.507400,-0.127800

The coordinates above are sample data, not my balcony.

Which button is free

The board has three small push buttons. The schematic shows what each one is wired to, but not where it sits on the board.

ButtonWired toFree for my code
S1The modem's own USB boot lineNo, the ESP32 cannot read it
S2 (RST)The ESP32 reset lineNo, it restarts the board
S3 (BOOT)GPIO 0, with a pull-upYes, once the board is running

I found BOOT by pressing each button with the serial monitor open. One printed my debug line, one restarted the board, one did nothing.

GPIO 0 is a strapping pin. Hold BOOT while the board powers on and the ESP32 starts in flashing mode, so the tracker never runs. Press it only after the start.

From a press to a text

flowchart LR
    B["BOOT held 3 s<br/>then released"] --> I["Interrupt<br/>sets a flag"]
    I --> L["Main loop<br/>sees the flag"]
    L --> T["Text with the<br/>newest fix"]
    T --> S["One SMS<br/>per number"]
    S --> C["30 s cooldown"]

The main loop reads a fix every 5 seconds and uploads it over HTTPS. That upload can block for seconds, so a loop that only polls the pin would miss a short press. An interrupt catches the press and the release, and the loop does the slow part later:

firmware/src/main.cpp
static void IRAM_ATTR onButton()
{
    if (digitalRead(BOARD_BOOT_PIN) == LOW) {
        pressed = true;
        pressedMs = millis();
    } else if (pressed) {
        pressed = false;
        if (millis() - pressedMs >= BUTTON_HOLD_MS) {
            smsRequested = true;
        }
    }
}

The modem sends the SMS itself with one library call per number. The numbers live in config.h as one comma separated string, and that file is never committed.

What cost time

ProblemWhat it looked likeFix
Six test pressesSix log lines, so six texts with a real numberOne round of SMS per 30 seconds
Wrong phone numberNo text on my phoneTwo digits were off. Read the number back before the flash
Busy serial port"Could not open port, the port is busy"Close the serial monitor before every upload
Cold GPS"No GPS fix yet" in every textWait outside. The first fix took minutes
Lost fixThe points stopped for five and a half minutesThe board had gone back inside. On the balcony the fix returned

The cold start confused me the most. A red light on the board kept blinking, and I read that as "still searching". At the same time the server was getting a new point every 5 seconds.

Check the data, not the LED. One request to the server told me in a second that the fix was there, while I was still staring at a blinking light.

What it took

The feature is about 60 lines of firmware and it built on the first try. The evening went into everything around it, again: finding the right button, a phone number with two wrong digits, a port held by my own monitor, and a receiver that needs sky and patience. The 3 second hold came last, after I saw how easy it is to send a text by accident. It is built and committed, and its test on the board is the next thing I do. The newest fix still lives in RAM only, so a restart forgets it. Next I will keep the last position across a restart, so the text can say "last seen here, 10 minutes ago" instead of "no fix".

Share
Mariusz Smenżyk
Written by

Mariusz Smenżyk

Builder for sport. Make. Test. Launch.

Related notes