You mean a software filter? Got any slick ways of performing this = trick? ----- Original Message -----=20 From: Olin Lathrop=20 To: Lawrence Lile=20 Sent: Tuesday, November 07, 2000 9:43 AM Subject: Re: [PIC]: The tintinnabulation of the noise >> Now, I am not real sure if I will have 60 hz noise (picked up from the = air) or 120 hz noise (from a full wave rectified power supply) as the major = noise component. It may actually be both, at various times. Does Old Nyquist rule in this situation, should I sample at twice 120 = hz or more to cancel out the effects of noise? I'm not interested in the frequency of the signal at all, just in an accurate DC level. Let's see: 120 hz =3D 8.33 milliseconds per oscillation. If I sample = at twice this, that's 4.33 milliseconds. sampling at exactly twice is cutting = it fine, so say we sample at four times that's ~2 milliseconds. I've got enough memory to increase the number of samples, maybe that = will help as well? << I would recommend a different approach. Sample as fast as you = possibly can, then run the result thru a one or two pole low pass filter. You only = need to store one number per pole, not one number per sample in the = average. This type of filter (gaussian) is better at squashing high frequencies = than the box filter you described, requires less state, and is generally = easier to implement. The main drawback is the slower response, which sounds = like can be much slower than 60Hz from your description. Make the time = constant as long as you can tolerate to maximize the random noise reduction. = It seems I end up doing at least a single pole filter in 90% of the = projects that measure an analog voltage. The trick is to make the filter = fraction a power of 2 so that it can be done with bit shifting, and the rest is = real easy. ***************************************************************** Olin Lathrop, embedded systems consultant in Devens Massachusetts (978) 772-3129, olin@cognivis.com, http://www.cognivis.com -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu