Frequency counter / comparator with 4046 PLL

Thread Starter

rodv92

Joined May 23, 2011
11
Hi.
I was wondering if it is possible to compare frequencies with the 4046 PLL. I don't care about phase.
I have an unknown frequency signal output from a XR-2206 IC, over which I have control of the frequency through digital potentiometers.
The goal is to fine tune the XR-2206 automatically.

Based on the 4046 datasheet, I am thinking of inputing a reference, known frequency PWM, 50% duty cycle signal to the comparator input, instead of the 4046 VCO signal. In my setup, this would be synthesized by a MCU.
The unknown XR-2206 frequency signal would be input to the signal in pin 14 of the 4046. This signal would be square too, with 50% duty.
If I understand the datasheet well, putting a low pass filter at the output of the phase comparator I yields a triangle signal output, When both signals are of same frequency, the LP outputs a voltage proportional to the phase difference between signals, that is, a DC signal. let's call it 's'
Then it would be trivial to sample that signal at the MCU level and make an integrator, ex. sum over 100 samples of abs(s(t+1) - s(t)).
Then change slightly the XR-2206 signal frequency every 100 samples, until the integrator output is the lowest value attained.

Am I thinking this setup right ?
 

crutschow

Joined Mar 14, 2008
34,420
A possible difficulty is that phase-detector 1 gives a phase-lock, which requires very precise control of the frequency so, depending upon the precision of you XR-2206 frequency adjustment, the MCU may be continually hunting to correct the frequency.
Also the two frequencies have to be within the capture range of the circuit, which depends upon the low-pass filter value.
For a wide frequency range, that's problematic.

A better choice might be phase-detector 2 which has a capture range all the way to near zero Hz.
But that will still have a possible hunting problem, which will be a concern if you need the output frequency to be completely stable.
 

Thread Starter

rodv92

Joined May 23, 2011
11
A possible difficulty is that phase-detector 1 gives a phase-lock, which requires very precise control of the frequency so, depending upon the precision of you XR-2206 frequency adjustment, the MCU may be continually hunting to correct the frequency.
Also the two frequencies have to be within the capture range of the circuit, which depends upon the low-pass filter value.
For a wide frequency range, that's problematic.

A better choice might be phase-detector 2 which has a capture range all the way to near zero Hz.
But that will still have a possible hunting problem, which will be a concern if you need the output frequency to be completely stable.
Thank you for your reply. I will put it to practical test soon.
For reference the frequency range will be quite limited, in the audio range. from C3 (130 Hz) to C7 (2097 Hz)
I am using three digital potentiometers of the x9c series (100K, 10K 1K), each with 100 wiper steps. That gives me very fine control in the low frequency range. at the high end, my precision is down 2 to 3 Hz.
The XR-2206 does not exhibit any substantial frequency drift in my setup.
I'll check the output of this setup with my oscilloscope to have an idea first.
 

crutschow

Joined Mar 14, 2008
34,420
My concern is that, best case, the frequency will dither around the minimum frequency step of your pots.
If that's not a problem, then you are likely okay.

You frequency range is about 16:1 which could be a problem with phase-detector one.
Phase-detector 2 might work better.
 

Ian0

Joined Aug 7, 2020
9,809
See fig. 10 on the XR2206 datasheet - it has a frequency sweep input. Just connect it to the output of the phase comparator, and you have a proper phase-locked-loop which will adjust itself to the reference frequency.
 

DickCappels

Joined Aug 21, 2008
10,170
Are you familiar with any microcontrollers with on-chip counter/timers? That would give you something solid without many parts.

What you seem to be doing is making a tachometer of sorts. This is usually done with a frequency-to-voltage converter. Take and NE555 set up as an astable oscillator and pass the pulse though a low pass RC filter to make the pulse into a DC voltage is is proportional to the duty cycle of the pulse.
 

Ian0

Joined Aug 7, 2020
9,809
You’ve got all the components to make a complete phase locked loop: a reference frequency (from the MCU), a phase comparator (in the 4046, in fact, a choice of 3 phase comparators), and a voltage controlled oscillator ( because the XR2206 has a sweep input) . Why do you need anything else?
 

