MQ3 alcohol sensor Arduino code

Hello guys, welcome back to another tutorial from the SriTu Hobby. In this tutorial, we will learn how to work the MQ3 alcohol sensor with Arduino code. With this sensor, we can measure the alcohol level in the air. Also, this MQ3 sensor can be used mainly to create projects to get the level of alcohol in the human body. So, we can buy this sensor in the market at a low price.

The structure of this MQ3 sensor
These sensors are made of iron mesh on the surface and a plastic cover on the outside. Also, these sensors are designed so that only gaseous elements can travel inside. These are also known as heater-driven sensors. If we talk about the interior of these sensors, there are 6 legs connected to the sensing element. Two of these six legs are used to heat the sensing element. Also, these are connected via a nickel-chromium coil. The other 4 legs are connected to the body of the sensing element using the platinum element. If we talk about this sensing element, it is made of ceramic containing aluminum oxide and coated with tin dioxide on the outside. Also, these tin dioxides are very sensitive to alcohol. The ceramic substrate here controls the heat as needed.



Sensor activation on clean air
Sensor activation on alcohol.
OK, now let’s see the pin structure of this sensor.

- Arduino UNO board x 1 — Amazon / Our Store
- MQ3 sensor x 1 — Amazon / Banggood
- Breadboard x 1 — Amazon / Our Store
- 5v buzzer x 1 — Amazon / Banggood
- LED x 1 — Amazon / Banggood
- 180-ohm Resistor x 1 — Amazon / Banggood
- Jumper wires — Amazon / Our Store
Step 1
Arduino UNO board.

MQ3 sensor.

Breadboard.
5V buzzer.
LED bulb

180-ohm Resistor
Jumper wires

Step 2

Step 3
/*MQ-3 sensor with Arduino.
created by the SriTu Tech team.
Read the code below and use it for any of your creations.
https://srituhobby.com
*/
#define sensorDigital 2
#define LED 3
#define buzzer 4
#define sensorAnalog A1
void setup() {
pinMode(sensorDigital, INPUT);
pinMode(LED, OUTPUT);
pinMode(buzzer, OUTPUT);
Serial.begin(9600);
}
void loop() {
bool digital = digitalRead(sensorDigital);
int analog = analogRead(sensorAnalog);
Serial.print("Analog value : ");
Serial.print(analog);
Serial.print("t");
Serial.print("Digital value :");
Serial.println(digital);
if (digital == 0) {
digitalWrite(LED, HIGH);
digitalWrite(buzzer, HIGH);
} else {
digitalWrite(LED, LOW);
digitalWrite(buzzer, LOW);
}
}
Code explanation
Step 4
Step 5
MQ3 alcohol sensor Arduino code | Step by step instructions