Arduino MKR WiFi 1010 - MQ3 Alcohol Sensor

This tutorial demonstrates connecting the MQ3 alcohol sensor to Arduino MKR WiFi 1010 for alcohol vapor and ethanol detection. The MQ3 sensor works excellently in breath testing applications, alcohol warning devices, and air monitoring projects.

What you'll learn:

Arduino MKR WiFi 1010 with MQ3 alcohol gas sensor module

Hardware Preparation

1×Arduino MKR WiFi 1010
1×Micro USB Cable
1×MQ3 Alcohol Sensor
1×Breadboard
1×Jumper Wires

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

Working as a Metal Oxide Semiconductor (MOS) Chemiresistor, the MQ3 detects alcohol by tracking resistance shifts in its detection material. This module provides sensitive ethanol vapor detection with stable readings across varied concentration ranges.

The sensor core uses a Tin Dioxide (SnO2) coating on a ceramic Aluminum Oxide base. Heat makes the SnO2 layer responsive to alcohol in the air. A stainless steel protective mesh covers the sensor, protecting the heater while allowing gas penetration to the detection surface.

Typical uses include handmade breathalyzer projects, intoxication detection equipment, alcohol presence alarms, and environmental alcohol tracking.

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? The ppm (parts-per-million) unit expresses gas concentration as a ratio. At 500 ppm, you have 500 alcohol molecules for each 1,000,000 total gas molecules, with 999,500 being other air components.

Pinout

The MQ3 sensor module has four connection pins:

  • VCC pin: Provide +5V power.
  • GND pin: Connect to ground (0V).
  • DO pin: Digital output switches LOW above alcohol threshold, HIGH below. Threshold adjusts via potentiometer.
  • AO pin: Analog output voltage corresponds to alcohol level. More alcohol yields higher voltage.
MQ3 alcohol sensor module pinout diagram

Two LEDs show sensor status:

  • PWR-LED: On when power is applied.
  • DO-LED: Follows digital output—on for detection, off for no detection.

How It Works

The MQ3 detects alcohol through resistance changes in Tin Dioxide (SnO2):

Clean air conditions: Heated SnO2 binds with oxygen molecules, trapping electrons in a depletion layer. Trapped electrons form a barrier to current flow, keeping resistance high.

Alcohol exposure: Alcohol reacts with surface oxygen, freeing trapped electrons into the tin dioxide. Freed electrons boost conductivity—more alcohol means less resistance.

Two output types are available:

Digital Output (DO pin):

  • Adjust threshold via onboard potentiometer.
  • Alcohol over threshold sends DO LOW and turns on LED.
  • Alcohol under threshold keeps DO HIGH with LED off.

Analog Output (AO pin):

  • Voltage rises and falls with alcohol concentration.
  • Higher alcohol = higher voltage.
  • Lower alcohol = lower voltage.
  • Note: Potentiometer only affects digital threshold, not analog voltage.

Warm-up and Calibration

Pre-heating Requirements

MQ3 sensor accuracy depends on proper heating:

  • Initial use or storage (30+ days): Provide 24-48 hours continuous heating for sensor stabilization and reliable operation.
  • Recent use: Brief 5-10 minute warm-up works fine. Readings may start high but stabilize quickly.

Heat the sensor by powering VCC and GND from 5V and ground—use a power supply or Arduino MKR WiFi 1010's power pins directly.

Finding Your Threshold Values

Gas sensors with heaters can drift when stored. For breathalyzer projects, calibrate thresholds using this method:

  1. Capture clean air baseline: Run sensor in fresh air and note analog output (usually 100-150).
  2. Test alcohol vapor: Hold isopropyl alcohol or hand sanitizer near (without touching) sensor, letting vapor reach it. Record higher values (often 400-900 based on vapor strength).
  3. Define zones: Use your data to set detection levels:
  • No detection: Below baseline + 20 (example: < 120)
  • Medium detection: Middle range (example: 120-400)
  • High detection: Above medium (example: > 400)

Important: Sensors vary unit-to-unit and between environments. Always calibrate your actual hardware before deployment.

Setting the Digital Threshold

Configure DO pin activation using the potentiometer:

  1. Place alcohol vapor near sensor.
  2. Rotate potentiometer clockwise until LED comes on.
  3. Turn slowly counterclockwise until LED just goes off.
  4. Threshold is set.

Wiring Diagram

Both outputs are accessible on the MQ3 module. Select one or use both based on application requirements.

MQ3 Alcohol SensorArduino MKR WiFi 1010
VCC5V
GNDGND
DO2
AOA0
The wiring diagram between Arduino MKR WiFi 1010 and MQ3 alcohol sensor  showing pin connections

This image is created using Fritzing. Click to enlarge image

Arduino MKR WiFi 1010 Code - Digital Output Reading

/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-mq3-alcohol-sensor */ #define PIN_DO 2 // The Arduino MKR WiFi 1010 pin connected to the DO pin of the MQ3 sensor void setup() { // Initialize serial communication Serial.begin(9600); // Initialize the Arduino MKR WiFi 1010 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

  • Load the code into Arduino IDE
  • Press the Upload button to send code to Arduino MKR WiFi 1010
  • Bring alcohol vapor source near sensor (hand sanitizer or rubbing alcohol on cotton)
  • View results 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  

If detection is incorrect (always detecting or never detecting), adjust the potentiometer for proper sensitivity.

Arduino MKR WiFi 1010 Code - Analog Output Reading

/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-mq3-alcohol-sensor */ #define PIN_AO A0 // The Arduino MKR WiFi 1010 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

  • Open the code in Arduino IDE
  • Click Upload to program Arduino MKR WiFi 1010
  • Introduce alcohol vapor to sensor (hand sanitizer or isopropyl alcohol)
  • Check 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  

Using digital or analog outputs, implement threshold decisions to drive alarms, control indicators, or store breathalyzer data.

Arduino MKR WiFi 1010 Code - Breathalyzer with Threshold Detection

This code shows analog interpretation with calibrated thresholds for assessing consumption levels.

/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-mq3-alcohol-sensor */ #define PIN_AO A0 // The Arduino MKR WiFi 1010 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

  • Must do first: Calibrate using the analog reading code to get proper threshold values for your sensor.
  • Change SOBER_THRESHOLD and DRUNK_THRESHOLD in code to your calibrated numbers.
  • Upload modified code to Arduino MKR WiFi 1010
  • Test with alcohol vapor (isopropyl alcohol or hand sanitizer vapor)
  • See 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: Educational purposes only. Do not use as a legal breathalyzer or for safety decisions.

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!