Turn a LoPy4 + PySense environmental sensor 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 PySense v1.1 expansion board.
| Sensor | Library | Usage |
|---|---|---|
| Si7021 (temp/humidity) | Adafruit Si7021 | Temperature (°C) and relative humidity (%) |
| MPL3115A2 (pressure) | Adafruit MPL3115A2 | Barometric pressure (hPa) and altitude (m) |
| LTR329 (light) | Adafruit LTR329 and LTR303 | Ambient light (lux) |
| LIS2HH12 (accel) | rhio-LIS2HH12 | Acceleration (g), earthquake detection |
| Event | Trigger | Priority | Cooldown |
|---|---|---|---|
| High temperature | T > 35 °C | 2 | 5 min |
| Low temperature | T < 5 °C | 2 | 5 min |
| High humidity | H > 80% | 2 | 5 min |
| Low humidity | H < 20% | 2 | 5 min |
| Low pressure | P < 970 hPa | 2 | 5 min |
| High light | L > 10 000 lux | 2 | 5 min |
| Earthquake | 3+ consecutive accel deviation > 0.2 g from 1 g | 2 | 5 min |
| Heartbeat | Every 30 minutes | −1 | — |
- Button on GPIO 37 (PySense P14) — sends a priority-1 notification with a full sensor snapshot on press
- WS2812B RGB LED on GPIO 0 (LoPy4 onboard)
- 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-PySense.git
cd NotifyBridge-LoPy-PySenseConfigure 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.