Alcohol Sensor- Pinout and Interfacing with Arduino

Published on May 7, 2022 , Last modified on August 16, 2024
by Hommer Zhao
Alcohol Sensor

Drunken driving is a serious crime in almost all countries. Hence, checking blood alcohol concentration levels is an important process for police officers.  We will elaborate on how to test alcohol content via an alcohol sensor and design this device using a typical microcontroller. 

What Is an Alcohol Sensor?

A Breath analyzer and alcohol in glasses

Fig 1: A Breath analyzer and alcohol in glasses

The sensor is an electronic device that measures ethanol’s gas concentration and presents the result as an analog output. 

An MQ3 sensor is a popular alcohol sensor from the MQ edition with a Metal Oxide Semiconductor. Furthermore, the MQ3 sensor utilizes 5V DC while identifying alcohol concentrations between 25 and 500 ppm.

Alcohol Sensor Module Pinout

A portable breath alcohol tester

Fig 2: A portable breath alcohol tester

Here’s the pinout description for the MQ-3 Sensor module.

For the MQ-3 Sensor

  • A-Pins: They connect to the supply voltage.
  • B-Pins: One pin connects to the ground while the other serves as the output.
  • H–Pins: The first H-pin connects to the supply while the other goes to the ground.

Remember, you can interchange A and B pins.

Features

A handheld breath alcohol tester

Fig 3: A handheld breath alcohol tester

Key Specifications 

PCB Assembly Services

Kickstart Your Projects with Precision! Get PCB Assembly for Only $99—Limited Time Offer!

ORDER NOW

Special Features

  1. It has two mesh layers on the internal structure to protect heater components from an explosion. Ideally, this is because alcohol is flammable.
  2. Secondly, its tubular sensing component contains Aluminum Oxide ceramic and a Tin Dioxide coat. The two materials are sensitive to alcohol. 
  3. In addition, it has high alcohol sensitivity, affordability, and a low-power standby setting. 
  4. Lastly, it is compatible with many microcontrollers. 

How Does an Alcohol Detection Sensor Work?

Fig 4: A digital alcohol tester

Fig 4: A digital alcohol tester

In the absence of alcohol, oxygen adsorption occurs when the SnO2 semiconductor layer heats up at high temperatures. Additionally, oxygen molecules attract tin oxide electrons in clean air. As a result, an electron depletion sheet forms below the SnO2 surface to create a possible barrier. The outcome is a highly resistant SnO2 layer that prevents current flow.

However, the presence of alcohol from human breath reduces the adsorbed oxygen’s surface density, decreasing the potential barrier. It pushes electrons into tin dioxide to allow current to flow through the alcohol sensor.

Note that we use ppm (parts-per-million) to measure one gas’s ratio to another. For instance, 500 ppm means 500 alcohol molecules exist in one million gas molecules. 

Applications of Alcohol Sensors

A pocket alcohol tester

Fig 5: A pocket alcohol tester

The primary application of liquor sensors is building alcohol detectors. Hence, it helps you identify drunk drivers. 

Other applications include background sensing devices and industrial and domestic ethanol gas alarms.

Measuring Alcohol Concentration Using Analog Output

A breath analyzer with a casing

Fig 6: A breath analyzer with a casing

Follow these steps to check alcohol concentration using the sensor’s analog output.

Follow these steps to check alcohol concentration using the sensor’s analog output.

Wiring

Connect the VCC and 5V pins on your alcohol sensor Arduino. Afterward, connect the GND and ground pins before linking the module’s AO output to Analog pin 0 on your Arduino.

Calibration

This procedure increases the accuracy of your alcohol sensor readings. Start by equating values to percentages and alcohol concentration levels. You can test the sensor by breathing into it before and after sipping some booze. 

However, if you don’t drink, waft isopropyl or hand sanitizer vapor towards the alcohol sensor. Because the MQ3 alcohol sensor is heat-driven, warm it up for accurate results. Use this code to heat the alcohol sensor for 20 seconds.

Calibration code

Fig 7: Calibration code

Source: https://lastminuteengineers.com/mq3-alcohol-sensor-arduino-tutorial/

Completing the Build

This program determines alcohol concentration by defining the following ranges.

  • Sober: <120
  • Drinking within legal limits: 120-400
  • Drunk : >400
A breath analyzer code. 

Fig 8: A breath analyzer code. 

Source: https://lastminuteengineers.com/mq3-alcohol-sensor-arduino-tutorial/

Note: You can change the code according to your calibration values.

Detect the Presence of Alcohol Using Digital Output

The following experiment explains how to detect ethanol presence through a digital display.

  1. Wiring

Link the VCC pin to the 5V Arduino terminal. Likewise, connect the digital output with your Arduino’s digital pin. Since you’re operating the digital output, don’t interfere with the analog output.

Besides, remember to ground both gadgets.

  1. Calibration

This module includes an in-built potentiometer to set the digital output. All you need to do to create a threshold is turn the knob. The status LED activates upon exceeding your threshold and registers a “High” output. The next step is blowing alcohol vapor into the sensors. Turn the pot clockwise until the status LED reads “ON” and readjust it counterclockwise to the “OFF” setting.

  1. Alcohol Arduino Sensors Code

Apply this code to your Arduino.

Arduino Code. 

Fig 9: Arduino Code. 

Source: https://lastminuteengineers.com/mq3-alcohol-sensor-arduino-tutorial/

Alcohol Sensor With Arduino

The MQ3 alcohol sensors aren’t limited to alcohol; they can also detect other gases.

Here’s how to build the sensor with Arduino.

  1. Finding RS/R0
FInding RS/RO code

Fig 10: FInding RS/RO code

Source: https://www.teachmemicro.com/mq-3-alcohol-sensor/#

RS represents the resistance of selected gas with varying concentrations, while R0 indicates resistance in clean air.

  1. Resulting Arduino sketch
Fig 11: Arduino Sketch 

Fig 11: Arduino Sketch 

Source: https://www.teachmemicro.com/mq-3-alcohol-sensor/

  1. Arduino breathalyzer sketch with LCD
Final Arduino Sketch code

Fig 12: Final Arduino Sketch code

Source: https://www.teachmemicro.com/mq-3-alcohol-sensor/#

Conclusion

Setting up alcohol sensors shouldn’t be hard. You can follow this guide to understand how the devices work and unlock the full potential of your MQ3 device. However, maintains it well to extend its service. For instance, store the device away from corrosive gases that invite corrosion and lower sensitivity. Alkalis, silicon steam, and freezing conditions also affect sensitivity. Lastly, If you have questions on this component, talk to us

PCB Assembly Services

Kickstart Your Projects with Precision! Get PCB Assembly for Only $99—Limited Time Offer!

ORDER NOW
Avatar photo
Hommer Zhao
Hi, I'm Hommer Zhao, the founder and Chief Editor at WellPCB. With extensive experience in the PCB industry, I oversee all content to ensure it meets the highest standards of accuracy and insight. We proudly serve over 4,000 customers globally. For inquiries or more information, don't hesitate to reach out. Your satisfaction is my top priority!