I would like a LED to be lit when the battery is getting empty. Can I connect the battery to an analog input of the Arduino trough a resistor and detect when the value decreases under a specific voltage threshold ? Or is there a better way to do it ?

I would like a LED to be lit when the battery is getting empty. Can I connect the battery to an analog input of the Arduino trough a resistor and detect when the value decreases under a specific voltage threshold ? Or is there a better way to do it ?

Thank you in advance.

That should work, and there is no real reason to use a resistor as a analog input pin is high impedance and will not draw any significant current from the battery. A reading of 3.0vdc is a generally used common value to stop drawing current from the lipo cell to prevent cell damage.

I'd include the resistor, something like 1k to 10k is fine, just to prevent the risk of accidental short(*) on the traces of the Arduinogrounding the LiPo - massive currents would then flow, vaporising pcb traces. LiPo's can put out 50 to 100A or more if abused...

(*) Accidentally put the board down on top of something metal for instance.

[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]