Pages: [1]   Go Down
Author Topic: Signal generator with >8-bit DAC  (Read 2915 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys,

I've recently been trying to use the Arduino Uno as a signal generator, and I've been fairly successful by using digital ports (0-7) and a resistor ladder to output 8-bit analog signals. I've attached a quick schematic, even though you probably know what I'm referring to.



My question is - can this be generalized to 10 bits or higher? The PORTD command only seems to cover the first 8 pins, and I need the signal to be as fast as possible while still maintaining stability. I've thought about taking the next two pins and using them as the two LSBs, but I'm afraid that I'll sacrifice speed in the process (with all that ORing with the previous bits and such). Is there any way to have direct digital writes similar to PORTD but with additional pins?

Any help is welcome!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31529
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there any way to have direct digital writes similar to PORTD but with additional pins?
Basically no. It is an 8 bit processor and you are stuck with 8 bits at a time.
You do not need to OR just shift and output.
I doubt if you are getting a true 8 bits with that circuit any way, you won't have monoticity.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 170
Posts: 12482
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


You can only access one port at a time but if accessed directly after each other the glitch will be in the 1 micro second range.

I would first set the high 8 bits and then the 8 low bits to minimize the disruption in the signal (maybe add a small capacitor to dampen the noise effect?).
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

0
Offline Offline
Full Member
***
Karma: 0
Posts: 239
Yeah Arduino surely rocks !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...
My question is - can this be generalized to 10 bits or higher? ...

Yes you can have a ladder like this for any resolution  you want (4, 5, 8 ,10, 16 and so on).

Not sure if it's under your expectations about speed but one good way of doing it is using latched shift registers to output the bits to the ladder, this way all the bits will show up on shift register output at same time (or almost ?).
Using direct port manipulation to drive the shift register will take approximately 30uS to 50us to shift all the 16 bits to 2 chained, latched shift registers.

Hope it helps
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31529
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yes you can have a ladder like this for any resolution  you want (4, 5, 8 ,10, 16 and so on).
The problem with going to higher bit counts is the resistor matching. The more resistors you use the tighter they have to be matched to each other. With normal 1% resistors you will not get more than about 6 bits and maintain monoticity.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 239
Yeah Arduino surely rocks !
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Yes you can have a ladder like this for any resolution  you want (4, 5, 8 ,10, 16 and so on).
The problem with going to higher bit counts is the resistor matching. The more resistors you use the tighter they have to be matched to each other. With normal 1% resistors you will not get more than about 6 bits and maintain monoticity.

That's interesting Mike. I suppose that error from resistor matching will just adds up error more and more to the ladder as whole until you stop adding resolution bits?
I guess that if you really need to rely on math to expect accurate results a DAC chip is the way to go and not R/2R ladders.
By the other hand ladders can be useful (even for more than 6 bits or wathever), if you can accept constructing a calibration table from empirical measures, I mean when you don't need direct math processing out from ladder outputs but just input/output know values.

I had a interesting experiment on this some months ago assembling a simple synth. I wanted the synth to be able to play exact notes in a 5 octaves range and I got it playing exact notes after scanning (or finding), exact notes (voltages), on output by trying input values. It was a R/2R ladder tied to 2x VCO's and was able to tune perfect notes this way. To be able to find exact note frequencies (exact as 0.5Hz of tolerance), in a 5 octaves range I needed a 14bit ladder. This is some result about this experiment: https://soundcloud.com/rodrigonh/vc
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31529
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes just matching a specific voltage is not so critical because you do not need monoticity so for any one piece of hardware there will be more than one set of bit patterns that give you the same voltage.
That is a ladder by the way.
Ladders no not require accuracy in the resistor's absoloute value just the relitave value. Some people think you can just keep extending ladders as long as you like but it depends on how closely they are matched. Without monoticity for generating an audio wave you get increased quantisation noise.
Logged

Belgium
Offline Offline
Full Member
***
Karma: 5
Posts: 135
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Depending on your end application you might like to know about those 'dirt' cheap AD9850 DDS modules on ebay and china-wholesale site (<5$) ,  there are arduino lib's available.
Logged

Gear: Arduino- Uno,Due,Ethernet,  OLS, Buspirate, J-Link, TDS1002, Rigol DG1022

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you can use digital output in PWM(with max. value for all) mode? I am a newbie so be careful smiley.
Logged

Pages: [1]   Go Up
Jump to: