DIY Function/Waveform Generator

27,292

146

17

Introduction: DIY Function/Waveform Generator

About: Awesome Electronics Tutorials, Projects and How To´s

In this project we will have a short look at commercial function/waveform generators in order to determine what features are important for a DIY version. Afterwards I will then show you how to create a simple function generator, the analog and digital way. At the end I will then present you a DIY DDS function generator design which can (kind of) hold up to the commercial versions. Let's get started!

Step 1: Watch the Video!

The video gives you all the information you need to create your own DDS function generator. During the next steps though, I will present you some additional information.

Step 2: Order Your Components!

Here you can find a parts list with example seller (affiliate links):

Aliexpress:

1x 12V center tapped transformer: https://s.click.aliexpress.com/e/_dZzaRwR

1x IEC socket: https://s.click.aliexpress.com/e/_dYQWdHl

1x B40C2300 full bridge rectifier: https://s.click.aliexpress.com/e/_dUSXlfZ

1x LM7812 12V regulator: https://s.click.aliexpress.com/e/_d8GjYYf

1x LM7912 -12V regulator: https://s.click.aliexpress.com/e/_d6ueEfl

1x LM7805 5V regulator: https://s.click.aliexpress.com/e/_dWITJXp

1x Capacitor kit: https://s.click.aliexpress.com/e/_d8NcJ0L

1x Arduino Nano: https://s.click.aliexpress.com/e/_d85qR0x

1x Rotary Encoder: https://s.click.aliexpress.com/e/_dXKK3dV

1x AD9833 DDS IC: https://s.click.aliexpress.com/e/_dTc4NZH

1x I2C LCD: https://s.click.aliexpress.com/e/_d6HiiMB

1x TL071 OpAmp: https://s.click.aliexpress.com/e/_dXd3VYL

1x BNC connector: https://s.click.aliexpress.com/e/_dZ51v0F

1x 10k, 50k Potentiometer: https://s.click.aliexpress.com/e/_dU8s3rt

Ebay:

1x 12V center tapped transformer: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x IEC socket: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x B40C2300 full bridge rectifier: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x LM7812 12V regulator: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x LM7912 -12V regulator: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x LM7805 5V regulator: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Capacitor kit: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Arduino Nano: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x Rotary Encoder: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x AD9833 DDS IC: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x I2C LCD: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x TL071 OpAmp: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x BNC connector: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

1x 10k, 50k Potentiometer: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...

Amazon.de:

1x 12V center tapped transformer: -

1x IEC socket: https://amzn.to/2UDXsK1

1x B40C2300 full bridge rectifier: https://amzn.to/2HVn8wn

1x LM7812 12V regulator: https://amzn.to/34vhVoP

1x LM7912 -12V regulator: https://amzn.to/34vN9vQ

1x LM7805 5V regulator: https://amzn.to/2N1l4ag

1x Capacitor kit: https://amzn.to/34vpEmB

1x Arduino Nano: https://amzn.to/34yTMgX

1x Rotary Encoder: https://amzn.to/300YJMl

1x AD9833 DDS IC: https://amzn.to/2MZm7HP

1x I2C LCD: https://amzn.to/31bhEW8

1x TL071 OpAmp: https://amzn.to/2ZXTb53

1x BNC connector: https://amzn.to/314ktI9

1x 10k, 50k Potentiometer: https://amzn.to/2HOI34j

Step 3: Build the Circuit!

Here you can find the schematic of the circuit as well as reference pictures of my finished perfboard construction. Feel free to use them.

Step 4: Upload the Code!

Here you can find the code for this project. You need to upload it to the Arduino before your function generator can work successfully.

Big thanks once again to Cezar Chirila for his work. The code is pretty much made by him. Have a look at his article:

https://www.allaboutcircuits.com/projects/how-to-D...

Step 5: 3D Print a Housing!

Here you can find the .stl and .123dx files for my 3D printed housing. 3D print them and then mount all the components inside the main enclosure to complete your function generator build.

Step 6: Success!

You did it! You just created your own function/waveform generator!
Feel free to check out my YouTube channel for more awesome projects:

http://www.youtube.com/user/greatscottlab

You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:

https://twitter.com/GreatScottLab

https://www.facebook.com/greatscottlab

4 People Made This Project!

Recommendations

  • Battery Powered Contest

    Battery Powered Contest
  • Plywood Challenge

    Plywood Challenge
  • Plastic Contest

    Plastic Contest

17 Discussions

0
ShaggyDog18
ShaggyDog18

3 months ago

