MQ3 Alcohol Sensor Work and interface with Arduino

MQ3 is an alcohol detective sensor. It detects presentation and presence of the alcohol in the air. This sensor is one of the most commonly used sensor. It is metal oxide semiconductor. Sensing is based on the change of resistance of semi-conductor material when is gets close or sense alcohol. By placing it in a simple voltage divider network, alcohol concentrations can be detected.

MQ3 works on 5V power supply and detects alcohol concentration from 25 to 500ppm.

What is ppm? When measuring gases, the term concentration is used to describe the gas per volume. It is the unit of measurement abbreviation parts per million. For example 200ppm of alcohol means from million molecules of gas 200 are alcohol molecule.
Specification of MQ3 sensor is:

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

Working of MQ3 sensor:

When semiconductor layer is heated on high temperature, oxygen is absorbed on the surface. In clean air electron from conduction band in the tin dioxide are attracted to oxygen molecules. As a result an electron depletion layer is formed just below the SnO2 particles and forms a potential barrier. When this happens the SnO2 film become highly resistive and prevents the flow of current.
In the presence of air the density of absorbed oxygen is decreased which lowers the potential barrier. Electrons are then released into the tin dioxide, allowing current to flow freely through the sensor.

MQ3 Alcohol Sensor Module Pinout

VCC This pin goes to the 5V pin of Arduino which powers the sensor.
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.

We can change the sensitivity by using knob on the senor. There are two LED’s on the module. One for the power and glows when module is on and the other glows when the digital pin goes low.

Calibration
To get accurate values from the sensor we suggest you to calibrate the sensor first. Calibrate values fist without taking alcohol and note down and then not down values after taking alcohol. You can use following sketch to calibrate the sensor.

#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
}

You don’t have to fully wet the sensor instead you have to sprinkle drops on the sensor.
When you run the sketch the probability of following reading will occur:

  1. When there is no alcohol in the breath reading will be (approximately 120)
  2. When there is alcohol then readings will be (approximately 150)
    Based on calibration we define the range of the alcohol means
  3. <120 is sober.
  4. 120-400 drink but in limitations.
  5. >400 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

Detection of alcohol using digital pin

Here pin configuration and wiring are same as we discussed before.

#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
}

The results of this sketch are as follows:

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
YouTube
× Contact us