Detects tampering, locks the engine and texts you the vehicle’s location.
Built and tested by Drisya K S · Industrial Robotics Institute
Arduino IDE, Blynk IoT app, TinyGPSPlus library
An anti-theft system for cars and bikes. A vibration sensor detects tampering; the ESP32 then sounds a buzzer, cuts the engine through a relay, reads the GPS location and sends an SMS with a Google Maps link via a SIM800L GSM module. The alert and link also appear in the Blynk app, and the owner can unlock with a button.
| Component | Qty |
|---|---|
| ESP32 Dev Board | 1 |
| GPS Module (NEO-6M) | 1 |
| GSM Module (SIM800L) with SIM card | 1 |
| Relay Module (engine lock) | 1 |
| Vibration Sensor (SW-420) | 1 |
| Push Button | 1 |
| Buzzer | 1 |
| LED | 1 |
| Power Supply (4V for SIM800L) | 1 |
| From | Connect to |
|---|---|
| GPS TX | GPIO 16 |
| GPS RX | GPIO 17 |
| GPS VCC / GND | 3.3V / GND |
| SIM800L TX | GPIO 27 |
| SIM800L RX | GPIO 26 |
| SIM800L VCC | External 4V (2A peak) |
| Vibration DO | GPIO 13 |
| Relay IN | GPIO 25 |
| Buzzer + | GPIO 14 |
| LED + (via resistor) | GPIO 12 |
| Button | GPIO 33 and GND |
| All GND | Common ground |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP32.
#define BLYNK_TEMPLATE_ID "YourTemplateID"
#define BLYNK_TEMPLATE_NAME "Vehicle Security"
#define BLYNK_AUTH_TOKEN "YourAuthToken"
#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <TinyGPS++.h>
#include <HardwareSerial.h>
char ssid[] = "YourWiFiName";
char pass[] = "YourWiFiPassword";
const char* ownerNumber = "+91XXXXXXXXXX"; // owner's phone number
TinyGPSPlus gps;
HardwareSerial gpsSerial(1);
HardwareSerial gsmSerial(2);
int vibrationPin = 13;
int relay = 25;
int buzzer = 14;
int button = 33;
bool alertSent = false;
void sendSMS(String text) {
gsmSerial.println("AT+CMGF=1");
delay(1000);
gsmSerial.print("AT+CMGS=\"");
gsmSerial.print(ownerNumber);
gsmSerial.println("\"");
delay(1000);
gsmSerial.print(text);
gsmSerial.write(26); // Ctrl+Z to send
}
void setup() {
Serial.begin(115200);
pinMode(vibrationPin, INPUT);
pinMode(relay, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(button, INPUT_PULLUP);
gpsSerial.begin(9600, SERIAL_8N1, 16, 17);
gsmSerial.begin(9600, SERIAL_8N1, 27, 26);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop() {
while (gpsSerial.available()) gps.encode(gpsSerial.read());
if (digitalRead(vibrationPin) == HIGH && !alertSent) {
digitalWrite(buzzer, HIGH);
digitalWrite(relay, HIGH); // engine lock
String link = "https://maps.google.com/?q=" +
String(gps.location.lat(), 6) + "," + String(gps.location.lng(), 6);
sendSMS("Theft Detected! Location: " + link);
Blynk.virtualWrite(V1, "Theft Detected!");
Blynk.virtualWrite(V2, link);
alertSent = true;
}
// Manual unlock
if (digitalRead(button) == LOW) {
digitalWrite(relay, LOW);
digitalWrite(buzzer, LOW);
Blynk.virtualWrite(V1, "Vehicle Unlocked");
alertSent = false;
}
Blynk.run();
delay(500);
}An anti-theft system for cars and bikes. A vibration sensor detects tampering; the ESP32 then sounds a buzzer, cuts the engine through a relay, reads the GPS location and sends an SMS with a Google Maps link via a SIM800L GSM module.
You need: ESP32 Dev Board (1), GPS Module (NEO-6M) (1), GSM Module (SIM800L) with SIM card (1), Relay Module (engine lock) (1), Vibration Sensor (SW-420) (1), Push Button (1), Buzzer (1), LED (1), Power Supply (4V for SIM800L) (1). Software: Arduino IDE, Blynk IoT app, TinyGPSPlus library.
It is rated advanced and takes about 4–6 hours to build, using the ESP32. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-157). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.