Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 00:44 06 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Mains frequency monitoring

     Page 3 of 4    
Author Message
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 09:16am 31 Dec 2016
Copy link to clipboard 
Print this post

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.pdfEdited by Herry 2017-01-01
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 12:58am 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 4406
Posted: 11:16am 13 Oct 2017
Copy link to clipboard 
Print this post

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.
Edited by Warpspeed 2017-10-14
Cheers,  Tony.
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 11:44am 13 Oct 2017
Copy link to clipboard 
Print this post

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 States
Posts: 209
Posted: 11:53am 13 Oct 2017
Copy link to clipboard 
Print this post

  Herry said   I'm revisiting this. Any further thoughts?

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.Edited by HankR 2017-10-14
 
Zonker

Guru

Joined: 18/08/2012
Location: United States
Posts: 767
Posted: 12:43pm 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 261
Posted: 12:48pm 13 Oct 2017
Copy link to clipboard 
Print this post

  HankR said  
  Herry said   I'm revisiting this. Any further thoughts?

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.


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 States
Posts: 209
Posted: 01:48pm 13 Oct 2017
Copy link to clipboard 
Print this post

  Quote   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.

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.Edited by HankR 2017-10-14
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 01:52pm 13 Oct 2017
Copy link to clipboard 
Print this post

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.Edited by Herry 2017-10-15
Senior?!  Whatever it says, I'm a complete and utter beginner...
 
Herry

Senior Member

Joined: 31/05/2014
Location: Australia
Posts: 261
Posted: 02:01pm 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 261
Posted: 02:09pm 13 Oct 2017
Copy link to clipboard 
Print this post

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 States
Posts: 209
Posted: 02:15pm 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 261
Posted: 02:19pm 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 4406
Posted: 02:49pm 13 Oct 2017
Copy link to clipboard 
Print this post

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: Australia
Posts: 6286
Posted: 07:01pm 13 Oct 2017
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2170
Posted: 10:17pm 13 Oct 2017
Copy link to clipboard 
Print this post

  Herry said   Here it is:

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/ Edited by CaptainBoing 2017-10-15
 
HankR
Senior Member

Joined: 02/01/2015
Location: United States
Posts: 209
Posted: 11:08pm 13 Oct 2017
Copy link to clipboard 
Print this post

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 States
Posts: 209
Posted: 11:14pm 13 Oct 2017
Copy link to clipboard 
Print this post

  Herry said   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).

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 States
Posts: 209
Posted: 11:18pm 13 Oct 2017
Copy link to clipboard 
Print this post

  JohnS said  Cheapest pre-built board with suitable chip (MX170) I found was BV502 (under $10).
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 States
Posts: 209
Posted: 11:29pm 13 Oct 2017
Copy link to clipboard 
Print this post

  CaptainBoing said  or from the horses mouth:

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
 
     Page 3 of 4    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025