Skip to content
Philipp M. Scholl edited this page Dec 4, 2015 · 2 revisions

Power Metering

One of the core challenges for any WSN implementation is to optimize the application for longevity. One of the basic problems is to reduce the power consumption of your application. In this session we will look into different possibilities of measuring the power consumption of a wireless sensor node. We will look into the work-for-all overall consumption metering with a shunt resistor, and software solutions for Linux and Contiki.

Overall Consumption

This option only uses hardware and is the cheapest and fastest option to asses the power consumption of your design - if you have the tools available. What you need is a shunt resistor, i.e. a resistor with a small tolerance (usually below 1%) and with a low resistance. You add this shunt to your circuit on the power line of the components you want to measure. Most of the time on the power line of your power supply, see the next figure.

Metering with a shunt

For the wsnlab you are provided with a shunt. You then need to find a way to measure the voltag drop over this shut, which then tells you the currently consumed power: $I=U/R$. You can either use an osciloscope, a multimeter or the ADC of a µController (for example the one found on the GoodFET). Integrating this figure gives you the overall consumed energy. This solution is quite good for a quick measurement, however you can only get the power consumption of the whole system and not single software components.

PowerTrace for Linux

Linux has a mechanism called PowerTrace, which records how often a process is waking up the main CPU and which hardware components is active at which time. This allows to attribute power consumption to the single software and hardware components. To use it on the edison, install the powertrace command and run it from the console:

$ opkg install powertrace
$ powertrace

On the Edison you will only see wake-up time. On your Laptop you also see the number of watts each process and components consumes. This works by using the Coulomb Counter (also called Fuel Gauges) that you find in Laptop Batteries, i.e. the hardware component that provides the percentage of load left in your battery. By integrating this figure over time, the overall consumption is calculated. This is not very exact but gives a rough estimate for optimization and power debugging.

Energest for Contiki

Contiki on the other hand provides a pure software solution. Here, the developer uses so called "probes". These are simple calls done to the energest module, whenever a section of code is entered and left. Combined with an identifier and an estimate of the power consumed in this code section, the overall consumption is calculated. For example, whenever the mac-driver turns on the radio a call to energest is done to inform about the time the radio module was turned on and off.

You can read more about energest in core/sys/energest.[c|h]

Material

Clone this wiki locally