How to measure AC voltage with single chip microcomputer?

1. Attenuates the input voltage by a certain multiple, that is, within the range of 0-5V. The attenuation circuit adopts RC attenuator, that is, RC is connected in parallel first and then in series. Select the appropriate r and c parameters.

2. Set the voltage following circuit. As long as this circuit is buffered and isolated, it can be guaranteed that the following circuit will not affect the voltage in front. The magnification of the voltage following circuit is always less than or close to 1 times.

3. If there is a negative voltage, it is necessary to use an operational amplifier circuit for bias processing (generally using an addition circuit) to make all voltages above 0V, that is, to become a positive voltage of 0-5V.

4. Send the processed voltage to ADC for sampling (the accuracy of ADC needs attention! ), the single chip microcomputer uses the data sampled by ADC to calculate the frequency and amplitude of the fundamental wave of alternating current, so that the waveform of this alternating voltage can be measured and the voltage can be calculated.