Can Arduino Measure its own power supply

Hi. I have a very short and simple question, "Can arduino meausure its own power supply?". I know the analog pins can meausre up to 5v but I am measuring 2 18650 batteries in series which sums up to 7.4v.

I am doing this to measure the voltage of the battery to know how much power it has left to warn me whenever I need to recharge. I might use a voltage divider to step down the voltage and just tweek the code, but I am not sure if this will work. The Arduino IS ALSO POWERED by the SAME POWER SUPPLY (2 18650 batteries). It connects to the Vin pin, so it a bit confusing for me. Looking forward to your reply​:grinning::grinning::grinning:

Hi Gabriel, yes of course - but the best solution depends which arduino you are using.

Of course but that does mean there will be a permanent current drain on the battery. You can make the voltage divider chain very high resisitance since the voltage will not be changing very fast.
You will need to use a voltage reference as a basis for measurement, but the "INTERNAL" reference will be good enough for this application.

1 Like

If you really wanted you could use a FET to switch the voltage divider onto the battery - possibly a good idea anyway to stop the processor being back fed via an analog input when switched off .

Hi, Thank you so much for the reply. So it would work. I don't really know how to use the ARef but I think it plays a significant role in accuracy of the reading which I need since I am measuring my battery life. If ever,may I ask?

Thank you also hammy for that idea, yeah, the arduino powers because the vcc is connected to the analog pin and common ground connection. Now I know it work I need to make sure how to make it accurate.:grinning::grinning::grinning: