Detect when M3pi is charging with mbed

We are doing a project, where we need to make a M3pi run for 24 hours with the ARM LPC1768 mbed… The batteries doesn’t have that much power, so we are making a “Pit-Stop”. So I figured out how to make it output, battery voltage, and that’s all good, but when it goes under a margin we need it to stop when it’s in the pit. The only way I can figure out how to make it stop when it’s in the pit, is when it begins charging.

But how can I make a the M3pi make a return value when that happens?

(Another question which isn’t related to the charging, do you know why the voltage is fluctuating so much? when I print the voltage value, it jumps up and down constantly, not a steady drop!)


It sounds like you are asking how to get the m3pi’s charging status from the mbed microcontroller. There is no special command or special function that determines when the 3pi is charging. However, since there is already a command to return the 3pi’s battery voltage using the serial slave program, it might be easiest to use the mbed to determine if the voltage readings from the 3pi indicate it is charging. (You can find the source code under the “Serial slave program” section of the 3pi’s user’s guide.) Alternatively, you could add an external sensor directly to the mbed to detect when the m3pi is at the pit stop.

Regarding the voltage fluctuations, it is normal to see the voltage change slightly, especially with a load (e.g. motors). If you can provide more details about the behavior such as the fluctuation range and conditions, it would help determine if what your are seeing is abnormal or not.

- Amanda

Hey Amanda! Thanks for the reply!

I think I found another solution with mounting cables connecting one of the analog-in pins on the Mbed, because when that get a power input it changes that value, which I can detect. :smiley:

Regarding the other question… After switching batteries, it seems like it stopped somehow, so If I gt the same behavior again, I’ll post again!

Thanks again! :slight_smile: