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

ESP8266-Based Smart Alcohol Detection System with RFID and LCD Display

View and Edit Project In Cirkit DesignerImage of ESP8266-Based Smart Alcohol Detection System with RFID and LCD Display

Circuit Documentation

Summary

This circuit integrates an ESP8266 NodeMCU microcontroller with an MQ-3 alcohol sensor, an RFID-RC522 module, a buzzer, and a 16x2 I2C LCD display. The ESP8266 NodeMCU reads data from the alcohol sensor and the RFID module, displays information on the LCD, and activates the buzzer based on the alcohol level detected.

Component List

ESP8266 NodeMCU

MQ-3 Breakout

RFID-RC522

Buzzer

16x2 I2C LCD

Wiring Details

ESP8266 NodeMCU

MQ-3 Breakout

RFID-RC522

Buzzer

16x2 I2C LCD

Code Documentation

ESP8266 NodeMCU Code

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN D3
#define SS_PIN D4
#define ALCOHOL_SENSOR_PIN D0
#define BUZZER_PIN D8

LiquidCrystal_I2C lcd(0x27, 16, 2);
MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
  lcd.begin();
  lcd.backlight();
  SPI.begin();
  rfid.PCD_Init();
  pinMode(ALCOHOL_SENSOR_PIN, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);
  digitalWrite(BUZZER_PIN, LOW);
}

void loop() {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial()) {
    return;
  }

  int alcoholLevel = analogRead(ALCOHOL_SENSOR_PIN);
  lcd.clear();
  if (alcoholLevel > 512) { // Adjust threshold as needed
    lcd.setCursor(0, 0);
    lcd.print("Closed");
    digitalWrite(BUZZER_PIN, HIGH);
  } else {
    lcd.setCursor(0, 0);
    lcd.print("Open");
    digitalWrite(BUZZER_PIN, LOW);
  }
  delay(2000); // Wait for 2 seconds before next read
  rfid.PICC_HaltA();
}

16x2 I2C LCD Code

void setup() {
  // put your setup code here, to run once:
}

void loop() {
  // put your main code here, to run repeatedly:
}

This documentation provides a comprehensive overview of the circuit, including the components used, their wiring details, and the code running on the microcontrollers.