# Don't get the right Voltage of my DAC pin

Hello,

I have a problem with my Project...
My Project is about to use a Keypad with my Arduino Due to select any Voltage between 2V - 4V, to get this Voltage I use my DAC0 PIN and connect it with an OP at the end.
After I finished my Code I realized that no matter which Voltage I enter it is everytime 0,01V less than it should be..
on the Internet I found a formula to calculate the right decimal number for the DAC0:

``````[color=#404040][b][i]V[/i]out = [i]V[/i]refX(input/2[i]N[/i]-1)+ [i]V[/i]offset[/b][/color]
``````

I changed it to get what I need

`````` int  input2 = (((voltage/2.0)-0.56)/2.2)*4095;
``````

If you are wondering why in the first place stands /2.0 it is for the OP at the end to get my full voltage.
I tried to expanded the formula but nothing helped...

I hope I have explained it good enough that everyone can understand it.
I'm looking forward to get some solutions to fix it
Thank you!

The maximum output current for both DACs is 3mA -----> Be sure to have at least 1.5 KOhms resistors in serie to avoid burning your DACs !

Moreover, DAC output is within 1/6 * 3.3V and 5/6 * 3.3V:

ard_newbie:
The maximum output current for both DACs is 3mA -----> Be sure to have at least 1.5 KOhms resistors in serie to avoid burning your DACs !

In no toturial someone said I need a resistor for my DAC0... :o

This is how I connected the DAC0 with the OP. So do I need a Resistor before I connect it to 1IN+?

``````Moreover, DAC output is within 1/6  * 3.3V  and 5/6  * 3.3V:
``````

I know this and that is the Problem.. I checked on my Arduino which numbers it exactly is and it was possible to what I need. The thing is that the Output is smaller than I expected. I wanted to have for example 0,556V but instead I get 0,546V.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.