Arduino Nano - MQ3 Alcohol Sensor

This guide walks you through integrating the MQ3 alcohol sensor with Arduino Nano for detecting and measuring alcohol vapor and ethanol concentration. The MQ3 sensor is commonly deployed in breath analyzer projects, alcohol alarm systems, and air quality assessment applications.

In this tutorial, you will learn:

Arduino Nano with MQ3 alcohol gas sensor module

Hardware Preparation

1×Official Arduino Nano
1×Alternatively, DIYables ATMEGA328P Nano Development Board
1×USB A to Mini-B USB cable
1×MQ3 Alcohol Sensor
1×Jumper Wires
1×Breadboard
1×Recommended: Screw Terminal Expansion Board for Arduino Nano
1×Recommended: Breakout Expansion Board for Arduino Nano
1×Recommended: Power Splitter for Arduino Nano

Or you can buy the following kits:

1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of MQ3 Alcohol Sensor

The MQ3 functions as a Metal Oxide Semiconductor (MOS) Chemiresistor, identifying alcohol by measuring resistance variations in its sensitive material. Designed for ethanol vapor detection, this sensor delivers reliable performance across different concentration levels.

The sensor's detection element consists of Tin Dioxide (SnO2) material layered onto a ceramic substrate made of Aluminum Oxide. When heated, the SnO2 layer becomes chemically reactive to alcohol molecules in the surrounding air. A protective stainless steel mesh guards the internal components while allowing gas molecules to reach the sensing chamber.

Common applications include DIY breathalyzer devices, drunk driving detection systems, alcohol vapor alarms, and atmospheric alcohol level monitoring.

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

What is ppm? Parts-per-million (ppm) describes the proportion of target gas molecules relative to total gas molecules. For instance, 500 ppm means there are 500 alcohol molecules within each 1,000,000 gas molecules, while the other 999,500 molecules are ambient air components.

Pinout

The MQ3 sensor module features four pin connections:

  • VCC pin: Connect to +5V power supply.
  • GND pin: Connect to ground (0V).
  • DO pin: Digital output goes LOW when alcohol exceeds the threshold, HIGH when below threshold. Adjust the threshold using the onboard potentiometer.
  • AO pin: Analog output delivers voltage proportional to alcohol concentration. Higher alcohol levels produce higher voltages.
MQ3 alcohol sensor module pinout diagram

Visual feedback is provided by two onboard LEDs:

  • PWR-LED: Lights up when the module receives power.
  • DO-LED: Mirrors the digital output state—illuminates when detecting alcohol, stays dark otherwise.

How It Works

The MQ3 operates through resistance changes in its Tin Dioxide (SnO2) semiconductor material:

In clean air: The heated SnO2 surface attracts atmospheric oxygen molecules, which trap electrons and form a depletion layer. This electron trapping creates a conduction barrier, maintaining high electrical resistance.

When exposed to alcohol: Alcohol molecules react with the surface oxygen, releasing the trapped electrons back into the tin dioxide lattice. This electron release increases conductivity substantially—higher alcohol concentrations result in lower resistance values.

The sensor provides two distinct output modes:

Digital Output (DO pin):

  • Threshold level is adjustable via the onboard trim potentiometer.
  • Detection above the threshold drives DO to LOW and lights the indicator LED.
  • Readings below the threshold keep DO at HIGH with the LED off.

Analog Output (AO pin):

  • Output voltage changes proportionally with alcohol concentration.
  • Higher alcohol vapor = increased voltage output.
  • Lower alcohol vapor = decreased voltage output.
  • Note: The trim potentiometer affects only the digital threshold, not the analog signal.

Warm-up and Calibration

Pre-heating Requirements

For accurate operation, the MQ3 sensor requires adequate heating:

  • First use or after long storage (30+ days): Run the heater continuously for 24-48 hours to stabilize the sensor and achieve consistent readings.
  • Routine operation: A quick 5-10 minute warm-up period is adequate. Early readings may show elevated values but will settle to normal within minutes.

Warm up the sensor by connecting its VCC and GND pins to 5V and ground respectively—either through a power supply or directly from your Arduino Nano's power pins.

Finding Your Threshold Values

