Smart Safety Device

Published Jun 08, 2026
 8 hours to build
 Intermediate

The Smart Safety Device is an emergency security system developed using ESP32 and Neo-6M GPS module. When the SOS push button is pressed, the device sends an alert message along with the user’s live location to a Telegram bot using internet connectivity. This helps in providing quick assistance during emergency situations. The project is compact, portable, and useful for personal safety applications.

display image

Components Used

Breadboard
Breadboard
1
Connecting Wire Jumper Wires
Connecting Wire Breadboard wires
5
ESP 32 MICROCONTROLLER
ESP32 is a compact, low-cost microcontroller with built-in Wi-Fi and Bluetooth. It is used in IoT projects to read sensors, process data, and send updates wirelessly.
1
GPS Neo-6m GPS Module
This is a complete GPS module that is based on the NEO 6M GPS. This unit uses the latest technology to give the best possible positioning information and includes a larger built-in 25 x 25mm active GPS antenna with a UART TTL socket. A battery is also included so that you can obtain a GPS lock faster. This is an updated GPS module that can be used with ardupilot mega v2. This GPS module gives the
1
Push Button
Tactile Push Button Switch 6x6x5 for navigation and control
1
POWER SUPPLY USB
POWER SUPPLY TO MICROCONTROLLER
1
Description

Project Description

The Smart Safety Device is an IoT-based emergency alert system designed to provide immediate assistance during emergencies. The project uses an ESP32 microcontroller, Neo-6M GPS module, and an SOS push button. When the SOS button is pressed, the ESP32 reads the user's current GPS location and sends an emergency alert message along with a Google Maps location link to a Telegram bot. This enables family members, friends, or emergency responders to quickly locate and assist the user.

Components Required

ComponentQuantity
ESP32 Development Board1
Neo-6M GPS Module1
Push Button1
Breadboard1
Jumper WiresAs Required
USB Cable1
Wi-Fi Connection1
Telegram Bot1

Step 1: Prepare the Components

Gather all the required components:

  • ESP32 Development Board
  • Neo-6M GPS Module
  • Push Button
  • Breadboard
  • Jumper Wires
  • USB Cable

 

Step 2: Connect the GPS Module

Make the following connections:

Neo-6M GPSESP32
VCC3.3V
GNDGND
TXGPIO16 (RX2)
RXGPIO17 (TX2)

The GPS module will continuously receive satellite data and provide location coordinates.

 

Step 3: Connect the SOS Push Button

Connect the push button as follows:

Push ButtonESP32
One TerminalGPIO4
Other TerminalGND

When pressed, the button triggers the emergency alert process.

 

Step 4: Create Telegram Bot

  1. Open Telegram.
  2. Search for BotFather.
  3. Type /newbot.
  4. Enter bot name and username.
  5. Copy the generated Bot Token.
  6. Obtain your Chat ID.
  7. Add both values to the ESP32 program.

 

 

 

Step 5: Program the ESP32

  1. Install Arduino IDE.
  2. Install ESP32 Board Package.
  3. Install required libraries:
    • TinyGPS++
    • WiFi
    • UniversalTelegramBot
  4. Upload the program to ESP32.

After uploading, the ESP32 connects to Wi-Fi and starts receiving GPS data.

code--

#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <UniversalTelegramBot.h>
#include <TinyGPS++.h>
//  WiFi Credentials
const char* ssid = "wifiname";
const char* password = "password ";
//  Telegram Bot
#define BOTtoken "8770187114:AAGG2HxTHQuI5-5-gXVweLT1VIQfoF5t12I"
#define CHAT_ID "7098141457"
WiFiClientSecure client;
UniversalTelegramBot bot(BOTtoken, client);
//  GPS Setup
TinyGPSPlus gps;
HardwareSerial gpsSerial(1);
//  Pins
#define GPS_RX 16   // ESP32 RX ← GPS TX
#define GPS_TX 17   // ESP32 TX → GPS RX
int buttonPin = 4;
void setup() {
 Serial.begin(115200);
 // Button
 pinMode(buttonPin, INPUT_PULLUP);
 // GPS Serial
 gpsSerial.begin(9600, SERIAL_8N1, GPS_RX, GPS_TX);
 // WiFi
 WiFi.begin(ssid, password);
 Serial.print("Connecting to WiFi");
 while (WiFi.status() != WL_CONNECTED) {
   delay(500);
   Serial.print(".");
 }
 Serial.println("\nConnected to WiFi");
 client.setInsecure(); // HTTPS
}
void loop() {
 //  Read GPS Data continuously
 while (gpsSerial.available() > 0) {
   gps.encode(gpsSerial.read());
 }
 //  Button Press
 if (digitalRead(buttonPin) == LOW) {
   Serial.println("Button Pressed!");
   if (gps.location.isValid()) {
     float lat = gps.location.lat();
     float lng = gps.location.lng();
     String message = " EMERGENCY ALERT!\n";
     message += "Live Location:\n";
     message += "https://maps.google.com/?q=";
     message += String(lat, 6);
     message += ",";
     message += String(lng, 6);
     bot.sendMessage(CHAT_ID, message, "");
     Serial.println("Location Sent!");
   }
   else {
     Serial.println("GPS not fixed yet!");
     bot.sendMessage(CHAT_ID, "⚠️ GPS not fixed. Try again.", "");
   }
   delay(5000); // avoid multiple sends
 }
}

Step 6: Testing the Device

  1. Power ON the device.
  2. Wait for GPS signal lock.
  3. Press the SOS button.
  4. ESP32 reads latitude and longitude.
  5. Telegram receives:
    • Emergency Alert Message
    • GPS Coordinates
    • Google Maps Location Link

Working of the Project

The ESP32 continuously remains connected to a Wi-Fi network and receives real-time location data from the Neo-6M GPS module. The device stays in standby mode until the SOS push button is pressed. Once the button is pressed, the ESP32 fetches the current latitude and longitude coordinates from the GPS module and generates a Google Maps location link.

The ESP32 then sends an emergency alert message along with the user's live location to a Telegram bot through the internet. The recipient instantly receives the notification and can view the exact location on Google Maps, enabling quick response and assistance during emergencies.

 

video of project-

Codes

Downloads

PROJECT DESIGN Download
Comments
Ad