Potentiometer Breath Monitor With Buzzer
Separate firmware for Waveshare ESP32-S3-LCD-2. It retains the stable three-wire potentiometer breath sensor from potentiometer_breath_monitor and adds an Arduino three-pin buzzer module.
Wiring
- potentiometer wiper:
GPIO2 / IO2; - buzzer
GND: boardGND; - buzzer
VCC: board3V3only; - buzzer
I/O:GPIO6 / IO6.
Do not feed 5 V into GPIO2 or GPIO6.
Sound behavior
- A complete cycle is stored when EXHALE ends and the following INHALE starts. The average is recalculated from the newest five complete cycles at that point, while alerts use only the newest complete cycle.
- A direction reversal that lasts under two seconds is ignored as sensor jitter unless its movement is at least three times the adaptive reversal threshold.
Minimum cyclecompares the newest complete inhale-plus-exhale cycle with the limit. A shorter cycle produces two 500 ms beeps with a 500 ms pause; a cycle at or above the limit produces one 50 ms beep.Maximum phase idledefaults to 30 seconds. If either INHALE or EXHALE has no detected movement for that time, the module makes a 400 ms beep and repeats it every 10 seconds until movement resumes.- The main screen has a
PAUSE/RESUMEbutton. While paused, signal processing and alerts stop; resuming starts a fresh current cycle without erasing history. SETopens settings.Minimum cycle,Maximum phase idle, and the upside-down display mode are saved in NVS.- A short
BOOTpress puts the board into deep sleep. PressingBOOTagain wakes it. The ESP32 wake source is the button press itself, so firmware cannot require a long press before wake-up. - The tested three-pin module is an active-high buzzer:
GPIO6 HIGHturns it on. Its physical pitch and loudness are fixed by the module, so the firmware intentionally does not offer fake frequency or volume controls.
Build and flash
From this folder:
./burn.sh