Monitoring the load on the National Grid with a PicAxe

tmfkam

Senior Member
I was inspired by an article in the January 2012 issue of Elektor which described how it was possible to measure the load on the Electricity National Grid by reading the Frequency of the Mains supply. The greater the load on the Grid, the slower the generators run and so the frequency slows down. The lighter the load, the faster the generators run and so the frequency increases. The Grid is constantly compensating for the fluctuations in load and attempt to balance the load with the supply by bringing more or less generation capacity on line. The frequency of the Grid should not normally drift by more or less than 0.4% or 0.2Hz.

The meter I have designed measures the frequency and voltage of the supply using a single 14M2 processor by sampling the output of a LOW VOLTAGE (9V AC) transformer and displays it on an LCD, it automatically detects frequencies of 50Hz or 60Hz, has options for displaying the voltage as 240V (UK) 220V (EU) or 120V (US) and will capture events where the nominal supply level has fallen above or below 10% of that nominal level. A facility is provided for battery backed power to maintain operation in short power cuts so that these 'events' are maintained in memory. To compensate for the variations of the oscillators within different PicAxe processors, it is possible to add /subtract compensation by placing a link at power up, this compensation value is stored in Eeprom so needs performing once only. The Voltage and frequency are displayed numerically on the top line of a standard 16x2 LCD display, with the bottom line of the display showing a bargraph representation of the frequency, centred at 50Hz (or 60Hz) with more bars being displayed left of centre as the frequency falls away from the nominal frequency and more bars to the right as frequency increases above the nominal frequency. The resolution of each bargraph element is just 0.025Hz, or 25 milli Hertz (at 50Hz). The frequency is sampled three times for the positive portion of the AC signal, and again for the negative portion of the AC signal with an average being taken of these samples to reduce the possibility of them being corrupted.

The Basic code very nearly fills the 14M2, much of it being taken up with the calculations required to convert the PulsIn values used for the frequency measurement into an accurate value of the frequency. The PDF document goes into the detail of how these calculations were settled on, and the accuracy they offer while staying within the limitations of the integer maths of the PicAxe.

Basic code:
View attachment GridFreq_Monitor_16x2_3_01_1.bas

Circuit diagram:
GFM.png
 
Last edited:

tmfkam

Senior Member
Pictures of the unit in operation.

Boxed version, showing a frequency of slightly below 50Hz.

Boxed.jpg

Unboxed version, showing a frequency of slightly above 50Hz. This (almost) shows the PCB design using the Eagle files in the above post.

Unboxed.jpg
 

tonyv

New Member
Hi,
I have downloaded the update and will reprog the 14m2
I have attached a pic of the gfm (will paint and text the box)
Above is my led monitor, rotate cw low freq rotate ccw high freq
Regards
Tony
ZR6ALGgrid mon pic.jpg
 

Janne

Senior Member
Wonder if the UK grid aims to keep the time deviation of the grid (ec. a clock running off the mains frequency) close to real time in the long run as here on the nordic coutries? If so, it might be interesting to try and calibrate the picaxe's internal oscillator based on the long - long time average of the mains frequency, based on the assumption that over long periods of time it would average to 50Hz..
 

hippy

Senior Member
Wonder if the UK grid aims to keep the time deviation of the grid (ec. a clock running off the mains frequency) close to real time in the long run as here on the nordic coutries?
It does, though it's not clear what period would have a guaranteed zero-deviation.

There is a conspiracy theory that the grid runs slow during normal working hours and fast outside so most of us actually work more hours than we get paid for :)

If so, it might be interesting to try and calibrate the picaxe's internal oscillator based on the long - long time average of the mains frequency, based on the assumption that over long periods of time it would average to 50Hz
That would seem possible. The main difficulty would be in dealing with some quite large numbers, but not insurmountable. One could simply output those big numbers via serial and let a PC process them to see if it is worth processing them in the PICAXE.
 

tmfkam

Senior Member
Hi,
I have downloaded the update and will reprog the 14m2
I have attached a pic of the gfm (will paint and text the box)
Above is my led monitor, rotate cw low freq rotate ccw high freq
Regards
Tony
ZR6ALGView attachment 22658
Sorry. I have only just spotted your post. I'd be interested to see the circuit/software for the LED version. It is intriguing. Thanks for posting your picture.
 

