It goes without saying that no developer would want to accidentally drain the integrated battery of 100,000 door locks, thermostats, or baby monitors connected to the IoT by providing code that’s not energy-optimized. The problem of battery draining software must be resolved before the IoT can fulfill its glorious promises, a prospect that should make any developer jump for joy. After all, a future where virtually every piece of electronics will run software is an opportunity bonanza for developers worldwide.
You just need to be wary of software that affects battery life. Easier said than done, but I’m here to give you three tricks to fully control energy consumption.
1. Design on paper, implement in C, deploy in assembly. Whatever high-level language you use, it will engage system library calls and will be executed as CPU commands. No exceptions. Change perspective and look at your code from compiler’s and processor’s point of view. Work thoroughly on your algorithm and data flow, keep your code clean and use all appropriate compiler’s optimization options.
2. Keep it idle. Yield control as soon as possible. Let the CPU and peripherals switch to power-save mode. On wakeup, it should do the job quickly and get back to sleep. Avoid querying the sensors periodically. Instead, configure them to wake up when something happens. Here’s a helpful example.
3. Collect it in batches. Consider overhead when sending via complex communications channels like TCP/IP, Ethernet, or WiFi. Each layer will encapsulate your data into its packet. IP protocol alone will add at least five 32-bit words (20 bytes). If your application allows it, collect data into bigger batches and transmit them when there’s enough payload to justify the overhead of underlying protocols.
There are many more ideas, but this gives you a good starting point to directly control energy consumption in IoT devices. There are more discussions, tutorials, and deep tech dives on this topic on the Qoitech web site.
Vanja Plicanic Samuelsson is the Founder of Qoitech. Her background is in telecom and most recently research and innovation on 5G, cellular IoT connectivity and low power IoT.