Prototype a Portable Heart‑Rate Monitor from Scratch
Read this article in clean Markdown format for LLMs and AI context.Ever looked at your smartwatch flashing a heart‑rate number and wondered what’s really happening under the glass? It’s just a tiny light, a sensor, and a microcontroller doing a bit of math. Building your own version lets you see that process up close, costs less than a fancy gadget, and gives you a fun piece to show off at the next maker meetup.
Why Build Your Own?
I still remember the first time I taped an infrared LED to my fingertip in a dorm room and watched the flicker on a cheap oscilloscope. Seeing my own heartbeat appear on a screen felt like magic, and it sparked a habit: whenever I spot a cool gadget I ask myself, “Can I make that with parts from my drawer?” A portable heart‑rate monitor is the perfect playground because it touches analog front‑end design, PCB layout, and a bit of firmware—all topics I love to share on Circuit Craft. Plus, you end up with a device that fits in your pocket and teaches you how raw signals turn into readable data.
Parts You Need
Below is a compact parts list for a single‑lead, battery‑powered monitor that fits in a small project box. Everything is easy to find on Digi‑Key, Mouser, or at a local electronics shop.
- Microcontroller: ATmega328P‑P (the same chip in an Arduino Uno) – 1
- Pulse sensor: MAX30102 optical sensor module – 1
- Voltage regulator: MCP1700‑33 (3.3 V, 250 mA) – 1
- Battery: 3.7 V Li‑ion 500 mAh (or a 2‑cell AA pack with a boost converter) – 1
- Battery charger: TP4056 module (if using Li‑ion) – 1
- Display: 0.96″ OLED I²C (SSD1306 driver) – 1
- Resistors: 10 kΩ (×2), 1 kΩ (×1) – 3 total
- Capacitors: 10 µF electrolytic, 0.1 µF ceramic – 2 of each
- Push button: Tactile switch for power on/off – 1
- Header pins: 2 mm male/female – assorted
- PCB: Two‑layer board, roughly 2 × 3 inches – 1 (perfboard works too). A compact 2‑layer PCB, similar to the one I detail in designing a compact 2‑layer PCB for a Bluetooth wearable, works well.
- Misc: Solder, heat‑shrink tubing, double‑sided tape, 3‑mm mounting screws
If you already have the ATmega and basic passives, the total stays under $25.
Wiring Overview
Block Diagram
Battery → TP4056 charger → MCP1700 regulator → ATmega328P → OLED
│
└─> MAX30102 (pulse sensor)
The regulator gives a steady 3.3 V to both the microcontroller and the sensor. The ATmega talks to the MAX30102 over I²C, computes beats per minute (BPM), and pushes the result to the OLED.
Key Connections
- Power – Li‑ion connects to TP4056; charger’s OUT+ and OUT‑ feed the MCP1700. Place a 10 µF cap at the regulator input and a 0.1 µF cap at the output for stability.
- Microcontroller – Wire the ATmega in its classic Arduino style: VCC and AVCC to 3.3 V, GND to ground, a 10 kΩ pull‑up on RESET, and either a 16 MHz crystal with 1 kΩ series resistors or the internal 8 MHz clock.
- Sensor – MAX30102’s SDA and SCL lines get 10 kΩ pull‑ups to 3.3 V; add a 0.1 µF decoupling capacitor close to its VCC pin.
- Display – The OLED shares the same I²C bus; the pull‑ups we already placed for the sensor are sufficient for the short board traces.
- Button – Connect one side of a tactile switch to ground and the other to digital pin 2 on the ATmega. Firmware uses this to toggle a low‑power sleep mode.
All of this is captured in the schematic PDF you can download from the Circuit Craft resources page. Keep the I²C traces short and run them as a tight pair to minimise noise.
PCB Layout Tips
When I first laid out the board, I followed the steps from my guide on 2‑layer PCB design in KiCad. I shoved the sensor far from the regulator, and the BPM reading jumped wildly between 60 and 120. The fix? Keep the sensor and its decoupling caps as close as possible to the regulator’s output, and route the I²C lines as a tight, parallel pair. A solid ground plane on the bottom layer shields the analog front end from digital noise generated by the microcontroller. If you’re using perfboard, try to mimic that compact arrangement—short leads, a ground strip underneath, and keep the sensor away from noisy digital traces.
Step‑by‑Step Assembly
1. Prep Your Workspace
Lay out all components, double‑check polarities (especially the battery connector, regulator, and OLED). A quick visual check saves headaches later.
2. Solder the Power Section
Start with the TP4056 charger and MCP1700 regulator side by side. Solder the input and output capacitors right next to the pins they belong to. Add a little heat‑shrink tubing on the battery leads to avoid accidental shorts.
3. Place the Microcontroller
If you’re using a bare ATmega328P‑P, orient the notch upward. Solder the crystal (if using) or rely on the internal clock, and add the 10 kΩ reset pull‑up. Keep the pins neat—solder wick is your friend for cleaning up bridges.
4. Attach Sensor and Display
The MAX30102 module usually comes with pins pre‑soldered. Align it so its SDA/SCL line up with the ATmega’s A4 and A5 pins. Position the OLED opposite the sensor for balance. Solder the shared 10 kΩ pull‑up resistors between VCC and the I²C lines.
5. Wire the Button
Solder the tactile switch to the board’s edge. Connect one terminal to ground and the other to digital pin 2. This lets you power‑save without unplugging the battery.
6. Verify the Power Rail
Before inserting the microcontroller, power the board with a bench supply set to 3.3 V. Measure VCC at the ATmega and at the sensor’s VCC pin—both should read within 0.1 V of 3.3 V. If you see a drop, re‑check for cold joints or shorts.
7. Load the Firmware
Grab the simple Arduino sketch from the Circuit Craft site. It starts the I²C bus, configures the MAX30102 for 100 Hz sampling, runs a moving‑average filter, and uses a peak‑detect algorithm to compute BPM (look for spikes roughly 600 ms apart). The result appears on the OLED in a large, readable font.
8. Enclose the Build
Drill two 3‑mm holes in your project box: one for the sensor’s LED window and one for the button. Secure the board with double‑sided tape or standoffs, then snap the cover shut. The final size is about that of a credit card—slip it into a pocket or a small bag and you’re ready to go.
Troubleshooting Quick Guide
- No display – Confirm OLED VCC and GND are correct and that the I²C pull‑ups are present. Swapped SDA/SCL is a common slip‑up.
- Jumping BPM – Make sure the sensor sits snugly but not too tight on your finger. Excess pressure saturates the LED; too little pressure yields a weak signal. A soft rubber band or a fingertip clip works well.
- Battery drains fast – Ensure the ATmega enters sleep mode when the button isn’t pressed. The MCP1700’s quiescent current is only ~2 µA, so most draw comes from the microcontroller; sleeping saves a lot.
What I Learned
Putting this monitor together reminded me why I love making electronics: you start with a vague idea, pick parts, draw a schematic, lay out a PCB, write a few lines of code, and end up with a tangible number that reflects your own heartbeat. Every step reinforces the same loop of curiosity that drives any maker. If you want a project that spans analog sensing, digital processing, PCB design, and firmware, a portable heart‑rate monitor is a sweet spot—plus it’s a great conversation starter at the next meetup.
Happy soldering, and may your pulse stay steady while you tinker!
- →
- →
- →
- →
- →