In this project, we are making an alcohol detector using an MQ3 alcohol sensor and nodemcu.
Things used in this project
Hardware components
Software apps and online services
Arduino IDE
Story
Hey techies, we are back with another new project. In this article, we are going to make an alcohol detector project using an MQ3 alcohol sensor. For making this alcohol detector we are using a nodemcu board. When the concentration of alcohol is excreted in the air then a notification will be sent that alcohol is detected. All the necessary details regarding the project are provided below. You can read the full article on our website.
You can see the real-time readings on the app. Just set up the app and upload the code in the NodeMCU.
Set up the Blynk Application.
Before starting, 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.
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.
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.
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
Circuit Diagram for alcohol detector project
This is the circuit diagram for the project. Make the connections correct and tight.
Code for alcohol detector project
NOTE: Please upload the code given below to the NodeMCU.
//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!");
}
}
We hope that you like this project and if so then you can also, check out the tutorials on Arduino and Raspberry Pi.
HAPPY LEARNING!
The article was first published in hackster, August 30, 2021
cr: https://www.hackster.io/electronicprojects/blynk-mq3-alcohol-sensor-alcohol-detector-d44223
author: Techatronic