ESP32 Wi-Fi Panic Button

A standalone emergency alert system with email, webhook notifications and battery monitoring

✨ Features

Wi-Fi Configuration

Easy setup with a user-friendly captive portal for network configuration

Email Alerts

Sends instant SMTP email notifications when the panic button is activated

Webhook Integration

Send JSON payloads to custom endpoints for integration with other systems

Battery Monitoring

Visual battery gauge with percentage display and low battery alerts

OTA Updates

Automatic Over-The-Air firmware updates for easy maintenance

Testing & Reset

Built-in functions for testing notifications and performing factory resets

🛠️ Hardware Requirements

Pinout Configuration

Component GPIO Pin Notes
Panic Button 4 Active LOW (connect to GND when pressed)
Status LED 15 Onboard LED, indicates system status
Battery ADC 0 Monitors battery voltage level

📦 Dependencies

This project relies on the following Arduino libraries:

View Project on GitHub

🚀 Getting Started

  1. Flash the Firmware: Upload the project code to your ESP32-C6 using the Arduino IDE.
  2. Initial Setup: When first powered on, the ESP32 will enter Setup Mode:
    • The device creates a Wi-Fi access point named PanicAlarm_XXXX (where XXXX is derived from the MAC address)
    • Connect to this network with password setupalarm
    • A captive portal should automatically open (or navigate to 192.168.4.1)
    • Configure Wi-Fi, email and/or webhook notifications, and device location
  3. Normal Operation: After configuration, the device will:
    • Connect to your Wi-Fi network
    • Begin monitoring for button presses
    • Track battery status
    • Show operational status via the LED indicator
  4. Accessing the Interface: Find the device's IP address from your router or serial monitor, then access it via a web browser.

🔧 Web Interface Simulator

Try out the control panel interface with this interactive simulator:

🔋 Battery Monitoring

The device includes comprehensive battery monitoring with visual feedback:

Battery Gauge

The control panel displays a color-coded battery level indicator:

75%

Low Battery Alerts

When battery level drops below 50%, the device will:

Both voltage and percentage information are tracked and included in notifications.

🌐 Webhook Integration

The device can send JSON payloads to a custom URL when events occur:

Webhook Payload Example

{
  "event": "PANIC_ALARM_TRIGGERED",
  "device_id": "PanicAlarm_AB12",
  "mac_address": "A4:CF:12:67:AB:12",
  "location": "Front Door",
  "ip_address": "192.168.1.42",
  "battery_voltage": 3.82,
  "battery_percentage": 68,
  "triggered_at": 1428
}

Event Types

Testing

You can test webhook functionality directly from the web interface using the "Test Webhook" button in the control panel.

📱 Usage Instructions

Triggering an Alert

Factory Reset

To clear all stored settings and return to setup mode:

  1. Navigate to http://[device-ip]/reset in your browser
  2. Confirm the reset when prompted
  3. The device will restart and create the setup access point

LED Status Indicators

Pattern Meaning
Solid On Alert triggered / sending notifications
Slow Blink (5 pulses) Setup mode active
Quick Blink (5 pulses) Low battery warning
3 Blinks Successfully connected to WiFi

🖨️ 3D-Printed Case

This project includes a printable enclosure designed for the FireBeetle ESP32-C6 and a small push-button. You can find the model files in the case/v1/ directory of the GitHub repository:

  • panic_button_case.3mf – full project file with all parts arranged
  • case_back.stl (View)
  • case_bottom.stl (View)
  • case_front.stl (View)
  • case_top.stl (View)

Recommended Print Settings

  • Material: PLA, PETG, or similar
  • Layer height: 0.2 mm
  • Infill: 15–20%
  • Supports: Optional (recommended if top and bottom alignment is critical)
  • Walls: 2–3 perimeters

Align the case halves carefully post-print; the included case_top and case_bottom have interlocking features with screw holes that benefit from clean bridging or light support settings.

Panic Button Case

🔄 OTA Updates

This device supports automatic Over-The-Air firmware updates via the included OTA update server:

For hosting your own OTA update server, refer to the OTA Server README for complete setup and usage instructions.

📄 License

Firmware: The source code for this project is licensed under the GNU General Public License v3.0 (GPLv3). You are free to use, modify, and distribute it under the terms of this license. See the full LICENSE for more information.

OTA Server: The OTA server code is licensed under the GNU Affero General Public License v3.0 (AGPLv3). You are free to use, modify, and distribute it under the terms of this license. See the full ota-server/LICENSE for more information.

3D-Printed Case: The STL and 3MF files for the enclosure are licensed under the MIT License, allowing for open use and modification with attribution. See case/LICENSE for details.