How MQ3 Alcohol Sensor Works? & Interface it with Arduino

Give your next Arduino project a nose for alcohol with the MQ3 alcohol sensor module. This sensor detects the presence and the concentration of alcohol present in the air. So, if you are planning to make your own breathalyzer to measure the amount of alcohol in the human body, the MQ3 alcohol sensor module is a great option.

MQ3 Alcohol Sensor

MQ3 is one of the most commonly used sensors in the MQ sensor series. It is a Metal Oxide Semiconductor (MOS) type of sensor. Metal oxide sensors are also known as Chemiresistors, because sensing is based on the change of resistance of the sensing material when exposed to alcohol. So by placing it in a simple voltage divider network, alcohol concentrations can be detected.

mq3 alcohol sensor

MQ3 alcohol sensor works on 5V DC and draws around 800mW. It can detect Alcohol concentrations anywhere from 25 to 500 ppm.

What is 1 ppm equal to?

When measuring gases, the term concentration is used to describe the amount of gas by volume in the air. The two most common units of measurement are parts-per-million, and percent concentration.

Parts-per-million (abbreviated ppm) is the ratio of one gas to another. For example, 500ppm of alcohol means that if you could count a million gas molecules, 500 of them would be of alcohol and 999500 molecules would be some other gases.

Here are the complete specifications

MQ3 Alcohol sensor specifications
Operating voltage5V
Load resistance200 KΩ
Heater resistance33Ω ± 5%
Heating consumption<800mw
Sensing Resistance1 MΩ – 8 MΩ
Concentration Scope25 – 500 ppm
Preheat TimeOver 24 hour

Internal structure of MQ3 Alcohol Sensor

MQ3 is a heater-driven sensor. That’s why it is enclosed in two layers of fine stainless steel mesh called an Anti-explosion network. It ensures that heater element inside the sensor will not cause an explosion, as we are sensing flammable gas (alcohol).

mq3 alcohol sensor parts hardware overview

It also provides protection for the sensor and filters out suspended particles so that only gaseous elements are able to pass inside the chamber.

mq3 alcohol sensor internal structure

This is what the sensor looks like when outer mesh is removed. The star-shaped structure is formed by the sensing element and six connecting legs that extend beyond the Bakelite base. Out of six, two leads (H) are responsible for heating the sensing element and are connected via a Nickel-Chromium coil ( a well known conductive alloy).

The remaining four leads (A & B) responsible for output signals are connected using Platinum Wires. These wires are connected to the body of the sensing element and convey small changes in the current that passes through the sensing element.

mq3 sensing element aluminium oxide ceramic with tin dioxide coating

The tubular sensing element is made up of Aluminum Oxide (AL2O3) based ceramic and has a coating of Tin Dioxide (SnO2). The Tin Dioxide is the most important material being sensitive towards alcohol. However, the ceramic substrate only increases the heating efficiency and ensures that the sensor area is continuously heated to the working temperature.

mq3 alcohol sensor internal sensing element structure

So, to summarize, the Nickel-Chromium coil and Aluminum Oxide based ceramic forms a Heating System; while Platinum wires and coating of Tin Dioxide forms a Sensing System.

How MQ3 Alcohol Sensor Works?

When SnO2 semiconductor layer is heated at high temperature, oxygen is adsorbed on the surface. In clean air, electrons from the conduction band in tin dioxide are attracted to oxygen molecules. This form an electron depletion layer just below the surface of SnO2 particles and forms a potential barrier. As a result, the SnO2 film becomes highly resistive and prevents electric current flow.

In the presence of alcohol, however, the surface density of adsorbed oxygen decreases as it reacts with the alcohols; which lowers the potential barrier. Electrons are then released into the tin dioxide, allowing current to flow freely through the sensor.

mq3 alcohol sensor working

MQ3 Alcohol Sensor Module Hardware Overview

Since the MQ3 alcohol sensor is not breadboard compatible, we recommend this handy little breakout board. It’s very easy to use and comes with two different outputs. It not only provides a binary indication of the presence of alcohol but also an analog representation of its concentration in air.

mq3 alcohol sensor module

The analog output voltage provided by the sensor (at AO pin) varies in proportion to the alcohol concentration. The higher the alcohol concentration in the air, the higher the output voltage; Whereas lower concentration gives lower output voltage. The following animation shows the relationship between alcohol concentration and output voltage.

mq3 alcohol sensor module working animation

The same analog signal is fed to a LM393 High Precision Comparator to digitize it and is made available at the Digital Output (DO) pin.

mq3 sensor lm393 comparator with sensitivity adjustment pot

The module has a built-in potentiometer for adjusting the sensitivity of the digital output (DO). You can use it to set a threshold; so that when the alcohol concentration exceeds the threshold value, the module will output LOW otherwise HIGH.

This setup is very useful when you want to trigger an action when certain threshold is reached. For example, when the alcohol concentration in the breath exceed a threshold, you can tell if someone is drunk. You got the idea!

Tip:

Rotate the knob clockwise to increase sensitivity and counterclockwise to decrease it.

mq3 sensor power and status leds

Apart from this, the module has two LEDs. The Power LED will light up when the module is powered. The Status LED will light up when the digital output goes LOW.

MQ3 Alcohol Sensor Module Pinout

Now let’s have a look at the pinout.

mq3 alcohol sensor pinout

