Reducing Power Consumption
I'm working on embedding a gpy+pytrack inside of an asset to track them and I'm using a 5000 mAh battery and right now I'm not getting the greatest battery life out of it with only about a day. My plan was to inductively charge the gpy's but right now I'm probably only pulling 300-500 mA with my inductive charger and its not enough to keep the battery charged and I have to charge it via usb. There are things I can do to bring the battery life down still such as turning off the wifi. My code right now is fairly simple 1.) If the accelerometer hits a threshold check 2.) GPS velocity, if velocity is greater than my threshold 3.) begin sending GPS location over LTE. 4.) Check velocity if its moving, if its moving keep tracking, if it stops moving stop tracking and wait for accelerometer wakeup. Overall getting the pycom device and up and running has been a breeze and I've got my tracker working pretty reliably. My issues now are how to get it from sucking so much power... The first step I know how to fix and thats turning off the wifi but what else should I be doing? I tried using https://docs.pycom.io/pytrackpysense/apireference/sleep.html this code for the wake on acceleration but then my GPS velocity function never returns a velocity... Does sleep turn things off that need be activated again? Do I need to wait for GPS to resync? Does LTE need a moment to turn back on or do I need to reinitialize the LTE instance?
@Fin another good way to reduce overall power usage while being able to use the GPS is to keep the GPS on as long as an acceleration has taken place in the last 3 or so minutes. That way you can sleep the GPS while your device isn't moving and is on long enough to collect acceleration data while you are on the move.
Thanks for the tips! I'll start playing around with your suggestions and reading up on your recommendations and report back with how things are working out.
@fin There are many things drawing a lot of power here:
- the ESP32 (CPU) while active: count about 40-50 mA. You definitely want to go to deep sleep as much as you can.
- Wi-Fi: depends a lot on what you do, can go over 200 mA when transmitting, and still uses power just listening. If you don't use it, definitely disable it (use
- The GPS. Haven't used the Pytrack, but GPS chips can be very power-hungry. You want to either switch it off when you don't need it, or use low-power modes as suggested by @crumble
- LTE: depending on your network and settings, it may use quite a bit of power as well (and it definitely does use a lot of power when sending). Depending on your scenario, here again you may switch it off completely when you don't need it, or use power saving modes (but that depends on the network and technology used).
Velocity on a GPS is computed using the difference between successive positions, so you need to have a position (two consecutive positions, actually). If you switch off the GPS, you'll need to wait for the GPS to get a fix before you can retrieve it.
Note that when you send the Pytrack to sleep, you can choose whether you keep the GPS on or not. If you switch it off, it'll save a lot of power, but it'll have to start from scratch. If you keep it it on, you'll want to switch to power saving modes. But what mode you can use depends on your exact needs.
It's unclear at what interval you send data while in the "active" phase, so if in that situation it could make sense to go back to deep sleep between updates. It's probably not worth it if you want to send updates every 5 seconds, but if you send have a minute or more between updates, it's probably worth it, even if you take into account the time to boot the module, get a fix, etc.
- WiFi needs a lot of power. Don't init it, if you don't need it.
- You need to wait for a new GPS fix after deep sleep.
- Have a look into the l76 documentation. You can configure the ll76 to run with less power consumption. I cannot help with details. The sky is too cloudy since I started to use EASY :(