Need Simple "No Parts" DAC, Sigma-Delta?
RickInTexas
Posts: 124
This is so simple, I feel silly asking but I'm having a brain-freeze on this.
Searching for DAC I find many solutions using external ICs, but I dont have any silicon DACs handy, so I just need something simple. I know that Sigma-Delta has been beat to death for ADC and that DAC should work in a similar manner.
I just want a couple of outputs where I can set them to arbitrary DC voltages e.g. 2.0 and 2.7.
By "no parts" I'm thinking a few Rs and Cs. Ideas?
RickInTexas
Searching for DAC I find many solutions using external ICs, but I dont have any silicon DACs handy, so I just need something simple. I know that Sigma-Delta has been beat to death for ADC and that DAC should work in a similar manner.
I just want a couple of outputs where I can set them to arbitrary DC voltages e.g. 2.0 and 2.7.
By "no parts" I'm thinking a few Rs and Cs. Ideas?
RickInTexas
Comments
You've looked at AN001 ?
http://www.parallax.com/Portals/0/Downloads/appnt/prop/AN001-PropellerCountersv1.1.zip
There's a DAC! words built into Tachyon which uses the duty mode of the counters. This only needs a resistor from the pin to a capacitor to ground. If you want that voltage buffered then just use an opamp in voltage follower configuration. Then again you can add gain resistors and get a 0-10V etc.
This is the word that's built into Tachyon, it makes it very simple to create a DAC.
Connect a 220R resistor to the pin (assume it's P0) and connect the other end to a 0.1uF capacitor tied to ground and try this:
$80 #P0 DAC!
The output voltage should be around 1.65V.
Perfect!
I get the following outputs, quite linear:
Volts
=====
0 #P0 DAC! 0.002
10 #P0 DAC! 0.203
20 #P0 DAC! 0.404
30 #P0 DAC! 0.606
40 #P0 DAC! 0.808
50 #P0 DAC! 1.009
60 #P0 DAC! 1.210
70 #P0 DAC! 1.412
80 #P0 DAC! 1.613
90 #P0 DAC! 1.811
95 #P0 DAC! 1.874
96 #P0 DAC! 1.886
97 #P0 DAC! 1.899
98 #P0 DAC! 1.911
99 #P0 DAC! 1.923
100 #P0 DAC! 0.002
Now I just need to scale it so I can obtain the 2.75v that I need, but that's ok, I have plenty of options there; 74HC245 etc.
@Peter I'm liking Tachyon more every day, but I've got a lot more to learn. I should be getting over the hump where my productivity begins to take off.
Thanks to all. I do need to get more into the counters, they are handy indeed.
RickInTexas
Connect a resister from the capacitor to +3.3.
The resister value is the same as the resistor from the capacitor to the prop pin.
Or use a single higher value resistor such as 10KΩ which is significantly larger than the pin out resistor.
This should go much closer to 3.3V than the 220Ω you are now using.
Duane J
Great idea Duane. I guess I need an analog refresher too. I got my novice ticket back in 1973 (WN9VYL), need to dig out those old study guides I knew this should be simple, I could have just order a cheap DAC (Mouser's accross town so I get stuff the next day), but that would be "cheating" and not in the spirit of "As simple as possible".
Using a pair of 22KΩs I get a range of 2.185V to 3.131V. Since I need 2.0V to 2.75V I could achieve that range by bumping the 22KΩ up a bit, correct?
Tachyon FORTH Rocks!
RickInTexas
220R is quite low tho, and the series pin impedance will start to skew the output, so precision will be lower than it could be.
It also has a high Icc cost at mid-scale voltages.
Q: Is there a Tachyon word to inquire what the current default input base is set to?
So anyways, while experimenting I was using Excel to produce the test data, by 10s, and then when I saw that "100" gave me zero, I went down to steps of 1 from 95 through 100. The resulting output looked quite reasonable, linear steps between 10 and 90, and still linear with correspondingly smaller increments as shown in my experimental data between 95 and 99 inclusive.
I used a junk-box cap that measured 0.01uF so that's why I chose the 2.2KΩ resistor(s). (Logic check?)
BTW, I said 22KΩ in post #7. I just double checked, they are indeed 2.2KΩ.
I'm going to Radio Shack right now to get 0.1uF caps. I have to work tonight so I won't probably get back to the bench 'till tomorrow (Saturday in Texas USA).
Thanks for your patient help.
Some good news: Tera Term 4.78 is working well. I was able to paste the "Sines" code and run it. Cool stuff.
RickInTexas
Some thoughts:
1. The product of R * C, the RC time constant, defines how fast the output voltage can change in response to a change in the digital value.
2. The actual values of R or C can be quite loose. Almost anything can be used and the accuracy will not suffer.
3. Of course if R * C is to low there will be lots of jitter.
4. If R is to small the props pin output resistance, which is not a fixed value, will interfere with accuracy.
Duane J
You didn't say what you needed this for because knowing a little bit more should yield more suitable values or circuit. But once again the low value resistance is better than too high a value that gets loaded too easily which introduces way more error. Remember, the DAC it not just so you can measure it with a meter, it's got to do something.
BTW, if it's a certain voltage that you are after then just add this word.
RickInTexas
Thanks for the analog refresher. On point 4 can you elaborate on the prop's output resistance? Are you alluding to a (sharp) rise in the IR drop of the Props output drivers once this current reaches a certain level? I don't recall seeing a spec on output impedance. I know that the outputs can source/sink 40ma. Is there a lower practical limit in terms of this application?
Rick
RickInTexas
Even when saturated the FETs still have some ON resistance.
Unlike conventional resistors where the resistance is constant with changing current, the ON resistance of FETs changes somewhat with changing current in the linear region. I don't think there is one. The spec suggests the normal operating current should be kept less than 10mA.
There was a thread a while ago where someone, (anyone? anyone?), did some accurate measurements of pin output resistance.
As I recall, it was something like 140Ω or was it 170Ω or so.
The 40mA current is probably way outside saturation and generally you should never go there. As a practical mater, the current depends on the require accuracy desired of the DtoA.
With higher R values the output resistance change will be smaller because the voltage across the FET will be less.
The only practical way to investigate this is experimentation. Use a pot, say 10KΩ or so, along with a bunch of capacitors and see what works for your application.
Duane J