On Mon, 8 Feb 1999, Andres Tarzia wrote:
{Quote hidden}> Andre,
>
> I know that I have to get DC from AC.
>
> But I don't know whether to build a half-cycle rectifier, a full-cycle
> rectifier or not to rectify the AC altogether. Besides that, I am not sure
> about adding a capacitor to "smooth" the rectified AC or to repeatedly
> measure the rectified sine wave to get the "peak" (maximum) and then work on
> that...
>
> o-----/\/\/\/\---+-----------o
> R1 |
> \
> 115V AC R2 / To PIC
> \
> /
> |
> o--+-------------+-----------o
> |
> ---
> -
> .
Since no one has suggested, I'll | in...
If you add a "pull-up" resistor between the pic I/O pin and say +5V, then
you can add a DC offset and keep the signal from swinging below 0V. This
will allow you to sample the complete waveform to obtain a more accurate
RMS calculation.
However, if your voltage signal is fairly clean and you feel comfortable
capturing the peak and approximating the RMS voltage, then I'd suggest
building a circuit that would capture peaks in the range between low and
high line (typically + and - 15% of 115Vrms) and scale that to a 0 to 5V
range for the A/D converter. Might as well use the A/D resolution only
where it's needed.