This is a PlatformIO project for the ESP32 microcontroller that plays an audible tone whenever an LNbits payment with a pending: false
is received via a Server-Sent Events (SSE) endpoint.
- Connects to an LNbits payments SSE endpoint.
- Detects successful payment events in real-time.
- Plays an audible tone on a piezo buzzer to notify the user.
- Automatically reconnects in case of network interruptions or server downtime.
- An LNbits instance with a wallet and the read-only API key for the wallet.
- A piezo buzzer connected to the ESP32.
Ensure you have PlatformIO installed. You can use the PlatformIO IDE for VS Code or install it via the command line.
git clone https://github.com/blackcoffeexbt/lnbits-payment-notification-audio-pinger-esp32.git
cd lnbits-payment-notification-audio-pinger-esp32
Copy src/config.h.example
to src/config.h
and edit the configuration values:
#ifndef CONFIG_H
#define CONFIG_H
const char *ssid = "Your_WiFi_SSID";
const char *password = "Your_WiFi_Password";
const char *lnbitsHost = "https://your-lnbits-instance.com";
const char *lnbitsReadApiKey = "Your_Read_Only_API_Key";
#endif // CONFIG_H
- Connect the piezo buzzer to the GPIO pin specified in the code (
const int piezoPin = 2;
). - Ensure the ESP32 is powered and connected via USB to your computer.
Using PlatformIO, build and upload the firmware to your ESP32:
pio run --target upload
Monitor the serial output to verify the connection and payment notifications:
pio device monitor
- The ESP32 connects to the configured Wi-Fi network.
- It establishes a connection to the LNbits SSE endpoint.
- When a successful payment is received, the ESP32 plays a tone sequence on the piezo buzzer.
- The device automatically reconnects if the Wi-Fi or SSE connection is lost.
This project is open-source and available under the MIT License.