Forums

Effect of Reducing Gain During a Sample

Started by Unknown March 18, 2007
Hello All,

I have used a crude auto-gain feature on a PIC processor that is
running a Goertzel algorithm to decide whether frequencies are present
or not. Currently, I start a collection of N samples. If the value
approaches 255 (that at which clipping will begin) I reduce the gain
on the input, clear the sample and start again. This is done until a
'clean' sample is collected.

I would like to start using a ring buffer to hold the samples and be
able to access a variety of 'groups' of samples within the buffer
depending on whether there is reason to look deeper at the time period
of interest. The problem is, is that the signal can change in
amplitude during the ongoing collection and require a reduction in the
gain... just as above. How detrimental is altering the gain during the
sample and are there any ways around this?

Thanks,

John

jecottrell65@gmail.com wrote:

> Hello All, > > I have used a crude auto-gain feature on a PIC processor that is > running a Goertzel algorithm to decide whether frequencies are present > or not. Currently, I start a collection of N samples. If the value > approaches 255 (that at which clipping will begin) I reduce the gain > on the input, clear the sample and start again. This is done until a > 'clean' sample is collected. > > I would like to start using a ring buffer to hold the samples and be > able to access a variety of 'groups' of samples within the buffer > depending on whether there is reason to look deeper at the time period > of interest. The problem is, is that the signal can change in > amplitude during the ongoing collection and require a reduction in the > gain... just as above. How detrimental is altering the gain during the > sample and are there any ways around this? > > Thanks, > > John >
Altering the gain during sampling is a multiplication in time, and as such you'll be convolving the received signal's spectrum with the gain's. Given what you're doing what you'll see is the received signal's spectrum will spread more or less proportionally to how fast and how far you drop the gain. How detrimental this will be depends on how much you spread the received signal's spectrum, and how much that spreading matters to your application. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/ "Applied Control Theory for Embedded Systems" came out in April. See details at http://www.wescottdesign.com/actfes/actfes.html
jecottrell65@gmail.com wrote:

> I have used a crude auto-gain feature on a PIC processor that is > running a Goertzel algorithm to decide whether frequencies are present > or not. Currently, I start a collection of N samples. If the value > approaches 255 (that at which clipping will begin) I reduce the gain > on the input, clear the sample and start again. This is done until a > 'clean' sample is collected. > > I would like to start using a ring buffer to hold the samples and be > able to access a variety of 'groups' of samples within the buffer > depending on whether there is reason to look deeper at the time period > of interest. The problem is, is that the signal can change in > amplitude during the ongoing collection and require a reduction in the > gain... just as above. How detrimental is altering the gain during the > sample and are there any ways around this?
What about storing the gain factor together with each sample value in the ring buffer? bye Andreas -- Andreas H�nnebeck | email: acmh@gmx.de ----- privat ---- | www : http://www.huennebeck-online.de Fax/Anrufbeantworter: 0721/151-284301 GPG-Key: http://www.huennebeck-online.de/public_keys/andreas.asc PGP-Key: http://www.huennebeck-online.de/public_keys/pgp_andreas.asc
Tim,

Thanks for the explanation.


Andreas,

> What about storing the gain factor together with each sample value in the ring buffer?
A similar thought had crossed my mind after Tim's response. The sampled values are 10bit ADC values being stored in 16bit variables, so there is plenty of room for scaling the values. Thanks a bunch guys, that will get me started, John