Changing Battery Charging Settings - Electron

I am looking for some help changing the Power Management IC battery charging voltage & current settings.

From my testing it looks like the battery is charged to 4v and not much more which is safe but it never brings the fuel gauge up to 100% full because the battery charge voltage is not brought up high enough.

I would also like to raise the charging current limit since the chip is able to charge up to 4 Amps of charge current, it looks to be set at 500mA for now. I want to charge higher capacity batteries quicker.

This TI chip is a good one and I’m happy they choose to use it.

From the firmware reference docs I found the code to make the changes but I need some guidance on how to use this properly. See below:

Do I just put a new voltage in the () brackets? Like bool setChargeVoltage(4.20 or 4200); ?

And I really need help with understanding the code that set’s the charging current.

If anybody can provide examples I would love to see it.

I would love to use LiFePo4 type battery cells due to their long lifespan and I can by changing the charge voltage settings but I’m think the fuel gauge is designed for reading LiPo cell voltage curves only which would make it useless with the LiFePo4 cells. :smiley:

2 Likes

You could have a look in the open source repo
https://github.com/spark/firmware/blob/develop/wiring/inc/spark_wiring_power.h
https://github.com/spark/firmware/blob/develop/wiring/src/spark_wiring_power.cpp

In the header file are some comments about the registers and the .cpp does tell you about how they do it.

5 Likes

Thanks @ScruffR I had no idea to look there but I do now :smile:

And yes it does have all the info there which is great!

@RWB did you ever play around with this? If so, how were your results?

Thanks!

YES I did but nothing happened like I wanted so I reverted back to the original settings. The Red charging LED started going crazy and the charge voltage didn’t change.

That’s disappointing to hear. What was/is the max voltage/charge you’re getting? I’m currently only checking the current with my setup.

I don’t remember honestly.

The SOC only goes up to like 86.

I played around with the charge current/voltage and had a medium amount of success. I have a 5000mAh lipo battery so charging it at 500mA (default) takes much longer than desired. I increased the charge current to 1024mA and was happy with the results. You will have to increase input current limit (I set to 1500mA) for this to work. You will not be able to go any higher than 1500mA due to the 330ohm resistor soldered to the chip. Pay attention to the PMIC status word as there is some good info in there about the charging status and input voltage limitations. I was charging from my iPad charger which puts out 2A, however there was significant voltage drop at the end of my 28AWG USB cable. The PMIC will automatically adjust the charge current if it sees too much voltage drop. I found a nice 22AWG USB cable and that does the trick.

I had less luck adjusting the charge voltage register. The chip datasheet allows for many settings, but looking at the .cpp file, it looks to me like there are only two options available. (below)

Adjusting this value works initially, but later gives me a the blinking PMIC LED fault. Maybe their are some other settings I have to adjust.

1 Like

I’m using a 6600mAh battery in place of the 2200 one that is shipped with the Electron and I’ve been able to get into the 90s charging it with the Electron and a solar panel. I have yet to verify that it is correctly reading the values, but I don’t see why it wouldn’t be.

If you don’t mind me asking; how are you mitigating the risk of overheating your lipo battery? I wish they broke out the thermistor pins on the PMIC chip so we could take advantage of the temperature protection.

What code did you use to change the charging current? It would save me from trying to figure it out :smile:

And I saw the same blinking LED issue when I upped the charging voltage so I changed it back to the default settings.

I checked what the max allowable charge rate was without temperature sensing for my battery and it’s 1A. The Electron’s max charging rate is 512mA, which is well below 1A. Additional, my 7.4V solar panel shouldn’t get close to the 512mA output. However, if the battery gets damaged I will let you know :sweat_smile:

hey, to change the charging current I called the below code in my setup.

//set charging current to 1024mA (512 + 512 offset)
pmic.setChargeCurrent(0,0,1,0,0,0);

//set input current limit to 1.5A
pmic.setInputCurrentLimit(1500);
2 Likes

alright! thanks

Currently the highest I can get to is 91.488%. This is without any modification besides a different lipo battery.

The higest recorded latley when charging via USB input is 85%

So I’m a little confused on how to call the PMIC functions. I looked through the repo files that @ScruffR shared. Am I supposed to include those files in my app by clicking the + button on the top right hand corner and then call the functions? Or is there some other way I can call these functions? I’m just a little lost here.

Thanks!

No, you don’t need to include them, since they are already there.
You just need to instantiate an object and use it.

2 Likes

I just instantiated it and it worked. Thank you!

What did you successfully change?