DIY Function/Waveform Generator

39,827

167

55

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

5 People Made This Project!

Recommendations

  • Reclaimed Materials Contest

    Reclaimed Materials Contest
  • Cookie Speed Challenge

    Cookie Speed Challenge
  • Edible Art Challenge

    Edible Art Challenge

55 Comments

0
ŁukaszF11
ŁukaszF11

14 days ago

Can you share pcb board or electronic scheme in eagle? I would like to print it.

0
MrTechCreator
MrTechCreator

4 months ago

Some of the components you can order from LCSC or Sparkfun.

0
ashermalik927
ashermalik927

Reply 4 months ago

digikey is also another good option

0
ashermalik927
ashermalik927

4 months ago

Just a question can c5 and c6 be an electrolytic capacitor aka a polarised capacitor or not and why

0
molfide
molfide

9 months ago

TL071is not capable of giving output at the specified amplitude and frequency (12v and 10MHz respectively ), because it's bandwidth is limited to 4MHz.

0
ShaggyDog18
ShaggyDog18

Reply 9 months ago

That's true... I've ordered a high speed OPA637 at AliExp; however, the seller shipped a faulty one... so no progress, to my regret... still use TL071...

0
brad.roy
brad.roy

Reply 7 months ago

I can recommend the LT1364. I found some on aliexpress, and they work. They're still not quite fast enough for full +/-15V at more than a few hundred kHz, but, they're relatively affordable. And available in DIP, if that makes a difference. It's massively faster than the OPA637, and TL07x

0
brad.roy
brad.roy

7 months ago

Hah! I've recently been working on my own take of this pretty much exact same project. Though I've built mine based on the STM8 uC, and have built all the software and libraries from the ground up myself (with the exception of the LCD library which is mostly borrowed from elsewhere).

Presently, I'm working on implementing a rotary encoder, and velocity detection. (version 1.0 used a potentiometer to set the frequency). Next up, I'll be incorporating a pulse/PWM generator from one of the pins on the uC.

Eventually, I may add a second channel with a second AD9833...maybe. Also, I'm thinking about digital feedback and/or control of the amplitude and offset settings.

Anyway, check it out here if interested:
https://github.com/prosper00/STM8-AD9833-Function-Generator/tree/dev

20210122_142009.jpg
0
Alchemist222
Alchemist222

Question 7 months ago

How would someone adjust this circuit to add a second BNC connector? Would the AD9833 support two different signals behind outputted?

0
ShaggyDog18
ShaggyDog18

Answer 7 months ago

AD9833 module is a single output module, still has two channels just to save two different sets of signal settings for a fast switching between them. So, there is no way to get two output signals out of a single AD9833 module. If you need two signals, you should consider a solution with two AD9833 modules.
In my project I used 2 BNCs, one dedicated to meander signal to get two output amplitude levels of 5v or 3.3v: https://github.com/ShaggyDog18/SignalGeneratorSD
There is a link to schematic (to EasyEDA) using Schmitt-trigger...: https://easyeda.com/Sergiy/switch-5-3-3v-power-bus

0
Alchemist222
Alchemist222

Reply 7 months ago

Yeah I took a look at your project for a better LCD interface. Great stuff. I’ll see how you setup your two BNC connectors. Thank you

0
Murat0770
Murat0770

Question 8 months ago on Step 6

I designed circuit same as this, i uploaded the cezar's code to arduino nano, but i couldn't get signal from AD9833. Do i need to change any of the cezar's code?

0
majidfallout
majidfallout

Question 10 months ago

Hi
Thanks for share this useful project.
I connected function generator output to oscilloscope as following results:
- freq set to 1000 Hz, Sine and Triangle showing correct but CLK showing half as 500 Hz.
- freq set to 2000 Hz, Sine and Triangle showing correct but CLK showing half as 1000 Hz.
Is that for AD89833 library “square signal wave at 1/2 frequency (for more accuracy of the output signal frequency)?
What is the solution?
I tested another circuit “https:/enerator-on-Arduino/” Sine,Triangle and square waves frequency is correct but the problem is that the output is nosily due to digital potentiometer.
Thanks for your advice

0
majidfallout
majidfallout

Reply 10 months ago

Hi,
Thanks, I will try.

0
ShaggyDog18
ShaggyDog18

Reply 10 months ago

So, how is it going? Successful?

0
majidfallout
majidfallout

Reply 10 months ago

yes, It's going Successful.
Thanks.

0
majidfallout
majidfallout

Reply 10 months ago

Thanks.

2.jpg1.jpg
0
ShaggyDog18
ShaggyDog18

Reply 10 months ago

try to triple click the encoder button to change the way a frequency is displayed: it will switch different modes: with/without thousand delimiters and with/without leading zeros...