Women safety device GPS tracking using nodeMcu

Women safety device with GPS tracking & alerts using nodeMcu

With all the technology available to us in recent times, it’s not hard to build a safety device for women which will not only generate an emergency alarm but also send a message to your friends, family, or concerned person.

Here we will build a band that can be worn by women, using which they can inform police or anyone, using SOS emergency SMS along with the current location.

 

Using this information, the police will be able to save the victim from the location. For this, here we are using an ESP8266 which can be interfaced with GSM and GPS module for sending SMS alerts and getting the location coordinates.

GPS Module

Here we are using the NEO6M GPS module. The NEO-6M GPS module is a popular GPS receiver with a built-in ceramic antenna, which provides a strong satellite search capability. This receiver has the ability to sense locations and track up to 22 satellites and identifies locations anywhere in the world. With the on-board signal indicator, we can monitor the network status of the module. It has a data backup battery so that the module can save the data when the main power is shut down accidentally.

Features:

1. Operating voltage: (2.7-3.6)V DC
2. Operating Current: 67 mA
3. Baud rate: 4800-230400 bps (9600 Default)
4. Communication Protocol: NEMA
5. Interface: UART
6. External antenna and built-in EEPROM.

Pinout of GPS module:

1. VCC: Input voltage pin of Module
2. GND: Ground pin
3. RX, TX: UART communication pins with Microcontroller

Interfacing GPS with ESP12E NodeMCU:

NodeMCU is ESP8266 based development board. It features ESP-12E as its processing core. It is a 32bit MCU. It has 14 GPIO pins, single channel 10 bit integrated ADC. It supports UART, I2C, SPI communication. It is 3.3V compatible, it cannot handle 5V. If you are new to NodeMCU

Connections between NodeMCU and GPS

 

NodeMCU GPS module

3V3—————-Vcc

GND————–GND

D1—————-(GPIO5) RX

D2—————-(GPIO4) TX

GSM Module SIM900

This is a GSM/GPRS-compatible Quad-band cell phone, which works on a frequency of 850/900/1800/1900MHz and which can be used for various applications such as access the Internet, make a voice call, send and receive SMS, etc. The frequency bands of the GSM modem can be set by AT Commands.

The baud rate is configurable from 1200-115200 through AT command. The GSM/GPRS Modem is having an internal TCP/IP stack which enables us to connect with the internet via GPRS. This is an SMT type module and designed with a very powerful single-chip processor integrating AMR926EJ-S core, which is very popular in various industrial products.

Technical Specifications:

1. Supply voltage: 3.4V – 4.5V
2. Power saving mode: Sleep Mode power consumption=.5mA
3. Frequency bands: SIM900A Dual-band: EGSM900, DCS1800.
4. Operating Temperature: -30ºC to +80ºC
5. Supports MIC and Audio Input
6. Speaker Input
7. UART interface support
8. Firmware upgrade by debug port
8. Communication: AT Commands

Arduino Code

#include <SoftwareSerial.h>
#include <TinyGPS++.h>
static const int RXPin = 2, TXPin = 3;
static const uint32_t GPSBaud = 9600;
int m = 9740;
int y = 71;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
SoftwareSerial SIM900(7, 8);
int Buzzer = 4;
String textForSMS;
int Switch = 5;

String datareal;
String dataimaginary;
String combined;
int raw = 1000000;

String datareal2;
String dataimaginary2;
String combined2;

double longitude;
double latitude;

void setup()
{
SIM900.begin(19200);
Serial.begin(9600);
ss.begin(GPSBaud);
delay(10000);
Serial.println(" logging time completed!");
randomSeed(analogRead(0));
pinMode(Switch, INPUT);
digitalWrite(Switch, HIGH);
pinMode(Buzzer, OUTPUT);
digitalWrite(Buzzer, LOW);

Serial.println(F("DeviceExample.ino"));
Serial.print(F("Testing TinyGPS++ library v. "));
Serial.println(TinyGPSPlus::libraryVersion());

Serial.println();
}

void sendSMS(String message)
{
SIM900.print("AT+CMGF=1\r");
delay(100);
SIM900.println("AT + CMGS = \"+918830584864\"");
delay(100);
SIM900.println(message);
delay(100);
SIM900.println((char)26);
delay(100);
SIM900.println();
delay(5000);

}

void loop()
{
int reading;
while (ss.available() > 0)
if (gps.encode(ss.read()))
displayInfo();

if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println(F("No GPS detected: check wiring."));
while (true);
}

if (digitalRead(Switch) == LOW)
{
displayInfo();
latitude = gps.location.lat(), 6 ;
longitude = gps.location.lng(), 6 ;
long datareal = int(latitude);
int fahad = ( latitude - datareal) * 100000;
long datareal2 = int(longitude);
int fahad2 = (longitude - datareal2 ) * 100000;
textForSMS.concat(fahad);
//textForSMS = "Longitude: ";
textForSMS.concat(datareal2);
textForSMS = textForSMS + ".";
textForSMS.concat(fahad2);
//textForSMS = textForSMS + " Latitude: ";
textForSMS.concat(datareal);
textForSMS = textForSMS + ".";
sendSMS(textForSMS);
Serial.println(textForSMS);
Serial.println("message sent.");
delay(5000);
}
else
digitalWrite(Switch, HIGH);
digitalWrite(Buzzer, LOW);
}

void displayInfo()
{
Serial.print(F("Location: "));
if (gps.location.isValid())
{
Serial.print(gps.location.lat(), 6);
Serial.print(F(","));
Serial.print(gps.location.lng(), 6);
Serial.print(" ");
Serial.print(F("Speed:"));
Serial.print(gps.speed.kmph());
}
else
{
Serial.print(F("INVALID"));
}

Serial.print(F(" Date/Time: "));
if (gps.date.isValid())
{
Serial.print(gps.date.month());
Serial.print(F("/"));
Serial.print(gps.date.day());
Serial.print(F("/"));
Serial.print(gps.date.year());
}
else
{
Serial.print(F("INVALID"));
}

Serial.print(F(" "));
if (gps.time.isValid())
{
if (gps.time.hour() < 10) Serial.print(F("0"));
Serial.print(gps.time.hour());
Serial.print(F(":"));
if (gps.time.minute() < 10) Serial.print(F("0"));
Serial.print(gps.time.minute());
Serial.print(F(":"));
if (gps.time.second() < 10) Serial.print(F("0"));
Serial.print(gps.time.second());
Serial.print(F("."));
if (gps.time.centisecond() < 10) Serial.print(F("0"));
Serial.print(gps.time.centisecond());
}
else
{
Serial.print(F("INVALID"));
}

Serial.println();
}
Subramanian
Subramanian

Subramanian MK, currently serving as a workshop instructor at Sakthi Polytechnic College, Erode Tamil Nadu. With a career spanning 25 + years, Subramanian MK has dedicated himself to advancing knowledge in Electronics and Communication Engineering (ECE). His passion for exploring new technologies has led to the development of numerous projects, showcasing expertise in IoT and PCB design.

Articles: 514

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

×

Hi, How can I help you?

×