Sunday 12 April 2015

16-level (4-bit) DAC for the Arduino Uno using 2 digital I/O pins.

In my previous post I described the theory for using the additional configurations of an I/O pin (high impedance and pull-up) to produce 4 different voltage levels. This can be used to construct a 'quaternary' DAC which outputs 4^n output levels for n-inputs used, instead of the 2^n scaling for a binary ladder.

Low cost n-ary DACs using digital I/O

This circuit can output 16 different voltage levels, controlled by 2 static pins.
Note that this is not intended for any practical use! It relies on properties of the chip which are not specified to be consistent in any way, the internal pull-up 'resistors'.


If you wanted to build this you would first have to find the effective value of the internal pull-up resistors on your chip. A fast way is to find the external pull-down resistance which results in a pin voltage of exactly 3.33V when the internal pull-up is enabled. (should be somewhere 60k-100k on the ATmega328P) If this measured value is Rpulldown:
Rb2 = 0.75 Rpulldown
Rb1 = 1.5 Rpulldown


The DC performance of the DAC will vary, but it's INL is on the order of 0.25LSB.


Due to the high resistance values and slow transitions it's not as fast as an R-2R ladder, and performance falls rapidly above 10kHz. The scope capture shows a 12kHz triangle wave.


There are visible glitches when transitioning between output levels, I'll cover the solution in my next blog post.

Reducing ladder-DAC glitches.

No comments:

Post a Comment