An analog circuit device that detects heartbeats between 60-100 BPM and produces a beep for each one.
October – November 2023
For ENGS032: Electronics – Introduction to Linear and Digital Circuits. Principles of operation of semiconductor diodes, bipolar and field-effect transistors, and their application in rectifier, amplifier, waveshaping, and logic circuits. Basic active-circuit theory. Introduction to integrated circuits: the operational amplifier and comparator, to include practical considerations for designing circuits with off-the shelf components. Emphasis on breadth of coverage of low-frequency linear and digital networks, as well as on high order passive and active filter design. Laboratory exercises permit “hands-on” experience in the analysis and design of simple electronic circuits.
Project Summary
| Designed an analog heartbeat monitor that detects a slow and fast heartbeat, producing a 450 Hz tone after each one. For the first heartbeat detected after a period of quiet, the beep is 2 seconds, and for every heartbeat detected after, the beep is 200 milliseconds. Specifications included working reliably well over 60-100 BPM, producing spectrally pure and loud beeps, and briefly turning on an LED when a heartbeat is detected. A 4-week project that took around 80 hours of design, fabrication, and debugging work. |
To produce this device, I implemented various passive and digital circuit subsystems. I used an electret microphone inside the tubing of a stethoscope to measure heart sounds and a small speaker to generate the detection beeps. Because a heartbeat contains 2 thumps, a “lub” (S1) and a “dub” (S2), and I only wanted 1 beep for each heartbeat, the input needed to undergo thorough conditioning and modulation before the desired beep could be produced. Because I want 2 distinct beeps at distinct and duration-based intervals, I need to include clocks and switches to have everything work as required. Such nuances force our device to become quite dense. 5 major sub-circuit blocks cascade to connect the microphone to the speaker, and each block contains several smaller circuits. Each circuit and component was chosen carefully, modeled robustly, thoroughly designed, and tested extensively. An overhead block diagram is included below for reference.

Our device solves the engineering problem summarized above by first amplifying and filtering the heartbeat input (Block A) so S1 can be processed and S2 ignored (Block B). I decided to use a 555 timer to set the beep pulse duration, which expects a very clean impulse signal as input. As such, I curated logic gates to send S1 through so it is conditioned into the timer’s expected input (Block B). The 555 timer extends the pulse to the desired duration of the output beep (Block C). However, project requirements dictate I must begin detection with a long beep and have short beeps for every heartbeat detected after; the timer cannot output just one pulse width, as it is designed to do in monostable mode. To achieve this beginning beep, I divert the pulse just before it reaches the 555 timer’s trigger pin, sending it into a circuit that functions like a clock and switch. It both keeps track of how long it has been since the last heartbeat was detected (ie. how long the circuit has been idle) and counts out 2 seconds. After the circuit has been idle for 10 seconds, the next S1 detected will trigger a 2 second beep, and then a switch will “turn off” the long beep possibility until the circuit has been idle for another 10 seconds, meaning all S1 signals detected before 10 seconds of quiet will produce a shorter beep (Block D).
Now that the different pulse widths have been curated, they are prepared for output. First, the pulse widths travel to an LED, which lights up for as long as the pulse endures (Block C). This flashing is one device output dictated in the project requirements. Second, the pulse widths are filled with a 450 Hz tone by combining a Wien Bridge oscillator output and the pulse widths in an amplifier with programmable gain (Block C). This 450 Hz branch travels through a Class D amplifier that connects directly to the speaker output (Block E). Thus, for any heartbeat input, our device generates long and short beeps with a 450 Hz tone and flashes an LED in time with the beeps.
Final Breadboarded Circuit and Proof of Functionality

Detailed Block Breakdown

The “Analog Front End,” the first block of our circuit, takes a heartbeat as input and amplifies and filters the signal, preparing it for conditioning in the next block. Essentially, this block is a scrubber: cleaning up a messy signal so the rest of the device can perform its tasks. A high level diagram and thorough schematic is included below to illustrate the cascading of the block’s essential components.
The block begins with a “Mic Bias” circuit—not present in the high-level block diagram above but is present in the detailed schematic—that implements a DC signal so the microphone can operate. The Mic Bias’s output is this operational DC signal and an AC signal: the microphone’s response to changes in pressure. This nonlinear signal is our device’s focus. Both DC and AC travel into a preamplifier that scrubs the DC bias and substantially amplifies AC signal so a subsequent bandpass filter (BPF) can remove extraneous noise, isolating a passband of 10-70 Hz.

In the “S1 Conditioning” block, I wrapped our signal using a classic envelope detector: a simple peak detector with a curated time constant. When the detector senses a heartbeat (ie. a jump in voltage), the detector grabs it and decays slowly, such that output is a simpler curve that can be processed by a comparator. The comparator outputs low to indicate a heartbeat and high for no signal. This output is processed by a logic gate that catches the last edge of each comparator output. The output of the logic gate is the appropriate input for the upcoming 555 timer.

This block has several subblocks, but in short, it sets the duration for each beep and outputs that signal to an LED that flashes in time with the beep and fills the signal with a 450 Hz tone for audio processing.
To generate the 450 Hz tone, I used a Wien Bridge oscillator and designed the component values to produce the periodic signal. I used a Wien Bridge oscillator because it provides better frequency stability and lower distortion than, say, a relaxation oscillator. This oscillator runs constantly, so I used a programmable gain circuit with a switch to keep the system’s output from being a constant 450 Hz sinusoid.
The programmable gain amplifier is controlled by an nMOS circuit that will be switched on and off by the pulse width signal coming from a monostable 555 timer. When the input is 0V, the amplifier will produce an output of 0V. When the input is 1V, it will produce an output of 1V. The “on” output will have a sinusoidal shape of 450 Hz because of the oscillator, and I will set its duration with the timer.
The 555 timer will extend the short burst being sent into this block from Block B to 200 ms. When I add Block D, I will change the 555 timer’s pulse width output to be 2 seconds or 200 ms depending on the idle condition of the circuit. The 555 timer outputs a pulse of set duration when the input pin is triggered high. This addition will force the system’s output bursts to be our chosen duration. I will invert the signal output from the timer so it can trigger the switch appropriately.

This block is intended to produce a long beep whenever there is an idle period between heart signals. Defining what idle means to us, I believed that 10 seconds is a realistic idle period between two heart signals. In order to achieve this, I did not want to create another 555 timer with a different RC time constant, because I then would have to essentially rebuild the whole rest of the circuit for a different signal. Instead, I wanted to be able to sense when the time between two signals was “idle,” and then open or close a MOSFET that changed the RC time constant of the current 555 timer that I have already implemented. Our goal for implementing this was to not have to rebuild the circuit again, and instead leverage the “switch” behavior of MOSFETS to change the length of the beep response produced by the 555 timer.

This block is used to reduce the noise at the end of the chain before it is driven into the speaker. In this block I input two waveforms: the audio signal I am processing, and an extremely fast switching waveform into the circuit. Our goal is to create such a waveform that, when filtered through a low-pass filter and a DC blocker, it is the averaged version of the original audio signal that is needed to produce a clean sound from the speaker.