Skip to main content
Version: ACS CC

BreatheCheck

A portable device that measures breath alcohol concentration, heart rate, and SpO2.

info

Author: Luciana-Ioana Toma
GitHub Project Link: https://github.com/UPB-PMRust-Students/acs-project-2026-lucianatoma8

Description

BreatheCheck is a small portable device built on the STM32 Nucleo-U545RE-Q board that measures two things: how much alcohol is in your breath and your heart rate and blood oxygen level.

For alcohol detection, it uses an MQ-3 gas sensor whose analog output is read through the STM32 ADC and converted to a concentration value in mg/L. A BME280 sensor measures the room temperature and humidity and uses those values to correct the MQ-3 reading, since the sensor is sensitive to environmental conditions. For heart rate and SpO2, a MAX30102 optical sensor shines infrared and red light into a fingertip and reads the reflection. The firmware processes the raw samples with a simple moving-average filter and a peak detection algorithm to get BPM, and uses the ratio of the two light wavelengths to estimate SpO2.

Results are shown on a small 0.96" OLED display. Three LEDs (green, yellow, red) and a buzzer give quick feedback about the alcohol level. The device runs on a LiPo battery charged via USB-C through a TP4056 module, so it works without being plugged into a computer.

The firmware is written in Rust using embassy-rs.

Motivation

I chose this project because I wanted to work with multiple sensors at the same time and learn how to handle them properly in Rust with embassy-rs. The MQ-3 sensor alone is a bit boring, but adding the BME280 compensation and the MAX30102 made it more interesting from a technical point of view. I also wanted to try building something battery-powered that actually works on its own, not just a demo connected to a laptop.

Architecture

The project is divided into a few main parts that work together to measure and display the biometric data.

Architecture diagram

Main Components:

  • The Controller: The STM32 Nucleo-U545RE-Q board — the brain of the device. It reads all sensors, processes the data, and controls the output peripherals.
  • The Alcohol Sensing System: The MQ-3 gas sensor connected to the ADC, with the BME280 providing temperature and humidity data for environmental correction.
  • The Optical Sensing System: The MAX30102 sensor connected over I2C, which measures heart rate and SpO2 from a fingertip.
  • The Display and Feedback System: An SSD1306 OLED displays all measurements. Three LEDs and a passive buzzer give immediate visual and audio feedback based on the alcohol threshold.
  • The Power System: A 3.7V LiPo battery charged via a TP4056 USB-C module powers the device autonomously.

Log

Week 5 - 11 May

Week 12 - 18 May

Week 19 - 25 May

Hardware

ComponentRoleInterface
STM32 Nucleo-U545RE-QMain microcontroller
MQ-3 alcohol sensorMeasures alcohol in exhaled breathADC (PA4)
MAX30102Heart rate (BPM) and SpO2 (%)I2C1 (0x57)
BME280Temperature and humidity for MQ-3 correctionI2C1 (0x76)
SSD1306 OLED 0.96"Displays all measurementsI2C1 (0x3C)
LiPo 3.7V 1000mAhBattery
TP4056 (USB-C)Battery charger
LED GreenAlcohol OK (< 0.2 mg/L)GPIO (PC0)
LED YellowAlcohol caution (0.2–0.5 mg/L)GPIO (PC1)
LED RedAlcohol exceeded (> 0.5 mg/L)GPIO (PC2)
Passive buzzerBeeps when alcohol limit exceededPWM TIM1_CH1 (PA8)
USER buttonStarts a measurementGPIO (PC13)

Schematics

Schematic

Bill of Materials

DeviceUsagePrice
STM32 Nucleo-U545RE-QMain microcontroller— RON
MQ-3 Alcohol SensorBreath alcohol detection13.00 RON
MAX30102Heart rate and SpO211.98 RON
BME280Temperature and humidity for MQ-3 correction32.67 RON
SSD1306 OLED 0.96"Display16.96 RON
TP4056 USB-CLiPo charger4.72 RON
LiPo 3.7V 1000mAhBattery26.85 RON
LEDs (x3) + ResistorsVisual feedback26.20 RON
Passive BuzzerAudio feedback1.45 RON
Breadboard + WiresPrototyping34.58 RON
Total168.41 RON

Software

LibraryDescriptionUsage
embassy-stm32STM32 HAL for embassy-rsADC, I2C1, PWM, GPIO peripheral access
embassy-executorAsync executor for embeddedRuns mq3_task, max30102_task, display_task, battery_task concurrently
ssd1306OLED display driverRenders measurements on the SSD1306 screen
bme280BME280 driverReads temperature and humidity for MQ-3 correction
max3010xMAX30102 driverReads IR/red FIFO values for BPM and SpO2
  1. MQ-3 Datasheet
  2. MAX30102 Datasheet
  3. BME280 Datasheet
  4. SSD1306 Datasheet
  5. TP4056 Datasheet
  6. embassy-rs documentation
  7. embassy-rs STM32 HAL
  8. STM32U545RE Reference Manual