MyVolts program
Rsadeika
Posts: 3,837
On my ActivityBot I have the Boebot li-ion power pack installed, and as per the suggestion by Andy, I wired up a circuit to measure the state of the battery. The program is working as expected, it shows a value of ~4.93 Volts, but what is that really showing me? The li-ion pack is putting out, or is rated at 7.4 Volts, the program is showing ~4.93 Volts, but when I plug in to charge, the blue LEDs are flashing, which means it is not ready for a charge. So I guess the question is, what is the state of my battery charge?
What I would like to do is, for my ActivityBot program, I will add this function and monitor the battery state via the XBee terminal, and at some Volt number I can have the ActivityBot start flashing a red LED as a warning, and maybe display a message on the terminal screen. But first a discussion of what that ~4.93 is really telling me.
Thanks
Ray
What I would like to do is, for my ActivityBot program, I will add this function and monitor the battery state via the XBee terminal, and at some Volt number I can have the ActivityBot start flashing a red LED as a warning, and maybe display a message on the terminal screen. But first a discussion of what that ~4.93 is really telling me.
Thanks
Ray
/* myvolts.c */ #include "simpletools.h" #include "adcDCpropab.h" int main() { // Add startup code here. adc_init(21,20,19,18); float v3; while(1) { // Add main loop code here. v3 = adc_volts(3); v3 = v3*2; putChar(HOME); print("%f Volts%c\n",v3,CLREOL); pause(100); } }
Comments
I just tested your code with the following setup:
I applied a 7.2 volt source to one side of a 100K pot, grounded the other side, and adjusted the center pin to 3.6 volts. Appllied that to A/D 3 and ran your program as you posted it. The terminal screen displayed continuously 7.2xxxxxx volts.
So the code is good, more than likely your voltage divider is not using equal resistors.
Ray
Ray
The procedure you quoted from Andy pretty well outlines how to make the voltage divider, but it left it to the user to make sure to set PWR switch to position 3 to activate the servo Vin rail. Also, if you did not set the jumper as indicated and left it in the 5v position would explain the reading you were getting.
Hal
I wanted to create a C version of MyVolts for the PropBOE, but I noticed at the Learn.com, coverage for the PropBOE is strictly Spin. Maybe it's going to be - Activity Board <-> C, and PropBOE <-> Spin.
Ray