Power monitoring

Since we’re using unprotected LiPo batteries, which would be seriously explosively damaged by over-discharge, we’ve worked some I2C voltage and power monitors into our bot this year.

We’re using these INA219 boards in-line with the battery cables to measure  voltage, current and power.

Out of the box, the sensors can read the bus voltage (i.e. potential difference between ground and the IN- connection).  To get them to read current and power, you need to set a configuration value in one of the registers.

One gotcha we hit was that the bus voltage register is not “right aligned”, some of the low-order bits are used for status flags so you have to take the voltage reading and shift the value 3 bits to the right to extract the voltage and then multiple by 4mV to scale it.

With that out of the way and the calibration register programmed, we now have sensible-looking readings from the battery pack that is powering the Pi:

A: 7.95V <nil> A: 0.459A <nil> A: 3.615W <nil>
A: 7.94V <nil> A: 0.431A <nil> A: 3.420W <nil>
A: 7.97V <nil> A: 0.424A <nil> A: 3.339W <nil>

and, we should be able to alarm if the voltage of the pack drops too low.  (We have a two-cell pack for the Pi, so anything less than 6V would mean that our pack would be damaged.)

Since we had some strange power-related gremlins last year, we split the motor and Pi power so that the motors are powered by a completely separate battery pack.  That means that we have two INA219s; one for each pack.

Leave a Reply

Your email address will not be published. Required fields are marked *