Blynk MQ3 Alcohol Sensor| Alcohol Detector

Hey techies, welcome back to Techatronic. Have you ever seen an alcohol detector used to check the concentration of alcohol in the air? Well in this article we are going to make a alcohol detector project using an MQ3 alcohol sensor. We can see the readings taken by the MQ3 alcohol sensor in the blunk app. When the concentration of alcohol is excreted then the value set by us a notification will be sent that alcohol is detected. See the image given below to understand how it works. You can also check blynk LPG detector made by us.

alcohol detector project

You can see the real-time readings on the app. Just set up the app and upload the code in the NodeMCU.

mq3 alcohol sensor

Set up the Blynk Application.

First of all, you have to install the Blynk IoT app. Then open the app and follow the next step.

Provide your email id so that the app will send a unique id token number to you. You can access the controls of your project only by using this token number.

Now click on the new project to set up the project settings. Provide a name to your project and select the device as NodeMCU. Choose the connection type as WiFi.

Touch the Plus(+) symbol to add the widgets to your project. You can choose different widgets from the menu that appeared.

Add a notification and a gauge widget to your project. The images of both are given below. Don’t add wrong or extra widgets it may disturb the working of the project.

mq3 alcohol sensor

Adjust the position of the gauge and the notification widget on the screen as you want. Then click on the highlighted button so you can set up the pins and value for the MQ3 alcohol sensor.

The configuration page will open and you have to provide the data for the sensor. Name the widget and set the pin to virtual-2. Set the value from 0 to 1023. You can also change the widget color and text font.

mq3 alcohol sensor

Now run this by clicking on the play button. Turn on the NodeMCU and the measured output will appear on the gauge.

Components Required

  • NodeMCU esp8266 board
  • MQ3 alcohol sensor
  • Smartphone with good internet connection
  • USB cable for uploading the code
  • Jumper wires and a breadboard
S.No Component Name Quantity Buy Link
1. Nodemcu esp8266 1 https://amzn.to/3EUGhuu
2. Nodemcu cable 1 https://amzn.to/3F1ywmu
3. MQ-3 Alcohol Sensor 1 https://amzn.to/39CfTa7
4. Breadboard 1 https://amzn.to/39vsRX2
5. Jumper wire 40 https://amzn.to/39q43jr

Circuit Diagram for alcohol detector project

mq3 alcohol sensor

Nodemcu esp8266 MQ-3 Alcohol Sensor
VV, Vin ( +5V ) VCC ( Positive + )
G, GND ( Ground ) GND ( Ground )
A0 Pin A0 Pin

Connect the VCC pin of the MQ3 sensor with the VIN pin of the NodeMCU. Attach the GND pin of the MQ3 sensor with the GND pin of the NodeMCU. Join the data pin of the MQ3 sensor with the analog-0 pin of the NodeMCU as shown above. Connect the NodeMCU with the mobile hotspot or a wifi router with a good internet connection. Click here to check how to set up Arduino IDE for uploading the code in NodeMCU.

Code for alcohol detector project

NOTE: Please upload the code given below to the NodeMCU. You have to install <ESP8266WiFi.h>, <BlynkSimpleEsp8266.h>, <SimpleTimer.h> libreries first. Check how to install zip libraries into Arduino IDE.

 //TECHATRONIC.COM  
 // BLYNK LIBRARY  
 // https://github.com/blynkkk/blynk-library  
 // ESP8266 LIBRARY  
 // https://github.com/ekstrand/ESP8266wifi  
 #include <ESP8266WiFi.h>  
 #include <BlynkSimpleEsp8266.h>  
 #include <SimpleTimer.h>  
 #define BLYNK_PRINT Serial  // Comment this out to disable prints and save space  
 char auth[] = "fRgyO8sX1W6CjpMiY8gp65I2_0yX-t4E"; //Enter Authentication code sent by Blynk  
 char ssid[] = "DESKTOP"; //Enter WIFI Name  
 char pass[] = "asdfghjkl"; //Enter WIFI Password  
 SimpleTimer timer;  
 int mq2 = A0; // Alcohol sensor MQ -3 is connected with the analog pin A0   
 int data = 0;   
 void setup()   
 {  
  Serial.begin(115200);  
  Blynk.begin(auth, ssid, pass);  
  timer.setInterval(1000L, getSendData);  
 }  
 void loop()   
 {  
  timer.run(); // Initiates SimpleTimer  
  Blynk.run();  
 }  
 void getSendData()  
 {  
 data = analogRead(mq2);   
  Blynk.virtualWrite(V2, data); // Blynk INPUT Connect V2 Pin  
  if (data > 700 )  
  {  
   Blynk.notify("Alcohol Detected!");   
  }  
 }  

Please try to make this project on your own. Also, check tutorials on Arduino and Raspberry Pi. Feel free to ask doubts in the comments section below.

HAPPY LEARNING!