Digital Frequency Generator

This project is to create a digital frequency generator.

The first goal is to use it to create the 455KHz IF frequency for tuning a superheterodyne AM Radio.

Step 1: 455KHz IF Generation

  • use Arduino to create 455KHz square wave carrier
    • analog circuitry will filter the harmonics, will mostly see the 455KHz fundamental

Code for 455khz IF

// RTM_TimerCalc 1.20,
// Timer-2 Mode_7_8Bit_Fast_TOP_is_OCRa

TCCR2B = 0x08; // 0000 1000, Disable Timer Clock 
TCCR2A = 0x63; // 0110 0011

OCR2A = 35-1; // Low PWM Resolution > 1% step-size 
OCR2B = (byte) (OCR2A * 0.49);

// UnComment following lines for UNO-NANO Timer-2 Pins 
// pinMode(11, OUTPUT); // OC2a
// pinMode(3, OUTPUT); // OC2b

// UnComment following lines for 2560 Timer-2 Pins 
// pinMode(10, OUTPUT); // OC2a
// pinMode(9, OUTPUT); // OC2b

TCCR2B |= 1; // Prescale=1, Enable Timer Clock

Generated using runtime micro’s pwm generator.
Used the generated code almost as is, needed to change a value, due to some error in the clock frequency. We used a capacitor to AC couple the output to the radio.

We then used the signal and an oscilloscope to tune the IF amplifiers.


This shows the output of the first and second stage filters, tuned to output the maximum amplitude of the 444kHz input carrier. The AC coupling capacitor used is also acting as a low-pass filter. It’s converting the square wave output from the Arduino into a sine wave.


Step 2: AM Modulation

For the next step of tuning/aligning a superheterodyne AM receiver, we need a 533kHz (??) IF carrier generator with an AM signal.

We can do that with the Arduino circuit from Step 1, a separate 1kHz audio signal, and a circuit to combine the two with amplitude modulation.

A simple way of doing that is to use a transistor: use the 1kHz signal to control the gain, and the carrier as the controlled voltage!


References for Later Stages