Dario Greggio wrote: > so, now assuming that I will re-do the pcbs :)) I think clever firmware can figure out the voltage with what you've got. It's not how I would have done it, but it should still be possible. You do however have to change the silicon diode to a Schottky. > you suggest I still use the max-min approach? No, not with the half wave rectified method. If you make the assumption the input is nearly a sine, then you can get away with measuring only the peaks. There are various things you can do to get successively more clever, depending on what performance you really need. First approximation is simply finding the peak of each period, and low pass filtering those a little. The theoretical error due to missing the peak is about 1.2%, which is well under your 5% spec, so maybe you can stop there. If you're worried about spikes and other noise messing up the peak measurements, you can apply just a little low pass filtering and then look for the peaks. The next step is to do third order approximation on the three nearest samples to the peak to find the true peak. Such a small part of a sine can be approximated quite well with a 3rd order polynomial, so the 1.2% error will pretty much vanish. It depends on what characteristics you care about and how much programming and CPU time you are willing to spend on it. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist