how to check power bank battery level using arduino-

how to check power bank battery level using arduino uno- am using same power bank as supply to my arduino.

can someone help..?

Yeah split it between two resistors:

  • ==<~>== A0 ==<~>=== Ground

**IF that voltage is never more than 10V you can use same ohms, otherwise less resistance goes on ground side. **

Then it's math, which I suck at. I assume you'd want to use a series of if statements on the analogRead(A0); it returns 0-1023 mapped from 0-5VDC at the input pin. I'd set aRead = analogRead(A0); if (aread < 900), light up one bar, if (901 < aRead < 950), etcetera.

Every time use use digitalWrite, it is latching, so you'll have a few of these statements each range condition.

What type of battery?

A power bank has a boost converter that keeps output voltage on the USB socket a constant 5volt.
No use measuring that.
If you want to measure battery voltage, you need to crack the power bank open, and solder a wire to the battery.
If you do so, add a 10k resistor in series with the wire, for safety.
Leo..