Edge Impulse logo
Blog Post

Analyze Power Consumption in Embedded ML Solutions

Embedded Devices, Machine LearningWhat is the impact of an embedded machine learning brick on the power consumption in an IoT solution?

Louis Moreau

February 15, 2022

When it comes to building battery-powered IoT solutions, one of the key factors of success is surely the battery life. But what exactly is the impact of an embedded machine learning brick on the power consumption in an IoT solution?

Ideally, we want our device to sense and process information all the time, transmit data in real-time, and last forever on the smallest batteries. As you guessed this is hardly achievable and we will have to make compromises. In this article, we will go through basic embedded machine learning use cases and see where optimizations can be applied:

Let’s take the following examples:

  • A wearable that recognizes the exercises you are doing with an accelerometer and sends the results to a mobile phone using BLE.
  • A pallet that can detect if it is located in a moving truck, train, plane, or stand by in a warehouse and send the results through 3G/NB-IoT/LPWAN.
  • A doorbell that detects who is waiting on your door and send the alerts using proprietary RF.
  • A beehive detecting occupancy rate based on the buzzing sounds.

All these use cases share the same big picture of a typical battery-powered sensor application. In a nutshell, it looks like the following:

Big picture of a typical battery-powered sensor application

To measure the real power consumption, we have used an Otii Arc from Qoitech and an Arduino Nano 33 BLE Sense. This Arduino board is not particularly considered as low power but it has a good combination of sensors that will interest us and a BLE module to send the inference results.

Read the Finding the lowest possible current consumption sectionFinding the lowest possible current consumption

Before measuring the actual inference impact, let’s start by measuring the current in idle mode. We have created a new sketch in Arduino IDE called “BareMinimum." This program simply does not do anything. Here is the following code:

void setup() {}

void loop() {}

Otii software allows us to quickly have an overview of the power consumption. For more information on how to set up your new project, power the Arduino board with Otii Arc, or more, check Qoitech documentation website.
One important metric Otii Software provides is the “average current consumption” during a selected period. For this idle mode, we obtain 13,6mA.
We will use this to monitor the current consumption during each different mode (deep sleep, sampling, feature extraction, and inference):

Another great feature Otii Software provides is the “Battery Life Estimator." This tool will help us to determine how long our device will run on a 500mAh battery. We will use the “Lifetime” value as a key indicator. In our first scenario, the lifetime is 1.5 days.

As you can see here, the current consumption without any optimization is quite high. To optimize this default current consumption, Arduino provides a few tips: How to reduce power consumption on the Nano 33 BLE.

Let’s try these recommendations in a second Arduino sketch:

void setup() {
  digitalWrite(LED_PWR, LOW);                   //Turn off the power LED
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);    //Turn off the sensors
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);     //Turn off the I2C pull-up resistors
  // Cut the 3.3 V jumper on the bottom of the board to avoid the power usage of the MPM3610 step-down converter.

void loop() {

Here we get an average current consumption of 5.39mA and an estimated lifetime of 3.9 days.

And, by cutting the 3.3 V jumper on the bottom of the board to avoid the power usage of the MPM3610 step-down converter, we obtain an average current consumption of 1.33mA and an estimated lifetime of 15.7 days.

Here is the comparison of the three different modes:

That’s great, we clearly see the improvement, but the board is still not doing anything yet. This step was nevertheless very important. Indeed, it gave us the minimum power consumption for this board in deep sleep. And, to optimize the lifetime, we will need to maximize the time our device is in this sleep mode. Having that in mind, we can move forward and we will add the Edge Impulse model to run the inference on the device.

Read the Impulse current consumption sectionImpulse current consumption

As an example, we will use the Tutorial: Continuous motion recognition public project that you can clone directly under your Edge Impulse account. From there, navigate to the deployment tab, download the Arduino Library and add it to your Arduino IDE.

Feel free to create your project with your own data to train a model that exactly suits your needs.

The full code that we have been using can be found here. 

When running the code, we obtain the following results:

💡Tip: You can connect the UART port between the Otii Arc and the Arduino to get more information about the power consumption in a process. Just linking the Arduino TX to the Otii RX will provide these serial console outputs.

If we zoom in on the Impulse process, we notice that the greediest part is the sampling part. The sampling time corresponds to the window size when designing your Impulse:

In Otii Software, the pre-processing step can be selected from the UART when enabling the debug flag in your code and corresponds to the “On-device performance” estimation in Edge Impulse Studio. 

💡Tip: You can change your hardware target under the Dashboard view in EI Studio to automatically adjust the latency calculation.

You may note a difference between the latency calculation and the actual latency on the Arduino Nano 33 BLE Sense. It can be explained because we are still using an old MACC-based calculation on this specific target.

In the same way, you can find the latency for the inference on the NN Classifier view:

Read the Use quantization when possible sectionUse quantization when possible

In the previous example, both the pre-processing and the inference time are extremely small compared to the sampling time. This is mostly the case for low-frequency time-series projects where both the pre-processing and the neural network architectures are basics.

When using Edge Impulse, we profile your model resources for both the quantized model and the float32 model. Here is an example of the latency in an image classification project where the inference time can have a big impact on the battery life:

In conclusion, when building a battery-powered embedded machine learning solution, it is important to keep in mind all the processes that your device will need to perform and how long will they last. Optimizing your models can have a big impact on how your battery life, which can both reduce cost and increase your customer satisfaction.


Are you interested in bringing machine learning intelligence to your devices? We're happy to help.

Subscribe to our newsletter