ARDUINO BASED ALCOHOL SENSE ENGINE LOCK & GPS

 

ARDUINO BASED ALCOHOL SENSE ENGINE LOCK & GPS

 

 

ABSTRACT:

  • This project introduces an innovative approach to improving road safety by developing an Arduino-based alcohol detection and engine lock system, integrated with GPS and GSM technologies. The main goal is to prevent driving under the influence of alcohol by disabling the vehicle’s engine upon alcohol detection.
  • The system employs an MQ-3 alcohol sensor to measure the driver’s breath alcohol content. When alcohol is detected, the Arduino microcontroller processes the data from the sensor and activates the engine lock mechanism, thus preventing the vehicle from starting. This functionality is enhanced with GPS technology to provide precise location tracking of the vehicle. In the event of alcohol detection, the system utilizes the GSM module to send alerts to pre-configured contacts, supplying real-time information about the driver’s condition and the vehicle’s location.

OBJECTIVE:

“To design and develop an Arduino-based system that detects alcohol levels using a sensor, locks the engine to prevent drunk driving, and integrates GPS for real-time location tracking, aiming to enhance road safety and prevent accidents.”

BLOCK DIAGRAM:

WORKING:

  • The proposed system is an Alcohol Driver Safety system that makes bike accident almost impossible. This bike safety project is a system attached to the bike ignition system. In order to start the ignition system, user has to enter his strong password. Only when the right password is entered does the ignition system start. The bike user must carry an Rf receiver device with him, By incorporating GPS, the system ensures continuous location monitoring, adding an extra layer of security and enabling swift emergency response.
  • This comprehensive solution aims to reduce incidents of drunk driving by leveraging Arduino for sensor interfacing and control, and combining it with GPS technologies for real-time tracking and communication. The proposed system is cost-effective, easy to implement, and scalable, offering a practical tool for enhancing road safety and saving lives.

COMPONENTS LIST:

  • ATMEGA328P MICROCONTROLLER.
  • Ignition KEY setup.
  • RELAY SETUP.
  • POWER SUPPLY.
  • GPS.
  • L293D MOTOR DRIVER.
  • MOTOR SETUP.

πŸ“ SAMPLE CODE:

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

// — Pin definitions —
const int alcoholPin = A0;
const int relayPin = 7;
const int buzzerPin = 8;

// GPS setup on SoftwareSerial
SoftwareSerial gpsSerial(4, 3); // RX, TX
TinyGPSPlus gps;

// SIM800A GSM (Optional, uncomment to enable)
// SoftwareSerial gsmSerial(10, 11); // RX, TX

LiquidCrystal_I2C lcd(0x27, 16, 2);

// Alcohol detection thresholds & debounce
const int ALCOHOL_THRESHOLD = 400; // Adjust based on calibration
const int DETECTION_COUNT_REQUIRED = 3;

int detectionCounter = 0;
bool engineLocked = false;

void setup() {
Serial.begin(9600);
gpsSerial.begin(9600);

// gsmSerial.begin(9600); // Uncomment if using GSM

pinMode(relayPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
digitalWrite(relayPin, LOW); // Start unlocked (relay LOW)
digitalWrite(buzzerPin, LOW);

lcd.init();
lcd.backlight();

lcd.setCursor(0,0);
lcd.print(“Alcohol Sensor”);
lcd.setCursor(0,1);
lcd.print(“Warming up…”);

delay(30000); // MQ3 Sensor warm-up time

lcd.clear();
lcd.print(“System Ready”);
delay(2000);
lcd.clear();
}

void lockEngine() {
digitalWrite(relayPin, HIGH); // Lock engine
digitalWrite(buzzerPin, HIGH);
delay(500);
digitalWrite(buzzerPin, LOW);

lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Engine Locked!”);
engineLocked = true;

Serial.println(“Engine locked due to alcohol detection.”);

// Optional: Send SMS alert with GPS location
// sendSMSAlert();
}

void unlockEngine() {
digitalWrite(relayPin, LOW); // Unlock engine
lcd.clear();
lcd.setCursor(0,0);
lcd.print(“Engine Unlocked”);
engineLocked = false;
}

void loop() {
int alcoholValue = analogRead(alcoholPin);

// Read GPS data
while (gpsSerial.available()) {
gps.encode(gpsSerial.read());
}

// Show sensor values on Serial and LCD
Serial.print(“Alcohol Level: “);
Serial.println(alcoholValue);

lcd.setCursor(0,0);
lcd.print(“Alcohol:”);
lcd.print(alcoholValue);
lcd.print(” “); // Clear remaining chars

if (alcoholValue > ALCOHOL_THRESHOLD) {
detectionCounter++;
} else {
detectionCounter = 0;
}

if (detectionCounter >= DETECTION_COUNT_REQUIRED && !engineLocked) {
lockEngine();
}

// Auto unlock if alcohol goes below threshold (optional safety)
if (alcoholValue < ALCOHOL_THRESHOLD – 50 && engineLocked) {
unlockEngine();
}

// Display GPS location if valid
if (gps.location.isValid()) {
Serial.print(“Lat: “);
Serial.print(gps.location.lat(), 6);
Serial.print(” Lng: “);
Serial.println(gps.location.lng(), 6);

lcd.setCursor(0,1);
lcd.print(“Lat:”);
lcd.print(gps.location.lat(), 4);
lcd.print(” “);

delay(1000);

lcd.setCursor(0,1);
lcd.print(“Lng:”);
lcd.print(gps.location.lng(), 4);
lcd.print(” “);
} else {
lcd.setCursor(0,1);
lcd.print(“GPS waiting… “);
}

delay(1000);
}

