Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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

Status
Not open for further replies.

matin-kh

Member level 3
Joined
Nov 9, 2013
Messages
66
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
iran
Activity points
1,938
Hi,

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.

Thanks
 

FvM

Super Moderator
Staff member
Joined
Jan 22, 2008
Messages
50,776
Helped
14,599
Reputation
29,473
Reaction score
13,676
Trophy points
1,393
Location
Bochum, Germany
Activity points
290,799
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).
 

BradtheRad

Super Moderator
Staff member
Joined
Apr 1, 2011
Messages
14,688
Helped
2,867
Reputation
5,744
Reaction score
2,876
Trophy points
1,393
Location
Minneapolis, Minnesota, USA
Activity points
109,735
Falstad's animated interactive simulator (latest version) produces audio output of waveforms.

falstad.com/circuit

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
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
23,010
Helped
4,714
Reputation
9,444
Reaction score
5,082
Trophy points
1,393
Activity points
152,440
Hi,

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

Klaus
 

Aussie Susan

Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,472
Helped
402
Reputation
804
Reaction score
440
Trophy points
1,363
Activity points
17,296
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).
Susan
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top