Making a piezo-based breathing monitor
Coming home with a new baby is pretty scary! Our daughter spent the first day in the NICU, where they have fancy monitors for all vitals. Once I got home I was worried I wouldn’t wake up in the middle of the night if there was a problem. Having spent many years on-call for Dropbox’s telemetry systems, I wanted an alert! But unlike the NICU, I didn’t want to wire electrodes multiple times a day.
I considered two approaches:
- mmWave radar — a presence/breathing sensor aimed at the crib. This was my first idea, but deconvolving the RF signal seemed like it might be difficult. And breathing is such a small signal! There are some sensors that purport to do this, so maybe I’ll try again at some point. But I wasn’t sure I would be able to mount it easily/safely, so I didn’t pursue this approach.
- Piezo film under the mattress — a passive PVDF strip under the sheet that turns mattress flex into charge. This is a very thin strip under the sheet.
I went with the piezo. It’s fairly intuitive: chest moves, mattress flexes, strip makes charge.
Analog is HARD
I started by reading Forrest Mims’s Getting Started in Electronics — the Radio Shack classic.

Then I went to the sensor vendor’s app notes (piezopvdf.com). The recommended front end for a film strip is a charge-mode amplifier with a T-network in the feedback path (top), with a variant adding output-side limiting diodes (bottom):

The T-network (R1/R2/R3) synthesizes an effective feedback resistance of (R1 x R2)/R3 — here 1 GΩ — so the lower limiting frequency lands around 0.07 Hz with an effective “gain” of ~3.3x over the sensor’s open-circuit voltage. The follow-up circuit adds output-side limiting diodes, since the sensor node itself is held at virtual ground and can’t be clamped directly.
I ended up trying a few different capacitor and resistor values here, but that schematic is basically the design.
The op-amp design
I used an MCP6002 as a charge amplifier:
- Piezo strip through a 100 kΩ series resistor into the inverting node.
- Feedback: 2.2 nF plus the 10 MΩ / 10 MΩ / 100 kΩ T-network.
- A pair of 1N4148s clamp the output to roughly VREF ± 0.6 V so a roll-over or a picked-up baby can’t rail the amp (or the ADC) too hard.
I used a $5 Seeed XIAO ESP32-C6 for the MCU. The firmware reads the voltage (~1.65V +/- 0.6V) using its ADC pin at 100 Hz and POSTs batches to my PC over Wi-Fi.
Breadboarding
I brought up the XIAO ESP32 on a full-size breadboard:

Half-size perma-proto
I shrank the analog front end to fit on a half-size breadboard:

Once the signal looked good, I condensed the circuit to fit on a half-size Adafruit Perma-Proto: XIAO at one end, MCP6002 mid-board, T-network resistors, clamps, VREF buffer and divider, filter caps, and an on/off switch:

There’s also a voltage divider wedged into some available space for measuring the battery level.
The finished board went into a small enclosure mounted underneath the bottom of the crib. The only thing under the baby is the piezo strip itself, slipped under the mattress sheet, with its thin lead running down to the box.


Of course once I finished the board it didn’t work! I spent a lot of time trying to figure out what had gone wrong and trying to replace individual components, but it turns out the Piezo strip had been damaged. It is very thin and fragile! Fortunately it came with 2 and for the second one I made it more robust by “laminating” it between two pieces of packing tape.
The dashboard
The receiver serves a small page showing the raw voltage, the filtered breathing trace, and some derived stats: peak-to-peak, envelope, estimated breathing rate, movement detected, battery level.

~30 breaths per minute seems to be good sleep.
What it’s actually for
You will wake up when your baby cries, no additional alert is needed. But it’s still been pretty useful as a monitor! You can easily see whether she’s sleeping soundly or rolling around in there. A flat, rhythmic trace means leave her alone. A big ragged envelope means she’s awake and thrashing around. I think it’s pretty neat that you can measure such a subtle signal as a baby breathing!