![]() |
Forum Index : Microcontroller and PC projects : Mains frequency revisited!
Author | Message | ||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
I am now revisiting my idea of monitoring mains frequency using Micromite. Australian nominal is 50 Hz. Regulated limits range between 47 and 52 . I would like read between say 45 and 55. I need high accuracy so using a crystal may not be good enough. Neither is it any use using the mains frequency itself as the variance would always be zero! I would think the best thing is to use the GPS one second pulses as the standard. I want to read the results on a continuous basis with say 2 to 3 decimal places. First on a digital meter and later with an offset to bring 50Hz to the centre of commonly available large left zero voltmeter or milliameter, with a pot to adjust it to match the digital figures shown. Power would be via an AC plug pack AC so that the low voltage would be monitored, and then rectified for the circuitry. I will need a bit of handholding re how to compare the GPS standard (which I know how to get) with the mains frequency being monitored. What do you all think? Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
One method would be: Square up the mains and divide by 50. Compare the phase of the divided mains with the GPS one second pulses. Any drift in the phase timing will indicate the frequency error. To get the sort of precision you are after, you will need millisecond timing. It's 25 years since I worked in the power industry but back when I was pushing the buttons, a frequency error of 0.3Hz would be the maximum unless there was a serous "disturbance" The only time I saw <45Hz was during a state wide blackout when the only generating plant that kept running was Tarraleah, a 1940 era hydro station. It was a strange experience with the turbines running that slowly. We shut the plant down manually. Any thermal station would spit the dummy with small drops in frequency due to pole-slip or loss of sync in the high speed alternators. I have lost track of the current protection and control systems in the modern power networks. Jim VK7JH MMedit |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2442 |
you may find there is some variance of a few microseconds is the 1 pps output of most cheap GPS receiver modules, in the form of a 'wandering' much as you see on the 50Hz mains. ie, there will certainly be 86,400 pulses per day, but they may not be exactly evenly spaced out. what is your end-goal? if you are just wanting a large analog meter display from 45 to 55Hz so you can see the changes of the mains frequency over the day, i'd suggest an MX170 with a 32kHz watch crystal used to 'condition' the onboard RC oscillator. a PWM output should be able to drive a meter movement directly via a series resistor, with just the mechanics of the meter integrating the pulse train. could make for an amusing SC project. cheers, rob :-) |
||||
Warpspeed Guru ![]() Joined: 09/08/2007 Location: AustraliaPosts: 4406 |
Crystal should be good enough, even a low cost crystal oscillator module has a typical rated accuracy of 50ppm or better. At 50 Hz that is plus or minus .0025 Hz For low frequencies such as 50Hz, reciprocal counting is usually the preferred method. If you measure over five mains cycles you can have ten readings per second which is probably fast and continuous enough. One reading every 100mS. With a 10Mhz crystal that will produce a million counts every 100mS, or six digit resolution. Cheers, Tony. |
||||
Chopperp![]() Guru ![]() Joined: 03/01/2018 Location: AustraliaPosts: 1097 |
Speaking of SC, here is a frequency counter but it would be far more sophisticated than what you want. (Oct '17, item 7) There are other frequency related projects if you search Silicon Chip ChopperP |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
Good morning All A traditional method of doing frequency to voltage is the phase locked loop (PLL), however, they depend on R & C to determine frequency. To overcome that problem it should be possible to use a mite (I had to fit one in somewhere) to calibrate the PLL. By that I mean, switch input between mains and a reference and do a correction. It should also be possible to square the mains and extract a harmonic to increase response time. Arduino people have put some effort into this so their ideas might be of use. I am assuming that the output will be an accurate representation of average frequency over a 1 sec. period. It does sound like fun ![]() Peter |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Thanks for inputs. Didn't realise I had any replies; the email notification doesn't seem to work at the mo (I have set it on). Consensus seems to be that crystal is better than GPS? Also, I definitely want to use my friend the Micromite! Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Davo99 Guru ![]() Joined: 03/06/2019 Location: AustraliaPosts: 1584 |
Voltage can Vary significantly here and is always High although still swings easily 20V. I have never seen frequency off by more than .5 Hz from High to low on any day. Most of the time it's a lot tighter than that. Not sure if it can have any effect but where I typically measure is on the same circuit and very close to where I run welders, plasma cutters, Compressors and saws so Start up or switch of of those possibly could affect the readings I get anyway. |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 5091 |
About measuring the mains frequency: I am not living in Australia, but in Europe. In Europe there is a guarantee from the network providers to deliver 50Hz long term stable (I think that is a requirement from the time that 50Hz was used for analog clocks). That resulted last year in a "keep up" night" where the total number of cycles was adapted withing 24 hours to get the long term drift corrected. Since whole of Europe is network coupled, also with foreight states, that could only be done by splitting the segments, adjusting each segment, and then restoring the coupling in the grid. Must have been a massive operation. Anyway... you cannot use 50Hz to meaure 50Hz accurate. You can buy pre-adjusted crystal oscillators that are accurate, in fact these are far cheaper than a GPS receiver. I am not talking oven controlled oscillators, but the smaller drift compensated oscillators (they measure temperature of the oscillator, and adjust crystal tuning according a calibration table). But even a 50ppm (standard) can oscillator will do the job. If you are interested in trends, you could simply measure the frequency over a longer gate time (count individual pulses over 1000 seconds or so) and get high resolution. That is by far the simplest. If you are not willing to "wait" for the first reading, you can always start counting for 1 second, then display the count (50), but continue counting, and after 10 seconds recalculate, and show 50.0. Then after 100 seconds update that to 50.03, and after 1000 seconds to 50.034 Hz. In fact you can get as accurate as you want... If you want to focus on short term changes, the best way to do that is measure the time each 50Hz cycle takes. This is around 20mSec. That means that every cycle is measured. The accuracy achievable is depending on the speed of your clock in time measurements. If it is 1uSec (1MHz) then the accuracy is 1:20000, or 0.005%. Problem with this method is that it is very sensitive to any noise on the mains network (machines polluting the mains), and you will see values all over the place. This can be improved by software (averaging), or hardware (bandpass filter and a PLL circuit). Some 30 years ago I implemented the short term method in a PIC16F84 chip, using external bandpass filter (opamps) and PLL (CD4046) with reasonable performance (I was intrigued by how PLL's work, and did not have lots of memory in the PIC16F84 to store values). But nowadays I would simply average the values. Why "tune" a PLL hardware, if you can simply change some values in a parametric averaging filter. So what you would need to do this with a micromite is (independent of the method listed above): a/ a command in MMbasic (or C function) than could switch from internal RC oscillator to an external oscillator. b/ an accurate external oscillator with the frequency needed to match MMbasic. c/ a circuit that gives a logic output from the mains frequency. Typically this can be an optocoupler with some passive components. Plenty of them on google. You can always start out without a/ and b/ since the internal RC oscillator is not bad at all. Regards, Volhout Edited 2019-08-28 17:45 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |