I'm using Arduino Nano to measure temperature with a 10 kohm thermistor and a voltage divider. My problem is I'm getting only 4.2V on the 5V pin. The power is supplied via a USB cable from a desktop PC.
I measured the output voltage of a USB port on the PC and it was around 4.5V. It doesn't look normal. So I suspect the power supply unit of the PC is not strong enough.
But it still makes sense to measure the voltage at the 5V pin since there is no guarantee it's exactly 5V. Its error will affect the calculated resistance of the thermistor. So I got it by connecting the pin directly to the A1 pin.
On the other hand, it seems to me Arduino internally and digitally knows the value of the supply voltage. So it would be faster and easier to get it rather than using the A1 pin. But I don't know how to do it.
After searching on the Internet, I could find only these things which didn't help me much.
- voltage level - What are the 5V and VIN pins for? - Arduino Stack Exchange
- voltage level - Getting 3.3v on 5v pin in Arduino Uno - Arduino Stack Exchange
I also considered using an external power supply, say 9V to the VIN pin but I don't feel like doing that much.
How can I measure the supply voltage of Arduino without using an analog pin?
analogRead()returns Rthermistor÷(Rthermistor+Rpullup)×1024, irrespective of the supply voltage.