Heater-based gas sensors like the MQ3 can drift after storage periods. For breathalyzer implementations, determine proper threshold values through this calibration process:

  1. Record baseline in clean air: Operate the sensor in fresh air without alcohol present. Note the analog reading (typically 100-150).
  2. Test with alcohol vapor: Bring isopropyl alcohol or hand sanitizer near the sensor (do not make contact), allowing vapor to reach the detector. Record the elevated values (usually 400-900 depending on vapor strength).
  3. Set detection ranges: Based on your measurements, create threshold zones:
  • Sober state: Values below baseline + 20 (for example: < 120)
  • Moderate level: Values in the mid-range (for example: 120-400)
  • High level: Values above moderate limit (for example: > 400)

Note: Each sensor unit and operating environment produces different values. Calibrate with your actual hardware before using in any application.

Setting the Digital Threshold

Adjust the DO pin trigger point using the module's potentiometer:

  1. Expose the sensor to alcohol vapor.
  2. Turn the potentiometer clockwise until the LED lights up.
  3. Slowly rotate counterclockwise until the LED just turns off.
  4. Your digital threshold is now calibrated.

Wiring Diagram

The MQ3 module provides both digital and analog outputs. Use either output individually or both together depending on your project needs.

MQ3 Alcohol SensorArduino Nano
VCC5V
GNDGND
DOD2
AOA0
The wiring diagram between Arduino Nano and and MQ3 alcohol sensor  showing pin connections

This image is created using Fritzing. Click to enlarge image

See The best way to supply power to the Arduino Nano and other components.

Arduino Nano Code - Digital Output Reading

/* * This Arduino Nano code was developed by newbiely.com * * This Arduino Nano code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano/arduino-nano-mq3-alcohol-sensor */ #define PIN_DO 2 // The Arduino Nano pin connected to the DO pin of the MQ3 sensor void setup() { // Initialize serial communication Serial.begin(9600); // Initialize the Arduino Nano pin as an input pinMode(PIN_DO, 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(PIN_DO); if (gasState == HIGH) { Serial.println("Alcohol is NOT detected"); } else { Serial.println("Alcohol is detected"); } delay(1000); }

Detailed Instructions

  • Copy the code into Arduino IDE
  • Click the Upload button to transfer code to Arduino Nano
  • Place an alcohol vapor source near the sensor (use hand sanitizer or rubbing alcohol on a cotton swab)
  • Check the Serial Monitor for results
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  

Tip: If the detection results don't align with reality (false triggers or missed detections), adjust the potentiometer on the module. Turn clockwise to increase sensitivity or counterclockwise to decrease it until the detection becomes accurate.

Arduino Nano Code - Analog Output Reading

/* * This Arduino Nano code was developed by newbiely.com * * This Arduino Nano code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano/arduino-nano-mq3-alcohol-sensor */ #define PIN_AO A0 // The Arduino Nano pin connected to the 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(PIN_AO); Serial.print("MQ3 sensor AO value: "); Serial.println(gasValue); delay(1000); }

Detailed Instructions

  • Paste the code into Arduino IDE
  • Click the Upload button to program Arduino Nano
  • Expose the sensor to alcohol vapor (hand sanitizer or isopropyl alcohol vapors)
  • Monitor the changing values 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  

With both digital and analog outputs available, you can implement threshold-based logic to trigger alarms, activate visual indicators, or log data for breathalyzer applications.

Arduino Nano Code - Breathalyzer with Threshold Detection

This example shows how to interpret analog readings using calibrated thresholds to estimate alcohol consumption levels.

/* * This Arduino Nano code was developed by newbiely.com * * This Arduino Nano code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-nano/arduino-nano-mq3-alcohol-sensor */ #define PIN_AO A0 // The Arduino Nano pin connected to the 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(PIN_AO); // 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 }

Detailed Instructions

  • Important: Calibrate your sensor first using the analog reading example to determine proper threshold values for your specific sensor.
  • Modify the SOBER_THRESHOLD and DRUNK_THRESHOLD constants in the code with your calibrated values.
  • Upload the updated code to Arduino Nano
  • Test by introducing alcohol vapor (isopropyl alcohol or hand sanitizer vapor)
  • Watch the status updates 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 is an educational project only. Do not use this device as an official breathalyzer or for determining driving safety.

Video Tutorial

Function References

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!