Turn a LoPy4 + PyTrack GPS tracker into a push notification device with NotifyBridge.
Platform: Espressif ESP32 · Board: lopy4 · Framework: Arduino (ESP32 core)
Runs on a Pycom LoPy4 module mounted on the PyTrack v2.0 expansion board.
| Sensor | Library | Usage |
|---|---|---|
| L76GNSS (GPS) | TinyGPSPlus | Position (lat/lon), speed, altitude, satellite count |
| LIS2HH12 (accel) | rhio-LIS2HH12 | Acceleration (g), earthquake detection |
The L76GNSS communicates over I2C (address 0x10) rather than UART. GPS time is used to sync the ESP32 RTC via settimeofday() on first valid fix; heartbeat timestamps switch from uptime to wall-clock UTC once synced.
| Event | Trigger | Priority | Cooldown |
|---|---|---|---|
| High speed | GPS speed > 120 km/h | 2 | 5 min |
| Earthquake | 3+ consecutive accel deviation > 0.2 g from 1 g | 2 | 5 min |
| Heartbeat | Every 30 minutes — includes RSSI, sensor snapshot, and position drift | −1 | — |
- Button on GPIO 37 (PyTrack P14) — sends a priority-1 notification with timestamp and sensor snapshot on press
- WS2812B RGB LED on GPIO 0 — IDLE state flashes green when GPS has a fix, blue while waiting for fix
- Position drift tracking — the heartbeat reports maximum drift (metres) and sample count since the last heartbeat
- Uses the native ESP32
HTTPClientlibrary for HTTPS POST
- PlatformIO (CLI or VS Code extension)
- A Mindeon NotifyBridge account with an API token and user key
git clone https://github.com/mindeon/NotifyBridge-LoPy-PyTrack.git
cd NotifyBridge-LoPy-PyTrackConfigure your credentials in src/main.cpp:
#define WIFI_SSID "YOUR_WIFI_SSID"
#define WIFI_PASSWORD "YOUR_WIFI_PASSWORD"
#define NB_API_TOKEN "YOUR_API_TOKEN"
#define NB_USER_KEY "YOUR_USER_KEY"
#define NB_DEVICE_CODE "YOUR_DEVICE_CODE"Build and upload:
pio run --target upload| State | Pattern | Meaning |
|---|---|---|
| CONNECTING | Fast 100 ms toggle | Joining WiFi |
| IDLE | 50 ms flash every 3 s | Connected, waiting |
| SENDING | 3 rapid 50 ms blinks | Sending notification |
| DISCONNECTED | Slow 500 ms toggle | WiFi lost |
HTTP POST to https://notifybridge.mindeon.net/v1/messages/send with JSON payload:
{
"api_token": "YOUR_API_TOKEN",
"user_key": "YOUR_USER_KEY",
"device_code": "YOUR_DEVICE_CODE",
"message": "Notification text",
"priority": 1
}Failed requests are retried with exponential backoff: 2 s initial delay, doubling up to 60 s, for a maximum of 5 attempts.
| Priority | Meaning |
|---|---|
| −1 | Background / heartbeat |
| 1 | User-triggered (button press) |
| 2 | System alert (WiFi restored, sensor event) |
This project sends push notifications via NotifyBridge, a cloud notification service for embedded and IoT projects — no Firebase SDK, no mobile development, no notification backend, just an HTTPS request.
- 📖 REST API
- 📚 Full developer guide — setting up your account, creating devices, claiming, groups
- 🧭 Other supported devices
See LICENSE for details.