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.

Build it step by step in the app

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.

  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).

  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).

  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 sketch

const int AOUTpin = A0; // 0 yerine A0 kullanıldı
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: ");
  Serial.println(limit); // println ile satır burada bitirildi
  
  delay(500);
}

What the Serial Monitor shows

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

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

Build it step by step in the app