Introduction: Homemade DAC A/D Converter

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

Step 1: Building the Circuit

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

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).

Step 3: How It Works

This circuit has a digital to analog converter, and can be used as one, it is really the heart of it.(red in second pic) With a Micro controller or a binary counter you switch the inputs A1-A3 (or what ever you max bit is). The highest resistance is your most significant bit, and as your circuit counts the resistance changes. This changing of resistance makes it a variable voltage divider. Then this voltage goes into a comparator or an op amp and gives you Y1 and Y1 is high only when the DAC is higher than the voltage you’re measuring. So Y1 will tel you it is lower than the DAC voltage but higher than the last binary input. It is not to hard for a program or a computer parallel port to read.

Step 4: Performance / Accuracy

Of course it isn't as accurate as a commercial unit, especially at only 3 bits of resolution, but remember it is expandable. A slight drawback is it produces a variable voltage with only a low current so it can not directly drive anything but, a power transistor would fix that. It will change over temperature but not too bad. It has a slight curve in voltage because I used 150 330 680 when 150 300 600 would be the appropriate values. The worst thing is that the voltage will never go as low as it can high but the last picture shows a solution. DAC's on the positive and negative rails. I hope my new DAC A/D converter solves some data logging problems.

If you need clarification please post a comment I hade trouble trying to explain all this.



DanielB281 (author)2016-03-29

So wait... Did you make an ADC, or a DAC? There is a lot of difference in those two terms, and even though a lot of people might mix them up, it can be a bad thing if they are.
An ADC (Analog-Digital Converter) converts an Analog signal (Like a voltage reading from a potentiometer, or even sound) into a Digital signal that a microcontroller or processor can read. Going by my reading of the article, this is the device you built.

A DAC (Digital-Analog Converter) is exactly the opposite: It takes a digital signal and converts it into an Analog signal for whatever reason (Generating sound, controlling voltage controlled devices, etc.) Again, going by the Article, this is *NOT* what you made, though the title of the article and some of the terms used in the article's body itself would lend one to believe that perhaps this is what you made?

Neither of these things are particularly difficult to make if you have the parts, the knowhow, and the room on your circuit board (The above design here could *potentially* be made with a small PCB footprint, but expanding it to 16 bits could make it a bit cumbersome). I'm personally working on a Delta-Sigma ADC design right now, using some pretty common ICs (An LM 324, a TL082, and a CD4013: The idea is that combination would provide 2 ADC channels to port into the mC), I might post it here if the tests prove to do well.

gvan kaam (author)2015-11-11

Currently I am using Anamometer, which uses an reed switch.

I would think your circuit would work for this application, since I want Analog output.

Where do I connect the Digital input.


mdshazwan2 (author)2015-09-09

Hi, currently I am using digital data inputs, but some people told me that my Atmega 328 cant read digital data. Can I use this op amp, acting as a voltage comparator, to change my digital data to analog data

ahmedebrahim (author)2015-02-06

hi thanks for this amazing diy ihave aproblem with my android tablet its
audio ic was damaged and it can't produce any audio through the I was thinking if i built a digital to analog converter
then i may gate the audio through the usb or otg cable output but I
can't do it because there are only 2 output pins the white and green please help or tell me your suggestions as soon as you can.
my email address is thank you.

Teslaling (author)2011-07-14

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)2010-11-04

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)2010-11-03

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.

mathieulj (author)2010-11-02

Another solution would be the traditional R-2R ladder network (see attached image).

mathieulj (author)mathieulj2010-11-03

Oups, the amplifier's inverting and non-inverting inputs are switched in my schematic.

jazzzzzz (author)2010-11-02

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

mathieulj (author)2010-10-29

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)mathieulj2010-11-01

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.

mathieulj (author)jazzzzzz2010-11-01

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).

woody123 (author)2010-11-01

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)