mq-3
Objective:

In this project, we will use Arduino to get alcohol  concentration value from MA-3 sensor module and display the data to PC. When concentration is more than some Threshold , LED will flash.

Parts and Devices:
Arduino UNO R3  x 1

USB cable x 1

MQ-3 x 1

breadboard and jumper wires

Circuit Graph

MQ-3_bb

Sample Code:
int gas_din=2;//MQ3 digital output pin to Arduino D2
int gas_ain=A0;//MQ3 analog output pin to Arduino A0
int led_pin=13;//use Arduino integrated LED which connected to D13
int ad_value;
void setup()
{
pinMode(led_pin,OUTPUT);
pinMode(gas_din,INPUT);
pinMode(gas_ain,INPUT);
Serial.begin(9600);
}
void loop()
{
ad_value=analogRead(gas_ain);
if(digitalRead(gas_din)==LOW)
{
Serial.println(“Gas leakage”);

}
else
{
Serial.println(“Gas not leak”);
}
if(ad_value>900)
{
digitalWrite(led_pin,HIGH);
delay(10);
digitalWrite(led_pin,LOW);
delay(10);
}
Serial.println(ad_value);
delay(500);
}

Result:
Load the code into Arduino, put the sensor in normal air, the serial terminal window will show “Gas not leak”  and show some small alcohol value, the LED is off.
IMG_20160616_200443

Put the sensor in beer, you will see “Gas leakage” in terminal window and high alcohol value. LED will flash

IMG_20160616_200718