Hardware
How a sound becomes the numbers the software reads: the electronics, the filter that shapes the signal and the fixture that lets recordings be tested without patients.
Status of the build
Hardware build in progress
The hardware is not connected to this software yet. The sensor changed from a piezoelectric contact sensor to a microphone, and the microphone type is not final: it may be analog or digital (I2S). The hardware team will confirm the final chain.
Until then this page shows the design intent from the project report. It is not a built or measured circuit.
The signal chain
The sound reaches the microphone, and five more stages carry the signal to the Raspberry Pi. Hover, focus or tap a stage to read what it does.
Scroll sideways to see the whole diagram.
| Stage | What it does | Why it is there |
|---|---|---|
| Microphone | Turns the sound that arrives through the silicone into a small electrical signal. | It is the sensor. It replaced the piezoelectric contact sensor, and its type is not final. |
| Protection and clamp | Limits how far the voltage at the amplifier input can swing. | A large spike must not reach, and damage, the amplifier. It was designed for the piezo sensor and will be checked for the microphone. |
| High-impedance voltage amplifier | Makes the weak signal larger without drawing current from the sensor. | A stage with a high input impedance does not load the sensor and weaken the signal. It is a voltage amplifier, not a charge amplifier: a decision already made. |
| Active bandpass, 20–600 Hz | Passes 20–600 Hz and attenuates everything outside it. | Heart sounds and murmurs lie inside this band, and the high edge leaves headroom against aliasing before the converter. See the response chart below. |
| ADC | Turns the filtered voltage into numbers (samples). | The Raspberry Pi works with numbers. The interface (USB audio codec, I2S codec or SPI converter), and so the sample rate and bit depth, is not decided yet. |
| Raspberry Pi 5 | Cuts the samples into 5 s windows, extracts the features, runs the classifier and serves these pages. | The analysis runs locally on the Pi, with no network or cloud service. |
If the microphone is digital (I2S)
A digital I2S microphone has its amplifier and converter inside it, so the analog stages above would not be needed in the same form, and the band-limiting would happen in software. The feature code already band-limits every window to 20–600 Hz, so the classifier sees the same band either way.
Microphone The sensor on top of the silicone layer. It turns sound into a small electrical signal. It replaced the original piezoelectric contact sensor; whether it is analog or digital (I2S) is not decided yet.
Protection and clamp An input protection network limits how far the voltage at the amplifier input can swing, so a large spike cannot damage it. The circuit is to be confirmed by the hardware team. It was designed for the piezo sensor and will be checked for the microphone.
High-impedance voltage amplifier Makes the weak signal larger. Its input draws almost no current, so it does not load the sensor. It is a voltage amplifier, not a charge amplifier.
Active bandpass, 20–600 Hz Passes 20 to 600 Hz and attenuates the rest. The low edge keeps the heart sounds' low-frequency energy; the high edge keeps the murmur band and leaves headroom against aliasing.
ADC Turns the filtered voltage into numbers. A USB audio codec, an I2S codec or an SPI converter are the options; the choice, and with it the sample rate and bit depth, has not been made.
Raspberry Pi 5 Cuts the samples into 5 s windows, extracts features, runs the classifier and serves the web pages.
The bandpass response
A bandpass filter lets a range of frequencies through and weakens the rest. This chart shows how much of each frequency gets through a 20–600 Hz bandpass filter, as a gain in decibels (dB). It draws two versions: the analog design the electronics are meant to follow, and the digital software model that the simulated condition applies to the recordings.
Loading the filter design…
Why the low edge is 20 Hz
The first and second heart sounds (S1 and S2) have energy below 100 Hz, and the classifier uses them as timing landmarks to see the rhythm of the heartbeat. A higher low edge would cut them away, so 20 Hz is deliberate.
Why the high edge is 600 Hz
Murmur energy lies mainly between about 100 and 400 Hz, so 600 Hz keeps most of it with little attenuation. It also leaves headroom against aliasing (high frequencies folding down into the band when the signal is sampled), provided the converter samples fast enough; the sample rate is not decided yet.
Adding measurements
When the front end has been measured, the points can be drawn over the design curve. Create data/hardware/measured_response.csv with the header freq_hz,gain_db (or freq_hz,vout_over_vin, where a ratio is converted to dB with 20·log10) and one row per frequency, then reload this page. A row that cannot be read is reported with its line number.
Frequency axis Frequency in hertz on a logarithmic scale, from 5 Hz to 2 kHz. Each step to the right multiplies the frequency by the same factor, so 10 to 100 Hz takes as much room as 100 to 1000 Hz.
Gain axis Gain in decibels. 0 dB means the signal passes unchanged, −3 dB means half the power gets through, and −20 dB means the voltage is a tenth.
Analog design (design intent) The gain of an analog Butterworth bandpass with the same edges, the filter the electronics are meant to follow. Outside the band it keeps falling by 12 dB each time the frequency halves or doubles. It is computed by code, not measured from a circuit.
Simulated condition (digital, 4 kHz) The gain of the digital copy of the filter that the simulated condition applies to the recordings, computed at their 4 kHz sample rate. It matches the analog design up to about 600 Hz, then falls faster above about 1 kHz, because a digital filter has to reach zero gain at half the sample rate (2 kHz). It is a software model, not a measurement.
Passband The shaded 20–600 Hz range the filter is meant to pass. Almost everything the classifier uses lies inside it.
−3 dB corners The two frequencies where the gain has fallen to −3 dB, the usual definition of a filter's edges. On both curves they sit at the design values, 20 Hz and 600 Hz.
Measured points Gains the hardware team measured on the real front end, read from data/hardware/measured_response.csv. Compare them with the analog design curve. This item appears only when that file exists.
The test fixture
To test the whole chain without patients, every test recording is played through a fixture: a loudspeaker inside a 3D-printed coupler, a cast silicone layer that mimics skin on top of it, and the sensor on top of that. The sensor therefore hears sound that has crossed the coupler and the silicone before the electronics see it.
Why a phantom?
A phantom is a stand-in for a body. Patient testing is not possible and is out of scope. A phantom gives exact ground truth, because the dataset says whether each recording has a murmur, and it is repeatable: the same recording can be played again and again, which also shows how much two captures of the same file already differ.
The thickness and hardness of the silicone layer have not been decided yet.
3D-printed coupler A printed housing that holds the loudspeaker, the silicone layer and the sensor at fixed positions, so every test is arranged the same way.
Loudspeaker Plays a dataset recording as sound from inside the coupler.
Cast silicone layer Stands in for skin and tissue between the loudspeaker and the sensor. Its thickness and hardness are not decided yet.
Microphone Rests on top of the silicone and picks up the sound that has crossed it.
Photos and schematic
These slots fill with the hardware team's pictures. Put an image in hmi/static/img/hardware/ and reload; the slot is chosen by a word in the file name (schematic, breadboard or fixture).
hmi/static/img/hardware/.
hmi/static/img/hardware/.
hmi/static/img/hardware/.
Where to look in the code
pcg/simulate_chain.py—design_sos, the digital bandpass design shared by the simulated condition and the dashed curve above.pcg/explain.py—filter_response(both curves, digital and analog) andmeasured_response(reads the CSV).pcg/features.py—band_limit, which keeps 20–600 Hz of every window in software.hmi/app.py— the/api/info/filterroute, andhardware_slots, which sorts the pictures folder into the slots above.hmi/static/site-charts.js,hmi/static/hardware.js— draw the chart and its readout.data/hardware/measured_response.csv— measured points, not created yet.