From: gpezzella on
Hello

this is the first time that I approach to DSP so I'm really newbie.
I have to write a program that realize a Low Pass Filter at 50 Hz.

My processor (ATTINY) have 10bit ADC so for first time I have used
Oversampling and Decimation technique for add 3 "Virtual Bit"

First Question:
Since my Oversampled Frequency is:

4^3 * F-nyquist = 64 * 100 = 6.4KHz

Taking sample at this precise rate I obtain directly a signal already
filtered at 50Hz??

The maximum sample rate of ATTiny is about 15KHz
Is Better take sample at this rate and after filter a signal with a DSP
Filter?

In this last case can you explane me how to write 50Hz Low Pass Filter?

Thanks




From: Tim Wescott on
On 06/17/2010 02:23 PM, gpezzella wrote:
> Hello
>
> this is the first time that I approach to DSP so I'm really newbie.
> I have to write a program that realize a Low Pass Filter at 50 Hz.
>
> My processor (ATTINY) have 10bit ADC so for first time I have used
> Oversampling and Decimation technique for add 3 "Virtual Bit"
>
> First Question:
> Since my Oversampled Frequency is:
>
> 4^3 * F-nyquist = 64 * 100 = 6.4KHz
>
> Taking sample at this precise rate I obtain directly a signal already
> filtered at 50Hz??

Not unless the processor does it for you, which I doubt.

> The maximum sample rate of ATTiny is about 15KHz
> Is Better take sample at this rate and after filter a signal with a DSP
> Filter?

From what perspective? It's more work for the processor, does it have
the bandwidth to spare? Assuming plenty of processor resources, faster
sampling is generally better.

> In this last case can you explane me how to write 50Hz Low Pass Filter?

Hit the books! Is this for school? If so, ask the prof. If it's for
work, or if it's project work, look on Wikipedia, and do some web
searches. You need to know if you want to use an IIR or FIR filter (web
searches will tell you what those are, and give some guidance of why one
or the other will be good), whether you want to decimate (web search), etc.

If you come up with more questions as you go along, ask.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
From: gpezzella on
Hello

I will try to explane better and if there are errors, please correct me.

My goal is to acquire very low frequency and voltage signal (5Hz-50Hz 1mV
-2mV) with 10bit DAC.

I have Voltage Reference = 1.1Volt that give me at 10bit 1mV resolution.
So for first thing I have add 3 virtual bit for increase resolution by
using Oversampling and Decimation Technique:

'F-cut = 50Hz
'F-nyquist = 100Hz
'Virtual Bit = 3
'Scale Factor 2^Virtual_Bit = 2^3 = 8
'F-oversampling = ( 4^3 ) * 100 Hz = 64 * 100 = 6400 Hz.

Since I can set only FIX Sample Rate at 9.8 KHz is correct that my real
f-cut will be 76Hz and not 50Hz?


NOW FILTER

I have read that FIR sync filter sen(x) / x is good low pass filter.
Is correct that:

1) My "Virtual Sample Rate" is 152 HZ and hence Filter f-cut = [0 - 0.5] *
152


For last
2) Since I have very few memory on micro, how I must choose M value?

Please do not reply vaguely but use number and value.

Thanks


p.s.
This is the tutorial that I'm reading: http://www.dspguide.com/ch16/2.htm





>On 06/17/2010 02:23 PM, gpezzella wrote:
>> Hello
>>
>> this is the first time that I approach to DSP so I'm really newbie.
>> I have to write a program that realize a Low Pass Filter at 50 Hz.
>>
>> My processor (ATTINY) have 10bit ADC so for first time I have used
>> Oversampling and Decimation technique for add 3 "Virtual Bit"
>>
>> First Question:
>> Since my Oversampled Frequency is:
>>
>> 4^3 * F-nyquist = 64 * 100 = 6.4KHz
>>
>> Taking sample at this precise rate I obtain directly a signal already
>> filtered at 50Hz??
>
>Not unless the processor does it for you, which I doubt.
>
>> The maximum sample rate of ATTiny is about 15KHz
>> Is Better take sample at this rate and after filter a signal with a DSP
>> Filter?
>
> From what perspective? It's more work for the processor, does it have
>the bandwidth to spare? Assuming plenty of processor resources, faster
>sampling is generally better.
>
>> In this last case can you explane me how to write 50Hz Low Pass Filter?
>
>Hit the books! Is this for school? If so, ask the prof. If it's for
>work, or if it's project work, look on Wikipedia, and do some web
>searches. You need to know if you want to use an IIR or FIR filter (web
>searches will tell you what those are, and give some guidance of why one
>or the other will be good), whether you want to decimate (web search),
etc.
>
>If you come up with more questions as you go along, ask.
>
>--
>Tim Wescott
>Control system and signal processing consulting
>www.wescottdesign.com
>
From: Tauno Voipio on
On 18.6.10 2:04 , gpezzella wrote:
> Hello
>
> I will try to explane better and if there are errors, please correct me.
>
> My goal is to acquire very low frequency and voltage signal (5Hz-50Hz 1mV
> -2mV) with 10bit DAC.
>

