Exact match. Not showing close matches.
'[EE] FIR filter on PIC32 for ECG'
I've been looking into various types of filters (active, passive, digital),
and wanted to give a digital filter a try.
I have a 3 electrode (+, -, ref) ECG hooked up to an LT1168 instrumentation
amplifier. There is a lowpass passive filter on the breadboard blocking out
all high frequency noise (can't remember the cutoff frequency I chose, but
it was something reasonable, maybe 150 Hz or so). There is the problem of a
60Hz signal going through the entire heartbeat signal. The output is
beautiful, but I would like to clean it up to the best of my abilities. I
COULD make an active filter (Butterworth or something), but I dislike the
phase characteristics. Since I'm going to be using an ADC, feeding it into a
microcontroller, and transmitting it to a screen of some sort, I figured I
could implement an FIR filter on the PIC32. I would think the PIC32 running
at 80 MHz is more than fast enough to filter a sub 200 Hz signal.
The main purpose is to first eliminate the 60Hz signal, then test, then see
what else I could get rid of.
What do you guys think
V G wrote:
> The main purpose is to first eliminate the 60Hz signal, then test,
> then see what else I could get rid of.
Trying to get rid of 60Hz is probably not a good idea since your signal
contains valid frequencies in that range. For example, if the fundamental
(the heart rate) was close to 60Hz, the result could be a very strange
It is far better to eliminate as much of the 60Hz as possible as early in
the analog chain as possible. Most will be common mode, and keeping it from
turning into differential mode will give you better results than trying to
get rid of it later.
Even if you do want to try removing 60Hz after the fact, a FIR filter is not
appropriate for that. FIR filters can do lots of cool things, all with the
same algorithm, just different kernel functions. However, their required
width goes up with the frequency discrimination. If you want to filter out
a narrow band around 60Hz, then you'll need a wide filter.
A better approach for 60Hz noise reduction is to use the fact that the noise
is exactly 60Hz. You could convolve the signal with a 60Hz sine and cosine
to determine the average 60Hz amplitude and phase over some segment of
signal, then subtract off a 60Hz sine with its phase and amplitude adjusted
As for a PIC 32, it probably can do meaningful FIR filters on 150Hz data.
However, a PIC 32 is not a DSP whereas a PIC 33 is. A PIC 32 may run
faster, but probably uses more time per point in the end than a PIC 33 does
with it's multiply-accumulate capability meant for exactly this kind of
problem. The PIC 33 can do successive points of a convolution in successive
cycles. It does the multiply, add, updating pointers to the next data words
with possible wrapping, and loop termination all in one instruction cycle.
A PIC 33 can run at up to 40MHz instruction rate. Let's say your data
sample rate is 500Hz. 40MHz / 500Hz = 80K, which is the maximum width
convolution it could perform every data point. That's way more than you
need, and certainly more than you have storage for anyway. You could do a
2000 point convolution at 500Hz and use up about 2.5% of the processor.
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014. Gold level PIC consultants since 2000
Peter Feucht <wrote:
>>For example, if the fundamental (the heart rate) was close to 60Hz, the
> result could be a very strange waveform.
> A heart rate of 60Hz? In that case you no longer need any ECG analysis.....
Important are details within the cycle. At 5Hz rate you won't get
needed resolution with 60Hz filter
>> I COULD make an active filter (Butterworth or something), but I dislike the
>> phase characteristics.
A digital filter and an Analog filter are only as good at best as the
algorithm they implement.
If you don't like a Butterworth in analog you won't like it in digital.
If you want maximally constant phases delay you need to implement a
Bessel filter (which is maximally constant phase by definition, with
less performance in other areas such as passband edge cutoff rate).
("At a distance" they all look the same).
An advantage and a "danger" with digital filters is that you can hack
around with parameters to try and make it do what you want. You can -
but what you ware usually doing is wandering to & fro across
'solution-space" already well described by classical solutions.
Knowing that there are formal solution that meet certain needs (choose
any one) is a good first start.
Peter Feucht wrote:
> I know.
> Max. frequency under stress conditions can be assumed with 210/Minute =
> about 3,5Hz.
> All this for humans.
Max. frequency under medicine can be higher, even without stress
conditions, I know
I think we're talking about the maximum slope of the big spike and how
it can immitate that of higher frequencies, even though the spike
occurs every second or so. It may be a sharp spike an not sinusoidal
On Sunday, March 6, 2011, N. T. <gmail.com> wrote: ntypesemi
More... (looser matching)
- Last day of these posts
- In 2011
, 2012 only
- New search...