Author |
Message |
Grumble

Joined: Nov 23, 2015 Posts: 1310 Location: Netherlands
Audio files: 30
|
Posted: Tue Apr 17, 2018 1:04 pm Post subject:
DDS for audio and clock generation Subject description: using an AD9833 and an Arduino |
 |
|
I get questions on a regular basis about my modular synth, especially about the use of the AD9833 DDS from Analog Devices in combination with an Arduino.
My plan is to write a series of articles about this little wonder, add basic programs and schematics.
The idea is to show how to work with control voltages to change the frequency, or make a hard sync etc.
The AD9833 is a DDS, what stands for Direct Digital Synthesis, Analog Devices has a large number of these type of devices but I like this one the most because it's ease of programming and the low pin-count.
There is one downside though: It's freaking small, so the hard part is not the programming, but the soldering of this chip to convert it to a more diy friendly format.
In order to do this I bought THESE pcb converters.
To get an idea how small the AD9833 really is:
For programming I use C++ on Atmel Studio which can be free downloaded HERE.
(see code)
in the line: ad9833_send(AD_TRI);// set waveform shape the shape is chosen, in this case a triangle shape, but also a sine or square is possible (not simultaneous) and for the square the output will be VCC, but the sine and triangle will be typ. 650mV so they need some amplification and maybe level shifting.
The frequency is set here: ad9833_set_frequency(1500); 1500Hz in this example, but 1500.1Hz is also possible...
The lowest frequency when using the 16MHz from the Arduino as a master clock, will be 0.0596Hz which is also the accuracy for setting the frequency.
The maximum frequency is well in the MHz range, not suitable for audio but definitely very practical for clock frequency generation.
To use the clock frequency of the Arduino a fuse has to be set: in Atmel Studio this one is called LOW.CKOUT if this fuse is set, the 16MHz clock is output to port PB0
edit: since the code keeps getting f*cked up, I added the code as an attachement
Description: |
|
Filesize: |
36.92 KB |
Viewed: |
6089 Time(s) |

|
Description: |
The fuses on the Atmega328P as set with Atmel Studio |
|
Filesize: |
37.68 KB |
Viewed: |
6090 Time(s) |

|
Description: |
This is the basic diagram as used in this article |
|
Filesize: |
44.16 KB |
Viewed: |
549 Time(s) |
This image has been reduced to fit the page. Click on it to enlarge. |

|
Description: |
the code that goes with this article |
|
 Download (listen) |
Filename: |
main - basic.cpp |
Filesize: |
2.94 KB |
Downloaded: |
645 Time(s) |
_________________ my synth |
|
Back to top
|
|
 |
Grumble

Joined: Nov 23, 2015 Posts: 1310 Location: Netherlands
Audio files: 30
|
Posted: Thu Apr 19, 2018 1:14 pm Post subject:
|
 |
|
In this second article about programming the AD9833 I added an input for modulation.
For modulation purposes I used a 3310B Function Generator from Hewlett Packard, but any sound source can be used, set to a voltage between 0 and 5 volt, I used the Analog 0 input (PC0) of the AtMega328p and added some lines of code to the previous code.
Also a sound clip is added to this page, where I use different wave forms and amplitudes to modulate the AD9833.
I added 10 to the Analog to Digital Converter input and made that equal to the frequency, so the frequency span is 10 - 1033Hz, since the ADC of the AtMega328 is 10bit (1024 levels)
Description: |
|
 Download (listen) |
Filename: |
main.cpp |
Filesize: |
3.58 KB |
Downloaded: |
621 Time(s) |
Description: |
The AD9833 modulated with several waveforms, frequencies and voltages |
|
 Download (listen) |
Filename: |
swept.mp3 |
Filesize: |
4.34 MB |
Downloaded: |
964 Time(s) |
_________________ my synth |
|
Back to top
|
|
 |
ixtern
Joined: Jun 25, 2018 Posts: 145 Location: Poland
|
Posted: Mon Jun 25, 2018 3:48 am Post subject:
|
 |
|
Grumble wrote: | In this second article about programming the AD9833 I added an input for modulation.
...
I added 10 to the Analog to Digital Converter input and made that equal to the frequency, so the frequency span is 10 - 1033Hz, since the ADC of the AtMega328 is 10bit (1024 levels) |
Go on, Grumble, I am very interested in your articles regarding using AD9833 in music synthesis. |
|
Back to top
|
|
 |
|