Mains frequency/grid monitor

Showcase your projects! We love to see what people come up with, so please share your creations here.
Post Reply
Things
Posts: 36
Joined: Mon Aug 26, 2013 3:47 pm
Location: Cairns, Australia
Contact:

Mains frequency/grid monitor

Post by Things » Mon Aug 26, 2013 4:03 pm

This may not sound like a particularly impressive project, though once you understand some of the details of it, it's really quite interesting.

Ever wished you could detect blackouts and brownouts before they actually happen? Well, you can, and all from any standard mains outlet in your house!

So what does it actually do, and why is it useful?

Well, to understand that, you need to think a bit into the infrastructure of your typical power grid. This device is able to monitor frequency down to surprisingly low fluctuations, which you can then log to a computer, or just display on a simple volt/current meter.

At the heart of all power grids are generators, which must spin at a certain speed in order to keep the line frequency constant. The speed of the generators is HIGHLY regulated, in fact, in many countries, even fluctuations as small as +- 0.2Hz are illegal.

Because many mains powered devices rely on the mains frequency being a constant 50 or 60Hz depending on where you live, many things are affected by these frequency changes. For example, AC induction motors will speed up/slow down, AC based clocks may lose or gain time, and well, most electronic devices are designed to only work within a specific frequency range.

With a basic understanding of electronics, you will know that the speed a generator runs at is dependent on the load it's driving. High loads will induce eddy currents in the generator, and cause it to slow down, while light loads will allow it to speed up.

This, in turn, affects the frequency of your mains power.

So how can it detect black/brown outs?

A brownout is usually caused by a load being too high for a given circuit, or short circuits in neighbouring sub-circuits, while blackouts are usually caused by shorts on your own sub-circuit, or in some extreme cases, the entire distribution grid. In many cases, the transformer and protection circuitry for your suburb will detect a brownout condition, and kill the power entirely until it is restored to normal voltage to protect equipment.

When large loads connect and disconnect from the main grid, they will cause the generators to speed up or slow down, varying the frequency of the entire grid. By monitoring the frequency, you can detect entire suburbs blacking out, possible brownouts and thus possible blackouts as well.

The measuring circuit consists of a simple bandpass filter and the library here: Lab3 - Laboratory for Experimental Computer Science

Image

It uses timers 0 and 1 on the Arduino as comparators. It generates a very accurate pulse, which your measured frequency is then compared to. Because of this, all the measurement is done in hardware, and anything you do in your main code loop won't effect the accuracy of the reading.

I have started work on a basic computer GUI for it, that graphs the readings over about 28 seconds, as well as an analog reader that averages out the values for smoother movements.

Image

The screenshot was taken as the meter needle was updating, so you can only see part of it there.
The graph at the bottom extends from 49.9 to 50.1Hz, so as you can see, the movements are really tiny, but can still mean a lot.

For example, you will notice that the frequency reading will typically be below 50hz around 6pm - When everyone is getting home, cooking, turning on their heaters etc, whereas around midday it'll stay above 50Hz most of the time.

In the case of the Australian main power grid, the entire east coast is interconnected, so theoretically you could detect blackouts in suburbs over 3000km away, however it depends largely on local and far generation as to how obvious it is.

I had a friend in Sydney (Roughly 600km away, and a major city) do a comparison on a 6 digit frequency counter, and our results were almost identical:

Image

Note that his frequency counter only sampled twice per second, where mine sampled every 50ms or so, so there is a fair bit of fluctuation in my readings, but the general trend matches.

We coordinated the event over IRC, so you can see that my reading was a few seconds before his.

Just because it looks cool, I decided to attach an analog current meter to my Arduino and let it act as a meter as well. It is connected to pin 3 (Only pins 3 and 11 will work for PWM with this setup, as the others are being used for timing), and has a lowpass filter consisting of a 82K resistor and 10uF capacitor.

It tracks the meter needle on my screen quite nicely, too!

Image

Anyway, just thought I'd share this interesting little project I've been working on :)

Dan

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Mains frequency/grid monitor

Post by angusgr » Mon Aug 26, 2013 10:44 pm

Hi Dan,

Cool project! I like the idea of monitoring the entire power grid via your own local outlet!

However please everyone remember to be very careful when doing this kind of thing. I'm not sure where you're dealing with the 240V AC, but the large resistors in the "dead bug" bundle makes me think you could be doing it there. Please remember those voltages have the capacity to easily kill you or start a fire.

If you want a safer way to do this, please consider finding a low voltage unregulated AC to AC adapter (12V or 24V AC output, or a lower voltage if you're lucky.) That way the lethal voltages stay in a safely insulated transformer package, and everything else becomes non-lethal. I often see AC output adapters in the electronics bins at op shops and the like (where I get most of my plug packs!)

Cheers,

Angus

Things
Posts: 36
Joined: Mon Aug 26, 2013 3:47 pm
Location: Cairns, Australia
Contact:

Re: Mains frequency/grid monitor

Post by Things » Tue Aug 27, 2013 1:44 am

Nope, was all done safely through a 12VAC transformer :)

angusgr
Freetronics Staff
Freetronics Staff
Posts: 853
Joined: Tue Apr 09, 2013 11:19 pm
Location: Melbourne, Australia
Contact:

Re: Mains frequency/grid monitor

Post by angusgr » Wed Aug 28, 2013 12:24 am

Great to hear. :)

Post Reply