EKG/ECG/EEG signal?

Please note that the built-in A/D converters of small processors
(like ATTiny) are far too noisy for this kind of work. If you have
biological signals, you need a proper pre-amplifier, and you were
much better off with a separate A/D converter.

--

Tauno Voipio, MSEE
From: Jerry Avins on
On 6/18/2010 7:04 AM, gpezzella wrote:

>> On 06/17/2010 02:23 PM, gpezzella wrote:
>>> Hello
>>>
>>> this is the first time that I approach to DSP so I'm really newbie.
>>> I have to write a program that realize a Low Pass Filter at 50 Hz.
>>>
>>> My processor (ATTINY) have 10bit ADC so for first time I have used
>>> Oversampling and Decimation technique for add 3 "Virtual Bit"
>>>
>>> First Question:
>>> Since my Oversampled Frequency is:
>>>
>>> 4^3 * F-nyquist = 64 * 100 = 6.4KHz
>>>
>>> Taking sample at this precise rate I obtain directly a signal already
>>> filtered at 50Hz??
>>
>> Not unless the processor does it for you, which I doubt.
>>
>>> The maximum sample rate of ATTiny is about 15KHz
>>> Is Better take sample at this rate and after filter a signal with a DSP
>>> Filter?
>>
>> From what perspective? It's more work for the processor, does it have
>> the bandwidth to spare? Assuming plenty of processor resources, faster
>> sampling is generally better.
>>
>>> In this last case can you explane me how to write 50Hz Low Pass Filter?
>>
>> Hit the books! Is this for school? If so, ask the prof. If it's for
>> work, or if it's project work, look on Wikipedia, and do some web
>> searches. You need to know if you want to use an IIR or FIR filter (web
>> searches will tell you what those are, and give some guidance of why one
>> or the other will be good), whether you want to decimate (web search),
> etc.
>>
>> If you come up with more questions as you go along, ask.
>>
>> --
>> Tim Wescott
>> Control system and signal processing consulting
>> www.wescottdesign.com
>>
> Hello
>
> I will try to explane better and if there are errors, please correct
> me.
> My goal is to acquire very low frequency and voltage signal (5Hz-50Hz
> 1mV -2mV) with 10bit DAC.
>
> I have Voltage Reference = 1.1Volt that give me at 10bit 1mV
> resolution.
> So for first thing I have add 3 virtual bit for increase resolution by
> using Oversampling and Decimation Technique:
>
> 'F-cut = 50Hz
> 'F-nyquist = 100Hz
> 'Virtual Bit = 3
> 'Scale Factor 2^Virtual_Bit = 2^3 = 8
> 'F-oversampling = ( 4^3 ) * 100 Hz = 64 * 100 = 6400 Hz.
>
> Since I can set only FIX Sample Rate at 9.8 KHz is correct that my
> real f-cut will be 76Hz and not 50Hz?

Not correct. You must sample *at least* twice as fast as the data's
bandwidth. In other words, the cut-off frequency should be *no more*
than half the sample rate. Actually, one third is good practice.

> NOW FILTER
>
> I have read that FIR sync filter sen(x) / x is good low pass filter.
> Is correct that:

Good for what? A truck is a good vehicle; so is a bicycle.

> 1) My "Virtual Sample Rate" is 152 HZ and hence Filter f-cut = [0 -
> 0.5] * 152

What is virtual sample rate? The reference you cite below deals with
windowed-sinc filters, not resolution or accuracy.

> For last
> 2) Since I have very few memory on micro, how I must choose M value?
>
> Please do not reply vaguely but use number and value.
>
> Thanks
>
>
> p.s.
> This is the tutorial that I'm reading: http://www.dspguide.com/ch16/2.htm


This isn't going to work. Other conditions being met, the precision
gained by averaging increases with the square root of the number of
measurements. To increase the precision eight times (three bits worth)
you need to average 64 (8^2) measurements. Even at that rate, it
probably won't work on your processor. To get 13-bit results from a
10-bit ADC, the converter needs to slice accurately to 13 bits
thresholds. Any converter on a processor chip is most unlikely to be
that good. If the spec sheet doesn't say it is, it isn't. There are
other considerations, but one thing at a time.

Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������