Added a new cool feature to my SignalGeneratorSD firmware: Stepped Sweep Generator - the frequency is varied in a range defined by values set in Ch#0 (start of the range) and Ch#1 (end of the range) with signal settings of Ch#0 and discrete steps of 0,1 of a current running frequency (kind of logarithmic steps). Frequency value steps either up or down from the start of the range depends on what channels' frequency is larger. Frequency is changed discretely every 250 mSec (can be changed at compilation).
The running Stepped Sweep Generator cycle is indicated by a blinking cursor at the end of a frequency value. Can be activated for Ch#0 only and uses its signal settings. While running, can be cancelled by short press and hold of OK button. When the end of the range is reached, it pauses for 3 sec and switches back to Ch#0 settings.
Sweep generators are commonly used to test the frequency response of electronic filter circuits. Read more about Sweep Generator in Wikipedia
Enjoy:
https://github.com/ShaggyDog18/SignalGeneratorSD

0
AntonPernisch
AntonPernisch

Question 4 months ago

Hi! Awesome project, but i'm wondering, which 3D filament did you use? Because the case looks really impressive. Thanks!

0
ShaggyDog18
ShaggyDog18

4 months ago

Sharing an improved firmware (see pictures of Signal Generator screens in "I Made It" section):
- Use MD_A9833(modified) library to control the AD9833 Module: compact and bug-free library with great functions.
- Improved, simplified, optimized, fixed bugs, used better/"standard" libraries for all components: the display, rotary encoder, button.
- Improved navigation, essentially, coded from scratch (see Navigation section below).
- Improved the way frequency value is displayed (coded from scratch):
- option to hide leading zeros in frequency value (toggled by triple click of encoder button).
- option to delimit thousands by a separation sign (toggled by triple click to encoder button).
- a selected option (one out of four possible combinations) is stored to EEPROM (if enabled) and is set at start up.
- NEW Use EEPROM to store and recover settings at switch on (to disable comment #define ENABLE_EEPROM).
- NEW Added graphic icons for signal form representation on the display (if you still like the old way, comment #define GRAPH_ICONS).
- NEW Tied a signal mode to a Channel; so, now you may change signal form along with its frequency by selecting a channel.
- NEW Added a new signal mode: square/meander signal wave at 1/2 frequency (for more accuracy of the output signal frequency). This is a standard feature of AD9833 module. Comment #define ENABLE_MEANDRE05F_SIGMODE if you do not need it.
- NEW More convenient and fast way of input frequency value by rotary encoder (if you still like the old way, comment #define NEW_WAY_INPUT_FREQ):
- continuous input: if reach either '9' or '0' in a digit position, then it jumps over to the senior digit and decreases/increases it.
- fast input: if fast encoder rotation is detected, then it increases/decreases ten times of a current digit position
- Renamed FREQuency register on the display to Channel: so, now it looks like Ch#0 and Ch#1.

Works much better and provides more features. Enjoy its new feel and look:
https://github.com/ShaggyDog18/SignalGeneratorSD

0
marco_festo
marco_festo

Reply 4 months ago

I've just ordered all components and I'll test your version asap! Many thanks for your great work! ;)

0
ShaggyDog18
ShaggyDog18

Reply 4 months ago

you are welcome!
I will post a new release soon. Major update: RUNNING_FREQUENCY - option to input and apply frequency value "on the fly" as you change/input new value...

0
ShaggyDog18
ShaggyDog18

Question 5 months ago

Hi GreatScott! Excellent Project! Do you still use the Generator?
I have been building it and found out that the software/firmware is very buggy and poorly written. Still great thanks to Cezar Chirila, the author. Major bug: the actual frequency of the CLK meander signal is 1/2 of the set frequency due to the error in the AD 9833 library (fixed it, but eventually, found a better library).
So, I have re-coded it a bit, fixed bugs, optimized, used better/"standard" libraries for all components: the display, rotary encoder, button and, most important, for AD9833 module. Works better. Do you wont me to share?

0
hansoon648291
hansoon648291

Answer 5 months ago

I need you to share! thank you

0
Bobes123
Bobes123

9 months ago

Great project, better than cheap xr2206 or icl8038 on ebay. Notice: if you cannot get center tap 12+12v, you can get +12 and - 12 from normal transformer, but you will need 2x more current transformer.

0
SourabhB12
SourabhB12

10 months ago

please give me the code i want to build it...

1
SourabhB12
SourabhB12

10 months ago on Step 4

signal generator.rar is not opening saying the file is corrupted

1
JDeV999
JDeV999

1 year ago

Thank you for this project, always wanted to make one myself.
What 3D filament did you use, it looks very nice.

0
drogge
drogge

1 year ago

Thanks for posting the design. Is F1 the fuse in the IEC socket? If so then I assume that F2 is fuse shown in the pictures of the proto board. You might want to include the fuse and holder in the list of required parts. I finally have all my parts and will be starting the build soon. Thanks again for the design.

0
KushagraK7
KushagraK7

Tip 1 year ago

Why not improve the design by replacing the transformer with an SMPS delivering +12 and -12 volts and making the device dual channel with phase shift control?

0
Polymorph
Polymorph

1 year ago

I think you mean 24Vac centertapped.

0
sumjar
sumjar

1 year ago

This is a great presentation. Excellent use of a variety of visuals. Nice!

0
billbillt
billbillt

1 year ago

WOW!!.. thanks for this!!............