Measuring sub 2Hz frequency with high accuracy - Page 1
Forum section: electronics / projects

author: ricko_uk
author_rank: Super Contributor
timestamp: June 05, 2020, 07:40:48 pm
content: Hi,I need to measure a steady 5V square wave frequency between 2 and 5 Hz with the precision of at least 2 decimal points, better if 3.1) I tried using the digital oscilloscope Rigol MSO1104 but unless the whole signal fits in the display it does not measure it and if I set the scope's timescale to fit the whole period in the display then the accuracy is not there. Any suggestion to doing such measurement with a scope?2) I tried using a frequency counter part of a Rigol DG1032Z but despite the waveform being very clean for some reason the reading keeps moving around by a lot (sometimes even several Hz) despite having tried various settings. Any suggestion why that is and what settings to do such measurement?3) any other suggestions?Many thanks

author: ejeffrey
author_rank: Super Contributor
timestamp: June 05, 2020, 07:52:03 pm
content: What settings have you tried? I haven't used the frequency counter on the Rigol generator but according to the manual it can be DC or AC coupled and AC is default. Make sure you are DC coupled.

author: CaptDon
author_rank: Super Contributor
timestamp: June 05, 2020, 08:36:00 pm
content: One way slow signals were counted was measuring a PLL thatwas running 10 or 100 times the base frequency and measuringPLL frequency. Not very stable unless the input is stable. Another waywas gating the counter for 10 seconds or more also not good asit averages the signal over time. The best way I found was to setthe counter up in more of a 'timer' fashion and gate the counterfrom the signal you want to measure and have the counter countinga fast signal like 10khz or 100khz that way you measure yourfrequency as a time interval of 100us or 10us or even 1us stepsand then do the reciprocal calculation to get frequency withresolution two or three digits to the right of the decimal. Thesquare wave is in your favor because the gate circuit will beless effected by noise and decision point on the slope.

author: TimFox
author_rank: Super Contributor
timestamp: June 05, 2020, 08:39:32 pm
content: Most “universal” digital counters have a “period averaging” mode, where it times 10 or 100 cycles. Some will compute the frequency from that period.

author: StillTrying
author_rank: Super Contributor
timestamp: June 05, 2020, 08:50:02 pm
content: Quote from: ricko_uk on June 05, 2020, 07:40:48 pmI'd say trigger off one edge of the square wave with the trigger X position in the center of the screen, then keep moving the trigger position until the next edge is in the screen center, the period is then the X position off-set, ..or something.

author: magic
author_rank: Super Contributor
timestamp: June 05, 2020, 09:04:57 pm
content: Quote from: ricko_uk on June 05, 2020, 07:40:48 pmRecord with a soundcard and analyzeThis is below audio bandwidth so it likely won't be captured faithfully, but nevertheless there will be distinct peaks where the edges are.If you are worried about accuracy, calibrate the soundcard by measuring some higher frequency which can be verified by other gear. But I think it will be good for two or three digits.

author: nctnico
author_rank: Super Contributor
timestamp: June 05, 2020, 09:31:11 pm
content: This shouldn't be hard with a decent time interval / frequency counter. You require 200us of time resolution for your measurment.

author: james_s
author_rank: Super Contributor
timestamp: June 05, 2020, 09:47:42 pm
content: What you need is a counter that does reciprocal counting, it's much better for providing reasonable resolution when measuring low frequencies without absurdly long gate times. You could also hack together something with something like an Arduino or other micro of your choice and measure the period and from that calculate the frequency. The accuracy is determined by the accuracy of the reference clock on which you are basing your measurements.

author: ebclr
author_rank: Super Contributor
timestamp: June 05, 2020, 10:12:24 pm
content: This is very easy to make with any microprocessor including Arduino, Using timers, Your accuracy will be similar to the crystal used( if you really wanna accuracy use a GPS disciplined oscillator as a processor cook).

author: trobbins
author_rank: Frequent Contributor
timestamp: June 05, 2020, 10:47:48 pm
content: I'd concur with magic, as my USB soundcard interface and REW software will display down to 2Hz in RTA display, and will calculate the frequency of the fundamental.I also have a HP3325A frequency synth that has crystal locked frequency generation, so could use an X-Y scope to display synchronous operation.