// Optional function to send SMS alert via SIM800A
/*
void sendSMSAlert() {
if (!gps.location.isValid()) {
Serial.println(“No GPS fix yet, SMS not sent.”);
return;
}

String message = “Alcohol Detected! Location:\nLat: “;
message += String(gps.location.lat(), 6);
message += “\nLng: “;
message += String(gps.location.lng(), 6);

gsmSerial.println(“AT+CMGF=1”); // Text mode
delay(100);
gsmSerial.println(“AT+CMGS=\”+91xxxxxxxxxx\””); // Replace with phone number
delay(100);
gsmSerial.print(message);
delay(100);
gsmSerial.write(26); // CTRL+Z to send
delay(5000);

Serial.println(“SMS alert sent.”);
}
*/

 

βœ… KEY FIXES

βœ… 1. Stable Alcohol Detection (MQ3 Sensor)

  • Fix: Allow the MQ3 sensor to warm up for 30 seconds before taking readings.

  • Code Improvement:

    cpp
    delay(30000); // Sensor warm-up time
  • Check threshold:

    cpp
    int alcoholValue = analogRead(A0);
    if (alcoholValue > 400) {
    // ABNORMAL
    }

βœ… 2. Engine Lock Control via Relay Module

  • Fix: Use a relay module rated for the vehicle’s voltage.

  • Code Example:

    cpp
    int relayPin = 7; // Relay connected to pin 7
    digitalWrite(relayPin, HIGH); // Lock engine
    digitalWrite(relayPin, LOW); // Unlock engine
  • Safety: Add a flyback diode across relay coil if not built-in.

βœ… 3. GPS Module Stability (e.g., NEO-6M)

  • Fix: Use TinyGPS++ library for more accurate parsing.

  • Ensure:

    • Use SoftwareSerial for GPS at correct baud (e.g., 9600).

    • Add delay between GPS reads.

  • Sample Code:

    cpp
    #include <SoftwareSerial.h>
    #include <TinyGPS++.h>
    SoftwareSerial gpsSerial(4, 3); // RX, TX
    TinyGPSPlus gps;

    void loop() {
    while (gpsSerial.available()) {
    gps.encode(gpsSerial.read());
    }
    if (gps.location.isValid()) {
    Serial.print(“Lat: “);
    Serial.println(gps.location.lat(), 6);
    Serial.print(“Lng: “);
    Serial.println(gps.location.lng(), 6);
    }

βœ… 4. Reliable Serial Communication

  • Fix: Avoid mixing Serial.print() with GPS on the same UART.

  • Solution: Use SoftwareSerial for GPS and keep main Serial for debug or GSM.

βœ… 5. Power Supply Stability

  • Fix: Use a separate 5V power supply or DC-DC buck converter for sensors and GPS. Avoid powering GPS from Arduino 5V if voltage drops occur.

βœ… 6. Optional: GSM Alert Integration

  • Fix: Ensure correct baud rate (SIM800A = 9600).

  • Send location SMS:

    cpp
    String message = "Alcohol Detected! Location: ";
    message += String(gps.location.lat(), 6);
    message += ", ";
    message += String(gps.location.lng(), 6);
    Serial.println(“AT+CMGF=1”);
    delay(100);
    Serial.println(“AT+CMGS=\”+91xxxxxxxxxx\””);
    delay(100);
    Serial.print(message);
    Serial.write(26); // CTRL+Z to sen

βœ… 7. System Feedback

  • Fix: Use buzzer or LCD to inform the user of the system state (NORMAL/ABNORMAL).

  • Example:

    cpp
    lcd.setCursor(0, 0);
    lcd.print("Status: NORMAL")

βœ… 8. Add Debounce/Delay Logic

  • Fix: Avoid false alcohol detection spikes.

  • Solution: Confirm 2–3 consecutive high readings before locking engine.

βœ… 9. Enclosure and Sensor Positioning

  • Fix: Place the MQ3 near the driver’s breath area (e.g., on steering wheel area).

  • Shield: Use a casing to avoid environmental contamination (perfume, sanitizer vapors).

βœ… 10. Emergency Override (Optional)

  • Fix: Include a secure manual override switch in case of false lock or failure.

MERITS:

  1. Prevents drunk driving accidents.
  2. Enhances road safety.
  3. Real-time location tracking using GPS.
  4. Low-cost and affordable solution.
  5. Easy installation and maintenance.

DEMERITS:

  1. Potential for false readings or sensor errors.
  2. Can be bypassed or tampered width.
  3. Limited accuracy in certain environments.
  4. Dependence on GPS signal strength.
  5. Potential for user resistance or non-compliance.

 

βœ… APPLICATIONS:

  1. Vehicle safety systems.
  2. Fleet management and monitoring.
  3. Law enforcement and traffic control.
  4. Public transportation systems.
  5. Automotive industries.
  6. Road safety initiatives.
  7. Commercial vehicle operations

 

πŸ“ž For More Details & Project Support:

 

Power Integrated Solutions
Networks | Electronics | Home Automation | Water Automation | IoT | PLC | Embedded | DBMS

πŸ“ Location:
10A/3, Radhakrishnan Colony,
Sasthri Road, Tennur,
Tiruchirappalli, Tamil Nadu – 620017


πŸ“ View on Google Maps

πŸ“§ Email:

πŸ“± Phone / WhatsApp:
+91 76393 85448
+91 82488 85959

🌐 Let’s Build the Future with Innovation in Education & Technology!