How to measure AC line frequency from mains

In summary: Then R4 and R5 can be 1/10 or even 1/100 of what they are now. They take too much current from the source. Make them 1M and 10M.You could check the voltage at the output of the LM193 before you connect it to the Arduino, to see if it is within 0 and Vcc-0.5V.In summary, the conversation discusses ways to measure the frequency of a main supply of 240V for a smart meter project. Suggestions include using a transformer and digitizing the voltage, using a zero crossing detector, or measuring the mains frequency in real time. It is also suggested to use a comparator and a voltage divider to get a more accurate
  • #1
kriscpm
3
0
Hi all,

I would like to ask for suggestions on how to measure the frequency from my main supply which is 240V? As i know the frequency varies very little, hence i would like to measure it as accurate as possible.

The reason for this is because I'm doing a smart meter project with Arduino Mega 2560. I've researched and I saw people using LM2917 or comparator or AN795. However, I am not so sure on how to connect them from the main supply. As i know, I need to step down the voltage from 240V to 6V. I have no ideas after that.

Suggestion are much appreciated.
Thanks!
 
Engineering news on Phys.org
  • #2
Why do you need such a precise measurement?
A transformer can give you low voltage with the same frequency, add something to digitize the voltage and compare its frequency with clock cycles of your microcontroller.
 
  • #3
You seem to be having difficulty with getting pulses from the 6V AC. Look up zero crossing detector on google.

Once you have pulses you can do any of several things, depending on the accuracy you need. You can count pulses for a fixed period and do division, or you can use the TC9400 and an A/D converter as explained in AN795.

The simplest is to count pulses, and just make the period as long as you need for the accuracy you want. But, sometimes you want faster results and there are tricky ways to do that. But, more accuracy always requires more time for any given method.

If you decide to use the TC9400 I think you just need a voltage divider (check the data sheet)
 
Last edited:
  • #4
Depending on your country, you may be able to get the mains frequency measurements in real time, more accurately than you can easily measure them yourself. Note that the frequency is adjusted so its long term average is "exactly" 50 or 60 Hz depending on your country, and at any time the cumulative deviation from the average is unlikely to be more than a few seconds either way.

See http://en.wikipedia.org/wiki/Utility_frequency#Long-term_stability_and_clock_synchronization

For example http://www.mainsfrequency.com/ shows the real time data for Europe.
 
  • #5
If i convert the AC signal to a square wave, then i can use Arduino to capture the rising pulse in order to count the frequency. Is this way correct and accurate? I have run the simulation and the result is as attached. Please correct me if I'm wrong.
 

Attachments

  • schematic.jpg
    schematic.jpg
    20.5 KB · Views: 935
  • schematic results.png
    schematic results.png
    15.9 KB · Views: 890
  • #6
That is certainly possible. I don't know the resolution you can get, but the edges look good.
 
  • #7
The 741 is not really a good choice to use as a comparator since the voltage out goes from -V to +V. You will find that digital circuits downstream do not want to see voltages lower than ground. (typically Vss - 0.3).

Use a comparator which, with a pullup usually, will give a voltage between 0 and +V (or whatever is on the pullup).

Accuracy will depend on how long you count. Count for any abitrary 1 second and you get 60 +- 1. Count for 1 minute and you get 3600 +- 1.
 
  • #8
meBigGuy said:
The 741 is not really a good choice to use as a comparator since the voltage out goes from -V to +V. You will find that digital circuits downstream do not want to see voltages lower than ground. (typically Vss - 0.3).
Add a resistor and a diode...

Accuracy will depend on how long you count. Count for any abitrary 1 second and you get 60 +- 1. Count for 1 minute and you get 3600 +- 1.
If you measure the time of the edges, you can get a better resolution.
 
  • #9
mfb is right in both cases. Technically the diode is out of spec at -0.7 volts or so, but it generally isn't an issue.

The 741 will have very slow edges compared to a comparator, but that might not be an issue for you. Could result in some jitter.
 
  • #10
meBigGuy said:
mfb is right in both cases. Technically the diode is out of spec at -0.7 volts or so, but it generally isn't an issue.

The 741 will have very slow edges compared to a comparator, but that might not be an issue for you. Could result in some jitter.

Will it help more if i use a LM193 Comparator?

I have corrected my schematic where i put a ground on V- instead of -5V. With this, there will not be anymore negative voltage. Does this help to avoid my Arduino from being damaged?
 
  • #11
It is possible to measure the mains frequency and get very accurate results, but it may take more than an Arduino to do it.

You would divide the mains frequency by 100 to give a 0.5 Hz symmetrical (50% duty cycle) square wave. This gives an approximately 1 second pulse which can be used to control a logic gate.

After that, you can count the number of pulses of a known frequency input (say 1 MHz ) are passed through by the logic gate.

Suppose you got a reading of 997654 pulses. This would mean the gating pulse was actually 0.997654 seconds and the mains period was 50 times this.
So the frequency would be 50.11757 Hz.

Depending on the speed of the Arduino, you may be able to apply this technique at a lower frequency and still get good results.
 
  • #12
See http://letsmakerobots.com/node/28278 for how to use the Arduino timers. This is definitely the correct approach.

The arduino runs at 16MHz and has an input capture register that can record a timestamp for an external event and notify you to go read it. You can measure for as long as you want and then average, or produce a running average, or whatever.

Timer Input Capture:
When a timer input capture interrupt occurs, the input capture flag bit ICFx will be set in the interrupt flag register TIFRx. When the input capture interrupt enable bit ICIEx in the interrupt mask register TIMSKx is set, the timer input capture interrupt service routine ISR(TIMERx_CAPT_vect) will be called.
 
  • #13
Put a blocking diode between the output and R4.
 

FAQ: How to measure AC line frequency from mains

How can I measure AC line frequency from mains?

To measure AC line frequency from mains, you will need a frequency meter or a multimeter with a frequency measurement function. Make sure to follow the manufacturer's instructions for proper use.

What is the standard frequency of AC mains?

The standard frequency of AC mains varies by country, but in most countries it is either 50 Hz or 60 Hz. In the United States, the standard frequency is 60 Hz, while in Europe it is 50 Hz.

Can I measure AC line frequency from mains without specialized equipment?

Yes, you can estimate the AC line frequency from mains by using a stopwatch or clock with a second hand. Count the number of cycles in one minute and divide by 60 to get the frequency in Hz. However, this method may not be as accurate as using specialized equipment.

How do I interpret the frequency measurement from mains?

The frequency measurement from mains is typically displayed in Hertz (Hz), which represents the number of cycles per second. For example, a frequency of 50 Hz means there are 50 cycles per second. The higher the frequency, the faster the alternating current is changing direction.

Why is it important to measure AC line frequency from mains?

Measuring AC line frequency from mains is important for ensuring the proper functioning of electrical equipment and appliances. Deviations from the standard frequency can cause damage or malfunction in devices that rely on precise frequency, such as clocks and timers. It is also important for electrical grid management and determining energy usage.

Similar threads

Replies
5
Views
4K
Replies
6
Views
3K
Replies
5
Views
2K
Replies
79
Views
4K
Replies
5
Views
3K
Replies
7
Views
3K
Back
Top