electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
Live streaming at radio.electro-music.com

  host / artist show at your time
  Twyndyllyngs live. Chez Mosc
Please visit the chat
 Forum index » DIY Hardware and Software » Developers' Corner
DDS for audio and clock generation
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
Grumble



Joined: Nov 23, 2015
Posts: 779
Location: Netherlands
Audio files: 23

PostPosted: Tue Apr 17, 2018 1:04 pm    Post subject: DDS for audio and clock generation
Subject description: using an AD9833 and an Arduino
Reply with quote  Mark this post and the followings unread

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:
Posted Image, might have been reduced in size. Click Image to view fullscreen.
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


soic_695.jpg
 Description:
small outline ic.
 Filesize:  36.92 KB
 Viewed:  908 Time(s)

soic_695.jpg



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

fuses.JPG



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

basic diagram.JPG



main - basic.cpp
 Description:
the code that goes with this article

Download
 Filename:  main - basic.cpp
 Filesize:  2.94 KB
 Downloaded:  67 Time(s)


_________________
my synth
Back to top
View user's profile Send private message Visit poster's website
Grumble



Joined: Nov 23, 2015
Posts: 779
Location: Netherlands
Audio files: 23

PostPosted: Thu Apr 19, 2018 1:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

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)


main.cpp
 Description:

Download
 Filename:  main.cpp
 Filesize:  3.58 KB
 Downloaded:  60 Time(s)


swept.mp3
 Description:
The AD9833 modulated with several waveforms, frequencies and voltages

Download
 Filename:  swept.mp3
 Filesize:  4.34 MB
 Downloaded:  97 Time(s)


_________________
my synth
Back to top
View user's profile Send private message Visit poster's website
ixtern



Joined: Jun 25, 2018
Posts: 17
Location: Poland

PostPosted: Mon Jun 25, 2018 3:48 am    Post subject: Reply with quote  Mark this post and the followings unread

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use