How can I measure the power usage for an nano running TinyML

Hi everyone, I'm not sure if my question is a Hardware or Software problem. I'm working on a cognitive protocol for TinyML. As I will be using the wireless communication module (BLE in Arduino nano 33 BLE to be specific), I need to measure the energy consumption of the protocol I developed. How can I measure energy consumption? Is there a library I could possibly use? Would be great if I could be pointed towards further reading resources as I couldn't find anything on this topic. Thank you in advance

How are you powering the project?

You need to measure the current. If the voltage is fixed, e.g. 5V, then you can skip measuring that. If otherwise, you can use the Nano's analog pin to measure the supply voltage, using a voltage divider to get that voltage into a suitable range. Measuring the current consumed is a little more difficult. There are chips/modules that you can use.

To begin, use a multimeter to measure the input voltage and monitor the current over the working cycle of the "protocol" including the periods when most processing work is done and periods when the Bluetooth is transmitting. This will give you some idea of the specs of the current measuring chip/board you need to look for.

My guess is your Arduino will be drawing current that changes as the device goes through its various communication / sleep / etc tasks. So a multimeter will do you no good.

I suggest you get a small super cap. Charge the super cap to the upper end of your power input tolerance. ie. if 5V charge the cap to 5.5V.

Run your program cycle and monitor the capacitor voltage. When the capacitor is down to 4.5 V record the voltage and the number of times through the program cycle.

You can then calculate the energy removed from the super cap.

A simple calculation is I = C dv/dt

  • I = the current in amps
  • C = capacitance in farads
  • dv is the change in voltage in volts
  • dt is the change in time in seconds

You could integrate the current over a fixed period of time, but that will require more circuitry.

I'm using the micro-USB port

Interesting, but I believe I will need some knowledge on circuitry yes? I'm a complete noob when it comes to circuitry as I come from a CS background.

At least you don't need to measure the voltage then, you can assume that will be 5V. However, powering through the usb socket makes it difficult to measure the current consumption. You may need to break into the usb cable so that you can get a current measuring device into the 5V or ground line.

I've never used one, but perhaps something like this would suit your needs?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.