IoTIntermediatePRJ-160

IoT Smart Helmet with Alcohol Detection Using ESP32

Stops the bike from starting if no helmet is worn or alcohol is detected.

Built and tested by Drisya K S · Industrial Robotics Institute

Circuit diagram of the IoT Smart Helmet with Alcohol Detection using ESP32
Circuit diagram · ESP32
LevelIntermediate
Build time3–4 hours
BoardESP32
Parts8 components

What is the IoT Smart Helmet with Alcohol Detection?

This smart helmet is a safety system designed to prevent accidents caused by drunk driving and riding without a helmet. An ESP32 reads an MQ-3 alcohol sensor and an IR helmet-detection sensor before allowing the bike to start. If unsafe conditions are detected, a relay keeps the ignition off, a buzzer alerts the rider and an alert can be sent to a mobile app.

How it works

  1. The IR sensor checks whether the helmet is being worn.
  2. The MQ-3 sensor measures the alcohol level in the rider’s breath.
  3. The ESP32 processes both inputs continuously.
  4. If the helmet is not worn or the alcohol reading exceeds the threshold (400), the relay cuts ignition and the buzzer sounds.
  5. If conditions are safe, the relay turns on to allow the bike to start.

Parts list

ComponentQty
ESP32 Microcontroller1
Alcohol Sensor (MQ-3)1
IR Sensor (helmet detection)1
Relay Module (bike ignition control)1
Buzzer / LED1
Jumper Wires / BreadboardAs needed
5V Power Supply or Battery1
GSM Module (optional)1

Software

  • Arduino IDE
  • Blynk
  • Blynk library

Wiring and connections

FromConnect to
MQ-3 VCC5V
MQ-3 GNDGND
MQ-3 AOUTGPIO 34
IR Sensor VCC3.3V
IR Sensor GNDGND
IR Sensor OUTGPIO 5
Buzzer +GPIO 25
Buzzer –GND
Relay INGPIO 26
Power Supply5V to ESP32 + all components

How to build the IoT Smart Helmet with Alcohol Detection

  1. Mount the IR sensor inside the helmet to detect when it is worn, and place the MQ-3 near the rider’s mouth.
  2. Connect MQ-3 to 5V, GND and analog pin GPIO 34.
  3. Connect the IR sensor to 3.3V, GND and GPIO 5.
  4. Connect the buzzer to GPIO 25 and the relay module input to GPIO 26; wire the relay into the bike ignition circuit.
  5. Upload the code to the ESP32 using the Arduino IDE and check alcohol readings on the Serial Monitor (115200 baud).
  6. Optionally set up Blynk: create an ESP32 Wi-Fi project, copy the Auth Token and add Button, Gauge and Notification widgets.
  7. Test with and without the helmet worn to confirm the relay switches correctly.

IoT Smart Helmet with Alcohol Detection code

Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP32.

#define alcoholPin 34
#define irPin 5
#define relayPin 26
#define buzzerPin 25

int alcoholThreshold = 400;

void setup() {
  pinMode(irPin, INPUT);
  pinMode(relayPin, OUTPUT);
  pinMode(buzzerPin, OUTPUT);
  Serial.begin(115200);
}

void loop() {
  int alcoholValue = analogRead(alcoholPin);
  int helmetStatus = digitalRead(irPin);

  Serial.print("Alcohol: ");
  Serial.println(alcoholValue);

  if (helmetStatus == LOW || alcoholValue > alcoholThreshold) {
    digitalWrite(relayPin, LOW);   // Bike OFF
    digitalWrite(buzzerPin, HIGH); // Alert
  } else {
    digitalWrite(relayPin, HIGH);  // Bike ON
    digitalWrite(buzzerPin, LOW);
  }

  delay(500);
}

Real-world uses

  • Two-wheeler rider safety
  • Drunk-driving prevention
  • Helmet-use enforcement
  • Fleet/delivery bike safety

Frequently asked questions

What is a IoT Smart Helmet with Alcohol Detection?

This smart helmet is a safety system designed to prevent accidents caused by drunk driving and riding without a helmet. An ESP32 reads an MQ-3 alcohol sensor and an IR helmet-detection sensor before allowing the bike to start.

What components are needed for the IoT Smart Helmet with Alcohol Detection?

You need: ESP32 Microcontroller (1), Alcohol Sensor (MQ-3) (1), IR Sensor (helmet detection) (1), Relay Module (bike ignition control) (1), Buzzer / LED (1), Jumper Wires / Breadboard, 5V Power Supply or Battery (1), GSM Module (optional) (1). Software: Arduino IDE, Blynk, Blynk library.

Is the IoT Smart Helmet with Alcohol Detection project good for beginners?

It is rated intermediate and takes about 3–4 hours to build, using the ESP32. The guide on this page explains every connection and step.

Where can I get the code for the IoT Smart Helmet with Alcohol Detection?

The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.

Can I buy a kit for the IoT Smart Helmet with Alcohol Detection?

Yes. IRI sells a kit with the parts for this project (PRJ-160). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.

Industrial Robotics Institute
Logo