Give your next Arduino project a nose for alcohol by including the MQ3 alcohol sensor module. This sensor detects the presence of alcohol in the air as well as its concentration. So, if you want to build your own breathalyzer to determine how much alcohol is in someone’s breath, the MQ3 alcohol sensor module is an excellent choice.
MQ3 Alcohol Sensor
The MQ3 sensor is one of the most widely used in the MQ sensor series. It is a MOS (Metal Oxide Semiconductor) sensor. Metal oxide sensors are also known as Chemiresistors because sensing is based on the change in resistance of the sensing material when exposed to alcohol.
The MQ3 alcohol sensor operates on 5V DC and consumes approximately 800mW. It can detect alcohol concentrations ranging from 25 to 500 ppm.
What does the concentration of 1 ppm mean?
Parts-per-million, or ppm for short, is the most commonly used unit for measuring gas concentration. ppm is simply the ratio of one gas to another. For example, 500ppm of alcohol means that if you could count a million gas molecules, 500 would be alcohol and the remaining 999500 would be other gases.
Internal structure of MQ3 Alcohol Sensor
The MQ3 is a heater-driven sensor. It is therefore covered with two layers of fine stainless steel mesh known as an “anti-explosion network”. It ensures that the heater element inside the sensor does not cause an explosion because we are sensing flammable gas (alcohol).
It also protects the sensor and filters out suspended particles, allowing only gaseous elements to pass through the chamber.
When the outer mesh is removed, the sensor looks like this. The sensing element and six connecting legs that extend beyond the Bakelite base form the star-shaped structure. Two (H) of the six leads are in charge of heating the sensing element and are linked together by a Nickel-Chromium coil (a well-known conductive alloy).
The remaining four signal-carrying leads (A and B) are connected with platinum wires. These wires are connected to the body of the sensing element and convey slight variations in the current flowing through the sensing element.
The tubular sensing element is made of Aluminum Oxide (AL2O3) based ceramic with a Tin Dioxide coating (SnO2). Tin Dioxide is the most important material because it is sensitive to alcohol. The ceramic substrate, on the other hand, improves heating efficiency and ensures that the sensor area is continuously heated to the working temperature.
To summarize, the Heating System is composed of a Nickel-Chromium coil and an Aluminum Oxide-based ceramic, while the Sensing System is composed of Platinum wires and a Tin Dioxide coating.
How Does the MQ3 Alcohol Sensor Work?
When a SnO2 semiconductor layer is heated to a high temperature, oxygen is adsorbed on the surface. When the air is clean, electrons from the conduction band of tin dioxide are attracted to oxygen molecules. This creates an electron depletion layer just beneath the surface of the SnO2 particles, forming 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 alcohol, lowering the potential barrier. As a result, electrons are released into the tin dioxide, allowing current to freely flow through the sensor.
MQ3 Alcohol Sensor Module Hardware Overview
The MQ3 alcohol sensor is simple to use and has 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.
The sensor’s analog output voltage (at the A0 pin) varies in proportion to the alcohol concentration. The higher the concentration of alcohol in the air, the higher the output voltage; the lower the concentration, the lower the output voltage. The animation below shows the relationship between alcohol concentration and output voltage.
This analog signal is digitized by an LM393 High Precision Comparator and made available at the Digital Output (D0) pin.
The module includes a potentiometer for adjusting the sensitivity of the digital output (D0). You can use it to set a threshold so that when the alcohol concentration exceeds the threshold value, the module outputs LOW otherwise HIGH.
Rotating the knob clockwise increases sensitivity and counterclockwise decreases it.
In addition, the module has two LEDs. The Power LED illuminates when the module is turned on, and the Status LED illuminates when the alcohol concentration exceeds the threshold value.
Technical Specifications
Here are the specifications:
Operating voltage | 5V |
Load resistance | 200 KΩ |
Heater resistance | 33Ω ± 5% |
Heating consumption | <800mw |
Sensing Resistance | 1 MΩ – 8 MΩ |
Concentration Range | 25 – 500 ppm |
Preheat Time | Over 24 hour |
MQ3 Alcohol Sensor Module Pinout
Let’s take a look at the pinout now.
VCC supplies power to the module. Connect it to the 5V output of your Arduino.
GND is the ground pin.
D0 indicates the presence of alcohol. D0 becomes LOW when the alcohol concentration exceeds the threshold value (as set by the potentiometer), and HIGH otherwise.
A0 produces analog output voltage proportional to alcohol concentration, so a higher concentration results in a higher voltage and a lower concentration results in a lower voltage.
Calibrating the MQ3 Alcohol Sensor
Because the MQ3 is a heater-driven sensor, the calibration of the sensor may drift if it is left in storage for an extended period of time.
When first used after a long period of storage (a month or more), the sensor must be fully warmed up for 24-48 hours to ensure maximum accuracy.
If the sensor has recently been used, it will only take 5-10 minutes to fully warm up. During the warm-up period, the sensor typically reads high and gradually decreases until it stabilizes.
Experiment 1 – Measuring Alcohol Concentration using Analog Output (A0)
In our first experiment, we will read the analog output to measure the alcohol concentration and estimate the level of alcohol intoxication.
Wiring
Let us connect the MQ3 alcohol sensor to the Arduino.
Begin by connecting the VCC pin to the Arduino’s 5V pin and the GND pin to the Arduino’s Ground pin. Finally, connect the module’s A0 output pin to Analog pin #0 on the Arduino.
The following image shows the wiring.
Finding the threshold values
To estimate the level of alcohol intoxication, you need to record the values your sensor outputs when you blow on it before and after consuming alcohol.
Simply run the sketch below and take your readings.
Note:
If you are not legally permitted to consume alcoholic beverages, use an isopropyl alcohol bottle or any hand sanitizer bottle for your testing. Don’t get alcohol on the sensor! Simply squeeze the bottle to allow the alcohol vapors to enter 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
}
When you run the sketch, you should see readings similar to the ones below:
- In the absence of alcohol (around 120)
- In the presence of alcohol (around 500)
This test may require some trial and error. Once you have the readings, you can use them as a threshold to trigger an action.
Arduino Code
The sketch below estimates the level of alcohol intoxication using the following threshold values:
- < 120 is sober
- 120-400 is drinking – but within legal limits
- > 400 is drunk
/* Replace these values with your own readings */
#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 something similar on the serial monitor.
Experiment 2 – Detecting the Presence of Alcohol using Digital Output (D0)
In our second experiment, we will use digital output to detect the presence of alcohol.
Wiring
We’ll reuse the previous experiment’s circuit. Simply disconnect the connection to the ADC pin and connect the D0 pin on the module to the Arduino’s digital pin #8.
The following image shows the wiring.
Setting the threshold
The module has a built-in potentiometer for setting an alcohol concentration threshold above which the module outputs LOW and the status LED lights up.
Now, to set the threshold, let the alcohol vapors enter the sensor and turn the pot clockwise until the Status LED is on. Then, turn the pot back counterclockwise just until the LED goes off.
That’s all there is to it; your module is now ready to use.
Arduino Code
Now, upload the sketch below 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 similar output on the serial monitor.