Instructables

Homemade DAC A/D Converter

Picture of Homemade DAC A/D Converter
tadi.JPG
COMER DAC.JPG

Various micro controllers come with built in A/D converters (these are the more pricy ones) and I have yet to see one with a DAC. I though of a relatively cost effective solution once again with easily acquired components (Radio Shack). It can effortlessly be expanded to limitless bits of resolution (though I only used three and show to six). This circuit uses only as many transistors as bits of resolution (NPN or PNP) and (If you can find the right values) possibly as few resistors (I used 150Ω 330Ω and 680Ω, better values would be 150, 300, and 600 made from 150’s in series I will show it later) Only one very common IC an LM741 but any op amp or better yet comparator would work. The second picture is of a more traditional A/D converter and the third a commercial DAC

 
Remove these adsRemove these ads by Signing Up

Step 1: Building the circuit

Picture of Building the circuit
Test.jpg

This circuit has an incredibly easy layout and I deliberately designed it that way for an easy PCB layout. The transistor simply shorts the resistor. The stages are in series I tried parallel at first it worked but was very difficult to get linear, then the duh moment, series circuits add and adding is linear. In the second picture I used a DIP switch to verify it was working. It is a really straightforward build. It also requires no calibrating or reference voltage, but the control system must know the voltage and stages for the equation. V(measure) = ( V(total) / 2^bits )* binary out(in decimal)

Step 2: Further Building

Picture of Further Building
6 CASCADE.JPG
same res.JPG

While building you should choose NPN or PNP transistors (I think PNP work better even though I used NPN) The first picture is a single stage, the top NPN bottom PNP. The second shows a 6 bit cascade for 8 times the resolution of a 3 bit ! In the third picture it shows how to use a single value of resistor to make the cascade and any value will work as long as you use 1 2 4 8 16 ect. resistors. This is even more accurate then using predetermined decade values. (see curve later).

Teslaling2 years ago
Another option would be to make a voltage divider connected to the inverting input (pin 2 of the op-amp) . You would put a 680 ohm resistor between the input and ground, then put a 150 ohm, 330 ohm, and 680 ohm in series between the input and V+. This should equalize the inputs bringing the voltage to almost ground. Now the output only will be above the ground rail slightly because of transistor leakage current and resistor tolerances.
jazzzzzz (author) 3 years ago
I've though of an even better a/d method It is more MCU friendly (using two I/O pins, one input one output for any resolution) but I hate to make a 'ible on the same topic.
jazzzzzz (author) 3 years ago
That is a nice solution, and feed into a comparator would make a very good A/D converter. My circuit does not require a buffing amp for use as a DAC, and can directly drive a speaker. (100mA output)

A VCO is a nice A/D converter too; made from a varactor diode it is relatively simple. (I don't have any varactor diodes) The program can be glitchy and you’re limited by clock speed.
mathieulj3 years ago
Another solution would be the traditional R-2R ladder network (see attached image).
ladder.png
Oups, the amplifier's inverting and non-inverting inputs are switched in my schematic.
jazzzzzz (author) 3 years ago
It was not made for extreme precision because the cost of the discrete components would be more than an IC. It was meant to be cheap and easy to get, and used for relatively low precision, say temperature ±5° or voltage ±.25 volts
mathieulj3 years ago
I'm not the most noligable person in electronics but, in my opinion, FETs would be better than bypolar transistors in this circuit. When sending a control voltage to turn on the transistor (higher voltage for an NPN), a current will flow into your gate (for an NPN) and into your resistance ladder (for a PNP, it will flow out). So if for example you have A1==A3==low and A2==high, current will flow into the middle of your resistance ladder (from the control gate) boosting the voltage at this point (even if the transistor is not fully on so long as the voltage at A2 is greater than that at the exit of the A2 transistor).

In a Field Effect Transistor (FET), the gate is isolated from the switching line and so no current would flow from you control gate to/from the resistance ladder although you have to be careful since FETs retain a (for some not so) small resistance in their on state.
jazzzzzz (author)  mathieulj3 years ago
Yes they might be a little better but, more costly. The resistors would then need to have a higher tolerance, once again more costly. I'm using 5% tolerance resistors they will have substantially more effect on error than the transistor. The simple addition of some bias resistors one the basses of the transistors would make the current negligible.

Would you go, n or p channel, enhancement or depletion mode, I would still like to try it.
With the addition of a bias resistor, the negligibility of your current will greatly vary with the quality of your transistor (ex. current ratio + forward voltage). With a low hfe, you will have to pass a good current trough in order to make all current go through the transistor instead of the resistor.

The best transistor for this situation is surly up for debate. I would personally chose n channel enhancement mode to avoid the need for negative voltages (that way you can use a single supply). Also they seem to be more common (a.k.a. cheaper) than the other FET variants.

For the resistors, you could always try to use a resistor network (ex. DigiKey # MNR18472CT-ND with 8 resistors per chip @ 1$ for 10 chips ). As for the higher cost of transistors, you might be able to save a bit if you experiment with surface mount versions however you are right in saying the will be slightly more expensive than than their bipolar counterparts.

The more I think about it, the less problematic this inaccuracy seems. This little circuit is wonderful for learning circuits but I wouldn't use it in a project that requires much precision. In fact, if you only want the output without the learning experience, there are many one chip solutions witch offer much better precision at a decent price (ex. MCP4901 @1.15$ with 8bits and serial interface or DAC0800LCN @ 1.71$ with 8bits and parallel interface).
woody1233 years ago
nice 'ible :-)
I believe there is another way you could do this omitting the transistors (summing amplifier)
using voltage dividers at each digital output (e.g. 8 bit) to create increasingly larger voltages (eg LSB 0.2v, MSB 4v)
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!