0
\$\begingroup\$

I have a Raspberry Pi Zero in a small robot that I have been powering off a USB powerbank and it works great. Unfortunately when the USB battery goes flat the power is cut and the Pi crashes. I want the Pi to know when the battery is nearly flat and warn me. Ideally it could calculate how many hours of battery life I have left too.

I have bought an INA219 voltage\current sensor. My original idea was to put the 0.1 Ohm shunt in series on the 5V between the USB output of the battery and the Pi. This only tells me the current at the time I sample it, and the voltage feeding the Pi which is largely irrelevant as long as it stays within the USB voltage spec.

Photo of powerbank and INA219 sensor

Having taken apart my USB powerbank (RavPower RP-PB19), can I put the INA219 between the Lithium ion cells and the boost converter\charging circuitry shown? Specifically, can I cut this red wire in the photo and put each cut end of the wire into the blue screw terminals on the INA219 sensor to be able to read the current cell voltage of 3.6V ish and therefore work out roughly what percentage the batteries have left in them?

\$\endgroup\$
  • \$\begingroup\$ Where would the INA219 draw its power from? \$\endgroup\$ – mkeith Sep 9 '18 at 16:02
  • \$\begingroup\$ The Vcc on the INA219 is fed from the 3.3V output on the Pi's GPIO connector. The Pi creates this from the 5V it gets from the micro USB. All GND's are connected together. \$\endgroup\$ – Ralph Sep 9 '18 at 16:05
  • 1
    \$\begingroup\$ Seems like it will work. Disregard any comments you may have seen from me which have now been deleted. \$\endgroup\$ – mkeith Sep 9 '18 at 16:10
1
\$\begingroup\$

Yes, the INA219 voltage/current sensing would be correctly applied directly at the battery cell terminal. This way you measure the current and the terminal voltage on the element that varies.
The current output (of the convertors) will not appreciably change until the unit is approaching failure so provides less predictive capability.

You may need to consider reducing the current sensing R since the pulse currents from the battery to the convertors will be significantly higher than the output current. If you have too much Rsense then you will eventually restrict the pulse current and so alter the PWM. Read the INA219 datasheet to decide on a new Rsense and PGA value. It's likely that you will want to achieve less than 100mV Full scale Vsense.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.