Alcohol Detector using Arduino. How To?

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
dondon pramis
Location: Philippines
Posts: 54
Joined: Sun Feb 12, 2017 8:28 am

Alcohol Detector using Arduino. How To?

Tue Jun 19, 2018 5:34 pm

Arduino Shield Circuit Diagram
Components-for-Arduino-Alcohol-Detector-Circuit.jpg (35.91 KiB) Viewed 1146 times
In this project, I am going to Interface an Alcohol Sensor with Arduino. Here I have designed an Arduino Shield PCB using EASYEDA online PCB simulator and designer. Arduino Alcohol Detector will detect the alcohol level in breath and by using some calculations in code we can calculate the alcohol level in breath or blood and can trigger some alarm.

Components Required:

Arduino UNO
Alcohol detector Arduino shield
Alcohol Sensor (MQ3)
Resistor 10K
Resistor 1K
16x2 LCD
Power Supply
10k POT
Push button
In this Arduino Alcohol Detector Shield we have used a MQ3 sensor to detect present alcohol level in the breath. A 16x2 LCD is used for displaying the PPM Value of alcohol. And an LM358 IC for converting alcohol level sensor output to digital (this function is optional). A buzzer is also place for indicating high alcohol level.

Circuit Diagram for this Arduino Alcohol Sensor Project is given above. We have a comparator circuit for comparing output voltage of Alcohol Sensor with preset voltage (output connected at pin D7). Alcohol sensor output is also connected at an analog pin of Arduino (A0). Buzzer is connected at Pin D9. And LCD connections are same as Arduino LCD examples that are available in Arduino IDE (12, 11, 5, 4, 3, 2). A push button also used here for start taking reading from Alcohol Sensor connected at digital pin D6 of Arduino. Remaining connections are shown in the circuit diagram.

Note: In the circuit, we need to short all the three pin of J2 header to calculate PPM.

For designing Alcohol Detector Shield for Arduino we have used EasyEDA, in which first we have designed a Schematic and then converted that into the PCB layout by Auto Routing feature of EasyEDA. Complete Process is explained below.

Calculations for Alcohol Level:
According to MQ3 datasheet, alcohol in clean air is 0.04 mg/L.

So we power the circuit and find the output voltage of MQ3 sensor in room air (I assume my room has clean air) so I got 0.60 voltage. It means when the sensor is giving 0.60v in the clean air then alcohol will be 0.04 mg/L.

Now we can find a multiplier by dividing alcohol by output voltage in clean air and we get
Multiplier = 0.40/0.60
Multiplier = 0.67
Now we have a formula for calculating alcohol (may be far away from the accurate or actual calculation. These are not standard calculations)
Alcohol = 0.67 * v .
Where v is the output voltage of alcohol sensor.

Note: This calculation is not accurate or standard.

Now we know the least driving limit while drinking alcohol is around 0.5mg/L. But in our calculation, we are getting around 0.40 mg/L in clean air so that we have set a threshold of alcohol while driving 0.80mg/L (just for Demonstration).

MQ3 Sensor:
MQ3 alcohol gas sensor is made by using SnO2 material which has less conductivity in clean air. Whenever it comes nearby alcohol gas its starts conducting highly according to the gas concentration. So user can sense the difference of output voltage using any microcontroller and can detect the presence of Alcohol. This is low cost and a suitable sensor for many applications for alcohol detection. This sensor has a long life and good sensitivity. Some of the applications that can be made by using this sensor are Alcohol gas alarm, portable alcohol detector, gas alarms, Breathalyzer etc.
MQ3 Sensor.jpg
MQ3 Sensor.jpg (18.63 KiB) Viewed 1146 times
To build your PCB Shield you can Edit from Here : ... 1af5b9ea35

The Complete Code Below:

Code: Select all

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);

#define sensor A0
#define led 13
#define buz 9
void setup() 
  lcd.print("Alcohol Detector");
  lcd.print(" Dohangout.Com ");
  pinMode(sensor, INPUT);
  pinMode(buz, OUTPUT);
  pinMode(led, OUTPUT);

void loop() 
  float adcValue=0;
  for(int i=0;i<10;i++)
    adcValue+= analogRead(sensor);
    float v= (adcValue/10) * (5.0/1024.0);
    float mgL= 0.67 * v;
    Serial.print(" mg/L");
    lcd.print("BAC: ");
    lcd.print(" mg/L        ");
    if(mgL > 0.8)
      lcd.print("Drunk   ");
      Serial.println("    Drunk");
      digitalWrite(buz, HIGH);
      digitalWrite(led, HIGH);
      lcd.print("Normal  ");
      Serial.println("    Normal");
      digitalWrite(buz, LOW);
      digitalWrite(led, LOW);


Thanks, and Enjoy!



In total there are 5 users online :: 1 registered, 0 hidden and 4 guests
Registered users: Bing [Bot]
Most users ever online was 19 on Mon May 20, 2019 11:06 pm
Total posts 527
Total topics 406
Total members 73
Our newest member Kelly
No birthdays today