11 years, 11 months ago.

m3pi battery voltage lcd display

Can someone help this old beginner get an example going that displays the battery voltage constantly?

My goal is to tie it to a digital relay that automatically turns the attached battery charger on/off.

Thanks

Bo

2 Answers

bo barry
poster
11 years, 11 months ago.

Chris,

Thanks a lot for the example program!! I studied it line for line and think I understand it (with my very limited knowledge so far). However, the 3pi battery voltage STILL ELUDES ME. Only the second line of your example displays. I can replace the current_volts in the printf statement to a number such as 3.14 and it displays OK.

I have learned how to put the LED on/off lines in my programs to help debug, to get an idea how far the program gets before choking. Thanks for that idea.

(I'm really an assy lang lover, using a JTAG to single step thru a program to see what I'm doing.) :)

I'll work with it some more tomorrow. If I can get this elusive voltage display to work then I'll feel better and can move onward. :)

Thanks again.

Bo (P.S. I'd sure like to hear from the MBED/3pi folks, it seems they are scarce.)

Accepted Answer
11 years, 11 months ago.

Hi Bo,

The m3pi library has an API function which returns the current battery voltage as a float.

The full API documentation can be found at :

Your application code can periodically call the battery methodss and choose what to do as a result, i.e. switch the charger on/off as needed.

I don't have an m3pi to hand so its not tested, but this might be a suitable framework to adapt.

Chris,

Thanks a lot for the example program!! I studied it line for line and think I understand it (with my very limited knowledge so far). However, the 3pi battery voltage STILL ELUDES ME. Only the second line of your example displays. I can replace the current_volts in the printf statement to a number such as 3.14 and it displays OK.

I have learned how to put the LED on/off lines in my programs to help debug, to get an idea how far the program gets before choking. Thanks for that idea.

(I'm really an assy lang lover, using a JTAG to single step thru a program to see what I'm doing.) :)

I'll work with it some more tomorrow. If I can get this elusive voltage display to work then I'll feel better and can move onward. :)

Thanks again.

Bo (P.S. I'd sure like to hear from the MBED/3pi folks, it seems they are scarce.)

posted by bo barry 20 Jan 2013