Arduino - MQ3 Alcohol Sensor

This tutorial demonstrates interfacing an MQ3 alcohol sensor with Arduino to monitor ethanol and alcohol vapor levels in your environment. The MQ3 sensor finds widespread use in DIY breathalyzer devices, alcohol detection alarms, and air quality monitoring projects.

You'll discover:

Arduino with MQ3 alcohol gas sensor module

About MQ3 Alcohol Sensor

Operating as a Chemiresistor, the MQ3 is a Metal Oxide Semiconductor (MOS) device that identifies alcohol presence through resistance changes in its sensing material. This module excels at detecting ethanol vapor with high sensitivity across a range of concentrations.

At its core, the sensor employs a Tin Dioxide (SnO2) layer deposited onto an Aluminum Oxide ceramic base. Heating activates the SnO2, making it responsive to alcohol molecules. A stainless steel protective mesh (anti-explosion screen) surrounds the sensor, shielding the heating element while permitting gas molecules to pass through to the detection chamber.

Popular uses for this sensor span breathalyzer construction, DUI detection equipment, alcohol warning systems, and environmental alcohol monitoring applications.

Technical Specifications

  • Operating Voltage: 5V DC
  • Load Resistance: 200 KΩ
  • Heater Resistance: 33Ω ± 5%
  • Heating Consumption: < 800mW
  • Sensing Resistance: 1 MΩ – 8 MΩ
  • Detection Range: 25 – 500 ppm (parts per million)
  • Preheat Time: 24-48 hours for first use

Understanding ppm: The abbreviation ppm stands for parts-per-million, representing the ratio of target gas molecules to total molecules. In practical terms, a reading of 500 ppm indicates 500 alcohol molecules exist among every 1,000,000 total gas molecules, with the remaining 999,500 being other atmospheric gases.

Pinout

Four connection pins are available on the MQ3 sensor module:

  • VCC pin: Supply +5V power through this connection.
  • GND pin: Connect to ground (0V).
  • DO pin: Digital output that goes LOW upon detecting alcohol above the threshold, or HIGH when below. The onboard potentiometer allows threshold adjustment.
  • AO pin: Analog output providing variable voltage corresponding to alcohol levels. Increased alcohol produces increased voltage output.
MQ3 alcohol sensor module pinout diagram

Two indicator LEDs provide visual feedback:

  • PWR-LED: Illuminates when power is supplied to the module.
  • DO-LED: Reflects the digital output state—lighting up during alcohol detection and remaining off otherwise.

How It Works

The MQ3's detection mechanism relies on resistance variations within its Tin Dioxide (SnO2) semiconductor element:

Clean air conditions: Heat applied to the SnO2 causes oxygen to bind to its surface, trapping electrons and creating a depletion layer. This electron trap generates a barrier that restricts electrical conductivity, keeping resistance high.

Alcohol exposure: Alcohol molecules interact with surface oxygen, breaking the oxygen bonds and liberating trapped electrons back into the tin dioxide structure. This increases conductivity significantly—greater alcohol concentration means lower electrical resistance.

Two output modes are available from this sensor:

Digital Output (DO pin):

  • An adjustable potentiometer sets the detection threshold level.
  • When detected alcohol surpasses the threshold setting, DO outputs LOW while the LED indicator illuminates.
  • When alcohol remains below the threshold, DO stays HIGH and the LED stays dark.

Analog Output (AO pin):

  • Voltage output correlates directly with detected alcohol levels.
  • More alcohol vapor present = higher voltage reading.
  • Less alcohol vapor present = lower voltage reading.
  • Note: The potentiometer adjustment only affects the digital output, not the analog signal.

Warm-up and Calibration

Pre-heating Requirements

Accurate measurements from the MQ3 require proper heating before operation:

  • Initial use or extended storage (30+ days): Allow 24-48 hours of continuous heating for sensor stabilization and reliable measurements.
  • Regular use: A brief 5-10 minute warm-up suffices. Initial readings may appear elevated but will normalize quickly.

To warm the sensor, simply connect VCC and GND to a 5V power supply or directly to your Arduino's power pins, maintaining the connection throughout the warm-up duration.

Finding Your Threshold Values

Extended storage can cause calibration drift in heater-based sensors like the MQ3. Establish accurate threshold values for breathalyzer applications by following this procedure:

  1. Establish clean air baseline: Operate the sensor in fresh air and note the analog output (expect values near 100-150).
  2. Introduce alcohol vapor: Hold isopropyl alcohol or hand sanitizer near (not on) the sensor, allowing only vapors to reach it. Record the elevated readings (commonly 400-900 based on vapor density).
  3. Define detection zones: Use your recorded values to establish ranges:
  • No intoxication: Readings under baseline + 20 (example: < 120)
  • Moderate consumption: Mid-range values (example: 120-400)
  • High intoxication: Readings exceeding moderate threshold (example: > 400)

Important: Sensor characteristics vary between units and environments. Always perform calibration with your specific hardware before deployment.

Setting the Digital Threshold

Configure the DO pin's trigger point via the onboard trim potentiometer:

  1. Position alcohol vapor near the sensor.
  2. Rotate the potentiometer clockwise until you see the LED activate.
  3. Slowly turn counterclockwise until the LED just deactivates.
  4. The trigger threshold is now properly calibrated.

Wiring Diagram

Both output pins are available on the MQ3 module. Select either one or use both simultaneously based on your project requirements.

MQ3 Alcohol SensorArduino
VCC5V
GNDGND
DOPin 2
AOA0
Arduino and MQ3 alcohol sensor wiring diagram showing pin connections

This image is created using Fritzing. Click to enlarge image

Arduino Code - Digital Output Reading

/* * Created by ArduinoGetStarted.com * * This example code is in the public domain * * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-mq3-alcohol-sensor */ #define DO_PIN 2 // The Arduino pin connected to DO pin of the MQ3 sensor void setup() { // Initialize serial communication Serial.begin(9600); // Initialize the Arduino pin as an input pinMode(DO_PIN, INPUT); // Warm-up message Serial.println("Warming up the MQ3 sensor"); delay(20000); // 20 seconds warm-up time for recently used sensor } void loop() { int gasState = digitalRead(DO_PIN); if (gasState == HIGH) { Serial.println("Alcohol is NOT detected"); } else { Serial.println("Alcohol is detected"); } delay(1000); }

Quick Steps

  • Open the code above in Arduino IDE
  • Upload to your Arduino board via the Upload button
  • Position alcohol vapor source near the MQ3 sensor (hand sanitizer or rubbing alcohol on cotton works well)
  • Monitor the output in Serial Monitor
COM6
Send
Alcohol is NOT detected Alcohol is NOT detected Alcohol is NOT detected Alcohol is detected Alcohol is detected Alcohol is detected Alcohol is detected Alcohol is NOT detected Alcohol is NOT detected
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Note: When readings don't match actual conditions (false positives or missed detections), fine-tune the detection threshold using the module's potentiometer. Clockwise rotation raises sensitivity; counterclockwise lowers it. Adjust until detection accuracy improves.

Arduino Code - Analog Output Reading

/* * Created by ArduinoGetStarted.com * * This example code is in the public domain * * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-mq3-alcohol-sensor */ #define AO_PIN A0 // The Arduino pin connected to AO pin of the MQ3 sensor void setup() { // Initialize serial communication Serial.begin(9600); // Warm-up message Serial.println("Warming up the MQ3 sensor"); delay(20000); // 20 seconds warm-up time for recently used sensor } void loop() { int gasValue = analogRead(AO_PIN); Serial.print("MQ3 sensor AO value: "); Serial.println(gasValue); delay(1000); }

Quick Steps

  • Load the code into Arduino IDE
  • Upload via the Upload button
  • Introduce alcohol vapor to the sensor (hand sanitizer or isopropyl alcohol)
  • Observe readings in Serial Monitor
COM6
Send
MQ3 sensor AO value: 120 MQ3 sensor AO value: 125 MQ3 sensor AO value: 128 MQ3 sensor AO value: 450 MQ3 sensor AO value: 620 MQ3 sensor AO value: 850 MQ3 sensor AO value: 920 MQ3 sensor AO value: 980 MQ3 sensor AO value: 950 MQ3 sensor AO value: 680 MQ3 sensor AO value: 420
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Using either digital or analog outputs, you can implement threshold-based decisions to activate alarms, control warning indicators, or record data for breathalyzer functionality.

Arduino Code - Breathalyzer with Threshold Detection

This example demonstrates analog output interpretation through calibrated thresholds to estimate intoxication levels.

/* * Created by ArduinoGetStarted.com * * This example code is in the public domain * * Tutorial page: https://arduinogetstarted.com/tutorials/arduino-mq3-alcohol-sensor */ #define AO_PIN A0 // The Arduino pin connected to AO pin of the MQ3 sensor // Threshold values - REPLACE THESE with your calibrated values! // Run calibration first to find these values for your sensor #define SOBER_THRESHOLD 120 // Below this = sober #define DRUNK_THRESHOLD 400 // Above this = drunk, between = drinking but within limits void setup() { // Initialize serial communication Serial.begin(9600); // Warm-up message Serial.println("MQ3 Alcohol Sensor - Breathalyzer"); Serial.println("Warming up sensor..."); delay(20000); // 20 second warm-up for recently used sensor Serial.println("Sensor ready!"); Serial.println(); } void loop() { int gasLevel = analogRead(AO_PIN); // Read the analog value from sensor // Print sensor value Serial.print("Sensor Value: "); Serial.print(gasLevel); Serial.print(" | Status: "); // Determine status based on thresholds if (gasLevel < SOBER_THRESHOLD) { Serial.println("Stone Cold Sober"); } else if (gasLevel >= SOBER_THRESHOLD && gasLevel < DRUNK_THRESHOLD) { Serial.println("Drinking but within limits"); } else { Serial.println("DRUNK"); } delay(1000); // Wait 1 second between readings }

Quick Steps

  • Critical: First calibrate your sensor using the analog reading example to determine appropriate threshold values for your environment.
  • Update SOBER_THRESHOLD and DRUNK_THRESHOLD constants in the code with your calibrated numbers.
  • Load and upload the modified code to Arduino
  • Test with alcohol vapor (isopropyl alcohol or hand sanitizer vapor)
  • Review status messages in Serial Monitor
COM6
Send
Sensor Value: 115 | Status: Stone Cold Sober Sensor Value: 118 | Status: Stone Cold Sober Sensor Value: 350 | Status: Drinking but within limits Sensor Value: 480 | Status: DRUNK Sensor Value: 520 | Status: DRUNK Sensor Value: 290 | Status: Drinking but within limits Sensor Value: 125 | Status: Stone Cold Sober
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Disclaimer: This project serves educational purposes exclusively. Never rely on this device for legal breathalyzer functions or driving safety assessments.

Video Tutorial

We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.

Function References

The Best Arduino Starter Kit

※ OUR MESSAGES