43,942

26

14

Posted

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

## Recommendations

• ### 3D CAM and CNC Class

105 Enrolled

• ### Science of Cooking

We have a be nice policy.

## Questions

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.

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.

Thanks,

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

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
headphones..so 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
my email address is maehmedebrahim@gmail.com thank you.

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.

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.

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.

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

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

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