A full-stack Internet of Things (IoT) emergency alert system combining custom ESP32 microcontroller firmware with a Python/Flask local web server. When a physical hardware button is pressed, the system instantly triggers an SMS notification to family members via the Twilio API.
Disclaimer: This project is for educational and personal prototype use only. It is not a certified medical life-safety device and should not replace professional medical alert systems.
- Hardware: ESP32 Development Board, push-button circuit.
- Firmware: C++ (PlatformIO / Arduino framework).
- Backend Server: Python (Flask).
- External APIs: Twilio Communications API.
- Network: Local TCP/IP communicating over home Wi-Fi.
This project requires a simple physical circuit.
Components Needed:
- 1x ESP32 Dev Board
- 1x Momentary Push-Button
- 1x Breadboard
- 2x Jumper Wires
Wiring Instructions:
- Place the ESP32 securely onto the breadboard.
- Place the push-button onto the breadboard, straddling the center gap.
- Connect a jumper wire from GPIO Pin 4 on the ESP32 to one leg of the push-button.
- Connect a second jumper wire from any GND (Ground) pin on the ESP32 to the opposite leg of the push-button.
Note: The C++ code utilizes the ESP32's internal INPUT_PULLUP resistor on Pin 4. Pressing the button closes the circuit to Ground, successfully triggering the alert without needing external resistors.
This monorepo requires two environments to run simultaneously: the local Python web server and the ESP32 hardware firmware.
- Create a free developer account at Twilio.com.
- Generate a Twilio Phone Number.
- Locate your Account SID and Auth Token on your Twilio console dashboard.
- Navigate to the root directory of this project.
- Install the required Python dependencies:
pip install flask twilio python-dotenv
- Copy
.env.exampleand rename it to.env. - Fill in your Twilio credentials and target phone numbers inside
.env. - Start the server:
python app.py
- Take note of the local IP address printed in the terminal (e.g.,
192.168.X.X).
- Open this project folder in VS Code with the PlatformIO extension installed.
- Navigate to
src/secrets.h.exampleand rename it tosecrets.h. - Input your home Wi-Fi
SSIDandPASSWORDintosecrets.h. - Open
src/main.cppand update theserverNamestring with the local IP address of your Python server (from step 2.6). - Build and upload the firmware to your ESP32 board.
DO NOT COMMIT YOUR SECRETS! This repository uses a unified .gitignore file to prevent API keys and Wi-Fi passwords from being uploaded to the internet. If you fork this project, never commit your .env or secrets.h files.