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, RuntimeMicro.com // 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); TCNT2=0x0; // 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.
Here you can see the mess of wires that was used to get the
signal from the generator and split it to both the scope and
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.
- online AVR PWM calculator
- Downloadable pretty AVR PWM calculator
- Secrets of Arduino PWM
Arduino PWM library- updated copy on GitHub
- [original thread about the PWM library](https://forum.arduino.cc/index.php?topic=117425.0]
- Fourier analysis of PWM Duty cycle
- Arduino Timers explained
Step 2: AM Modulation
For the next step of tuning/aligning a superheterodyne AM receiver, we need a 540kHz and 1600kHz IF carrier waves with audio range amplitude modulation (AM) - say 1kHz so we can easily hear it.
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!
First we compared two different Arduino’s to see how close the clocks would be between two different boards.
One generated a frequency of 444.37kHz and the other one generated 444.25kHz. The percentage difference is (444.37 - 444.25)/444.37 *100 = 0.03% difference- which is very small!
This is the circuit we created:
We tried to add a low pass filter to convert the square wave to a sine wave.
We got a triangle wave with some noise:
From previous observations we know the radio under test will filter the input anyway so we decided to not use this low pass filter- it’s adding a lot of noise.
And this is the final output from our FET based mixer:
There is minimal modulation.
Power FETs are not good at doing amplification!
We tried to use this but it didn’t work out very well.
We are going to try and borrow an RF test signal generator.