Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Programmable waveform generator

Not open for further replies.


Member level 3
Nov 9, 2013
Reaction score
Trophy points
Activity points

I need a programmable waveform generator to use in my circuit, I need to generate square wave and sine wave and also sum of several (up to 5) sine waves. It should be adjustable and I need these specifications:

Frequency range: 20Hz-20KHz
Amlitude range: 1mv-2v

I found some ICs as like as AD9850 or AD9833 but I cannot understand how I can control its amplitude and also is it possible to add several sine waves in this ICs.

I would appreciate if anyone can help me.


DDS waveform generators like the mentioned ADI chips are not able to produce more than one sine frequency at a time. Other waveforms like square wave, sawtooth or triangle are supported by some devices. If you say sum of multiple sine wave, do you mean integer frequency ratios (e.g. fundamental and harmonics) or arbitrary frequency ratio. In the latter case, the signal can't be even generated by a memory based arbitrary function generator because the waveform period may be infinite (no common frequency factor).
Falstad's animated interactive simulator (latest version) produces audio output of waveforms.

Below is the circuit I drew. Running the simulation lets me hear sound through my boom box. You can get the same thing right away on your computer.

Sliders adjust amplitude and frequency.
Right-click on Audio Output to select a duration for the sound to play (say 5 seconds). Wait a minute to let the buffer store digitized audio. Then click Play Audio to hear it for your desired length of time.

You can also open a digitized audio file on disk. I find I can now use Falstad's to experiment with PWM processing including class D amplification and filtering.

3 waveforms adjust V & F mixed to audio output (Falstad).png

I guess a simple DSP like ADAUb1701 could do this easily and cheap.
Simple graphical programming interface. No code writing.

There are some examples of 'arbitrary waveform generators' that use the RPi Pico (more correctly the RP2040). I've also written something like this myself.
In simple terms, knowing the sampling frequency, you create a buffer in memory, insert whatever values you want for the waveform and then pass them out via a GPIO port (or pins) into some form a DAC.
You can use whatever equations you like to generate the samples, adding however many frequencies you like. The only thing to watch is the buffer needs to be long enough so that the waveform is continuous when you cycle from the end of the buffer back to the beginning.
I used DMA to move the samples from the buffer to the PIO that did a little manipulation and put the values on the GPIO pins. I also used a R-2R ladder as the DAC (no timing required) and then a small buffer op-amp.
In my case I programmed sine, square (more exactly a frequency with a variable mark-space ratio and the ability to slope the sides that could make a saw-tooth or triangle wave etc.), sinc, gaussian and random noise waveforms. I also had a simple AM and FM modulation system, 35kHz to 45kHz (default but variable) sweep oscillator (for testing ultrasonic filters) and finally an ECG simulator (using either a simulated ECG or a measured sample of one of my heartbeats).
You can use this principle for just about any 'arbitrary' waveform you want, just remembering the sample rate and value range can be a little limiting (I used 8-bit samples, and with a 64-sample buffer could get about 3MHz sine wave from my arrangement, the FM could only give me a 1kHz modulation a 1MHz carrier).
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to