Learn how to make your own arbitrary waveform generator using an ATmega328p, a DDS function generator IC, an op-amp, a few passives, and some hard work.

Having your own electronics laboratory at home is great—the only downside is that even basic equipment can be costly. Building your own devices is not only easier on your wallet, but it is also a great way to improve your knowledge. Therefore, in this article, I am going to explain how to build your own function generator.

### What is a function generator?

First, a function generator (also called a tone generator) is an electronic device that can output a specific waveform at a set frequency. For example, one could generate a sinusoidal signal at 60Hz. You can use it to test the inner workings of audio amplifiers, find the characteristic of op-amps and diodes, make funky noises—the list of applications goes on.

A DDS function generator is a digital arbitrary waveform generator, meaning it uses a digital-to-analog converter (DAC) to build a signal. It also has read only memory (ROM) where it stores amplitude values for specific waveforms at various time intervals based on a sampling frequency (Fs).

Let’s say we have a DDS signal generator with an 8-bit DAC and it outputs a sinusoidal signal at 100Hz with a sampling frequency of 800Hz. Because the Fs is eight times the frequency of the sine wave, an engineer or, more likely, a computer needs to extract from a real sine wave eight amplitude values from t = 0 to t = 2π. This amplitude interval is [0, 255] (1111 1111 in binary = 255), which corresponds to the interval [-1, 1] with a real sine wave. As a picture is worth a thousand words, below is a comparison between the real sine wave and the one outputted by our imaginary (and low-performance) DDS function generator.