MisterBill2

Joined Jan 23, 2018
18,477
Now I am a bit confused because of the "comparing frequencies" instead of determining frequencies or measuring frequencies. If the purpose is to measure a frequency then there are a lot of schemes available, including both rate counters and period counters. If the intention is to generate frequencies there are quite a few methods available to create exact frequencies with setting resolutions to the 0.001 hertz.
And if the intention is to duplicate my invention of the automatic tuning system for a pipe organ then we need a private conversation.
Bob Pease published a number of frequency to voltage and voltage to frequency circuits that were FAR mor accurate and linear than what DC mentioned in post #7, but they are more complex.
So the big question is what you hope to achieve, which will determine what you need to create.
 

Ian0

Joined Aug 7, 2020
9,809
Now I am a bit confused because of the "comparing frequencies" instead of determining frequencies or measuring frequencies. If the purpose is to measure a frequency then there are a lot of schemes available, including both rate counters and period counters. If the intention is to generate frequencies there are quite a few methods available to create exact frequencies with setting resolutions to the 0.001 hertz.
Look back at the first post, the intention is to fine tune the XR2206 to match a reference frequency.
That needs a phase locked loop.
A phase locked loop consists of a phase compararator, an error amplifier and a voltage controlled oscillator.
The XR2206 is a voltage controlled oscillator.
 

MisterBill2

Joined Jan 23, 2018
18,477
How close to a match was not specified. The PLL goes to an exact match with a defined phase relationship. That is not likely to be reached with a manually adjusted oscillator circuit.
 

Ian0

Joined Aug 7, 2020
9,809
How close to a match was not specified. The PLL goes to an exact match with a defined phase relationship. That is not likely to be reached with a manually adjusted oscillator circuit.
But what’s the point of having it manually adjusted, when the PLL can do the job?
 

MisterBill2

Joined Jan 23, 2018
18,477
Upon reading the first 2 comments by the TS, it seems perhaps that the desire may be to either know or to duplicate a frequency. At that point a counter could do the job better, either counting events per time or time per event, depending on the frequency and the time available. Counting a ten megahertz clock would give the time to the tenth of a microsecond, which should be close enough to calculate the frequency accurately. And a ten megahertz oscillator can be adjusted against the NBS WWV signal at 10.000,000.000 megahertz. Close enogh for most uses.
 

MisterBill2

Joined Jan 23, 2018
18,477
OK, fine tune the oscillator of the XR-2206 relative to what? Manually adjusting it to be the same as the frequency synthesized by an MCU? A frequency counter system as I described in my post #13 could provide that.
Another option would be to feed the output of the phase-frequency detector on the CD4046 to an amplifier and then to a zero-center meter. When the meter stops at zero the frequency is the same.
And a very interesting option is to feed both frequencies into the two channels of a stereo amplifier.With the speakers fairly close it would be simple to tell when the frequencies were the same. AND the effect will be interesting as well.
 

Ian0

Joined Aug 7, 2020
9,809
OK, fine tune the oscillator of the XR-2206 relative to what? Manually adjusting it to be the same as the frequency synthesized by an MCU?
I am thinking of inputing a reference, known frequency PWM, 50% duty cycle signal to the comparator input, instead of the 4046 VCO signal. In my setup, this would be synthesized by a MCU.

The goal is to fine tune the XR-2206 automatically
Seems pretty clear to me. The MCU synthesises the reference, and the output is AUTOMATICALLY adjusted to match the reference.
He needs a phase locked loop.
 

MisterBill2

Joined Jan 23, 2018
18,477
Seems pretty clear to me. The MCU synthesises the reference, and the output is AUTOMATICALLY adjusted to match the reference.
He needs a phase locked loop.
Now I see why the need, and a PLL will not do the job because it only holds the frequency while the reference is present. So the need is to hold the frequency after the MCU has delivered it . An alternative would be to use a 16 or more bit D/A converter to tune the oscillator, and then latch that digital value so that the frequency would stay constant until the next one was required.
 
Top