Projects / Breath alcohol tester

Breath alcohol tester

Beginner1 hGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANO11.6 mA

    Wire the module

    Connect power, AO and the three LEDs through resistors.

  2. NANO

    Burn in the sensor

    Power it for a few minutes (ideally some hours the first time) so it settles.

  3. NANO

    Check the baseline

    After warm-up, note the clean-air reading on Serial or the screen.

  4. NANO

    Test with a safe source

    Hold a cotton bud with a little hand sanitiser near, not touching, the sensor.

  5. NANO

    Adjust the levels

    Change the 80 and 200 limits to suit your sensor's sensitivity.

  6. NANO

    Label the box

    Print "Demonstration only, not a legal breathalyser" on the case.

In short

How do you build a breath alcohol tester?

An MQ-3 sensor gives a relative alcohol reading when you blow on it, with green, yellow and red lights. A demonstration only, not a legal breathalyser. You need Arduino Nano, MQ-3 alcohol sensor module, LED 5 mm green, LED 5 mm yellow, LED 5 mm red, Resistor 220 Ω × 3 and SSD1306 OLED Display. It takes 6 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
MQ-3 module VCC, GNDNano 5V, GNDPower (the heater draws about 150 mA)
MQ-3 module AONano A0Analog output
OLED SDA, SCLNano A4, A5I2C
OLED VCC, GNDNano 5V, GNDPower
Nano D5220 Ω resistor then green LED, to GNDLow
Nano D6220 Ω resistor then yellow LED, to GNDMedium
Nano D7220 Ω resistor then red LED, to GNDHigh

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). Install "U8g2". The MQ-3 also responds to breath humidity, mouthwash and other vapours, so figures are only relative. It is a classroom demonstration and must never be used to decide whether it is safe to drive or work.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <U8x8lib.h>

U8X8_SSD1306_128X64_NONAME_HW_I2C oled(U8X8_PIN_NONE);
const byte SENSOR = A0, LEDS[3] = { 5, 6, 7 };
int baseline = 0;

int avgRead(int n) {
  long s = 0;
  for (int i = 0; i < n; i++) { s += analogRead(SENSOR); delay(10); }
  return s / n;
}

void show(const char* a, const char* b) {
  oled.clear();
  oled.drawString(0, 1, a);
  oled.drawString(0, 4, b);
}

void setup() {
  for (byte i = 0; i < 3; i++) pinMode(LEDS[i], OUTPUT);
  oled.begin();
  oled.setFont(u8x8_font_chroma48medium8_r);
  show("Warming up", "2 minutes");
  delay(120000UL);                         // MQ-3 needs time to heat
  baseline = avgRead(50);                  // clean-air reading
  show("Ready", "Blow for 5 s");
}

void loop() {
  if (analogRead(SENSOR) > baseline + 30) {          // a breath is detected
    int peak = 0;
    unsigned long start = millis();
    while (millis() - start < 5000) { int r = analogRead(SENSOR); if (r > peak) peak = r; delay(20); }
    int rise = peak - baseline;
    byte level = rise < 80 ? 0 : (rise < 200 ? 1 : 2);
    for (byte i = 0; i < 3; i++) digitalWrite(LEDS[i], i == level);
    const char* names[] = { "LOW", "MEDIUM", "HIGH" };
    show(names[level], "Not a legal test");
    delay(8000);
    for (byte i = 0; i < 3; i++) digitalWrite(LEDS[i], LOW);
    while (analogRead(SENSOR) > baseline + 10) delay(500);   // wait for clean air
    show("Ready", "Blow for 5 s");
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Clean airReady, no LED
Sanitiser near sensorLED goes up with strength
Normal breathLittle or no rise
Wait after useScreen waits for the reading to fall before the next test

If it does not work

Always High

The sensor has not warmed up, or the baseline was taken near a vapour.

Never rises

Check AO to A0 and the 5 V supply.

Readings drift

Humidity and temperature change MQ-3 values. Re-take the baseline.

Screen blank

Check the I2C connection.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the breath alcohol tester?

Arduino Nano, MQ-3 alcohol sensor module, LED 5 mm green, LED 5 mm yellow, LED 5 mm red, Resistor 220 Ω × 3 and SSD1306 OLED Display.

How long does the breath alcohol tester take to build?

About 60 minutes for a beginner maker, in 6 steps.

How do I know the breath alcohol tester works?

Clean air: Ready, no LED. Sanitiser near sensor: LED goes up with strength. Normal breath: Little or no rise.

Always High: what should I check?

The sensor has not warmed up, or the baseline was taken near a vapour.

Never rises: what should I check?

Check AO to A0 and the 5 V supply.

Readings drift: what should I check?

Humidity and temperature change MQ-3 values. Re-take the baseline.

Screen blank: what should I check?

Check the I2C connection.