I am experimenting with Arduino reading voltage with a 10k resistor. I have successfully done that but I realised I can’t use power when the mini USB cord is not in the Arduino Nano. I would like to use it when it is not plugged in like a lcd screen or anything else. I would only like to use resistors not a voltage sensor. If anyone would like to reply to me that would be great.
A cheap 8 MHz Arduino Pro Mini will run with three AAA batteries.
Some use a Arduino Uno with a 9V battery, but don't do that. That battery can not give enough power.
A normal multimeter is designed to last a long time on a battery. The Arduino boards are not designed for that. When you use a LCD screen, then the backlight needs current, so you need a bigger battery for that.
If you use an Arduino board to measure a voltage, then you need a good voltage reference. A Arduino has a internal voltage reference, but then you probably need a voltage divider (a voltage divider is two resistors).
The Arduino Uno and Nano can measure their own VCC.
The VCC is used as reference voltage to measure its internal voltage reference. By reversing the calculation, the VCC can be calculated if the internal voltage reference is known.
If you connect the battery to the 5V pin, then you don't need to add any resistors of any wire. The Arduino can measure that voltage.
Search for "arduino secret voltmeter" or something like that.
Not all Youtube videos are good. You might learn wrong things.
We don't measure a voltage with the 5V as reference when it is not a stable voltage. We don't fix a (temporary) lower 5V in the sketch. We calculate the voltage in a different way. We don't use String when it is not needed.
You should also be careful with Instructables.com, there are also some questionable tutorials over there.
Yes we got that bit. The thing that is wrong is that you only have a single series resistor. That will not affect the voltage you read. You need a potential divider to measure voltage and then some calculations to turn it into a resistance.
To a great extent the accuracy will be determined by the accuracy of your fixed resistor.
I think @Koepel has the right idea here.