Showing posts with label energy. Show all posts
Showing posts with label energy. Show all posts

Monday, April 6, 2015

Contiki OS: Using Powertrace and Energest power profile to estimate power consumption

To estimate the energy consumption. We can run on Cooja or with a real device

- Check the number of ticks per sencond for rtime (RTIMER_SECOND = 32768)
printf("Ticks per second: %u\n", RTIMER_SECOND);

- Include powertrace app in your project by adding it to your Makefile
APP += powertrace
(You also can use simpler version of powertrace at https://github.com/sonhan/contiki-sonhan/)
- Add to source file
#include "powertrace.h"
- Add to source file to print power profile every 10 seconds:
powertrace_start(CLOCK_SECOND * 10);

- Sample data
CPU         LPM            TX           RX
512803    14227588    153188    195436
531519    14535272    158359    203847
549549    14844701    163409    211794
560341    15161365    165821    216534
575755    15473409    169844    223419
599333    15777318    178173    231767
610307    16093852    180704    236651
625674    16406020    184722    243660
649197    16710040    193402    252940
660144    17026626    195811    258453
670942    17343372    198221    263249

- Energy consumption (Power - mW):

Check datasheet for current and voltage, e.g., CPU = (531519 - 512803) * 0.33 * 3 / 32768 / 10

- Duty cycle (%):


E.g., TX duty cycle = (158359 - 153188) / (531519 - 512803 + 14535272 - 14227588)

- Sample output:
- Sample data and calculation:
https://github.com/sonhan/contiki/tree/master/apps/powertrace-sonhan/sample-data