poida
 Guru
 Joined: 02/02/2017 Location: AustraliaPosts: 1459 |
| Posted: 01:39am 17 Feb 2026 |
Copy link to clipboard |
 Print this post |
|
recent discussion on mains frequency and inverter frequency generated by EG8010 has resulted in an update on the mains frequency monitoring I do. Also, the FeelElec FY6900 function generator can be calibrated with junk you already have to less than 1ppm.
The mains freq monitor is based on a GPS module, that produces the 1 second pulse of goodness that over time (1 hour to 1 day) has very high accuracy I use an arduino Due, which runs at 84Mhz, 9V AC transformer, zener diode, opto coupler and resistors. Code running on the Due has an interrupt from the 1Hz pulse, that feeds a PLL that converges to give me an accurate estimate of the Due clock.
Right now, in my office, the clock/2 is 41,999,477 and is stable within 1 this is short term variation of one part in 42 million.
I feed the 9V AC from mains into a current limited 5V zener, then limit that 5V current to 10mA to fire the opto. The output is pulled up to 3.3V and the opto yanks it down at a certain height of the ac waveform.
There is noise in this and uncertainty of measurement of the period is dominated this by noise.
The setup was tested with a stable function generator and it is accurate to within 1 part in a million with 50Hz frequency.
eg with a clock of 42M, I see a period of 840,000 for 50 Hz and with the stable test 50Hz input, I see only +/- 1 added to the 800,000 so it's nearly 1ppm
The Fy6900 costs about $100AU from Aliexpress. it has average accuracy but it seems quite stable. I calibrated it, using the Due to less than 1ppm error so now I have a very good FG for cheap. it's specs say +/- 20ppm accuracy with +/- 1ppm stable for 3 hours. It was in fact 30ppm out when I calibrated it.
I store the measured mains frequency and phase once a second into a database. check out http://1eq2.cc/f3.html for a view of what it is at Notting Hill, VIC. I show a phasor too, which gives an idea of how fast mains frequency phase changes over time.Green is a fixed reference, Blue is what it was a second ago.
Wiseguy in a recent post wrote about mains freq stability. another thing I made shows the entire 24 hours of data, you can select recent days. see http://1eq2.cc/f5.php?ddate=20260128 for instance. it takes 10 seconds to show the data so give it time.
Today's data will be a bit wobbly due to my calibration and testing, in preparation for this post here. there will be some spikes and other rubbish in it.
I suspect I could reduce the noise in the frequency data by putting the 9V mains through a band pass filter. In mains voltage there are significant amounts of 2,3,4th harmonics and this no doubt alters the timing of the opto coupler output.
here is some "proper" mains freq data, from https://wattclarity.com.au/articles/2026/01/16jan-frequency/
 and my data
 I wondered what the average frequency for a day is. I chose Jan 14 2026..
mysql> select avg(fnfreq) as avfreq from freq where ts > 20260114 and ts < 20260115; +-------------------+ | avfreq | +-------------------+ | 49.99938892271266 | +-------------------+ 1 row in set (5.02 sec)
so my measured mains frequency is quite close the day's expected average of 50 Hz. wronger than a phone book full of wrong phone numbers |