cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Bluetooth

Anonymous
Not applicable

Per this thread here: Measuring Battery life with BCM20732S

I am in a very similar boat to the original poster.

I have a battery that can vary in voltage from 2.8 to 4.2v.

For this reason I have a 2.8v (output) regulator connected between my battery and the VBAT pin of my bcm20737s.

When I turn on my module and view the battery percentage, it is always roughly 66%.

What I intend on adding to the next revision if my board is the following circuit:

pastedImage_1.png

Supply is connected to my battery (2.8 to 4.2v)

BATT is connected to P8 (ADC)

BATT control is connected to P24 (GPIO)

As my bcm20737s is running at 2.8v passing straight in my battery voltage to P8 would be very harmful as it is above the recommended input voltage. Also it would be larger then my adc voltage reference.

So I have set up a voltage divider law (2K2 & 1K1) which when my battery is at 4.2v, P8 will see 2.8v.

As there is a voltage divider according, and I left my module sitting on a shelf for a long time my battery would eventually run dead.

So I have included a npn transistor. The transistor is controlling the ground path of the voltage divider.

If I apply voltage to the base of the transistor my voltage divider will be connected to ground and the flow of electricity can occur.

if I do not apply voltage on the base of my transistor my voltage divider will not be connected to ground and the flow of electricity cannot occur.

This same theory can be applied to improve power consumption while the module is running.

I know I will have to pass the voltage of P8 to the function that is calculating the battery voltage currently.

I also know I will have to change a few parameters for the calculation to be correct.

Can anyone see any problem with the above design?

How will I pass the voltage of P8 to the current battery calculator?

Thanks,

Luke.

0 Likes
1 Solution
JacobT_81
Employee

Apologies for the delay.

Going through the source code the, the battery monitoring code is actually hard coded to only monitor the battery input pin. That's the reason it's not working with a simple switch of the GPIO number.

This cannot be changed/worked around at the moment, but it could potentially be provided as a patch in future SDKs.

Jacob

View solution in original post

0 Likes
6 Replies
MichaelF_56
Moderator
Moderator

Creating a new thread as it is unlikely anyone is policing threads that are closed.

Adding jakewtorres

0 Likes
JacobT_81
Employee

In platform.h, change GPIO_PIN_BATTERY from 15 to 8.

Putting a BJT inline with your circuit will cause some saturation voltage drop, up to about .2v depending on your BJT. This will affect you measurement. Additionally, your measurement may be slightly skewed by possible lower-than-ideal impedance on the ADC input (reported by one other customer).

Making this circuit viable will come down to tuning your voltage divider so that the measurement is accurate. Using these fixed values may give you some skewed readings.

Jacob

0 Likes
Anonymous
Not applicable

I changed this and it did not work. The battery level stayed the same as before.

If I make changes in blebat.c, how would I apply them to hello_sensor.c?

do I have to build the file etc after I am the changes?

What every changes I make to this file do not seem to happen when I upload the program to my board

0 Likes
Anonymous
Not applicable

jakewtorres

Any update Jake? I'm stuck on this one at the moment.

Thanks, Luke.

0 Likes
JacobT_81
Employee

Apologies for the delay.

Going through the source code the, the battery monitoring code is actually hard coded to only monitor the battery input pin. That's the reason it's not working with a simple switch of the GPIO number.

This cannot be changed/worked around at the moment, but it could potentially be provided as a patch in future SDKs.

Jacob

View solution in original post

0 Likes
Anonymous
Not applicable

I am at the stage of ordering a final board for this project.

This is the last hurdle at the moment. Could you tell me when could I expect a patch to fix this?

Is there any other way around it?

Could I do my ADC read on my own battery monitoring pin and pass the result to the piece of code that actually sends the value of the battery? The value of the battery must be stored in some variable before it is sent.

Regards,

Luke.

0 Likes