In places such as bars, factories, and warehouses, monitoring the alcohol content in the air is crucial for safety. To meet this demand, electronics enthusiasts can use an Arduino and an MQ-3 sensor module to create a mini alcohol sensing project. This project can actively detect alcohol concentration in the air and provide corresponding analog values through the serial monitor. Let’s get started!
MQ-3 Alcohol Sensor
The MQ-3 is a gas sensor that employs tin dioxide (SnO2) as its sensitive material, and it possesses high sensitivity to alcohol. Under normal circumstances, the sensor’s sensitive material maintains a low level of electrical conductivity. However, when alcohol vapors are present in the surrounding air, these gas molecules adsorb onto the sensitive material, leading to an increase in electrical conductivity. Utilizing this principle, the MQ-3 sensor can accurately detect alcohol concentration in the air and output corresponding voltage or digital signals for further processing by microcontrollers or circuits. Thanks to its excellent performance, cost-effectiveness, and resistance to some environmental interference factors, the MQ-3 sensor is highly favored and widely applied by electronics enthusiasts.

It’s important to note that the MQ-3 sensor requires some time to preheat (approximately 20 seconds) after powering on to ensure data stability. The sensor contains an electric heating element, so it may generate some heat, but as long as it doesn’t cause burns, this is a normal occurrence.
To ensure the sensor’s accuracy, calibration is typically necessary. Firstly, place the sensor in a normal, alcohol-free environment, and then, by adjusting the potentiometer, set a reference point that causes the indicator light to illuminate. Subsequently, when alcohol gas detection is required, the sensor will illuminate the indicator light again based on changes in concentration.
Wiring and Schematic Diagram




To power the Arduino MQ-3 alcohol sensor project, a 5V direct current should be connected. Based on your system design and data acquisition requirements, two signal output modes are available: DOUT and AOUT.
DOUT Mode
You can directly connect the sensor’s TTL high/low-level signal to the microcontroller’s input/output port or use it to drive a relay through an NPN transistor. In this setup, there’s a potentiometer (labeled as RP) for adjusting the threshold at which the output signal changes.
In DOUT mode, the MQ-3 sensor’s comparator part compares the detected gas concentration with the threshold set by potentiometer RP. When the concentration exceeds the threshold set by RP, the voltage at pin 2 of the comparator is higher than at pin 3, causing the comparator’s pin 1 to output a low level, lighting up the LED. R3 is used as a current-limiting resistor for the LED, and C1 acts as a smoothing capacitor to smooth out the output signal.
AOUT Mode
You don’t need to worry about adjusting the potentiometer; you can directly connect the sensor’s AOUT pin to the input of the AD converter or to a microcontroller with AD functionality.
In a normal environment, the sensor’s AOUT pin outputs a voltage of approximately 1V. However, when the sensor detects the target gas, the output voltage rises by 0.1V for each 20 ppm increase in actual gas concentration (ppm stands for parts per million and is commonly used to indicate gas or solution concentration). Based on this parameter, you can internally convert the measured analog voltage value into the corresponding gas concentration value within the microcontroller.
Code
int ycPin = A0;
void setup() {
pinMode(ycPin, INPUT);
Serial.begin(9600); // Initialize the serial communication
}
void loop() {
int ycValue = analogRead(ycPin); // Read the analog value from pin A0
Serial.print("ycValue = "); // Print a label
Serial.println(ycValue); // Print the analog value
delay(200); // Delay for 200 milliseconds
}
Code Explanation
int ycPin = A0;:
- This line declares an integer variable named ycPin and initializes it with the value A0. In Arduino, A0 refers to analog pin 0.
void setup():
- This is the setup function, which is executed once when the Arduino board starts.
- pinMode(ycPin, INPUT);:
- This line sets ycPin (analog pin 0) as an input pin. It configures the pin to receive analog input.
- Serial.begin(9600);:
- This line initializes serial communication at a baud rate of 9600. It allows you to communicate with a computer via the Arduino’s USB port.
void loop():
- This is the main loop function, which runs continuously after the setup function.
- int ycValue = analogRead(ycPin);:
- This line reads an analog value from pin A0 (stored in ycPin) and assigns it to the integer variable ycValue.
- Serial.print(“ycValue = “);:
- This line prints the text “ycValue = ” to the serial monitor as a label.
- Serial.println(ycValue);:
- This line prints the value of ycValue to the serial monitor, followed by a line break, so each reading appears on a new line.
- delay(200);:
- This line introduces a 200-millisecond delay before the next iteration of the loop.
You Might Be Interested


This DIY project introduces an Arduino-based smart tea maker that combines mechanical and electronic control for automated tea brewing. It uses multiple Arduinos, servos, and sensors to handle tasks like


This comprehensive guide explores how to use Arduino with LCD displays, covering essential concepts and pin configurations. It includes three practical projects: basic text display, dynamic number updates, and real-time


This comprehensive guide elucidates the process of enabling multi-core functionality on the ESP32 microcontroller, leveraging its dual-core architecture for enhanced parallel processing capabilities. Through detailed steps and code examples, developers


This guide illustrates how to integrate LVGL with the ESP32, enabling the creation of engaging graphical user interfaces for embedded systems. By configuring libraries and writing code, developers can enhance


This Arduino temperature alarm project effectively demonstrates how to create a practical temperature monitoring system. By utilizing the LM35 temperature sensor and a buzzer, it warns users with an audible


This article provides a comprehensive guide on using CMake and rosserial_client to compile and upload code to Arduino for larger Arduino projects, offering an alternative to the Arduino IDE. The


Discover the wonders of Arduino, an open-source electronics platform that simplifies electronic design and empowers people to create their own projects. From mesmerizing LED displays to intelligent home automation systems,


In this comprehensive tutorial, we will provide a detailed exploration of various Arduino boards, delve into essential concepts, and highlight their distinctive features. Our aim is to assist you in