# Battery question / usable range

**URL:** <https://community.particle.io/t/battery-question-usable-range/43403>\
**Category:** Hardware\
**Created:** [August 9, 2018, 8:23am UTC](https://community.particle.io/t/battery-question-usable-range/43403 "2018-08-09T08:23:02Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)\
**Post date:** [August 9, 2018, 3:48pm UTC](https://community.particle.io/t/battery-question-usable-range/43403/9 "2018-08-09T15:48:03Z")

</div>

Here is the code I and others have used to put the Electron into deepsleep once the battery SOC hits 20%.

The code wakes up every hour to check if the solar panel has charged the battery above 20% and starts running normally once this happens and keeps sleeping if the SOC is still 20% or below.

The SOC% sleep number is adjustable so you can change it if desired.

> [@Particle Electron PMIC](https://community.particle.io/t/particle-electron-pmic/31412/2):
>
> If you use 6v solar panels and set the Vin limit to 4.8v or even higher if you do not plan on plugging in any 5v USB sources then you basically force the solar cells to stay in their Vmp voltage range without needing any other circuits in the mix. You should be using code like I’m using below to put the Electron to sleep if the battery SOC hits 20%. When the solar panels bring the SOC above 20% the Electron goes back to running it’s main loop as normal. I have a 3w 5v solar panel + the 2300mAh…

---

_[View the full topic](https://community.particle.io/t/battery-question-usable-range/43403)._
