1. Introduction
Driving under the influence of alcohol is a major cause of road accidents. This project presents a smart safety system using Arduino and MQ3 alcohol sensor that detects alcohol from breath and prevents the vehicle engine from starting.
If alcohol is detected beyond a safe level, the system locks the engine using a relay, activates a buzzer alarm, and provides visual indication using LED.
2. Components
- Arduino Uno / Nano
- MQ3 Alcohol Sensor
- Relay Module (5V)
- Buzzer
- LED
- Resistor (220Ω)
- Breadboard
- Jumper Wires
- Power Supply
3. Circuit and Connections
MQ3 Sensor
- VCC → 5V
- GND → GND
- Analog Output → A0
Relay Module
- IN → Pin 8
- VCC → 5V
- GND → GND
Buzzer
- Positive → Pin 9
- Negative → GND
LED
- Positive → Pin 7 (via resistor)
- Negative → GND
4. Detailed Step By Step Circuit Working
- MQ3 sensor continuously senses alcohol concentration in air.
- Sensor outputs an analog voltage based on alcohol level.
- Arduino reads this value through analog pin A0.
- If value exceeds predefined threshold:
- Relay is turned OFF → Engine stops
- Buzzer turns ON → Warning alert
- LED glows → Visual indication
- If alcohol is not detected:
- Relay stays ON → Engine runs normally
- Buzzer OFF
- LED OFF
5. Libraries to be included
No external libraries are required for this project.
Arduino built-in functions are sufficient.
6. Code
#define mq3 A0
#define relay 8
#define buzzer 9
#define led 7
int threshold = 300;
void setup() {
pinMode(relay, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
int alcoholValue = analogRead(mq3);
Serial.println(alcoholValue);
if (alcoholValue > threshold) {
digitalWrite(relay, LOW); // Engine OFF
digitalWrite(buzzer, HIGH);
digitalWrite(led, HIGH);
} else {
digitalWrite(relay, HIGH); // Engine ON
digitalWrite(buzzer, LOW);
digitalWrite(led, LOW);
}
delay(500);
}
7. Detailed Step By Step Code Working
- Define pins for MQ3 sensor, relay, buzzer, and LED.
- Set threshold value (adjust based on calibration).
- In setup():
- Configure pins as OUTPUT
- Start Serial Monitor
- In loop():
- Read analog value from MQ3 sensor
- Print value for monitoring
- If value > threshold:
- Relay OFF → Engine locked
- Buzzer ON
- LED ON
- Else:
- Relay ON → Engine allowed
- Buzzer OFF
- LED OFF
- Delay added for stability
8. Tips
- Calibrate MQ3 sensor before use
- Avoid testing near perfumes or smoke
- Use proper power supply for relay
- Adjust threshold based on real testing
- Use enclosure for real-world application
9. Uses
- Vehicle safety systems
- Anti-drunk driving systems
- Engineering projects
- Industrial safety monitoring
- Awareness demonstrations
10. Conclusion
This project demonstrates how a simple Arduino-based system can help improve road safety by preventing drunk driving. It is easy to build, cost-effective, and highly useful for real-world applications.