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

Arduino-Based Alcohol Detection and Location Sharing System with SIM800L and GPS NEO 6M

View and Edit Project In Cirkit DesignerImage of Arduino-Based Alcohol Detection and Location Sharing System with SIM800L and GPS NEO 6M

Circuit Documentation

Summary

This document provides a detailed overview of an Alcohol Detection and Location Sharing System. The system uses an MQ-3 alcohol sensor to detect alcohol levels, an LCD to display the readings, a buzzer to alert when the alcohol level exceeds a threshold, and a SIM800L module to send location messages using GPS data from a NEO 6M module.

Component List

  1. Arduino UNO

    • Description: Microcontroller board based on the ATmega328P.
    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
  2. SIM800L

    • Description: GSM/GPRS module for communication.
    • Pins: NFT, RING, VCC, DTR, RST, MIC +, RXD, MIC-, TXD, SPK+, GND, SPK-
  3. GPS NEO 6M

    • Description: GPS module for location tracking.
    • Pins: VCC, RX, TX, GND
  4. LCD 16x2 (Wokwi Compatible)

    • Description: 16x2 character LCD display.
    • Pins: VSS, VDD, V0, RS, RW, E, D0, D1, D2, D3, D4, D5, D6, D7, A, K
  5. MQ-3 Breakout

    • Description: Alcohol sensor module.
    • Pins: VCC, GND, DO, AO
  6. Potentiometer

    • Description: Variable resistor for adjusting LCD contrast.
    • Pins: GND, Output, VCC
  7. Buzzer

    • Description: Sound alert device.
    • Pins: PIN, GND
  8. LED: Two Pin (red)

    • Description: Indicator LED.
    • Pins: cathode, anode

Wiring Details

Arduino UNO

SIM800L

GPS NEO 6M

LCD 16x2 (Wokwi Compatible)

MQ-3 Breakout

Potentiometer

Buzzer

LED: Two Pin (red)

Code Documentation

/*
 * Alcohol Detection and Location Sharing System
 * This code reads the alcohol level from the MQ-3 sensor, displays it on the LCD,
 * and if the level exceeds a threshold, it sounds a buzzer and sends a location
 * message using the SIM800L module and GPS NEO 6M module.
 */

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

// Pin definitions
const int ledPin = 13;
const int buzzerPin = 8;
const int mq3Pin = A0;
const int sim800lRxPin = 1;
const int sim800lTxPin = 0;
const int gpsRxPin = 3;
const int gpsTxPin = 2;

// Threshold for alcohol level
const int alcoholThreshold = 300;

// LCD pins: RS, E, D4, D5, D6, D7
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Software serial for SIM800L
SoftwareSerial sim800l(sim800lTxPin, sim800lRxPin);

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  sim800l.begin(9600);

  // Initialize LCD
  lcd.begin(16, 2);
  lcd.print("Alcohol Level:");

  // Initialize pins
  pinMode(ledPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  pinMode(mq3Pin, INPUT);
}

void loop() {
  // Read alcohol level
  int alcoholLevel = analogRead(mq3Pin);

  // Display alcohol level on LCD
  lcd.setCursor(0, 1);
  lcd.print(alcoholLevel);

  // Check if alcohol level exceeds threshold
  if (alcoholLevel > alcoholThreshold) {
    // Sound the buzzer
    digitalWrite(buzzerPin, HIGH);

    // Send location message
    sendLocationMessage();
  } else {
    digitalWrite(buzzerPin, LOW);
  }

  delay(1000);
}

void sendLocationMessage() {
  // Get GPS data
  String gpsData = getGPSData();

  // Send SMS with location
  sim800l.print("AT+CMGF=1\r");
  delay(100);
  sim800l.print("AT+CMGS=\"+1234567890\"\r");
  delay(100);
  sim800l.print("Alcohol level exceeded! Location: ");
  sim800l.print(gpsData);
  sim800l.print((char)26);
  delay(100);
}

String getGPSData() {
  // Dummy GPS data for now
  return "Lat: 0.0000, Lon: 0.0000";
}

This code initializes the necessary components and continuously reads the alcohol level from the MQ-3 sensor. If the alcohol level exceeds a predefined threshold, it sounds a buzzer and sends a location message using the SIM800L module. The location data is currently a placeholder and should be replaced with actual GPS data from the NEO 6M module.