Introduction: DIY Function/Waveform Generator
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:
Attachments
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
78 Comments
3 months ago
Thanks for your Instructable. I made a couple of changes to the code. My build can be found at https://www.hackster.io/john-bradnam/ad9833-function-generator-180317
Question 7 months ago
Good, I have a doubt and fix the code and I have all the modules, for some reason I do not upload anything to the i2c or the module ad9833 or why does it appear this way?
Is it possible that it is a poorly connected cable or is not sending the information?
I'm using Dupont cables but right in the ad9833 module I ran out of cables of that type and changed it for some UTP cables that I got to find...
I look forward to your response, thank you very much for the help above :)
Answer 7 months ago
Hi Tomas,
try to decrease brightness of the LCD module: there is a potentiometer on the back side of the module...
Hope that would help.
Cheers
Reply 7 months ago
Hi Shaggy, I still have the same problem, what can it be?...
Reply 7 months ago
look, as I can see on the screenshot you shared, you made changes to my code...
So, try to flash a pre-compiled firmware, hex file is available at my github https://github.com/ShaggyDog18/SignalGeneratorSD.
Sure, you should use the pin layout according to schematic/circuit above in the description.
If it does not work, then double check all connections.
Reply 6 months ago
Good Bro, change the code by which you passed me, I get the error of "no matching function for call to "liquidCrystal_I2C:begin()" but the start I change it to init? or that you recommend me?...
Reply 6 months ago
I already tried it with a digital oscilloscope with the protoborld but on the display I do not see anything like in the video ... I already regulate the brightness but I still have the problem.
I look forward to your answer, sorry for so many questions, but I would love to finish this project sincerely... By the way do you have Telegram?)
Reply 6 months ago
Please, try to flash a pre-compiled firmware, hex file is available at my github https://github.com/ShaggyDog18/SignalGeneratorSD.
Question 7 months ago on Introduction
Hi Great Scott! I have a link to share with you regarding your last yotube video dedicated to Dark Secret of Relay.
Here is the link to schematic based on pair of simister and relay: it combines relay and simister in parallel with delay for relay to connect a load at switch on and with delay for simister to disconnect the load at switch off.
The article is in ruzzian still the circuit is self-explanatory: https://habr.com/ru/company/unwds/blog/390601/
Could be a good follow up for your video!
Enjoy!
Question 8 months ago
I have this error. Why?...
"class MD_AD9833 has no member named "setModeSD", did you mean "setMode"?
I just used the same github code I last climbed from 3 months ago...
Answer 8 months ago
Please, be sure you use a midified MD-AD9833 library available at: https://github.com/ShaggyDog18/MD_AD9833
The error is because you most probably refer to the original library that does not have setModeSD() method...
Question 12 months ago
I have this error. Does anyone know why?
Answer 12 months ago
Hi Tnlam!
I would suggest you to use my firmware I developed for the project. It provides more features and... it works :-)
Please, jump to GitHub, all SW is there including a pre-compiled hex file:
https://github.com/ShaggyDog18/SignalGeneratorSD
1 year ago
how to set the duty cycle?
Reply 1 year ago
Hi Vinicius!
Unfortunately, AD9833 Module, the heart of the solution, does not support the feature of changing duty cycle of signals it is generating...
Reply 1 year ago
not without another circuit at the output right, but it does have a fixed duty cycle of 50%? it should be enough..
Reply 1 year ago
Right, the duty cycle is 50%.
In case you still need to vary duty cycle, you have to add extra circuit at the output...
Question 1 year ago
Hi, can someone send me the code? I cannot open the .rar, it says its damaged
Answer 1 year ago
Hi Jeno!
Please, jump to GitHub, all SW is there including a pre-compiled hex file:
https://github.com/ShaggyDog18/SignalGeneratorSD
Question 1 year ago
Hi, what size of fuse did you use? (For F1, I mean)