- #36
- 2,138
- 2,713
Forgive me, I should have given this link before:CWatters said:Line/mains voltage is too high to be connected directly to an Arduino. The ADC cannot measure voltages that high. Some sort of pre-scaler is required to bring the voltage into the range the Arduino can measure. Bit like setting the range dial on your multi meter.
One way is to use some sort of diode/resistor network to reduce the voltage but in the event of a fault the whole circuit could become "live" and dangerous.
Another method is to use a transformer to step down the mains voltage to something safer first (say 5 or 10v) then use a diode/resistor network to get it in range of the ADC. If the transformer is suitably insulated then it's very unlikely any part of your Arduino circuit could accidental become live.
To be honest... if you have to ask about necessary safety precautions such as these you probably shouldn't really be attempting it.
https://circuitdigest.com/microcontroller-projects/arduino-ac-voltmeter
My circuit is based on this but with slight variations. I will use a full-wave rectifier and some different values for the voltage divider resistors, and also a capacitor to get only the peak voltage. But the basic is same.