University project - Electronic Stethoscope

Hey guys! Im new to the world of programming. My university project is an electronic Stethoscope, that displays BPM from audio alone.
I have recently acquired a FEZ cerbuino Bee, and have completed the hardware side. I need to implement a program that reads the analogue pin A0, performs an fft and displays the graph in Visual studio (i didnt have enough of a budget to buy a gadgeteer LCD).

Could I have some guidance please? im stuggling to make this work :frowning:

Here is some FFT done in RLP:

http://www.tinyclr.com/codeshare/search?q=fft

I would use serial module as @ patc suggested.

If all you’re doing is heartbeat counting, you probably don’t even need an FFT. You can probably measure signal power or energy and determine if it’s a heartbeat from that. Probably no need to decompose the signal into its frequency components unless you’re doing something really fancy.

Or if you really need FFT you can do it on PC side as well. So your Cerbuino will just serve measured values to the PC side.

Great feedback guys, many thanks!
Unfortunately I cannot afford that gadgeteer module, the uni is very strict that everyone has the same budget to spend. it does look appealing though :slight_smile:

You raise an interesting point iggmoe, it may well be feasible to just count peak amplitude, but the problem that arises is that breathing is quite audible in a chest cavity, i would need a way to differentiate lung from heart sounds, and the frequency spectrum of each is different, hence why i thought an fft?

Your idea of sending the values to excel and having it plot them appeals to me a great deal, that way the computing power of my laptop is used, and the cerbuino is merely a medium from hardware to laptop. How would i go about actually computing an fft, and sending the variables to excel? or ought i do the fft within excel and not visual studio?

@ ks09aao - what freq ranges do you need? I have a audio spectrum module that might work…

I believe a range from 40 to 500Hz ought to be sufficient to isolate heart sounds alone

My module has 2 MSEQ7 chips and breaks the audio into left and right at 63Hz, 160Hz, 400Hz, 1kHz, 2.5kHz, 6.25kHz and 16kHz

Hmmm, bandpass filtering your signal in hardware should make your software development easier. Once the signal is filtered, signal power/energy should get you heartbeats, I think. And if you absolutely have to do an FFT, doing it on the PC side should be easier than on the microcontroller side, since the full .NET framework already has support for complex numbers and such.

when you say breaks, are those ranges of specific frequencies that are isolated?

yes the module returns peak values in each of those seven bands for both L + R so you get an array of 14 ints

Here’s a WIP video… http://www.tinyclr.com/forum/topic?id=10399

I have, in hardware, implemented a low pass filter to cut-off the excess signals, and an amplifier to get enough amplitude to be detected by the fez processor. When attaching a n oscilloscope to the output from my system, i can quite clearly see the peaks that occur when my heart beats.

A crude but acceptable alternate would be to simply display the analogue output on the computer screen, much like the oscilloscope does?a doctor could use that to count teh peaks for bpm, and diagnose heart murmurs. Or am i underestimating the difficulty of such a task?

Sounds simple enough…

And wow justin that looks impressive! Yes, if I could see your code thatd be fantastic, with no budget left to spend I must provide the ouput on my laptop, in one form or the other

@ ks09aao - it’s given me an idea to show off a couple of modules…whats our time frame?
I can happily give you the code but without the modules it would be useless…
But as i said, i have a cunning plan…
shoot me an email justin at ingenuitymicro dot com

@ ks09aao - Out of curiosity, what was the budget you were given? Kinda interesting to see how much a university thinks a project like this should cost.

There is also this guy:

http://code.google.com/p/serialchart/

my budget was 45 pounds, the vast majority of which went on the processor and stethoscope im afraid, my supervisor insisted I get very specific ones!
Left me very little left to play with, Id have liked an LCD screen for an ouput and cut out the laptop altogether

@ Architect - neat project, cheers for the linkie

@ ks09aao - That sounds kinda stingy!