Edward Cooper wrote: > that subject isn't very informative! My problem is that I'm using the > PWM output to control the rate of charge of some batteries and I'm > monitoring the current into the batteries by measuring the voltage > across a 1/2 Ohm resistor is series with the batts, the problem is the > PWM output is controlling the current by high speed switching and is > interfering greatly with the numbers on the A2D input, I've tried > basically filtering it out using diodes and caps but it doesn't work > well and I have to use a long median average routine from many samples > to get half decent numbers for the current flow. > > So any idea what basic circuit I can build that will be best to filter > this 'noise' from my a2d samples :) Synchronous sampling can do a lot for you if the noise is periodic. The "noise" is still there, but it has the same value for every sample and can be compensated for. In other words, take your A/D samples at a rate that's locked to the PWM carrier frequency. Better yet, take them at a fixed point relative to the PWM cycle. For example, if you take the reading right before the current switching element turns off, you should get a fairly accurate measurement of the peak charging current. You can then massage this, knowing the PWM duty cycle, to get the average current you probably want to end up with. Many DMMs take samples at 10 Hz because this rate is synchronous to both 50 Hz and 60 Hz power lines, eliminating most of the jitter associated with "hum". -- Dave Tweed -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body