What's new

Battery charge limiter experiment

Wayne Orwig

Active Member
I know a lot of people go out of their way to not let device batteries get to 100%. Generally for me, I am plugged into the charger full time, so the device is always ready to go. I did have an OLD smartphone that I installed a security camera app on, and plugged it in for a few years, that the battery started to swell after years. Other then that, I have no real issue.

A few days back while playing with my Android phone, I encountered a macro that lets you control a smart device based on the phone battery level. As in, when the phone gets to say 95%, it turns off the charger. Then when it drops to say 85%, it turn it back on. I then wrote a batch file to sort of do the same for my Surface Pro 3.

Basically:
1) I created a task in the scheduler that runs a batch file ever 15 minutes.
2) The batch file looks at the battery level
3) If the battery level is high (or low) it sends an off (or on) request to IFTTT.
4) IFTTT then controls the charger as needed.

Sort of convoluted, but it works. So my SP3 stays between about 85% and 95% now. I'm not convinced that this is a great thing, but I don't think it will hurt.
If anyone is seriously interested in trying this, and you know how to control a switch from IFTTT, I can do a more detailed writeup.
 

ScottyS

Active Member
I know a lot of people go out of their way to not let device batteries get to 100%. Generally for me, I am plugged into the charger full time, so the device is always ready to go. I did have an OLD smartphone that I installed a security camera app on, and plugged it in for a few years, that the battery started to swell after years. Other then that, I have no real issue.

A few days back while playing with my Android phone, I encountered a macro that lets you control a smart device based on the phone battery level. As in, when the phone gets to say 95%, it turns off the charger. Then when it drops to say 85%, it turn it back on. I then wrote a batch file to sort of do the same for my Surface Pro 3.

Basically:
1) I created a task in the scheduler that runs a batch file ever 15 minutes.
2) The batch file looks at the battery level
3) If the battery level is high (or low) it sends an off (or on) request to IFTTT.
4) IFTTT then controls the charger as needed.

Sort of convoluted, but it works. So my SP3 stays between about 85% and 95% now. I'm not convinced that this is a great thing, but I don't think it will hurt.
If anyone is seriously interested in trying this, and you know how to control a switch from IFTTT, I can do a more detailed writeup.
I wish I had this when I had my SP3. I used to leave it plugged in all day and night and the battery swelled (although this was after 5 years of great service) and I had to get rid of it and get a SP7. Now I unplug it, but still it gets up to 100%. I would be interested if you could post your batch file.
 

GoMan

New Member
You can limit battery charging to 50% of its maximum capacity in the Surface UEFI settings menu by enabling the battery limit mode. This setting is particularly useful in situations where the device continuously receives power as a means of prolonging battery life.

In addition to this, I have tweaked a few of the advanced power settings to adjust the defaults for:
  • Low battery level
  • Low battery action
Power.png
 
OP
Wayne Orwig

Wayne Orwig

Active Member
Ok, below is the batch file. I 'stole' the bit that reads the battery level and don't really understand how it parses the battery level. Mainly, it only returns one battery number, so it will not work well on a Book with two batteries. But it should work to some extent.
I have a task scheduled to run once a day and run for a day. And repeat the batch file every 15 minutes. You can bump the repeat up or down if you feel it is needed.
As you see, I used 90% to turn on the device, and 95% to turn it off. Adjust for your situation.
The 'SP3ChargerOn' (and off) are event names that match the IFTTT Webhooks service. Use whatever name you want here and match it in IFTTT.
Replace YOUR-KEY with the key code that WebHooks, in IFTTT supplies, to work with your devices.

I mainly did this as a novelty, but it appears to work fine so far.

rem This batch file triggers an outlet through IFTTT based on the battery level. rem rem Parse the Win32_battery info for the battery level rem note that this is not correct for a device with two batteries, but close enough for /f "usebackq skip=1 tokens=1" %%i in (`wmic Path Win32_battery Get EstimatedChargeRemaining ^| findstr /r /v "^$"`) do ( set _charge=%%i ) rem now decide what to do if %_charge% lss 90 ( echo Charger ON curl "https://maker.ifttt.com/trigger/SP3ChargerOn/with/key/YOUR-KEY" ) if %_charge% gtr 95 ( echo Charger OFF curl "https://maker.ifttt.com/trigger/SP3ChargerOff/with/key/YOUR-KEY" )
 
Top