Acoptex.Com

Learn ESP32, ESP8266, Arduino, and Raspberry Pi

Arduino Guide for MQ3 Alcohol Sensor

We will learn about the MQ3 Alcohol Sensor Module and how to use it with Arduino board. 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.

Tag: Project 122a MQ3 Alcohol Sensor. Acoptex.lt

Project resources

Parts required

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1. MQ3 Alcohol Sensor 1 pc

MQ3 Alcohol Sensor
MQ3 sensor module
MQ3 sensor module

2. Jumper cables  F-F 4 pcs

jumper cables

3. Arduino Nano and Mini-B USB cable 1 pc

ARDUINO NANO

Understanding the MQ3 Alchohol sensor module

MQ3 is one of the most commonly used sensors in the MQ sensor series. MQ-3 module is suitable for detecting Alcohol, Benzine, CH4, Hexane, LPG, CO. 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 sensor

It can detect Alcohol concentrations anywhere from 25 to 500 ppm.

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.

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 sensor

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 sensor

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

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 sensing element

Features:

  • Sensor Type – Semiconductor
  • Easy SIP header interface
  • Compatible with most of the microcontrollers
  • Low-power standby mode
  • Requires heater voltage
  • Good sensitivity to alcohol gas
  • Fast response and High sensitivity  
  • Long life and low cost
  • Requires simple Drive circuit

Specifications:

  • Power requirements: 5 VDC @ ~165 mA (heater on) / ~60 mA (heater off)
  • Current Consumption: 150mA
  • DO output: TTL digital 0 and 1 ( 0.1 and 5V)
  • AO output: 0.1- 0.3 V (relative to pollution), the maximum concentration of a voltage of about 4V
  • Detecting Concentration: 0.05-10mg/L Alcohol
  • Interface: 1 TTL compatible input (HSW), 1 TTL compatible output (ALR)
  • Heater consumption: less than 750mW
  • Operating temperature: 14 to 122 °F (-10 to 50°C)
  • Load resistance: 200kΩ
  • Sensitivity S: Rs(in air)/Rs(0.4mg/L Alcohol)≥5
  • Sensing Resistance Rs: 2KΩ-20KΩ(in 0.4mg/l alcohol)
  • Dimensions: 32 x 22 x 16 mm

You can find the datasheet here.

Applications of MQ-3 Gas Sensor

  • Gas level over-limit alarm
  • Breathalyser
  • Portable alcohol detector
  • Stand-alone/background sensing device
  • Environmental monitoring equipment

MQ-3 Equivalent Sensors

MQ-2, MQ214 (detection of Methane), MQ303A

Alternative MQ-3 Gas Sensors

Sensor NameGas to measure
MQ-2Methane, Butane, LPG, Smoke
MQ-3Alcohol, Ethanol, Smoke
MQ-4Methane, CNG Gas
MQ-5Natural gas, LPG
MQ-6LPG, butane
MQ-7Carbon Monoxide
MQ-8Hydrogen Gas
MQ-9Carbon Monoxide, flammable gasses
MQ131Ozone
MQ135Air Quality
MQ136Hydrogen Sulphide gas
MQ137Ammonia
MQ138Benzene, Toluene, Alcohol, Propane, Formaldehyde gas, Hydrogen
MQ214Methane, Natural Gas
MQ216Natural gas, Coal Gas
MQ303AAlcohol, Ethanol, smoke
MQ306ALPG, butane
MQ307ACarbon Monoxide
MQ309ACarbon Monoxide, flammable gas

How does it work?

Sensitive material of MQ-3 gas sensor is SnO2, which with lower conductivity in clean air. When the target alcohol gas exist, the sensor’s conductivity is more higher along with the gas concentration rising. MQ-3 gas sensor has high sensitity to Alcohol, and has good resistance to disturb of gasoline, smoke and vapor.

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. 

MQ3 sensor

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.

There is a resistance across an A and  B inside the sensor which varies on detection of alcohol. More the alcohol, the lower the resistance. The alcohol is measured by measuring this resistance. The sensor and load resistor form a voltage divider, and the lower the sensor resistance, the higher the voltage reading will be.

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. Rotate the knob clockwise to increase sensitivity and counterclockwise to decrease it.

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. 

MQ3 structure

Structure and configuration of MQ-3 gas sensor is shown in the figure above for Configuration A or B, sensor composed by micro AL2O3 ceramic tube, Tin Dioxide (SnO2) sensitive layer, measuring electrode and heater are fixed into a crust made by plastic and stainless steel net. The heater provides necessary work conditions for work of sensitive components. The enveloped MQ-3 have 6 pin, 4 of them are used to fetch signals, and other 2 are used for providing heating current.

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.

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 limit. So that when the alcohol concentration exceeds the threshold value, the Status LED will light up and the module will output HIGH.

Digital output MQ3

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 MQ3 alcohol sensor is now calibrated and ready for use.

Understanding the Arduino Nano

You can read more about it here.

Signals and connections of the MQ3 gas sensor

MQ3 gas sensor
  • VCC – supply pin. Supplies power for the module. Connect it to 5V pin of your Arduino board.
  • GND – ground pin. Connected to GND pin on Arduino board.
  • DO – digital output pin. Provides a digital representation (0 or 1) of the presence of alcohol.
  • AO – analog output pin. Provides analog output voltage (0-5V) in proportional to the concentration of alcohol.

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.

Sensor pins:

1H -PinsOut of the two H pins, one pin is connected to supply and the other to ground
2A-PinsThe A pins and B pins are interchangeable. These pins will be tied to the Supply voltage.
3B-PinsThe A pins and B pins are interchangeable.   One pin will act as output while the other will be pulled to ground.

Signals and connections of the Arduino Nano

You can read more about it here.

Wiring

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

1.Wiring using analog output

Wiring MQ3 sensor module
Wiring MQ3 sensor module

2. Wiring using digital output

We’ll use the circuit from the previous example. This time we just need to remove the connection to ADC pin (A0) and connect DO pin on the MQ3 alcohol sensor module to the digital pin D2 on the Arduino board.

Wiring MQ3 sensor module
Wiring MQ3 sensor module

Step by Step instruction

  1. First mount the sensor to a breadboard. 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.
  2. Do wiring.
  3. Open Arduino IDE.
  4. Plug your Arduino Nano board into your PC and select the correct board and com port
  5. Verify and upload sketch for analog output or sketch for digital output to your Arduino Nano.
  6. Open up Arduino IDE Serial monitor and set your baud to 9600 baud and select Newline.
  7. 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). Once you get a good handle on these readings, you can use them as threshold if you intend to trigger an action.
  8. If you use analog output of MQ3 sensor module, you should see below output on serial monitor:
Serial monitor MQ3

9. If you use digital output of MQ3 sensor module,you should see below output on serial monitor:

MQ3 digital output

Code

You can define maximum values that you consider sober and drunk here:

#define Sober 120   
#define Drunk 400   

Wrapping up

We have learnt about the MQ3 alcohol sensor module and how to use it with Arduino Nano.

Check for more DIY projects here.

Thank you for reading and supporting us.

Check for more DIY projects on Acoptex.lt and Acoptex.com!

If you are looking for high quality PCBs PCBWay is the best choice: