Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

Arduino Nano Based GPS Tracker with GSM Module and Panic Buttons

Image of Arduino Nano Based GPS Tracker with GSM Module and Panic Buttons

Circuit Documentation

Summary

This circuit integrates an Arduino Nano with a GPS module (NEO 6M), a GSM module (SIM800L), two arcade buttons (yellow and green), and a polymer lithium-ion battery. The Arduino Nano serves as the central processing unit, interfacing with the GPS module to obtain location data and with the GSM module to send SMS messages and make calls. The arcade buttons are used as input devices, potentially to trigger an action such as sending an alert message. The battery provides power to the system, and resistors are included for necessary voltage/current adjustments or pull-up/pull-down configurations.

Component List

Arduino Nano

  • Microcontroller board based on the ATmega328P
  • Offers a variety of digital and analog I/O pins
  • Can be powered via USB or an external power source

GPS NEO 6M

  • A GPS module capable of providing geolocation data
  • Communicates with the Arduino via serial interface

SIM800L GSM Module

  • A GSM/GPRS module that allows for SMS and voice communication
  • Interfaces with the Arduino for cellular connectivity

Arcade Button (Yellow)

  • A simple push-button switch used for user input

Arcade Button (Green)

  • Another push-button switch used for user input

Polymer Lithium Ion Battery - 850mAh

  • Provides power to the circuit
  • Rechargeable battery with a nominal voltage

Resistor (10k Ohms)

  • Two resistors, each with a resistance of 10k Ohms
  • Used for pull-up/pull-down or to limit current

Wiring Details

Arduino Nano

  • D1/TX connected to TX of GPS NEO 6M
  • GND connected to GND of GPS NEO 6M, SIM800L GSM Module, Polymer Lithium Ion Battery, Arcade Button (yellow), and Arcade Button (green)
  • D7 connected to SIM_TXD of SIM800L GSM Module
  • D8 connected to SIM_RXD of SIM800L GSM Module
  • D10 connected to one terminal of the yellow Arcade Button and a 10k Ohm Resistor
  • D11/MOSI connected to one terminal of the green Arcade Button and a 10k Ohm Resistor
  • VIN connected to VCC of Polymer Lithium Ion Battery and 5V of SIM800L GSM Module
  • 5V connected to VCC of GPS NEO 6M and one terminal of a 10k Ohm Resistor

GPS NEO 6M

  • VCC connected to 5V of Arduino Nano
  • RX connected to D1/TX of Arduino Nano
  • GND connected to GND of Arduino Nano

SIM800L GSM Module

  • 5V connected to VIN of Arduino Nano
  • GND connected to GND of Arduino Nano
  • SIM_TXD connected to D7 of Arduino Nano
  • SIM_RXD connected to D8 of Arduino Nano

Arcade Button (Yellow)

  • One terminal connected to D10 of Arduino Nano and a 10k Ohm Resistor

Arcade Button (Green)

  • One terminal connected to D11/MOSI of Arduino Nano and a 10k Ohm Resistor

Polymer Lithium Ion Battery - 850mAh

  • VCC connected to VIN of Arduino Nano
  • GND connected to GND of Arduino Nano

Resistor (10k Ohms)

  • One resistor connected between D10 of Arduino Nano and the yellow Arcade Button
  • Another resistor connected between D11/MOSI of Arduino Nano and the green Arcade Button

Documented Code

#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <Wire.h>

SoftwareSerial Gsm(6, 7);
char phone_no[] = "+919390801277";
TinyGPS gps;
int state;
String textMessage;

void setup() {
  Serial.begin(9600);
  Gsm.begin(9600);
  Serial.print("AT+CMGF=1\r");
  delay(100);
  Serial.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);
  pinMode(10, INPUT);
}

void loop() {
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;
  for (unsigned long start = millis(); millis() - start < 1000;) {
    while (Serial.available()) {
      char c = Serial.read();
      Serial.print(c);
      if (gps.encode(c))
        newData = true;
    }
  }
  if (Gsm.available() > 0) {
    textMessage = Gsm.readString();
    textMessage.toUpperCase();
    delay(10);
  }
  state = digitalRead(10);
  if (state == 0) {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Gsm.print("AT+CMGF=1\r");
    delay(400);
    Gsm.print("AT+CMGS=\"");
    Gsm.print(phone_no);
    Gsm.println("\"");
    Gsm.println("Alert I need help.............");
    Gsm.print("http://maps.google.com/maps?q=loc:");
    Gsm.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Gsm.print(",");
    Gsm.print(flon == TinyGPS ::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    delay(200);
    Gsm.println((char)26);
    delay(200);
    Gsm.println();
    Serial.println("SMS Sent");

    Serial.println("Call");
    delay(20000);
    Gsm.println("ATD+919390801277;");
    delay(150000);
    Gsm.println("ATH");
    delay(1000);
  } else {
    delay(10);
  }
  Serial.println(failed);
}

This code is designed to run on the Arduino Nano and utilizes the TinyGPS library to parse GPS data and the SoftwareSerial library to communicate with the GSM module. The code reads GPS data and sends an SMS with a Google Maps link to the specified phone number when the button connected to pin D10 is pressed. It also initiates a call to the same number.