VCC supplies power for the module. You can connect it to 5V output from your Arduino.

GND is the Ground Pin and needs to be connected to GND pin on the Arduino.

D0 provides a digital representation of the presence of alcohol.

A0 provides analog output voltage in proportional to the concentration of alcohol.

Measuring alcohol concentration using Analog Output

As you know that the module provides both analog and digital output, so for our first experiment we will measure the alcohol concentration by reading the analog output.

Wiring

Let’s hook the MQ3 alcohol sensor up to the Arduino.

Start by connecting VCC pin to the 5V pin on the Arduino and connect GND pin to the Ground pin on the Arduino. Finally, connect AO output pin on the module to Analog pin#0 on the Arduino.

The following illustration shows the wiring.

arduino wiring mq3 alcohol sensor to read analog output

Calibration

To get accurate readings from your alcohol sensor, it is recommended that you calibrate it first. You need to find out what values equate to specific percentages or even blood alcohol concentration in the case of a breathalyzer.

Use the below sketch to note what values your sensor outputs when you blow your breath on the sensor without consuming alcohol -vs- after consuming alcohol.

If you are not lawfully permitted to consume alcoholic beverages, use isopropyl alcohol bottle or any hand sanitizer bottle for your testing. Do NOT get the sensor wet with alcohol! Simply squeeze to breathe the vapors of the alcohol into the sensor and take your readings.

#define MQ3pin 0

float sensorValue;  //variable to store sensor value

void setup() {
	Serial.begin(9600); // sets the serial port to 9600
	Serial.println("MQ3 warming up!");
	delay(20000); // allow the MQ3 to warm up
}

void loop() {
	sensorValue = analogRead(MQ3pin); // read analog input pin 0

	Serial.print("Sensor Value: ");
	Serial.println(sensorValue);
	
	delay(2000); // wait 2s for next reading
}

Note that MQ3 is a heater-driven sensor. For accurate measurement, the sensor needs to be fully warmed up. The sample code above has a 20s warm-up, but increase the warm-up time to 24–48 hours for maximum accuracy.

When you run the sketch, you’ll see the close to the following readings in the serial monitor:

  • When there is no alcohol in the breath (~120)
  • When there is alcohol in the breath (~500)
calibrating mq3 alcohol sensor

This test may take some trial and error. Once you get a good handle on these readings, you can use them as threshold if you intend to trigger an action.

Final Build

Based on the calibration values, the program below defines the following ranges to determine the alcohol concentration:

  • < 120 is sober
  • 120-400 is drinking – but within legal limits
  • > 400 is drunk
/* Change these values based on your calibration values */
#define Sober 120   // Define max value that we consider sober
#define Drunk 400   // Define min value that we consider drunk

#define MQ3pin 0

float sensorValue;  //variable to store sensor value

void setup() {
	Serial.begin(9600); // sets the serial port to 9600
	Serial.println("MQ3 warming up!");
	delay(20000); // allow the MQ3 to warm up
}

void loop() {
	sensorValue = analogRead(MQ3pin); // read analog input pin 0

	Serial.print("Sensor Value: ");
	Serial.print(sensorValue);
	
	// Determine the status
	if (sensorValue < Sober) {
		Serial.println("  |  Status: Stone Cold Sober");
	} else if (sensorValue >= Sober && sensorValue < Drunk) {
		Serial.println("  |  Status: Drinking but within legal limits");
	} else {
		Serial.println("  |  Status: DRUNK");
	}
	
	delay(2000); // wait 2s for next reading
}

If everything is fine, you should see below output on serial monitor.

simple breathalyzer using analog output

Detect the presence of alcohol using digital output

For our second experiment we will detect the presence of alcohol using digital output.

Wiring

We’ll use the circuit from the previous example. This time we just need to remove the connection to ADC pin and connect DO pin on the module to the digital pin #8 on the Arduino.

Hook up your circuit as pictured below:

arduino wiring mq3 alcohol sensor to read digital output

Calibration

The module has a built-in potentiometer for calibrating the digital output (DO).

By turning the knob of the potentiometer, you can set a threshold. So that when the alcohol concentration exceeds the threshold value, the Status LED will light up and the module will output HIGH.

digital output of mq3 alcohol sensor

Now to calibrate the sensor, blow your alcohol breath on the sensor or squeeze the isopropyl alcohol bottle to breathe the vapors of the alcohol into the sensor and adjust the pot clockwise so that the Status LED is ON and then adjust the pot back counterclockwise just until the LED goes OFF.

That’s it your sensor is now calibrated and ready for use.

Arduino Code

Once the circuit is built, upload the following sketch to your Arduino.

#define MQ3pin 8

int sensorValue;  //variable to store sensor value

void setup() {
	Serial.begin(9600); // sets the serial port to 9600
	Serial.println("MQ3 warming up!");
	delay(20000); // allow the MQ3 to warm up
}

void loop() {
	sensorValue = digitalRead(MQ3pin); // read digital output pin
	Serial.print("Digital Output: ");
	Serial.print(sensorValue);
	
	// Determine the status
	if (sensorValue) {
		Serial.println("  |  Alcohol: -");
	} else {
		Serial.println("  |  Alcohol: Detected!");
	}
	
	delay(2000); // wait 2s for next reading
}

You should see below output on serial monitor.

alcohol detection using digital output