![]() |
Forum Index : Microcontroller and PC projects : Mains frequency monitoring
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
It might be of interest to give a link to the article which prompted much of my thinking http://www.iotpe.com/IJTPE/IJTPE-2011/IJTPE-Issue9-Vol3-No4-Dec2011/16-IJTPE-Issue9-Vol3-No4-Dec2011-pp102-105.pdf Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
I'm revisiting this. Any further thoughts? No point in getting the frequency reference from the mains as it is the mains I want to check, using a low voltage plug pack of course. It is matter of referencing from a super stable standard frequency and being able to display the mains frequency to one or two decimal places dynamically. Nominal is 50 HZ. I would like to monitor between 47 and 53. Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Warpspeed Guru ![]() Joined: 09/08/2007 Location: AustraliaPosts: 4406 |
There are basically two ways to get a fairly rapid response with very fine frequency resolution. Reciprocal counting, as mentioned in that link you posted earlier. Counting stable clocking pulses from an accurate high frequency (crystal) source over each mains cycle which gives you the period. Then converting the period into a frequency which is how you prefer the result to be displayed. That is how commercial frequency counters work for getting such high resolution at the lower frequencies. A second less common way to do it is to multiply up the mains frequency by a known factor, say by x1000 with a phase locked loop. 50.021 Hz then becomes 50.021Khz. That can then be displayed as 50.021 on a very basic low cost five digit frequency counter that has only 1Hz resolution and updates perhaps every second. http://www.ebay.com.au/itm/1Hz-50MHz-Digital-LED-Meter-Frequency-Measurement-Counter-Tester-Module-New-J5Q0-/40117299891 6?var=&epid=5004040984&hash=item5d67c62b04:m:mse5DhIuoZ0oUbmZeAoiqmQ I suppose it depends on what you want this for, and if the software approach appeals to you more than the hardware approach. If all you want is a digital display, then a cheap Chinese frequency counter, and a phase locked loop frequency multiplier would probably be the easiest way to get resolution as fine as you want ! If you wish to data log the frequency, and require a serial data output port, then a microcontroller might be better, although there will be more of a practical limitation to the resolution and speed of response that is possible. Cheers, Tony. |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
I think Warpspeed's excellent answer is about as good as it's going to get taking into account the contributions from before. Last night I looked up cheap Chinese FC boards and was amazed when I found this very same RED board. I didn't find any self-contained FC boards that used either a longer gate time than 1 second, nor any that use the reciprocal method. One might be out there somewhere, though. |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
Herry, why don't you give us an idea of which of the several methods that have been mentioned you might be partial to so far after having many months to think about it? That way it might help to avoid a general rehashing of all the methods already mentioned. Of course everyone should read back in the thread to the beginning before posting anyway. |
||||
Zonker![]() Guru ![]() Joined: 18/08/2012 Location: United StatesPosts: 767 |
If you want to use the "270" 28pinner, I remember that Kiid released a version for use with a X-tal... This gets you the better timing back... ![]() 2017-10-13_224227_KIID_-_MX270B_USB.zip |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
My problem is I have too many irons in the fire. I would like to display the current mains frequency on a simulated analogue meter (backpack?). And I would like both the hardware and the software to be as simple as possible. Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
Let's start then by asking you a few questions: By the simulated analog meter that pretty much translates into "you want very much to use a Mite;" maybe even the design MUST use a Mite. So one of your requirements is that a Mite will drive the display. Can you settle with a mains frequency measurement every 100 seconds? That can be yes or no or it can be something like you can live with 100 seconds but you don't like it. If yes it seems as if one or more of the Mite family can do this alone. If no then I think it's starting to look as if you either need a C function or a small helper uC like a low pin number PIC or Atmel to do the counting itself (over a much shorter interval) and just feed the results to the Mite for display. Maybe do a reciprocal arithmetic calculation in the Mite which it is very well suited for. The frequency counting is almost trivial for any micro, including some of the smaller PICs, but using a non-interpreted language. That could be BASIC, C, or one of the other hybrid compiled languages available for PICs. It goes without saying that assembly language would also be superb. The time base accuracy requirement is not much at all, and can be easily met with a cheap crystal running the Pic. So a crystal equipped Mite is not required if the helper uC is used. Based on the above reasoning, the C function solution is the least complex for parts count and software complexity outside of the creation of the CFunction itself. The complementary small uC concept has of course a little more complexity both in hardware and software in that the Pic needs code and there has to be communication from the Pic to the Mite. The CFunction method may be the way to go for you. |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Oh dear! I wanted it to be real time. Once a second might just do it! There is an on-line real time display of the actual UK grid frequency. I'd like something like that. I'll try and find the url again. Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Here it is: http://www.dynamicdemand.co.uk/grid.htm Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
Mind you, I'm a bit suspicious that this is merely a demo page and not a real time one. Whenever I load it, I seem to get the same range (below 50 Hz). I've just downloaded a few times and it appears identical. Also it happens to be early hours of the am in the UK right now. Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
I'd like to be on record as saying that since the resolution required is very relaxed, clever programming in MM Basic might be able accomplish the kind of period or interval measurement you need to derive the frequency. Geoff would know about that. I'd have to go back and read what the upper frequency counting limits are in the MM manual to see if it's possible. It may well be possible, but it's only because the power frequency is so low and the precision requirement is very low for doing an interval measurement of the power frequency. |
||||
Herry![]() Senior Member ![]() Joined: 31/05/2014 Location: AustraliaPosts: 261 |
I don't think I mentioned the resolution. Only the range. BUT I think a hundredth of a Hz would be OK? Senior?! Whatever it says, I'm a complete and utter beginner... |
||||
Warpspeed Guru ![]() Joined: 09/08/2007 Location: AustraliaPosts: 4406 |
Period measurement is the way to do it. If you need 0.01Hz resolution at 50Hz, you will need to accumulate AT LEAST 5,000 counts in 20mS which requires a reference counter clock of 50 x 5,000Hz or 250Khz. Now there is going to be jitter and a one count uncertainty, so if you want a non jumping around last digit the resolution will need to be a lot better than the minimum requirement, maybe a 1Mhz clock rate minimum for period measurement. What is the clocking rate of the timer in an MM, I have no idea ? Cheers, Tony. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6286 |
Have you looked at the frequency meter featured in October Silicon Chip? You could omit the high frequency preamp and prescaller etc. It uses a micromite plus. A simpler alternative is to use a precision RTC to get a reasonable 32k pulse Use a divide by 10 (or 8 or 16) on the 50Hz input. Count the number of RTC pulses in 10 cycles and do the maths. Jim VK7JH MMedit |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2170 |
http://www.dynamicdemand.co.uk/grid.htm or from the horses mouth: http://www2.nationalgrid.com/uk/industry-information/electricity-transmission-operational-data/ not exactly real time though looks to be the past couple of minutes maybe : 0917 here but graph shows 09:15 and this is nice: http://www2.nationalgrid.com/UK/Industry-information/Electricity-transmission-operational-data/Data-Explorer/ |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
I wish there were a way to nuke one of my latest posts in this thread (second one on page 4). :( I have now more carefully read this thread back to page one through to the present and the MM manual. And finally will soon order a handful of Mick's MUP boards. Herry states his plans and concerns about drift and accuracy on page 1 as follows: _________________________________________________________________________ "OK. Zeroing in (I hope)! I will build a zero crossing counter fed from a plugpack and a bridge rectifier. There are three zero crossings each cycle. I will use this and eg SETPIN 15, CIN to measure number of milliseconds between pulses. I note that the accuracy can be as good as .1% although specified as .9% but I suspect that it is temperature sensitive, and with temperatures here varying by as much as 20 degrees C in a day (!) I would like to be more accurate (I believe by law the mains frequency may not be beyond 1% of spec). Any thoughts on using a crystal?" ________________________________________________________________________ A little later I believe, when it's suggested that he use a MM+ clocked with a crystal, Herry states a preference for the less costly plain MM. So I think the crew had converged pretty well on a great strategy put forth by TassyJim on page 3 of the thread as follows: ____________________________________________________________________ "To measure mains frequency with a umite, I would have two period measurements. One measuring the mains and one measuring the one Hz output of a DS3231 (or similar accurate device) You could then correct the mains measurement to compensate for the umite errors. You would only have to read the reference occasionally as the umite doesn't fluctuate too fast. You might then find that the zero crossing detector has to be fairly precise to get a good precision. .... or a calibration chart for CLOCKTRIM Vs temperature [could be] used and forget about regular references." ____________________________________________________________________ So, Herry I guess you didn't get to test out any of the earlier counsel yet. It looks like we're converging to pretty much the same advice this time when the smoke clears. Use a plain MX170 MM and feed it with a nice stable clock or use a temperature correction chart. Not sure if TJ intended this, but with a one-wire sensor hooked up (super simple) the temp correction could be applied automatically by part of your MM code. Hank |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
It's real. Watched it for a while and it went from a little plus to almost .01 negative over about a 10 minute period. |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
John Thank you for that tip, John. Now obsolete. Just got one, though. On its way from England. |
||||
HankR Senior Member ![]() Joined: 02/01/2015 Location: United StatesPosts: 209 |
http://www2.nationalgrid.com/uk/industry-information/electricity-transmission-operational-data/ Hi CaptB, We both posted NG links early in round 1 (page 1). I did the live graph link back then. The funny thing is that NG serves part of Massachusetts now and the guy two homes away from me works for them as a linesman. They aren't in my exact area, though. They also serve part of New York state. I think that's where they have the most customers in any given state. So NG jumped the pond to sell more, more, more. H |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |