# How could I create a high-precision voltage with the atmega128?

In my solution i have to replace an 10 turn potentiometer ( 5 K Ohms ) with a digital circuit. the potentiometer is dividing a voltage between 4v to 21v. so it seems if i could generate a voltage between 4v to 21v with a Atmega8 or Atmega128 ( indeed it must meet high accuracy ) I'm done ! I have tried to use Digital potentiometer , but got in to 2 problems :

1 - first they can not stand the current going throw the potentiometer : (21-4)/5K = 3.4mA

2 - they don't have the required accuracy (21-4)/256 = 66 mV ( but i need 0.5mV)

Is there any way i could do this?

• Do you really need this kind of accuracy? I made this calculation: (21V-4V) / 0.5mV = 34000 Steps. Can the user currently set the pot this precise? For a 10 turn pot you have an total rotation angle of 10*360°, this is only 0.1° for a 0.5mV increment. However, you can achieve this easily with 16Bits (2^16=65536) DAC resolution. Aug 30, 2011 at 6:55
• Yes , I Do need it, actually I need more and I'm thinking that the DAC is a good idea specially when using it with an Op-Amp to bring up the voltage level to 4-21 Volts. Sep 1, 2011 at 6:50

First the accuracy. Your total range is 17V, so 0.5mV in 17V is 1/34000, just a little bit over 15 bits. As 0x6d64 notes that's a lot to get from even a multiturn potmeter. Let's see. Most multiturn potmeters are wirewound, the one I have here in front of me has a diameter of about 15mm for the wire path. If the wire is wound at a 0.5mm spacing then you can have $10 \times \dfrac{2 \pi \times 7.5mm}{0.5mm}$ < 1000 steps or less than 10 bits. $V_{IN}$ is your 4V-21V input voltage, and via the serail digital interface you can set the output voltage as a ratio of $V_{IN}$ like a potmeter would.