# How to sample AC input?

I have to sample the output of a trasformer(stepdown), connected to the AC power line using arduino. The stepdown volatge 3-0-3 and I expect to get a sampling rate of atleast 4ksps. How can I achieve this?

I have to sample output of a 3-0-3 step down transformer using Arduino at a rate of 4ksps. But the problem is there is no reference ground for the input, How can I achieve this with maximum accuracy?

saravananm92:
I have to sample output of a 3-0-3 step down transformer using Arduino at a rate of 4ksps. But the problem is there is no reference ground for the input, How can I achieve this with maximum accuracy?

Transformers pass only AC not DC, so there is no need to have an electrical reference to the primary winding side of a transformer. One simply establishes a 'ground reference' from the secondary winding side of the transformer. However establishing such a reference for an arduino analog input requires additional circuitry to either offset the voltage or rectify the secondary voltage so that you insure that the arduino analog input pin 'sees' only a 0-5 VDC voltage, as above or below that electrical range will damage the input pin.

sample the voltage
sample the voltage again
sample the voltage again
et cetera

saravananm92:
I have to sample the output of a trasformer(stepdown), connected to the AC power line using arduino. The stepdown volatge 3-0-3 and I expect to get a sampling rate of atleast 4ksps. How can I achieve this?

You need a pair of resistors to cut down the voltage so it is less than 5V peak to peak. A 3-0-3 signal will give you an 8.5V peak to peak signal which will damage the arduino if you apply that.
Why do you want to sample so fast? A simple diode and capacitor will capture the peak voltage which is all you want.

Why do you want to sample so fast? A simple diode and capacitor will capture the peak voltage which is all you want.

I am trying to build a energy meter using arduino.So I need to get instantaneous samples of volatages and current.So as much samples I get the more accurate will be the power.

Actually my problem is not in sampling at the high rate, but about how to sample the input signal which does not have ground.

can you please suggest one such circuitry, I have searching alot in the internet but couldn't find one satisfiying.

Stop cross posting.
Only start a new thread when you have a new question.

So as much samples I get the more accurate will be the power.

No that is wrong.
Power is AC, so only the peak voltage is relevant, you only get a peak voltage every 10mS so sampling any faster than that is totally useless.

And you also need to consider system power factor since VA does not equal watts in AC circuits (unity PF excepted)
What is the purpose of the energy meter. Do you simply want power generated/consumed or are you requiring instantaneous power per millisecond. If the latter and you want to store the data, you'll be filling your memory like there is no tomorrow.

Actually my problem is not in sampling at the high rate, but about how to sample the input signal which does not have ground.

Just give it a ground reference by connecting one wire to the arduino ground. Remember to keep the voltage into the arduino below 5V, remember the difference between RMS and PTP when dealing with AC.

I am trying get something similar to this using Atmega 328.
http://www.atmel.in/Images/doc42039.pdf

If you see on page 7(about ADC) you can notice that system uses sampling rate of 2-4ksps.

And the equation for calculating is laid out on section 3.8.2(page 8).

Sorry for that was only trying to get more attention and answers. I had questions that were not answered by the forum before.

If you see on page 7(about ADC) you can notice that system uses sampling rate of 2-4ksps.

And do you understand why?
Using a peak detector is much more efficient.

Using a peak detector is much more efficient.

But is it accurate?

Can yo write the equation for calculating power from the peak values?

Mike knows best, listen to him.

Oh sorry if anyone felt I am arguing. I'm not,I just want to know why.
I know before his experience and knowledge I am nothing. I just wanted his precious guidance.

saravananm92:

Using a peak detector is much more efficient.

But is it accurate?

Yes, it is even more accurate than asynchronous sampling.

Can you write the equation for calculating power from the peak values

Yes just use that equation 3.1 and set N = 1

was only trying to get more attention and answers.

Cross-posting can attract entirely the wrong kind of attention.

DO NOT CROSS-POST, IT WASTES TIME.

``````DO NOT CROSS-POST, IT WASTES TIME.
``````

Sorry for that.

Mike, sorry for the late reply.

My doubt is that if we take only 2 samples/cycle. It can measure only the first harmonic.In the case of measuring current from a current sensor the the current is not a pure sine wave, it varies with the type of load connected, so the measurement will erroneous in the case of measuring the energy consumed by the non-linear devices. Please help me.