• EUR€
  • £GBP
  • $USD

How to Use the MQ-3 Alcohol Sensor

DFRobot Apr 09 2018 2327

 Learn how to use this sensor in this tutorial.


According to its datasheet, the MQ-3 alcohol sensor detects 25 to 500 ppm of alcohol (ethane). Here’s the graph of voltage vs. alcohol concentration:

Blood alcohol level (BAC) is normally measured in grams per deciliter (g/dL). 1 g/dL is equivalent to 10000 ppm. In the US and Canada, the minimum BAC for driving is 0.08 g/dL or 800 ppm. In most European countries, it’s 0.05 g/dL or 500 ppm.

Note that the graph was derived with a load of 4.7 kΩ. It would be difficult to replicate the results of the graph if we will be using the MQ-3 as a breathalyzer. Instead, we will be using the RS/R0 graph:

Here we see the different curves for each gas the MQ-3 can detect. Rs is the resistance of the board at target gas while R0 is the resistance of the board when only clean air is present.

MQ-3 Alcohol Sensor Breakout Board

The MQ-3 alcohol sensor breakout board has four pins as shown:

Here’s the schematic diagram for the breakout board:

The alcohol level is readable via the AOUT pin. Since it’s a varying voltage, this pin should be connected to any of the Arduino’s or PIC’s analog pin. To use the MQ-3 alcohol sensor with the Raspberry Pi you need an external analog to digital converter.

The DOUT pin becomes high when the alcohol level exceeds a threshold value. Based on the schematic, the threshold value depends on the value of Rp which is the trimmer on the breakout board. You will need to test the device as to which BAC will trigger DOUT.

Breath Analyzer with Arduino

To build a reliable alcohol level sensor using the MQ-3, we need to determine the R0 of the device first. We can use this sketch for that:

void setup()
void loop()
    float sensor_volt;
    float RS; //  Get the value of RS via in a clear air
    float R0;  // Get the value of R0 via in Alcohol
    float sensorValue;
    for(int i = 0 ; i < 100 ; i++)
        sensorValue = sensorValue + analogRead(A0);
    sensorValue = sensorValue/100.0;     //get average of reading
    sensor_volt = sensorValue/1024*5.0;
    RS = (5.0-sensor_volt)/sensor_volt; // 
    R0 = RS/60.0; // 60 is found using interpolation
    Serial.print("R0 = ");

Once we have R0, we can now use the information from the graph to calculate BAC. Using regression, I found the relationship between RS/R0 and mg/L to be:


I then use this formula to calculate the BAC in g/dL.

This is the resulting Arduino sketch. Remember to replace R0 with the results obtained from the previous sketch.

void setup() 
void loop() 
    float sensor_volt;
    float RS_gas; // Get value of RS in a GAS
    float ratio; // Get ratio RS_GAS/RS_air
    float BAC;
    int sensorValue = analogRead(A0);
    RS_gas = (5.0-sensor_volt)/sensor_volt; // omit *RL
   /*-Replace the name "R0" with the value of R0 in the demo of First Test -*/
    ratio = RS_gas/R0;  // ratio = RS/R0   
    BAC = 0.1896*ratio^2 - 8.6178*ratio/10 + 1.0792   //BAC in mg/L
    Serial.print("BAC = ");
    Serial.println(BAC*0.0001);  //convert to g/dL

You now have an Arduino-based breathalyzer!

Thanks for Teachmemicro.com. The original tutorial is from here.