452

This project is about a frequency standard, reaching ±8 10E-9

This project is about a frequency standard, reaching ±8 10E-9 relative stability today, with simple circuit and cheap components.

Latest development (as of Jan 24th, 2015)

I finally decided to use a microcontroller to get a better stability. Implementing with success a high pass and low pass filters of the VCO control voltage with specific moving averages. Programmed in assembly language on a PIC16F876A. It works very well with a stable output after a few minutes of oscillations. But I am still working on understand how it works….

Summary of performances obtained

·       Output standard:
o   Frequency = 162 kHz
o   Period = 6.172 839 506… microseconds (μsec)
·       Stability with 0.1 second integration (measured with HP 5385A):
o   Period stability measured:             ΔT= ±0.5*10E-8 μsec
o   Frequency stability deducted:         ΔF= ±0.0013 Hertz
o   Relative stability:                           ΔT/T=ΔF/F= ±8*10E-9
o   Which translates into the following range on the counter:
§  T between 6.172 839 46 μsec and 6.172 839 56 μsec
§  F between 161 999,9987 Hz and 162 000.0013 Hz

The device is hence suitable to calibrate a counter with up to 8 digits display with an accuracy of ±1 digit.

Approach

Three main options - providing high accuracy frequency standards - appear to be accessible to the hobbyist:

1/ Cesium or Rubidium stabilized frequency standards
(short term relative stability of about 10E-11)
2/Oscillator disciplined by a GPS clock
(short term relative stability of 10E-9 to 10E-12 depending on the type of oscillator)
3/ Oscillator disciplined by the carrier of long wave broadcasting stations (can we do better than 10E-9?)

The (ir)rationale for my preference for solution 3/ is the following:

- Solution 1 provides a very stable reference and affordable devices can be found either on the used market or from Chinese vendors….  But this is not fun, you just have to buy it and there is nothing else to do for the “do-it-yourselfer”…

- Solution 2 provides a very stable signal but it requires an external antenna and involves too much of high tech equipment to my own taste. GPS technology is quite advanced but it’s a black box.

- Solution 3 is (a priori) less accurate than the two previous ones but one can build it from scratch with cheap components and reach a reasonably good understanding and control of what happens at each and every step. It works almost everywhere in the country, works indoors with a simple ferromagnetic antenna, and is wonderfully tricky to understand, make work and optimize. Perfect combination!

The approach consists of isolating the carrier of a stabilized radio broadcasting signal. Several countries still use today Long Wave radio stations to broadcast either music or time signals, or both. Such stations are also part of emergency response networks. The interest with long waves (kilometer length, example with 162kHz: λ = c/F = 3 * 10-8  / 162khz = 1852 m) is that they propagate by “ground effect” which provides a very long range (thousands of km) from only one broadcasting station.

Living in Paris, France, I naturally choose the France Inter station located in central country at Allouis (Cher), using a 162kHz carrier with 2MW power. The carrier is stabilized with a Cesium reference providing an initial relative stabilization figure of 10E-12 which means that the frequency is 162 000.000 000 0 Hertz, with a precision of +/- 0.000 000 081 Hertz. Naturally there are a number of perturbations on the path that degrade this precision when the wave reaches the antenna.

However, the big challenge is that the 162kHz carrier signal is (unfortunately) heavily modulated both in amplitude (with the France Inter radio programs broadcasting) and in phase (with the time signal for AMDS). So there is quite some work to do to recover the pure 162kHz carrier…

Implementation principles
The processing steps of the current prototype are described hereafter. The configuration presented is the result of a combination of ideas that I gathered from several source, many trials and naturally many errors.  

1) The first step is to receive the radio signal and to amplify it
The antenna is composed of a ferromagnetic rod with coil and capacitor forming a resonating circuit, tuned at 162kHz. Then a first JFET transistor picks this faint signal, further filters it with an IF transformer (tuned at 162kHz) and amplifies it to about 30 millivolts. Finding the antenna rod, building the special coil and tuning it appropriately were already quite “interesting”. Another challenge was to find the appropriate transformer (intermediate frequency TR found in vintage radio receivers). This kind of RF technology is not much in use anymore.

Next challenge was to adjust the gain while avoiding self-oscillations… indeed these direct receiving assemblies love to oscillate, and when you feel happy to see a loud and clear signal on the scope, it may well mean that the amplified output is actually being re-captured by the antenna leading to auto-oscillation. You have to carefully understand what is going-on, and a lot of things can indeed go wrong… very "interesting"….

2) The second step is to get rid of the amplitude modulation.
A second amplifier pumps the signal up to 300mV which simply eliminates the amplitude modulation through saturation. A nice square signal appears on the scope but…. with a furious back and forth “dancing” due to the phase modulation (as can be seen on Pictures 1 and 3). Indeed the modulation is quite deep:

•       Phase modulation is triangular, peaking at +1 radian and -1 radian at a rate of 40rads/sec
•       This translates to +/- 1rad * 360/2*PI = +/- 57 degrees modulation, or 6.17 μsec  * 1/2PI = 0.98 μsec
•       Not very far from 90° which triggers the phase comparator (as discussed later)

I really wondered how to get anything stable from this awfully jittered signal!....

It’s important to notice that the broadcasting station stops the phase modulation of the signal for just one second, during the 59th second. It is then possible to watch the “pure” wave during that second. But this one second signal is unfortunately still not exempt from jitter. I measured a remaining jitter of about 100nsec (which corresponds to 1300Hertz). A better stability should be achievable through strong filtering, but the incoming wave is indeed quite noisy….

3) This is where the magic of the phase locked loop comes to play! The principle is to compare the average phase of the radio signal with that of a reference oscillator. Such local oscillator operates close to the 162kHz target and is slightly adjustable (Variable Frequency Oscillator or VCO), as per Picture 2. 

The input signal (Fin) is sent to the phase detector whose output is proportional to the phase difference between the feedback path (Fout) and input signal. The output of the phase detector is then low-pass filtered by the loop filter. The output of the loop filter drives the control voltage of the VCO. If the VCO frequency is too high, the low-pass phase detector output goes low, which reduces the VCO control voltage and hence the VCO frequency. In this manner, the VCO is forced to settle on a value that matches the long-term average of the input frequency fin. Of course, as this is a closed loop, the appropriate compromise between accuracy and stability needs to be found. 

And as the phase coding of the France Inter signal is symmetric, which means that negative phase shifts are exactly compensated by positive phase shifts, after appropriate integration time the average phase shift of Fout should be zero.

4) Optimizing the VCO
To implement a PLL one thinks at the popular 4046 component family. But the 4046’s built-in oscillator is deceiving. The output frequency is still polluted by a significant jitter, which is not welcomed for a frequency standard. One solution is to use a Crystal disciplined oscillator with the possibility to slightly “pull” the frequency through Varicap (or Varactor) diodes for the VCO function.

The problem however is to find a crystal tuned exactly on 162kHz (still looking for it!) and the “pulling” range of such crystals is very limited (a few tens of Hertz), so I looked for crystal with frequency multiples of 162kHz and was fortunate to find one with a nominal frequency equal to 32 times 162kHz = 5,184MHz. After dividing the 5,184MHz by 32 the trick was to try to “lock” the PLL loop exactly on 162kHz… The locking range being very narrow, due to the low gain of the loop and small pulling range of the VCO.

After many tests and trials, I was able to make it work with the XOR phase comparator of the CD4046 and a long time constant for the loop filter (RC = 70sec). Through fine and patient adjustment of the oscillator “pulling” in order to force the PLL into its locking range, I could stabilize on a scope the incoming radio signal to “dance” around the Pi/2 position of the VCO signal (the PC1, XOR gate phase comparator leads to lock at 90° from the input signal) and it would stay locked there forever, the readout on the frequency counter remaining stable for days.

5) Optimizing the PLL loop filter
However… actually… the output frequency was not that stable. It was just OK on short term, but with significant high frequency ripple plus a nasty very low frequency oscillation (1 Hertz or less) around the target value. This low frequency jitter is probably due to instability of the PLL loop. This was not acceptable and far from reaching desired stability level…  

So I tried lots of things, red many articles, visited many countries full of loops, poles and zeroes…. And found a first trick!

I was able (as of May 30th 2014) to reduce the high and low frequency jitters quite efficiently, and reach a period measurement stability of better 2*10E-7 μsec on the counter (HP 5385A), with a 0.1sec integration time.

Note: period measurement is more accurate than frequency measurement when the frequency to count is lower than that of the counter’s reference, (which is 10Mhz with the HP 5385A).

Details of the maths are as follows:

•   ΔTn(0.1) = 1*10E-7 μsec (integration time window of 0.1 second)
•   F = 162 000 Hertz then T = 1/F = 1/162 000 seconds
•   0.1 seconds corresponds to n = 0.1/T = 0.1*F = 16 200 periods
•   Integrating measurements over n periods leads to reduce the jitter by √n = √16 200 = 127.3
•   The stability for one period is then ΔT = √n ΔTn =√n*10E-7 = 127* 10E-7 = 1,27*10E-5 μsec
•   Hence the relative stability is ΔT/T = ΔF/F  = ΔT*F = 1,27*10E-5*10E-6*1,62*10E+5 = 1,27*1,62*10E-6 = 2,05 * 10E-6
•   Which means ±1*10-6 relative stability
•   and ΔF = F*F*ΔT = 0,33 Hertz => ±0,16 Hertz absolute stability

6) Low ripple Phase Comparator and filter

Tentative rationale to present the “trick” I found to reduce the ripple:

1.The type1, PC1, XOR gate comparator is inherently noisy, generating ripple in the voltage control of the VCO because it is constantly oscillating between +Vcc and 0 at twice the incoming frequency. Even when the PLL is locked. Whatever the filter is added behind PC1, it is difficult to completely damp such oscillations to avoid transferring ripple to the control voltage of the VCO.

2.So a better approach would be to reduce/suppress the ripple itself at the source.  

3.One can notice that the range of VCO voltage control does not need to be very large because we only have to adjust for the small variations of the 162kHz center frequency of the crystal oscillator. Such small adjustments are needed to compensate for thermal drift mainly. So there is no need for the comparator output signal to swing between 0 and Vcc. We could limit the swing to a much closer range around VF0 (with VF0 = control voltage of the VCO that corresponds to F0=162kHZ). And limiting the initial swing reduces the ripple that propagates through the filters.

4.This leads to the idea of a phase comparator that would provide a signal similar to that of the PC1 - XOR - Type1, but oscillating only between Vlow and Vhigh, centered on Vf0. The amplitude of (Vhigh-Vlow) being just large enough to compensate for the long term drifts of the crystal oscillator. This can be done with an additional op amp. But… there is a simpler solution… 

5.The PC2 “charge pump” PDF phase comparator of the 4046 family is attractive because it provides long periods of “calm” - when in high impedance state - between the “up” and the “down” pulses. While in this high impedance state, the VCO voltage control signal is not polluted and one can reach the ultimate: the pure nature of the crystal oscillator signal! However the pulses are still quite “aggressive” when they occur, they induce ripple in on the control voltage, difficult to damp. Moreover, due to the large phase shift, even when locked, signal crossing the PI/2 line either on the “up” or the “down” side is unavoidable.

6.Now, when adding two resistors to the charge pump output - one to the Vcc and one to the ground - we can fix the voltage level of the high impedance state to any value between 0 and Vcc. It is then possible to fix it close to Vf0 and Vcc (or to the ground) in order to reduce the swing of the VCO control signal, while of course tuning the useful VCO range in correspondence.

7.In conclusion, we transform the current source of the PDF charge pump to a voltage source, We create a low swing voltage phase comparator output that is comparable to that of PC1 (leading to 90° locking) with “smoother” pulses than those of the PC1 XOR gate.

8.Further smoothening of the signal is provided with traditional filters (resistors + inductor and capacitors).

Picture 3 shows the result. The bottom trace is the clean 162kHz output signal. The middle trace is the incoming signal where the furious jitter can be noticed. The top trace is the output of the modified PC2 comparator .One can notice that the swing is reduced with an amplitude of less than one volt.

Locking is quite tricky (fine tuning of the VCO adjustable capacitor and the filter parameters), but once locked, the PLL stays there.

 

7) Latest Enhancement, filtering with a micro-controller

The purely analog prototype was still not exempt of very low frequency oscillations of the output signal and was also not reliable a start-up (sometimes the PLL would not lock). I decided - at last - to go digital for the filter. Digital filtering provides more possibilities than analog.

One thing that became clear… after a while… is that the traditional low pass filters on the VCO control signal is NOT enough. Low pass filters don’t damp low frequencies (and that is indeed not really what they are supposed to do best…). So the idea was to find in a combination of low pass (to suppress the comparator high frequency signal) and high pass filter (to dampen the very low oscillations).

As I wanted to stay in the low cost approach, I decided to use a popular PIC micro (PIC16F876A) and to program it in assembly language. This further limits the ability to implement efficient digital filters. Except with moving averages, easy to implement and quite efficient especially with integers. Within this family the champion is the “exponential moving average” that is simple and easy to implement with very limited memorisation of the samples.

The general equation of an exponential moving average filter is the following:

Yk = a*Xk + (1-a)*Yk-1 (1)

Where Xk is the input of the filter and YK the output at T+k sample time and with a<1. When using powers of 2 for a (such as a=(1/2n)), one can implement very fast and simple integer multiplications through bit shifting.

Form (1) provides a first order Low Pass Filter, exactly equivalent to the traditional Resistor + Capacitor analog filter. Can we build a high pass filter with the same moving average implementation simplicity? I tried many different approaches, and found that the following equation works pretty well:

Yk = -a*Xk  -(1-a)*Yk-1 (2)

It is built by just inverting the coefficients of (1) and does not seem to have a clear analog equivalent.

The Bode plot indicates that (2) is an “aggressive” high pass which should be unstable in close loop… But it actually works well and helped me to finally find an efficient solution to damp this $#@&§!$$£% low frequency ripple!

I developed simulations on Excel and believe I found a bit of understanding of why it works… but it is still not very clear.

 

Have the limits been reached…?  
More soon.

Gilles.