# Arduino voltmeter Question

I am using this circuit to calculate the raw supply voltage

And with this code

`````` vout= (A0_value * 5.0)/1024.0;                                         // voltage coming out of the voltage divider
vin = vout * ((R1 + R2)/R2);
``````

Now the thing is that I am using that 2200uf capacitor because my arduino will be doing some other works and when the supply is cut off the capacitor will help the AVR to store some data in the EEPROM.
Now there are other circuits connected to the same supply and to avoid them using this capacitor's charge I am using the diode.. So because of the diode there will be a fall in the voltage of 0.6Volts, and because of that the voltmeter reading will also decrease by 0.6volts.

So to get a correct reading can I add up 0.6 to the Vin in the code

`````` vout= (A0_value * 5.0)/1024.0;                                         // voltage coming out of the voltage divider
vin = (vout * ((R1 + R2)/R2)) + 0.6;
``````

Is this going to work...??
Is it the correct way...??

Is this going to work...??

Up to a point. Recall that .6vdc is just a nominal value for the forward voltage drop of a silicon diode, it will vary by actual current flow and ambient temperature. If as much accuracy as possible is important just move the top of Ra to the anode side of the diode.
Is it the correct way...??

Depends on your objectives, it's certainly not wrong, but there is always the possibility of more then one correct method.

If as much accuracy as possible is important just move the top of Ra to the anode side of the diode.

No I cannot move the Ra to the anode side of the diode, thats because the arduino will not get enough power supply ..

Joy:

If as much accuracy as possible is important just move the top of Ra to the anode side of the diode.

No I cannot move the Ra to the anode side of the diode, thats because the arduino will not get enough power supply …

Yes it will, I didn’t say to remove the wire from the diode cathode to the arudino power input, I said to remove the top (left side in your picture) lead of the Ra resistor and run it to the anode of the diode. Draw it out and see what you see.

Lefty