Introduction: DIY Pocket Size Emergency Button Notifier for Elderly With WiFi -- Personal Alarm (IoT)
This is a DIY Internet-Connected (IoT) Personal Alarm that sends out the GPS coordinates via Email to your relatives or the police when he emergency button is pressed.
Say, you fell down the stairs and hurt yourself and you could not move. This is a one push button notifier that alerts other people, relatives or the police (depending on how you change the programming) that you have been injured or are in danger.
There are countless use cases for this button. For example, if you're walking back home late at night and encounter some 'resistance,' you can just push this button covertly and it can alert 911 for you. It is especially convenient compared to a phone, since you can notify people at just one push, a necessity in some emergencies.
Step 1: Circuit
Follow the table below for a concise guide in wiring the sensors to the ESP32 Development Board.
I/O | I/O Pin # | Wire Colour | Arduino pin# |
---|---|---|---|
Push Button | 1 | Blue and Red | D5 and 3.3V |
2 | Orange | GND | |
Buzzer | 1 | Black | D4 |
2 | Ground Rail | GND |
Step 2: Code
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */ //#define BLYNK_MAX_SENDBYTES 128
#include "WiFi.h"
#include "WiFiClient.h" #include "BlynkSimpleEsp32.h" // replace"" with <>
// You should get Auth Token in the Blynk App. // Go to the Project Settings (nut icon). char auth[] = "YourAuthToken";
// Your WiFi credentials. // Set password to "" for open networks. char ssid[] = "YourNetworkName"; char pass[] = "YourPassword";
void emailOnButtonPress() { // *** WARNING: You are limited to send ONLY ONE E-MAIL PER 15 SECONDS! ***
// Let's send an e-mail when you press the button // connected to digital pin 2 on your Arduino
int isButtonPressed = !digitalRead(4); // Invert state, since button is "Active LOW"
if (isButtonPressed) // You can write any condition to trigger e-mail sending { Serial.println(""); // This can be seen in the Serial Monitor
BLYNK_WRITE(V1) { GpsParam gps(param);
Blynk.email("Subject: URGENT EMERGENCY Emergency Button has been pressed! GPS Coordinates: %d latitude, %d longitude", gps.getLat(), gps.getLon); tone (5, 10000); } }
void setup() { // Debug console Serial.begin(9600);
Blynk.begin(auth, ssid, pass); // get this from your phone // You can also specify server: //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442); //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
// Send e-mail when your hardware gets connected to Blynk Server // Just put the recepient's "e-mail address", "Subject" and the "message body" Blynk.email("your_email@mail.com", "Subject", "My Blynk project is online."); ! // Setting the button pinMode(4, INPUT_PULLUP); // Attach pin 2 interrupt to our handler attachInterrupt(digitalPinToInterrupt(2), emailOnButtonPress, CHANGE); }
void loop() { Blynk.run(); }
Step 3: Enjoy and Stay Safe!
Enjoy your build and Stay Safe!!