Implementing a DAC (digital to analog converter)

A simple way to implement a DAC is by using a R2R network which “converts” a binary pattern to an analog voltage.


binary value (eg 8 bit: b0..b7)  ==> R2R network ==> analog buffering ==> Analog value

R2R

Tutorial on R2R network R2R network for doing a DAC

Fast digital output on Arduino UNO

In this example we wil use an Arduino (UNO) wg´here we will use direct register access to speed up the DAC.

See here: fast DAC direct register access for digital output on Arduino UNO

Pin overview on Arduinos

An overview over pins and PORTs on AVR Arduios(uno,mega,…)

See here

Unipolar versus bipolar voltages

Normally a microcontroller is powered by 3,3 to 5V. So there is no negative voltages available.

and

Normally or often we want to have bipolar voltages on our DAC.

An example:

We have [0-5]V as output on our R2R network - Vdac

We would like to have [-2.5 2.5]V as output - Vo

So we just need to add -2.5V to Vdac: Vo = Vdac -2.5V
So you need a …

Voltage summing circuit.

could be …

 
  1. opamp supply voltage must be [-6 - 6]V or more

  2. buffer output from R2R with a unity gain opamp

  3. R1 = R2 and choose them to be 100 kOhm

  4. Ra = 100kOhm remove Rb – unity gain buffer

  5. output from buffer to V1

  6. V2 must be -2.5V the offset you need

  7. and now we have [-2.5 - 2.5]V

If you want to have more output then set gaing in backend opamp (Ra, Rb)


NB: This is not a comprehensive guide but should give you some ideas.

JEns