empowering creative people

How to Conserve Battery Life with IoT Projects

If you’ve ever created a project that uses batteries, you’ll be well aware how hard it can be to decide on elements in the project which can affect the battery life. You end up ‘umming’ and ‘ahhing’ for ages about whether you should use LEDs as indicators, how often it should connect to the cloud or network (for IoT projects), and how you can minimise general power consumption.

It can be a tricky thought process and it's why commercial products are designed in such specific ways to minimise power usage. So, I thought we could take a look at some tips and tricks that you can use, especially in IoT projects, but also any portable project, to conserve battery life.

Using Sleep Modes

In a recent project, I was using the Particle Photon for the microcontroller, and along with using a 2400mAh LiPo/Adafruit Power Boost combo to power it, and took a look at the various power modes that are available with the Particle IDE. The documentation lists a few different options for putting your device to sleep, where you can control how long it should sleep for, or whether it should wake up when a particular signal arrives on a digital pin. This info is strictly related to the Particle gear, however, the same concept can apply to any device. Microcontrollers all have some form of low power mode which can be controlled in code.

In the case of Particle, there are three main forms of sleep, each with their pros and cons:

  • Sleep (low power consumption)
  • Deep Sleep (lower power consumption)
  • Stop Mode (lowest power consumption)

The standard sleep disables the Wi-Fi module which is the biggest power draw on the device. The Deep Sleep does this, as well as putting the microcontroller on standby, which resets the device when it exits sleep, with the standard RAM losing any stored variables.

The deepest mode of sleep is Stop Mode which shuts down the network system and puts the microcontroller into Stop Mode which is a hardware function of the chip. The microcontroller essentially ‘freezes’ where it is, and no clock cycles are performed, so power consumption is almost zero. Unlike Deep Sleep, when a specific interrupt is received (or the timer has triggered), it will resume from Stop Mode, with the contents of registers and SRAM being preserved. Here are the quoted numbers from Particle on the Photon sleep modes:

Photon power specifications

Reducing LED Power Consumption

Many projects require some form of visual feedback, usually using LEDs as they’re low power, low-cost devices. Despite being low power, they still draw current in the milliamps range which can noticeably shorten your battery life, especially if you’re running them at full brightness (around 20mA for most LEDs). What you may not know, however, is that most LEDs light up almost as brightly with only a fraction of the power. Take a look at the image below to get an idea of how the brightness of a standard 5mm LED differs with current supply (using current limiting resistors):

 LED current draw comparison

So, the lesson learned here is that you can often get away with a much higher value resistor to limit the current than you might think.

Duty Cycle Operation

The duty cycle of operations is a big thing for most IoT projects as they’re often tasked with reading a sensor and relaying that information over a network. Some projects require constant monitoring and activity, however, most simply need to sample the data every now and then, or can be woken up by an interrupt. For these applications, it makes a lot of sense to enter a low power mode whenever you’re not completing a task, and either used a timed interval, or an interrupt to wake from it. In the examples, I listed above for the Particle boards, I used the Stop Mode to conserve as much power as possible, to wake it up every hour, sample the sensors, and if action is required, perform it, and then go back to sleep. This was possible because it was for soil moisture sensing, so the content of the soil isn’t going to change drastically in the course of an hour, so that was a good time period to check at.

Project duty cycle for power saving

The exact time required will depend on your duty cycle, but generally speaking, unless you need the processor to be active for something, the best bet is to put it to sleep.

Rechargeable Options

Whilst it may seem obvious, one of the most effective ways to keep your portable IoT project going is a recharging solution such as a solar panel to keep your batteries topped up.

Solar panel example connection wiring

Whilst they're not ideal for high power designs as the technology limits how much juice they can provide, they are great at filling in the gaps when you’re not drawing that much power, and you just want to keep your battery full for the heavy load moments. The size of the panel affects how much energy it can provide, but if you’re interested in learning more, check out our tutorial on using solar panels in your projects.

What Now

So, that’s a few of my tips that I use in projects to conserve battery power. You can probably tell that I love using Particle devices for my IoT projects, so most of the tips here are related to the Particle.IDE firmware, however, the concepts are applicable to all platforms.

If you’ve ever created a project that uses batteries, you’ll be well aware how hard it can be to decide on elemen...