The circuit is based on the
AD9850 DDS Module which is available
from various sources such as eBay, Banggood, etc. Although it claims to operate up to 40 MHz, I found the output voltage started to drop off
at about 2.6 MHz - both the 50 MHz digital 'scope and the 20 MHz analogue 'scope showed identical results. Therefore, I've limited the
available frequency range from 10 Hz to 10 MHz in the software.
The desired frequency is set in the AD9850 module by clocking data to its DATA pin. The ATmega328 digital pins D5, D6, D7 and D8
connect to the AD9850 module's pins RESET, DATA, FQ_UD and W_CLK respectively. "In phase" sine and square wave outputs
are available from the AD9850 module pins 10 and 7. The square wave's duty cycle is adjusted with a pre-set potentiometer on the module
itself. I did consider removing the pot and using a panel-mounted one instead but I decided against it for this simple project. I just
adjusted the pot for a 50% duty cycle (ie equal mark-space ratio) and left it at that.
Over the 10 Hz to 2.5 MHz frequency range, the peak-to-peak sinewave output is consistent at about 1.08 volts. The square wave is around 5 volts peak-to-peak.
An interrupt-driven rotary encoder, connected to the ATmega328 interrupt pins (D2 and D3), adjusts the frequency between 10 Hz and 10 MHz in pre-set steps. Pushing
the rotary encoder's button (connected to D4) resets the frequency to 1 kHz.
are set with a second rotary encoder (not interrupt-driven) connected to ATmega328 pins A2 and A3.
are determined in software - I've set them to 1 Hz, 10 Hz, 50 Hz, 100 Hz, 500 Hz, 1 kHz, 2.5 kHz, 5 kHz, 10 kHz, 100 kHz and 500 kHz. Pushing the encoder's button -
connected to A4 - resets the step to 1 Hz.
The 1.8" TFT display connects to the ATmega328 pins A1, A0, D13, D12, D11 and D10. D10 to D13 are the
ATmega328's SPI pins and the software uses an Adafruit library. Pin D9 connects to the display's LED pin via a 100 ohm
resistor. D9 is a PWM pin so the display's backlight brightness can be adjusted if desired. I've set it in software to '255' -ie
There are some very similar 1.8" TFT displays available - the one I used has an ST7735 controller IC. Some of the other displays use a different
controller (and different Adafruit library) and - not provided for in the PCB layout - require 1k series resistors in each IO lead.
I've used a 5 volts 1.5A regulator in the power supply section. With a 12v DC input, the regulator does run slightly warm so I fitted it with
a small heatsink. I included a jumpered link in the PCB design so an on/off switch could easily be added.
The two rotary encoders are soldered to the small front-panel-mounted PCB with the track side up. The encoders I used had metal bases so I slipped
a piece of thin insulation under them.