Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Based GPS Tracker with GSM Communication and MPU-6050 Integration

View and Edit Project In Cirkit DesignerImage of Arduino UNO Based GPS Tracker with GSM Communication and MPU-6050 Integration

Circuit Documentation

Summary

This circuit integrates an Arduino UNO with a GPS module (NEO 6M), a GSM module (Sim800l), and an MPU-6050 sensor to create a multifunctional system capable of location tracking, motion sensing, and GSM communication. The Arduino UNO serves as the central processing unit, interfacing with the GPS and GSM modules via serial communication and with the MPU-6050 via I2C. The system is designed to read GPS coordinates, sense motion parameters, and perform GSM operations such as sending SMS messages.

Component List

Arduino UNO

GPS NEO 6M

Sim800l

MPU-6050

Wiring Details

Arduino UNO

GPS NEO 6M

Sim800l

MPU-6050

Documented Code

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

// GPS
TinyGPSPlus gps;
SoftwareSerial gpsSerial(2, 3); // RX, TX

// GSM
SoftwareSerial gsmSerial(7, 8); // RX, TX

// MPU-6050
MPU6050 mpu;

void setup() {
  Serial.begin(9600);
  
  // GPS
  gpsSerial.begin(9600);
  
  // GSM
  gsmSerial.begin(9600);
  
  // MPU-6050
  Wire.begin();
  mpu.initialize();
  if (!mpu.testConnection()) {
    Serial.println("MPU6050 connection failed");
  }
}

void loop() {
  // Read GPS data
  while (gpsSerial.available() > 0) {
    gps.encode(gpsSerial.read());
  }
  if (gps.location.isUpdated()) {
    Serial.print("Latitude: ");
    Serial.println(gps.location.lat(), 6);
    Serial.print("Longitude: ");
    Serial.println(gps.location.lng(), 6);
  }

  // Read MPU-6050 data
  int16_t ax, ay, az;
  int16_t gx, gy, gz;
  mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
  Serial.print("a/g:\t");
  Serial.print(ax); Serial.print("\t");
  Serial.print(ay); Serial.print("\t");
  Serial.print(az); Serial.print("\t");
  Serial.print(gx); Serial.print("\t");
  Serial.print(gy); Serial.print("\t");
  Serial.println(gz);

  // GSM communication (example: send SMS)
  gsmSerial.println("AT");
  delay(1000);
  gsmSerial.println("AT+CMGF=1"); // Set SMS mode to text
  delay(1000);
  gsmSerial.println("AT+CMGS=\"+1234567890\""); // Replace with your phone number
  delay(1000);
  gsmSerial.print("Hello from Arduino!"); // Message content
  delay(1000);
  gsmSerial.write(26); // ASCII code of CTRL+Z to send SMS
  delay(1000);
}

This code initializes the GPS, GSM, and MPU-6050 modules and sets up serial communication with them. It reads GPS data and motion sensor data from the MPU-6050, printing the results to the serial monitor. Additionally, it demonstrates how to send an SMS message using the GSM module. The code is structured to run continuously in the loop() function.