Hey Arduino forum!
I'm currently designing an AC voltage sensor that'll eventually be used to calculate voltage harmonics via FFT for use in a power quality analyzer. I attached my circuit schematic built up in Multisim. The gist of the circuit is I'm passing the AC voltage through a voltage divider, and then having the AC ground referenced to 2.5V through a voltage buffer so that the voltage could be read safely by the Arduino. This worked swimmingly when there was no load. However, when I connected a test parallel RLC load, it appears that my voltage buffer now has a transient, and slowly increases from 0V to 2.5V. I have also attached an oscilloscope snapshot of this transient. Do you guys have any ideas on why this is happening?
EDIT: I should mention that the pink trace on the scope is what should have been the 2.5V output of the voltage buffer
EDIT2: Sorry for editing this post again, I figured the problem was somehow related to the time constant for charging the capacitor at the voltage buffer side, and reducing the capacitance from 10uF to 10nF sorted out that problem for me. My only concern now is if this was simply a band-aid solution and not a proper fix, and if changing the load would impact the time constant again.
From the gist of it you should first pay your life insurance and be sure it has double indemnity for accidents, you can name me as a beneficiary. The "Pink" trace is doing exactly what is expected. The op amp is configured as a unity gain buffer as you stated. The VCC is divided to 2.5 Volts by R3 and R4, this then charges C! slowly to 2.5 Volts as expected. MOST IMPORTANT Use Isolation transformers for the Mains. You need a AC to DC converter, you can design or purchase one. What are you actually measuring, Peak, RMS, Peak to Peak? RMS gets very tricky and is waveform dependent, it also defines your converter. If you make your own AC to DC converter, try this calculator for the capacitors you will need: Capacitor charge and discharge calculator | MustCalculate
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil
Haha don't worry, I'm not about to mess around with mains without protection. I am using an isolation transformer which steps down mains to 10Vp, which was why I had a 7.07Vrms source in my schematic. When I put the capacitor in, I only intended for it to be a low impedance path to couple AC ground with the Arduino ground, and completely forgot about its charging time period which was why I was confused in the first place. In terms of what I plan on doing though, I intend to sample the voltage waveform to use in FFT, and use that to find out the voltage THD in the system.
Thank you for your response 