DIY ELECTRONICSTR

← All projects

Alcohol Measurement with the MQ-3 Sensor

Beginner25 min

A project that measures alcohol vapour in the air with an MQ-3 gas sensor and writes the analog value and the threshold state to the Serial Monitor every half second. The analog value (0-1023) rises as the alcohol concentration goes up; the Limit value shows whether the threshold set with the trimmer on the board has been crossed. No extra library needed. The sensor's heater gets warm while it runs; on first use, leave the sensor powered for a while (ideally 24 hours), and let it warm up for a few minutes before measuring. The code uses 115200 baud, so pick 115200 in the Serial Monitor too.

Get it on Google Play

What you need

Wiring steps

  1. 1

    Power the sensor

    Power the sensor

    Plug a red jumper wire into the 5V pin on the Arduino's POWER header. Connect its other end to the top pin, pin 1 (VCC), in the MQ-3 module's pin row. The sensor's heater runs on 5V.

    • Arduino 5V → MQ-3 VCC (red wire)
  2. 2

    Ground (GND) connection

    Ground (GND) connection

    Plug a black jumper wire into the GND pin on the Arduino's POWER header. Connect its other end to the module's pin 2 (GND).

    • Arduino GND → MQ-3 GND (black wire)
  3. 3

    Connect the digital output (DOUT)

    Connect the digital output (DOUT)

    Plug a green jumper wire into the Arduino's digital pin 8. Connect its other end to the module's pin 3 (DOUT). When the alcohol level crosses the threshold set with the trimmer on the board, this pin goes LOW and the Serial Monitor shows Limit: 0 (DOUTpin = 8).

    • Arduino pin 8 → MQ-3 DOUT (green wire)
  4. 4

    Connect the analog output (AOUT)

    Connect the analog output (AOUT)

    Plug a blue jumper wire into pin A0 on the Arduino's ANALOG IN header. Connect its other end to the module's bottom pin, pin 4 (AOUT). The code reads the alcohol concentration on this pin as a value from 0 to 1023 (AOUTpin = A0).

    • Arduino A0 → MQ-3 AOUT (blue wire)

Arduino sketch

Download the sketch (.ino)

// A0 rather than 0
const int AOUTpin = A0;
const int DOUTpin = 8;
int limit;
int value;

void setup() {
  Serial.begin(115200);
  pinMode(DOUTpin, INPUT);
}

void loop() {
  value = analogRead(AOUTpin);
  limit = digitalRead(DOUTpin);

  Serial.print("Alcohol value: ");
  Serial.print(value);
  Serial.print("  |  Limit: ");
  // println ends the line here
  Serial.println(limit);

  delay(500);
}

What the Serial Monitor shows

SERIAL MONITOR · 115200 BAUD
Alcohol value: 250  |  Limit: 1
Alcohol value: 253  |  Limit: 1
Alcohol value: 248  |  Limit: 0

Similar projects

In the app, tick off every wire, match the parts to your inventory and pick up where you left off.

Get it on Google Play