Lawrence Lile wrote: >I'm sampling a DC voltage with lots O noise. I've set up a routine that takes a sample, waits a few milliseconds, then takes another sample, etc. When 15 samples are taken, it takes the median of the samples as the result. Still get false alarms due to noise pulses every once in a while. > >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. > Sounds like you are taking way too few samples here. Also, remember that you will only get the "correct" DC value of a periodic waveform if the total sampling time is an "exact" multiple of the waveform period. If you get something like the following, your average will be off: x x x x x x x x x x----------x-----------x---------- x x x x x The last four samples are going to skew the result here. It would seem a good way to compensate for this problem would be to take a lot of samples, and as many per period as possible, then the endpoint discontinuities will have less effect. Some sort of h.w. low-pass filtering might also help. regards, - dan michaels =============== -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu