Path: Home => AVR overview => Applications => DCF77 receivers => Superhet xtal filter
DCF77 receiver logo Applications of
AVR single chip controllers AT90S, ATtiny, ATmega and ATxmega
DCF77 superhet receiver with xtal filter

4 DCF77 superhet receiver with xtal filter

Those who want to have the Mercedes of a DCF77 receiver, home-brew themselves a superhet with a crystal filter! The DCF77 receiver RF signal (e. g. from a cross antenna) of 77.5 kHz is
  1. amplified in a pre-amp, then
  2. mixed with an oscillator signal to form a different frequency (here: 32.768 kHz), which is then
  3. filtered with an LC circuit and a crystal, after that
  4. amplified in an Intermediate Frequency (IF) amplifier, its output then
  5. is again filtered with an LC circuit and rectified in a two-diode stage as shown here with the generated DC filtered in an RC stage, and then
  6. the DC is measured, checked and decoded in an ATtiny45 controller, with time and date information serially transmitted to
  7. be received, decoded and displayed on an´LCD.
With that, you can be absolutely shure that no one besides you (and me, of course) has such a homebrewed Mercedes in its garage: it is unique and perfect.

4.1 Advantages of a superhet over any other concepts

Superhets are better than direct receivers because the Intermediate Frequency (IF) can be filtered with a small bandwidth (here: of a few Hz). So any interferences from other sources (random noise, strong RF from nearby short wave transmitters, from switching power supplies or switched power saving lamps as well as all other electromagnetic fields can be completely sorted out and eliminated. So it is possible to receive the DCF77 signal in a very far distance and in a noisy environment, where other receivers do not work.

As the IF amplifier works on a different frequency, the IF signal can be amplified without getting self-oscillation. This also makes it more sensitive than direct receiver concepts.

4.2 The superhet schematic

Schematic of the TCA440 superhet This is the schematic of the Mercedes.

The symmetric output signal from the cross antenna's FET buffer stage is fed into the pre-amplifier stage of a TCA440 on its pins 1 and 2. The gain reduction of the pre-amp stage on pin 3 is turned off. IF you are in the absolute near-field of DCF77 (say: less than 10 km) you can apply 1 or 2 V here to not drive the mixer stage into an overload.

On the oscillator pins 4 and 5 the oscillator signal of 77.5 + 32.768 = 110.268 kHz is supplied. This signal ois either generated in an LC circuit (by using the oscillator output signal on pin 6, see here) or with an xtal oscillator (see here).

The mixer products are filtered with a LC circuit made of a fixed coil of 15 mH and a capacitor of 1.5 nF. To filter the only product of interest, the 32.768 kHz, one or up to three 32kHz xtals follow. The properties of such a crystal filter are in detail shown here.

The output of the crystal filter is fed into one of the two symmetric input pins (pin 12) of the IF amplifier, with the other input on pin 13 being blocked to ground potential via a 1µF capacitor.

The emitter output of the IF amplifier on pin 7 is connected with a second LC combination with L=100µH and two parallel capacitors of 220 nF and 15 nF. The signal is then fed into a 2-diode rectifier and RC filter stage to yield the amplitude as DC. This is further measured and analyzed in a controller as described here. The superhet comes in two variations: with the oscillator signal
  1. produced by a LC combination, or
  2. with a crystal oscillator and rectangle-to-sine filter.

4.2.1 TCA440 with an LC oscillator circuit

LC oscillator for DCF77 superhet If you want to use the built-in oscillator in the TCA440 the following is necessary. Prepare an 18mm ferrite core with an AL value of 2,850 nH per winding2. The core can be trimmed with a screw or with the trim capacitor to 110.268 kHz. Use a frequency counter or the rectified DC to adjust.

4.2.2 TCA440 with an external oscillator

The following is rather experimental and only for hardcore experimentalists that love extraordinary solutions. It replaces the LC part of the oscillator and produces an exact crystal controlled oscillation signal. Let's start with some warnings, so that you can't argue you knew not what you're doing:
  1. My first approach was to clock an ATtiny25 with a crystal attached to the Xtal1 and Xtal2 pins, setting the CLKOUT fuse and to switch to a high frequency external oscillator.
  2. I realized that this only works with xtals from 14 MHz upwards. Xtals with lower frequencies do not work at all.
  3. With a 15MHz crystal the ATtiny25 works, but only at operating voltages below 4 V.
  4. At 3.3 V the oscillator clock of the ATtiny25 contaminates the operating voltage by a strong RF signal. It cannot be suppressed with 10 or 100nF ceramic capacitors. The 15MHz signal also is on the generated sine waves and is not reduced by the RC filters (which should be perfect filters for that high frequency).
  5. The 15MHz signal also contaminates the DCF77 signal of the cross antenna and cannot be filtered from there with normal means. Mixed and amplified, this signal overshoots any DCF77 RF, making it impossible to read the amplitude changes of DCF77.
It seems that such an ATtiny25 is a strong RF generator, contaminating anything in the area with strong stray signals. So better do not go this road but use a commercial crystal oscillator for 15 MHz. Concept using a crystal oscillator as basis

LC resonance circuits are slightly temperature sensitive, so that its frequency has to be adjusted from time to time. Under long term operation and with some aging of parts, this has some disadvantages. An alternative to the LC would be to generate the oscillator frequency from a xtal-controlled base frequency, by dividing that with a fixed rate.

Of course, there are no 110.268 or 44.732 kHz on the market. This solution here uses a xtal clocked AVR as a rectangle generator.

An AVR, here an ATtiny25, is clocked by an external xtal oscillator. Its timer/counter 0 works as a divider (in CTC mode), divides the clock frequency by a fixed rate and toggles the compare outputs A and B on compare match. By starting outputs A and B with different start conditions, it produces counter-phased rectangles. The rectangles are filtered with an RC network, that yields sine waves that can drive the TCA440's oscillator inputs with a symmetric sine wave signal. Selecting ´the crystal frequency

Digital dividers can only divide by integer values. Therefore the xtal frequency, divided by the divider, has to fit nearest to the desired TCA440 oscillator frequency. To find the nearest fit I have listed all available xtals in a spreadsheet and did some calculations with those.

In the table the higher (110.268 - 77.5 = 32.768 kHz as well as the lower (77.5 - 44.732 = 32.768 kHz are considered. The divider is calculated, the divider determined and the factually generated frequency f is as well as its absolute deviation in percent and in +/- Hz is listed. The table is available here as OpenOffice file.

The table holds a second sheet, listing xtal oscillators only. There are fewer, but also some frequencies that are not available as discrete xtal. The output of the crystal oscillator is connected to the ATtiny25's XTAL1 pin. The CLKOUT fuse can, but must not be activated. The calculation sheet "xtal_oscillator" lists that. In this mode the ATtiny25 can be operated with 5 V, the reduction of the operating voltage is unnecessary.

Please note that the divider toggles the OC0 pins, so that two toggles are necessary for one wave. The frequency therefore is half of the compare value (+1).

77.5 + 32.768 = 110.268 kHz77.5 – 32.768 = 44.732 kHz
Dividerf is
Dividerf is

When mixing the 77.5 kHz input signal with the higher frequency (+32.768  = 110.268 kHz) the 15 MHz xtal has the smallest deviation (0.02%, +26.1 Hz). The crystals 5.0688 and 6.4 MHz deviate by 0.07% or 77 Hz and the xtal 4.194304 MHz by 0.1% or 108 Hz. When mixing with the lower frequency (77.5 - 32.768 = 44.732 kHz) the 9.216 MHz- crystal fits best, with 0.01% or 5.9 Hz deviation.

When mixing with 44.732 kHz the first harmonic (89.46 Hz) is in the wider range of the input frequency. Therefore interferences cannot be excluded, therefore the 15 MHz xtal was chosen. This deviates by 26.1 Hz upwards. Operating voltage dependancy of the frequency

Frequency of the xtal at different operating voltages When using a discrete xtal with 15 MHz plus two 18 pF capacitors an operating voltage dependent frequency results, see the graph. In principle, the xtal frequency should rather be 14.996.448 MHz to fit better to the input frequency. At higher operating voltages the deviation even increases. But the differences are more of an academic nature. Rectangles to sine waves

Any ATtiny has an 8-bit counter/timer with OC0A and OC0B output. The two pins can generate a symmetric output signal: OC0B generates the opposite signal by starting with a high instead of a low port-bit. So, the oscillator signal can be fed symmetrically to the oscillator input of the TCA440.

On both outputs, OC0A and OC0B, rectangular signals are made. Using those rectangles for mixing would have adverse consequences, as rectangles consist of all uneven harmonics of the base frequency. It is better if those harmonics are filtered off by use of a three stage RC network.

The calculation spreadsheet OpenOffice file here has a sheet named "Oscillator_coupling", where I played with different RC combinations. To have a large-enough signal the filter should not damp the base frequency too much, but the third (and beyond) harmonic.

To limit the number of components three RC filter stages have been combined. Finally I selected a combination of 1kΩ and 2.2nF. The loss of amplitude is limited and the harmonics are well suppressed with that.

Rectangle-to-Sine wave conversion This displays the filter effect of the three stages, as calculated with the spreadsheet.

The first stage (V(C1), blue curve) still is nearly fully reaching the operating voltage limits. In the second stage (V(C2), the red curve) the amplitude swing is smaller and the form is nearer to a sine wave. In the third stage (V(C3), green curve) the amplitude loss is lower and the wave is a nearly perfect sine.

Displayed here is only one signal, the second is reversed. With that mixing can be made. The schematic with a discrete crystal

Schematic of a 110kHz oscillator with a discrete crystal The schematic is rather simple: the timer outputs OC0A and OC0B generate the reversely clocked rectangle of 110.294 kHz, to be filtered in three RC stages. The oscillator inputs on pin 4 and 5 of the TCA440 receive that signal.

The reset input of the ATtiny25 are, via a resistor of 10 kΩ, tied to the operating voltage of 3.3 V. The xtal of 15 MHz is connected to the XTAL inputs, each with a capacitor of 18 pF to GND.

In practice, the xtal didn't swing above an operating voltage of 4 V. Even did not resolve that problem. The operating voltage was therefore reduced with a resistor, a Zener diode and an electrolytic capacitor to suppress Zener random noise. In addition I realized that removing the standard CMOS ceramic capacitor on the supply pin increased swinging of the xtal. Mounting of this capacitor directly to VCC completely shut down swinging. Starting swinging was increased by delaying reset with a small electrolytic capacitor. With all that measures the oscillation is reliable, but small signals on the supply line can still stop oscillation.

I call this unbelievable behavior "reverse BOD level effect". Reversed because applying more than 4V stops oscillation. The schematic with an integrated xtal oscillator

Schematic of an integrated xtal oscillator for the 110kHz oscillator This is the schematic using an integrated crystal oscillator. That works at 5 V operating voltage and does not have any other limitations like above described. Even though this type of xtal oscillators produce a horrible rectangular signal (anything else than a steap up and down), it works perfect with an ATtiny25.

Oscillogram of the generated sine waves These are the two sine waves of the two generated signals. Looks clean. Software for the ATtiny25

The software for the ATtiny25 consists of a few lines assembler:
  1. The two output pins OC0A and OC0B are configured as outputs.
  2. The port register of OC0A is cleared, the one for OC0B is set to one (reversed signal)./li>
  3. Both compare values are set to the divider factor (divider minus 1).
  4. In the control port TCCR0A of timer TC0 the CTC mode is set and both output pins are defined to toggle on compare match.
  5. In control port TCCR0B the timer is started with a prescaler value of 1.
  6. The sleep mode of the controller is set to idle mode, the SLEEP instruction is executed and the controller is not needed any further.
The source code is listed here and can be downloaded in assembler format here.

; *********************************
; * Xtal oscillator for TCA440    *
; * 15 MHz ==> (77.5+32.768 kHz)  *
; * (C)2019 by DG4FAC             *
; *********************************
.include "" ; Define device ATtiny25
; **********************************
;     H A R D W A R E
; **********************************
; Device: ATtiny25, Package: 8-pin-PDIP_SOIC
;            _________
;         1 /         |8
; RESET o--|RESET  VCC|--o +5 V
; XTAL1 o--|PB3    PB2|--o
; XTAL2 o--|PB4    PB1|--o Osc out -
;   0 V o--|GND    PB0|--o Osc out +
;         4|__________|5
; **********************************
;   F I X E D   C O N S T A N T S
; **********************************
.equ clock = 15000000 ; 15 MHz
.equ fosc = 77500+32768 ; Added
.equ divider = (clock+fosc)/(fosc*2)
.equ cCtc = divider - 1 ; CTC value
; **********************************
;        R E G I S T E R S
; **********************************
.def rmp = R16 ; Multipurpose register
; **********************************
;  M A I N   P R O G R A M   I N I T
; **********************************
.org 000000
  sbi DDRB,DDB0 ; PB0 direction output
  cbi PORTB,PORTB0 ; Clear OC0A output
  sbi DDRB,DDB1 ; PB1 direction output
  sbi PORTB,PORTB1 ; Set OC0B output 
  ldi rmp,cCtc ; Write CTC value
  out OCR0A,rmp ; to compare register A
  out OCR0B,rmp ; and B
  ldi rmp,(1<<WGM01)|(1<<COM0A0)|(1<<COM0B0) ; CTC mode, toggle OC0A
  out TCCR0A,rmp ; in TC0 control port A
  ldi rmp,(1<<CS00) ; Prescaler = 1
  out TCCR0B,rmp ; in TC0 control port B
  ldi rmp,1<<SE ; Sleep enable, idle mode
  out MCUCR,rmp
  sleep ; Go to sleep
  rjmp loop
; End of source code Fuses of the ATtiny25

Prior to or after programming the flash the fuses of the ATtiny25 have to be set to work with the external xtal or xtal oscillator. The following fuses have to be set with a discrete crystal:
  1. CLKOUT has to be enabled.
  2. CLKDIV8 has to be disabled.
  3. The clock frequency has to be set to an external oscillator of more than 8 MHz.
The listed row has to be followed in any case, otherwise you risk to end with a chip that cannot be programmed in ISP mode any more.

When using an external integrated xtal oscillator, setting the CLKOUT fuse can be omitted, but the CLKDIV8 fuse and the oscillator setting changes have to be made accordingly. Mounting the xtal sine wave generator

Oscillator on the breadboard This is the sine wave generator on a breadboard, here with a discrete crystal. The six capacitors right to the ATtiny25 form the three RC networks for sine wave filtering.

Oscillator with integrated xtal oscillator on a breadboard This is the version with the integrated xtal oscillator.

4.2.3 Mounting the superhet

The superhet on the breadboard That is how the capacitor and xtal grave looks alike on a breadboard, here with a LC oscillator.

To the left the buffer stage with the FET can be seen (the antenna can not be seen). The frequency of the input stage can be adjusted with the left trim resistor. Then the TCA440 with the oscillator coils follow. Above to the right the three tiny crystals and the 1µF grave can be seen. On the lower part the three 470 µF capacitors of the rectifier can be seen. The trim resistor to the right regulates the gain of the IF amplifier.

4.3 The xtal filter for 32.768 kHz

Measuring the passband curve of 32.768kHz crystals To measure the filter properties of 32.768kHz crystals, one can use this oscillator. It generates a 32kHz sine wave signal with an adjustable frequency. The adjustment is made with Medium Wave varactor diodes, for which a BB212 or a variable capacitor for medium wave can also be used.

The crystal is fed with the low-resistance signal output of the sine wave generator and has an output resistor of 1kΩ.

Filter pass band curve of one 32.768kHz crystal This is the resulting pass-band curve. It is less than 10 Hz wide, especially the falling edge is rather steep.

When measuring slightly above the resonance frequency a moderate feedback on the oscillator took over control, so one single data point showed an unexpected value.

Remarkable is that the selectivity far from the resonance is rather limited. This is caused by the stray capacity of the crystal. Therefore the crystal filter shall always be combined with an LC filter, to reduce frequencies far from the xtal resonance.

4.4 Automatic control of the DCF77 signals

The gain control as well as the frequency adjustment can, for test purposes, be adjusted with resistor trimmers. A usual trim potentiometer with 270° is sufficient.

More comfortable is when a micro-controller does that work. Measuring, adjusting and control of the AGC and AFC can be done with an ATtiny45, as shown here in detail.

©2019 by