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.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Circuit

Follow the table below for a concise guide in wiring the sensors to the ESP32 Development Board.

I/OI/O Pin #Wire Colour Arduino pin#
Push Button1Blue and RedD5 and 3.3V
2Ground RailGND

Step 2: Code

#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */

#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
    GpsParam gps(param);"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
  Blynk.begin(auth, ssid, pass);    // get this from your phone
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "", 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""", "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()

Step 3: Enjoy and Stay Safe!

Enjoy your build and Stay Safe!!

Bluetooth Challenge

Participated in the
Bluetooth Challenge

Automation Contest 2017

Participated in the
Automation Contest 2017

Makerspace Contest 2017

Participated in the
Makerspace Contest 2017

Be the First to Share


    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    4 Discussions


    Question 1 year ago on Step 2

    Code does not compile. I get the following error:

    Arduino: 1.8.5 (Windows 10), Board: "ESP32 Dev Module, QIO, 80MHz, 4MB (32Mb), 921600, None"

    C:\Users\school\Desktop\workspace\EmergencyButton\emergency_button\emergency_button.ino: In function 'void emailOnButtonPress()':

    emergency_button:25: error: a function-definition is not allowed here before '{' token



    emergency_button:32: error: a function-definition is not allowed here before '{' token



    emergency_button:49: error: a function-definition is not allowed here before '{' token



    emergency_button:51: error: expected '}' at end of input



    Multiple libraries were found for "WiFi.h"
    Used: C:\Users\school\Documents\Arduino\hardware\espressif\esp32\libraries\WiFi
    Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
    exit status 1
    a function-definition is not allowed here before '{' token


    2 years ago

    Good Work! :)