Skip to main content
Version: FILS English

Breathalyzer

A device that measures the alcohol level in the air used mainly for combating drunk driving.

info

Author: Iliescu Alin-Andrei
Group: 1221EA
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-13alinnn

Description

My breathalyzer device is an embedded project that meassures the amount of alcohol present in the users breath.

The output given by the breathalyzer is sent through an OLED display, a buzzer that recreates a police siren and an RGB LED that flashed blue and red, when alcohol is detected, everything physically connected through a breadboard. The program starts with an initial 2 minute "loading" time in which the MQ-3 alcohol sensor has to heat up.

Motivation

When I was thinking of project ideas I wanted to make something related to music and I thought of a flute, in which you would blow into and based on the air preassure, a certain note would be played, then I remembered how you also blow into breathalyzers at police filters and I personally found this idea more unique, interesting and having more real world applications.

Architecture

The project's architecture is thought of around the STM32 NUCLEO-U545RE-Q microcontroller. The workflow is:

  • Input: The MQ-3 sensor constantly meassures the alcohol level in the air
  • Output: The OLED Display, RGB LED and buzzers connected to the board give feedback to the user
  • Control: The STM32 processes the input and based on its algorithm chooses what has to be done

How components connect:

MQ-3 Alcohol Sensor
|
| Analog (ADC)
v
Sensor Acquisition Module
|
v
Processing Pipeline (STM32U545)
|
+--[ PWM ]------------> Alarm Controller (Buzzer)
|
+--[ PWM (x3) ]-------> Status Indicator (RGB LED)
|
v
Rendering Engine -> 1.3" OLED Screen

Log

Week 5

  • Researched required components and made a list
  • Planned how everything will connect
  • Ordered most of the components

Week 6

  • Tested the STM32 board
  • Ordered the last component, the screen

Week 7

  • Researched about the MQ-3 sensor
  • Started learning how to 3D model for the casing of the device

Hardware

The system is centered around the STM32 NUCLEO-U545RE-Q MCU. For output I am using an 1.3" OLED Display (SSD 1306 controller) using I2C for data transmission, a passive buzzer that gets a PWM signal, and an RGB LED that gets an oscilating PWM signal in the form of a 2D vector(since only red and blue are needed).

The OLED Display will have animations for the 2 minute waiting time and in the case of alcohol being detected.

Schematics

MQ-3 Sensor (Analog/ADC)STM32 NUCLEO-U545RE-QMain Controller1.3" OLED Screen (I2C)Buzzer (PWM)RGB LED (3x PWM)

Bill of Materials

DeviceUsagePrice
STM32 NUCLEO-U545RE-QThe main microcontroller~160 RON
MQ-3 Alcohol Ethanol SensorThe main sensor~15 RON
Passive BuzzerFor making siren noises~1.5 RON
BreadboardFor connecting the componentsPreviously owned
DisplayFor displaying alcohol levels~35 RON
RGB LEDFor the police aestheticPreviously owned
Jumper wiresFor connectingPreviously owned
ResistorsFor a voltage divider going from the sensor to the MCUPreviously owned

Software

LibraryDescriptionUsage
embassy-stm32Hardware Abstraction LayerCore hardware control
embassy-executorAsync ExecutorRunning non-blocking tasks
ssd1306Display driverControlling the OLED screen
embedded-graphics2D graphics libraryDrawing text and shapes
  1. Embassy-rs Documentation - The official book for the async framework used.
  2. STM32U545 Datasheet - Technical details for our specific MCU.
  3. SSD1306 Rust Driver - Documentation for the OLED screen library.
  4. Embedded Rust Book - General guide for Rust on microcontrollers.