Sensors now play an essential role in the safety and security of a wide range of flats, houses, and businesses by detecting smoke, fire, or gas and alerting the appropriate person. Today's post will discuss one such Sensor, the MQ-3. The MQ-3 is Alcohol Sensitive Sensor that is often used in a breath analyzer. So, let's jump right into it.
MQ-3 Alcohol Sensor Pinout
The MQ-3 Gas Detection Sensor Module includes four pins that may be used to extract data from the Sensor: VCC, GND, Aout, and Dout. The pinout of the MQ-3 Alcohol Detection Sensor is as follows:
VCC is the Gas Detection Sensor's power supply pin, which can be linked to a 5V source.
GND is the board's ground pin, which should be linked to the Arduino's ground pin.
DOUT is the board's digital output pin; a low output indicates that no alcohol is present in the environment, while a high output indicates that Alcohol is present.
AOUT is the board's Analog output pin, which will provide us with an analog signal that varies between Vcc and ground depending on the alcohol level detected:
MQ-3 Alcohol Sensor Module – Parts
The MQ-3 Sensor is popular among novices since it is used in most Arduino projects to detect Alcohol. These are also low-cost, simple-to-use sensors with a wide detecting range that may be narrowed to change sensitivity. The MQ-3 Sensor's component marks are shown below.
The MQ-3 Alcohol Sensor Module features four pins, two of which are for VCC and GND. The other two may simultaneously output analog and digital data, much like the other basic sensor modules. We're utilizing the Arduino's 5V pin to power the circuit since the module's working voltage range is 5V with a 0.1 percent tolerance. The module features two inbuilt LEDs, as seen in the figure above. When power is connected to the board, the power LED illuminates, and the Dout LED illuminates when the potentiometer's trigger value is achieved. This board also has an OP-Amp comparator that converts the incoming analog signal from the gas sensor to a digital signal.
How Does the MQ-3 Alcohol Sensor Module Work?
The MQ-3 gas sensor requires a heating element to identify Alcohol correctly. However, placing a heating element near Alcohol might be dangerous. Thus the Sensor is built with an anti-explosion network comprised of two thin layers of stainless steel mesh, as seen in the figure below. This stainless steel mesh contains a heating element.
This mesh structure also protects against dust and other suspended particles, allowing only gaseous components from the environment to pass through. When we disassemble the sensor, we can see that it comprises two primary components. The first is the heating element, which is made of nichrome wire, and the second is the detecting element, which is composed of platinum wire with a tin dioxide coating on it. The image below shows the mesh decapped from the actual sensor.
When the mesh is removed from the Sensor, it looks like this. We cut the stainless steel mesh and positioned it on the side of the Sensor, as you can see in the above image. The sensing aspect that we discussed previously is now visible as well. The Sensor's star-shaped pins are produced by constructing the actual detecting and heating element attached to the Sensor's six legs. The black base of the Sensor, which is made of Bakelite to promote heat conductivity, can also be seen.
Preheat Time for MQ-3 Sensor:
Working with this sort of alcohol sensor needs a preheat or stabilization period for the device to function correctly. If you look at the device's datasheet, you'll notice that it requires a 48-hour preheat period. Is this to say that it must be turned on for 48 hours before it may be used?
To this question, the clear answer is a resounding NO. You must operate it continuously for 48 hours to acquire the standard performance numbers stated in the datasheet. And it was tested in their lab after 48 hours. So, if you want to stay inside the parameters, you must adhere to the 48-hour preheating time. Thermal equilibrium will undoubtedly be attained within 30 minutes, given the Sensor's modest size. And getting within a few percent of the numbers supplied by the datasheet would probably take a few minutes.
The 48-hour warm-up period is only essential if you want an exact alcohol concentration measurement. You'll also need a robust sensor calibration and some way to correct for other environmental conditions like temperature, humidity, and so on.
The MQ-3 Sensor may be used to detect and measure alcohol levels in PPM. It's essential to keep in mind that detecting the vapour and measuring its concentration in PPM are two very different things. The primary focus of this essay is on seeing alcohol levels and concentration increases. The technique is slightly different if you want to compute the alcohol level in PPM precisely; nonetheless, we will briefly touch on it.
How to use MQ-3 Sensor to Detect Alcohol?
We have a container containing IPA in the above gif, and when it is sprayed, the gas concentration in the surrounding grows. When we pour it a second and third time, the alcohol concentration increases again. The output voltage from the sensor increases as the alcohol concentration rises, as can be seen on the multimeter. The green LED on the module illuminates when it exceeds a particular threshold (which may be controlled using the potentiometer). This may be seen in the backside photograph of the module that we've included for demonstration purposes.
How to measure Alcohol concentration in PPM using the MQ-3 Sensor?
This is a highly accurate sensor that is calibrated to detect the PPM of Alcohol present in the environment; however, to do so, you must first understand the sensitivity characteristics of the MQ-3 Sensor, which can be found in the MQ3 Sensor datasheet and look like the image below.
In the logarithmic graph, RS is the sensing resistance during the presence of Alcohol. While R0 is the sense resistance to clean air. This Sensor is designed to detect Alcohol and has minor sensitivity to Benzine, so this Sensor's resistance will change depending on the concentration of alcohol present in the atmosphere.
Commonly Asked Questions about MQ-3 Alcohol Sensor Module
Q-1: What does MQ3 sensor detect?
There are many gas detecting sensors available in the market. It's a low-cost semiconductor sensor that can detect alcohol. MQ-3 is suitable for detecting Alcohol, Benzine, CH4, Hexane, LPG, CO.
Q-2: What is the operating voltage of MQ-3 sensor?
The MQ3 alcohol sensor operates at 5V DC and consumes around 800mW. It can detect alcohol concentrations ranging from 25 to 500 parts per million (ppm).
Q-3: What is the sensing range of MQ-3 sensor?
It can detect alcohol gas concentrations ranging from 0.05 mg/L to 10 mg/L, or it can detect alcohol concentrations ranging from 25 to 500 parts per million (ppm).
Q-4: What are MQ Series Sensors?
MQ gas sensors are a type of sensor that can detect a broad range of gases, including alcohol, smoke, methane, LPG, hydrogen, NH3, Benzene, and Propane, among others. These sensors are constructed consisting of an electrode that has been covered with a sensing material which is heated to increase its reactivity and sensitivity.
Internal Schematic of MQ-3 Sensor Module
The MQ-3 Alcohol Detection Sensor Module circuit diagram is given below. This module's design is relatively basic and only requires a few components to construct. The schematic presented below will come in helpful if you are in a rush to create this circuit.
We have an LM393 op-amp in the schematic, a low-power, low-offset voltage op-amp that a +5V supply can drive. However, because the MQ-3 Sensor's minimum operational voltage is 5V, powering the circuit using 3.3V is impossible. This op-primary amp's function transforms an incoming analog signal into a digital signal. Aside from that, we have an integrated 10K potentiometer for adjusting the sensitivity of the MQ-3 Alcohol Sensor module triggering voltage. Aside from that, there are two LEDs. The power LED is the first, while the trigger LED is the second. When power is provided to the board, the power LED illuminates. When a specific specified threshold is met, the trigger LED illuminates. Finally, there are two decoupling capacitors on the board that help to decrease noise.
Arduino Uno MQ-3 Alcohol Sensor – Connection Diagram
Now that we know how the MQ-3 alcohol sensor works, we can connect all necessary wires to an Arduino Uno and see how it functions. We'll start with the analog component and then go on to the digital part, which is pretty simple.
To work with the Sensor, we must first power it. We use the Arduino UNO Board's 5V and GND pins, and the Sensor's output pin is connected to the Arduino's A0 pin.
We have connected an LED to PIN 6 of the Arduino, the analog pin to the A0 pin of the Arduino, and the ground pin is shared between the led and the sensor, as shown in the above diagram. We'll configure the Arduino such that the brightness of the LED changes in response to the alcohol concentration in the environment.
To read the sensor's digital component, just connect the sensor's output to any digital pin on the Arduino and check the pin for a high pulse; if the Arduino reads a high pulse, alcohol has been detected; if the Arduino reads a low pulse, there is no alcohol present in the environment.
Arduino Code for Interfacing MQ-3 Gas Sensor Module
The code for the Arduino MQ-3 alcohol sensor module is simple. We're simply reading the analog data from the sensor and adjusting the brightness of the LED to match the data. Please keep in mind that we are merely processing the analog data from the sensor; for the digital data, the module's inbuilt LED will light up.
We define Four macros: the first two are values we consider sober and drunk. The third is for the sensor pin, and the fourth is for the led, which, when lit up, indicates alcohol presence.
#define Sober 150 #define Drunk 400 #define MQ3 0 #define ledPin 6
As you know, the sensor needs to heat up a bit to provide an accurate reading. This part of the code pauses everything and heats the sensor module for 20 seconds.
Serial.println("MQ3 Heating up!"); delay(20000);
After the heating is done, we begin to read the analog data coming from the analog pin of the sensor and print the data on the serial monitor. As we defined before the values for sober and drunk we compare those values with the realtime sensor values to display if a person is drunk or not.
sensorValue = analogRead(MQ3); // read analog input pin 0 Serial.print("Sensor Value: "); Serial.print(sensorValue); if (sensorValue < Sober) { Serial.println(" | Status: Sober"); } else if (sensorValue >= Sober && sensorValue < Drunk) { Serial.println(" | Status: Drinking but within legal limits"); } else { Serial.println(" | Status: DRUNK");
There is an LED connected to pin 6 and we are generating a PWM signal corresponding to the sensor value to turn the LED on. When the sensor value is greater than 150, the LED will start to glow and since we are powering the LED via a PWM signal, it will increase its brightness as the sensor value increases.
unsigned int outputValue = map(sensorValue, 0, 1023, 0, 255); if (sensorValue > 150){ analogWrite(ledPin, outputValue); } else{ digitalWrite(ledPin, LOW); }
Working of the MQ-3 Sensor Module
The MQ-3 Sensors working is demonstrated in the animation below. When no alcohol is present in the environment, the LED is off, but when we supplied a small amount of IPA , the LED switches on since we had written the code to do so. The LED will light brighter the more alcohol is present in the environment; the LED will glow brightest when the alcohol concentration in the air is 500 ppm.
Troubleshooting the MQ-3 Sensor
- First and foremost, check your connections.
- If everything looks fine then check if the mesh on the sensor is clogged. If it is clogged try cleaning it or changing the sensor
- If the trigger light behind the sensor is not turning on, try rotating the potentiometer behind the sensor to change its sensitivity.
- If the sensor is not giving accurate results wait for some time and let the sensor heat up a bit to achieve a better precision.
Previously we build this Alcohol Detector using Arduino, if you are interested, you can check this out.
Arduino Alcohol Detector will detect the alcohol level in breath and by using some calculations in code we can calculate the alcohol level in breath or blood and can trigger some alarm.
Supporting Files
#define Sober 200 // Define max value that we consider sober
#define Drunk 400 // Define min value that we consider drunk
#define MQ3 0
#define ledPin 6
float sensorValue; //variable to store sensor value
void setup() {
Serial.begin(9600); // sets the serial port to 9600
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, LOW);
Serial.println("MQ3 Heating Up!");
delay(20000); // allow the MQ3 to warm up
}
void loop() {
sensorValue = analogRead(MQ3); // read analog input pin 0
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
// Return analog moisture value
// Determine the status
if (sensorValue < Sober) {
Serial.println(" | Status: Sober");
} else if (sensorValue >= Sober && sensorValue < Drunk) {
Serial.println(" | Status: Drinking but within legal limits");
} else {
Serial.println(" | Status: DRUNK");
}
unsigned int outputValue = map(sensorValue, 0, 1023, 0, 255);
if (sensorValue > 700){
analogWrite(ledPin, outputValue); // generate PWM signal
}
else{
digitalWrite(ledPin, LOW);
}
return outputValue;
delay(2000); // wait 2s for next reading
}