tutorialspinouttools
Sensors · ESP32-C3

MQ-3 on OLED: Alcohol Vapour

Free ESP32 & Arduino tutorial · wiring, code & parts · gokul.builds

Overview & Wiring

What it is: The MQ-3 is tuned for alcohol vapour — the sensor behind DIY breathalysers. It also reacts to benzine and some solvents. How it works: Same principle as the MQ-2: a heated element whose resistance drops with alcohol concentration, read as an analog voltage on AO. This sketch shows a relative 0–100 level plus raw ADC. Wiring: MQ-3 AO -> GPIO0 MQ-3 VCC -> 5V (heater needs 5V) MQ-3 GND -> GND OLED VCC=3V3, GND=GND, SDA=GPIO4, SCL=GPIO5 VOLTAGE WARNING: put a divider on AO so the peak stays under 3.3V for the ESP32-C3 ADC. Libraries: only "Adafruit SSD1306" and "Adafruit GFX Library". On screen / Serial: relative alcohol level (0–100) and raw ADC. Breathe near it after some mouthwash to see it spike. Gotchas: Needs burn-in and warm-up like all MQ sensors. It is NOT a legal/medical breathalyser — treat it as a fun relative indicator only.

Circuit Diagram

MQ-3 on OLED: Alcohol Vapour wiring diagram for ESP32-C3

Parts You Need

ESP32-C3 SuperMiniBuy →
0.96" SSD1306 OLEDBuy →

Source Code (Arduino / ESP32)

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_SSD1306 display(128, 64, &Wire, -1);

#define MQ 0                  // AO on GPIO0 (via divider)

void setup() {
  Serial.begin(115200);
  Wire.begin(4, 5);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}

void loop() {
  int raw = analogRead(MQ);
  int level = map(raw, 0, 4095, 0, 100);

  display.clearDisplay();
  display.setTextColor(SSD1306_WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("MQ-3 Alcohol");
  display.setTextSize(3);
  display.setCursor(0, 18);
  display.printf("%d", level);
  display.setTextSize(1);
  display.setCursor(0, 52); display.printf("raw %d", raw);
  display.display();

  Serial.printf("Alcohol: %d  (raw %d)\n", level, raw);
  delay(400);
}
Browse all tutorials ESP32-C3 pinout Calculators