Path: Home => AVR-EN => Applications => DCF77 clock ATmega16 => => DCF77 AM receiver => Crystal oscillator   >Diese Seite in Deutsch:
 Applications of AVR Single chip controllers AT90S, ATtiny, ATmega and ATxmega Xtal oscillator for DCF77 clock with ATmega16

# A crystal oscillator for the DCF77 AM Superhet Receiver

Please note that this is un-tested.

## 1 Why and for what a crystal oscillator?

The receiver, as described, uses an TCA440 to generate and mix an oscillator frequency of (455 + 77.5 kHz) with the reception frequency of 77.5 kHz to yield the intermediate frequency of 455 kHz. The original design uses a trimmed coil and a fixed capacitor to generate this oscillator frequency. It is clear that this concept is depending from ambient temperatures as both the coil and the capacitor are both depending from those temperatures. Reception field strength varied in my longterm observation by a factor of roughly two between summer and winter (hot and cold weather).

I therefore thought about deriving this frequency from a more temperature- stable crystal oscillator. Unfortunately 532.5kHz crystals are not available in stores. So one has to pick a higher frequency crystal and divide it down to 532.5 kHz (or 377.5 kHz).

## 2 Selecting the crystal frequency

To be able to select the optimal frequency of the crystal I have generated a LibreOffice Calc sheet here
• with all commercially available crystal frequencies as well as oscillators,
• derived the nearest integer divider to yield the nearest frquency for 532.5 and 377.5 kHz,
• calculated the difference between those two frequencies and the divided frequency.

These are the discrete crystals that fit best (in red on green background). The differences of 833 or 592 Hz are insignificant, the ferrite circuit on the input stage is by far broader.

These are the commercially available crystal oscillators. The differences are also below one kHz for the 14.31 and the 16.00 MHz oscillator.

Both, a discrete crystal or a crystal oscillator can be used for that purpose.

## 3 The controller ATtiny25 for that purpose

Dividing can either be done with a TTL-Divide-by-N counter (old school) or with a microcontroller, here an ATtiny25 is used for that purpose. This has more than one advantage:
1. it comes in a small-size 8-pin-package,
2. it has a much smaller operating current than most TTL, LS-TTL or HCT-TTL devices,
3. it can divide by any number between 1 and 256,
4. a crystal oscillator is already on board, just change a fuse,
5. it can easily be programmed to generate the normal and the reversed signal, to generate positive and negative symmetric signals.
Of course, you'll have to be able to program the ATtiny25.

Dividing is done with the 8-bit-timer/counter TC0. This TC is set to CTC mode (Clear Timer on Compare), the divider value minus one is written to both compare registers. The OC0A- and OC0B-output pins are defined as outputs by setting their direction bits and are set to toggle on compare match by setting their COM bits accordingly. The output port either of 0C0A or OC0B is set while the other is cleared. That produces a inverted output signal. The TC0 is then started with the prescaler of one.

When programming the ATtiny25 do not forget to alter the fuse (select external crystal oscillator with high frequency).

## 4 Forming sine waves from rectangles

The ATtiny25 now produces two inverted signals on its OC0A- and OC0B- pins as rectangles. As the TCA440 needs sine waves for mixing, the rectangles have to be shaped as sine waves. This is done with a four-stage RC network.

By using the RC network calculator here, chapter 4, I found that four R=3k3 and C=100p at 378 kHz produce clean sines with enough amplitude to drive the TCA440's oscillator input pins.

## 5 Schematic of the oscillator

This is it. It releaves you completely from re-adjusting the oscillator frequency of the TCA440.

Please be aware that I have not tested this intensively yet.

Praise, error reports, scolding and spam please via the comment page to me.