You won't get 5.0V out of the regulator if you only feed it 5.13V. You're supposed to feed it 7V to 12V. You'll be lucky if you get s much as 4V out of the regulator. Measure it at the "+5V" pin.
If you connect your 5.13V VIN to the top end of your voltage divider you will have to turn the input down below the regulator output before you get a reading below 1023.
If you aren't getting 5.0V on the "+5V" pin then you won't be measuring voltages correctly using 5.0 / 1024.0
nik600:
So, basically, as i want to mesure the value of a NTC 5k resistor using the voltage divider i need to:
read the "real" vin value on A0 (connecting +5.15v to A0 and GND to GND)
read the vout value on A1
finally, i won't power the arduino with the same circuit used for the voltage divider, (ie. i'll use the usb of the laptop).
correct?
Incorrect. Your USB supply might not be exactly 5.0V. Even if it is you can't measure 5.15V using a 5.0V supply.
To determine resistance with a voltage divider you need the ratio of (A) the voltage across the divider to (B) the voltage across the variable side of the divider. Typically you would use the Arduino "+5V" pin for (A) and thus you know the first number is 1023. The other number would be whatever analog input you read from between the fixed and variable resistors.
If you use a separate power supply for the voltage divider that voltage must be LESS THAN OR EQUAL TO the voltage on the "+5V" pin if you want to use an analog input to get (A). Using 5V on the Arduino and 5.15V on the voltage divider gives you no way to measure the 5.15V relative to the Arduino power.
Can your 5.15V supply power the Arduino via the "+5V" pin? If so you can use 1023 for the first number since the Arduino supply voltage and the voltage divider supply voltage are again the same.