I was wondering if I could measure AC mains voltage with Arduino.
The design uses a transformer to transform from 230 VAC to 12 VAC. Then the voltage is stepped down by the resistors. Arduino measures the voltage over the 10k resistor.
I saw a couple of posts that used diodes + capacitors to rectify the AC after transforming it down, but I saw another post that made the Arduino take a sample over a period of time and take the highest value.
Which way is better?
When I look at the graph of the Arduino pin in the program I still see a negative voltage (-350mV) will the Analog pin survive that?
I'm testing a device that has 230 V passthrough. To test the connection, I wanted to measure the voltage from the output connector on the device.
I designed the circuit below with the help of the answer below and this site: https://learn.openenergymonitor.org/electricity-monitoring/voltage-sensing/measuring-voltage-with-an-acac-power-adapter?redirected=true
With the chosen resistor values the voltage will always be between 0-5 V, so I can take samples of the analog pin and get the highest value in software.
As Ferrybig rightly commented the voltages are still too high/low for the Arduino pin, I entered the amplitude wrong on the voltage supply. I adjusted the resistances to be 22k/22k/3k/6.8k from 22k/22k/12k/12k (not pictured)