author: max_torque
author_rank: Super Contributor
timestamp: June 06, 2020, 01:35:37 pm
content: The answer depends on how quickly / often you need to know the frequency?If you can afford to measure lots of pulses, and wait a while, then you can simply calculate the time for say 1000 pulses, by counting say the rising edges, and using a stopwatch. Your edge count has a max error of 1 (either an edge has happened or it hasn't) and even a hand held stop watch is good to around 1 sec resolution (mainly the latency in the wetware jelly (<< you!) pressing the stop button)At a true 2.000000 Hz 1000 pulses takes 500 seconds, so you pulse counting worstcase error is 1/1000 and your time counting 1/500. So the longer you time for, the better your resolution!Of course, this tells you nothing about jitter and repeatability, just about the average frequency over the counting time period

author: Benta
author_rank: Super Contributor
timestamp: June 06, 2020, 04:52:34 pm
content: Universal frequency counters always have a "Period" function. That's the one to use.

author: bob91343
author_rank: Super Contributor
timestamp: June 06, 2020, 06:35:43 pm
content: If the reading is unstable, it indicates noise - including phase noise. An unsteady frequency won't give steady readings.

author: AndyC_772
author_rank: Super Contributor
timestamp: June 06, 2020, 06:49:18 pm
content: Quote from: ricko_uk on June 05, 2020, 07:40:48 pmThe built in measurements on a scope are quick and easy to use but are never the right way to measure time as accurately as possible.The way to measure the period of a wave with a scope is to start by capturing a single period using as much of the scope's horizontal memory as possible. Zoom in on one edge and position a cursor, then zoom out, scroll to the other edge, then zoom in on that one and position the other cursor as accurately as you can. The distance between the two cursors is your answer.If your scope won't let you capture, freeze and zoom in this way, then the other option is to trigger one one edge but move the trigger point one whole cycle off to the left of the screen, then measure the time between the trigger event and the next rising edge. Any scope should let you zoom right in on the second edge so you can position a cursor accurately. This is also the way to measure cycle to cycle jitter.

author: mino-fm
author_rank: Regular Contributor
timestamp: June 07, 2020, 08:40:54 am
content: Using a reciprocal counter it is no problem to get 5-6 digits resolution. Accuracy can be the same, if a calibrated quarz or TCXO is used.Are you able to programm AVR8 devices like ATtiny4313, ATmega48, ...?Here you can find examples in C for AVR and even for Arduino Uno (Fmeter_UNOR3.ino) or Bascom (fm48_bas):http://www.mino-elektronik.de/fmeter/fm_software.htmExamples for ATtiny44 or ATtiny45/85 with 4-digit LCD are shown here:http://www.mino-elektronik.de/7-Segment-Variationen/LCD.htm

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 02:02:37 pm
content: Thank you all for the suggestions, all very interesting and useful!!

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 02:57:38 pm
content: To use your scope, slow it down so that there is at least one period on the screen and use cursors to measure the time from one edge to the next. If your Rigol is like my old one, there are two different frequency counters--have you found and tried them both?I'm not familiar with your frequency counter, but even my ancient HP 5316B correctly reads a 2 Hz square wave (I just tried it) to 7 or 8 decimal places with no special settings.Just for fun I plugged in my joke-quality FeelTech 6900 and it promptly read the frequency correctly, as shown. You have to increase the gate time to 100s to see two decimal places, but if you just look at the cycle time of 4.99994 million nS (FeelTech wants you to be able to move decimal points in your head...) you can infer the Hz quite accurately and quickly.I've no idea why, but Rigol probably owes you an apology. Any reasonable device should handle this without any problem.EDIT: Check and see if the Rigol counter has a HF Reject option and try it if it does.

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 03:50:17 pm
content: Thank you bdunham7,I just checked me Rigol MSO1104z and if the frequency is lower than 15Hz it just shows "< 15Hz". I assume because the internal counter overruns/rolls-over...

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 04:31:22 pm
content: Quote from: ricko_uk on June 07, 2020, 03:50:17 pmThe hardware counter on scopes is typically a simple gated counter, no frills. There should also be a frequency entry under 'measurements'. Set your trigger to DC coupled, HF reject (or noise reject) ON and timescale to 100ms (for 2 Hz) or whatever gives you 2 to 4 complete cycles on the screen. Make sure it triggers reliably on the rising edge of the square and looks stable on the screen. Then find Frequency and Period in your measurements menu and turn them on--you should get a two-decimal readout on each. Not super accurate or precise, but good enough for most things.

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 05:10:34 pm
content: Thank you bdunham7I just checked the manual and I think that's by design. Have a look at page 145 of the manual:https://www.batronix.com/pdf/Rigol/UserGuide/MSO1000Z_DS1000Z_UserGuide_EN.pdf

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 05:22:38 pm
content: OK, that's the hardware counter. Scroll up to 6-25 and 6-26. If the waveform is displayed on the screen, the measurement parameters 1 and 2 should give you what you want. Did that work?

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 05:36:32 pm
content: yes I just tried it and as soon as I increase the frequency above 15Hz not only it shows the correct period value but it does so with four decimal points. But as soon as it goes below 15Hz it suddenly changes the value to "<15Hz"

author: joeqsmith
author_rank: Super Contributor
timestamp: June 07, 2020, 05:55:17 pm
content: Old HP5328A attached to a GPS. The GPS runs 24/7 and is the reference for my lab. Note, there are two more ranges, if needed.

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 06:42:32 pm
content: Quote from: ricko_uk on June 07, 2020, 05:36:32 pmThis is in the measurements menu? Can you post a picture of how your screen looks? If that scope can't do this measurement then Rigol owes you another apology.The photo is my ancient dinosaur Tek 2221.

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 06:47:32 pm
content: Thank you bdunham7,it does measure it if I put the entire waveform on the screen but as per my oy original post then the resolution is very low. I needed to measure it with a high precision (as high as possible, ideally 4 or more decimal digits).

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 07:04:32 pm
content: Quote from: ricko_uk on June 07, 2020, 06:47:32 pmOK, I thought you weren't even getting the two decimals. The measurements in the menu are done with the on-screen information, so the precision is quite limited, I'm guessing you see something like 2.00 Hz, or even 2.0 Hz (which would be pretty crappy) and you want 2.0000. It appears that neither of your instruments will give you what you want directly and you either have to use cursors, which will likely be no more precise, or some workaround like running your test signal into CH1 and your AWG into CH2 and then adjusting the AWG output to exactly overlap your test signal. That should give you the precision you want. That' s the best idea I've got.

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 07:36:00 pm
content: Thank you bdunham7

author: ejeffrey
author_rank: Super Contributor
timestamp: June 07, 2020, 10:01:09 pm
content: Quote from: ricko_uk on June 07, 2020, 03:50:17 pmI would expect the counter in the signal generator would be better than that. Have you tried to figure out why that was giving poor results?

author: ricko_uk
author_rank: Super Contributor
timestamp: June 07, 2020, 10:14:43 pm
content: The signal generator gives several decimal digits accuracy but had issues getting to trigger or give steady readins. The signal is very precise and stable but the readings were not. Now I managed to get the reading with enough accuracy.Thank you all!

author: bdunham7
author_rank: Super Contributor
timestamp: June 07, 2020, 11:11:20 pm
content: Quote from: ejeffrey on June 07, 2020, 10:01:09 pmAdd-on simple counters may lack features like noise reject and adjustable triggers that are necessary to get stable readings in some cases. I was actuallysurprisedshockedat how well the FY6900 handled it.

author: trobbins
author_rank: Frequent Contributor
timestamp: June 08, 2020, 01:21:51 am
content: So was it that you didn't initially configure the counter appropriately in the Rigol DG1032Z, or did you do some external signal modification, or ...?

author: ricko_uk
author_rank: Super Contributor
timestamp: June 08, 2020, 08:13:12 pm
content: I initially tried every setting also with the scope connected to make extra sure the signals was always very clean. But wasn't working. Then I kept trying and suddenly it worked. No idea what happened.