tmfkam

Senior Member
Wonder if the UK grid aims to keep the time deviation of the grid (ec. a clock running off the mains frequency) close to real time in the long run as here on the nordic coutries? If so, it might be interesting to try and calibrate the picaxe's internal oscillator based on the long - long time average of the mains frequency, based on the assumption that over long periods of time it would average to 50Hz..
The main problem is that the steps for calibrating the frequency when dealing with the resolution of milli-hertz is that the trim steps are rather large. It may be possible to get close by using this method, but not always 'dead on'. One of the reasons for the update from Christmas Eve 2018 (Wife works in healthcare!) was that I had managed to build a crystal controlled version from the article in Elektor that had originally fired my interest in making my own design. On comparing the two models I had at home, one could be trimmed so that it exactly matched the crystal controlled model, the other would either under or overshoot the target frequency. Only by a tiny margin, 0.05Hz or so, but enough to make me think how I could improve it. Eventually, I decided to trim the results with a correction factor, rather than trim the oscillator. This gave far narrower steps of control making it easier to get it spot on, and more of them too.

I still stare at mine and wonder if I should boil the kettle when there is too much supply on the grid, or turn off the telly when there is too little!

It was the drop in frequency due to insufficient supply that caused the major supply outages a few months back here in the UK. When a couple of generating plants suddenly went offline at almost the same time the demand on the grid slowed down the remaining generation so much that loads were dropped to protect the entire grid. this brought the grid back under normal operating conditions quickly but left large areas of the country without power until reserve generation was able to fill the gaps left by those that had failed, and the dropped loads could be reconnected.

The first major incident since I've had my meters, and I was out so couldn't monitor the drop in frequency. Typical!
 

tmfkam

Senior Member
It does, though it's not clear what period would have a guaranteed zero-deviation.
I would have thought that a one hour average should be enough. Over the course of any given hour, the frequency seems to drift down in frequency by a similar amount, and for a similar length of time as it then drifts up. Watching the one I have here beside me, it seems to be slowly going down to 49.95Hz then up to 50.05Hz, back to 50Hz for a while then repeating again.

Right now it is spot on 50Hz, and it has just gone to 50.025Hz, held that for as long as it took to type, briefly touched 50.05Hz then back to 50.025Hz and now gone down to 50.00Hz then further to 49.975Hz and then 49.950Hz, 49.975Hz, 49.950Hz, 49.925Hz, 49.900Hz, 49.925Hz, 49.900Hz, quickly back to 50.000Hz, 50.025Hz 50.050Hz...

Well, you get the idea. I could watch this all day!
 

premelec

Senior Member
Suggest you have it play a different tone for each .05Hz above or below 50- then you don't have to watch and can just be driven crazy by the tunes... ;-0 And for fun have a random sample interval...
 

tmfkam

Senior Member
Do you know, that sounds like something I could pitch to the Arts Council...

I picture it in a darkened room, each tone coming from a different direction, blending into each other rather than stopping and starting abruptly.

Call it "An immersive, auditory experience, bringing to life by the medium of music the excessive energy consumption of the twent first century and symbolising the need to reduce energy usage in order to slow climate change." and I reckon I'd be sure to get a Grant. Perhaps I could take it on tour?

I've seen less ridiculous things in Art galleries!
 

premelec

Senior Member
Let us know how this works out if you try it - sort of like listening to refrigerator and other appliances on house cycling only for the whole grid... perhaps a glissando between states would be interesting ...
 

Janne

Senior Member
I still stare at mine and wonder if I should boil the kettle when there is too much supply on the grid, or turn off the telly when there is too little!
If you were here, you could actually get paid by the national grid operator for offering to shed load on your kettle :) ..

In principle they offer money for agreeing to shed power loads in case of power shortage, with shortage being frequency dropping under 49.5Hz. Not sure how much they are paying for that, but it seems somewhat reasonable since it seems to be quite a common system nowdays on industries that has such power usage that load can be turned off at will.. One good example being the growth lamps on greenhouses, no harm done in turning off the lamps for a while, and they can be turned on with a "flick of a switch" too.
 
Top