The "Power Blink" app used in this tutorial is a TinyOS image that runs on Tmote Sky nodes. The app fulfils essentially the same purpose as the "Blink" app from Tutorial 3: After startup of the target node, the image shows the uptime of the node in seconds as a binary count on the three external LEDs on the observer and (in contrast to the app from Tutorial 3 on the internal LEDs of the Tmote node.
You can download the source code for apps, pre-compiled images and the test configurations for all tutorials from here. The app for this tutorial can be found in the folder 'flocklab_tinyos/apps/tutorials/5_PowerProfiling'.
After having downloaded the source code, have a look at it. As you can see, the code uses the FlockLab sensorboard definitions (see tutorial 1 for further info). You can either compile the app yourself or use the pre-compiled image in 'build/telosb/main.exe'.
The test configuration
Take now a look at the FlockLab configuration XML which can be found in 'FlockLab_Testconfiguration.xml'. The overall test configuration is the same as in tutorial 2. As in tutorial 4, the target image is embedded into the test configuration XML automatically through the Makefile. As the power profiling service generates quite some data, only one observer is used for this test instead of three like in the other tutorials.
Since we want to exploit the power profiling service in this tutorial, there needs to be at least one block '<powerProfilingConf>'. Everyone of these blocks needs to have the following elements:
'<obsIds>': A list of observers to which the configuration applies.
'<profConf>': Configuration for a power profile. There can be several of these blocks for different power profiles (e.g. at different times or different profiles for observers). Every power profile configuration consists of:
'<durationMillisecs>': Duration of the profile in ms. Since the power profiling service generates a lot of data, you generally want to keep time durations for measurements as short as possible.
'<relativeTime>' or 'absoluteTime': Timing information about when to start profiling. FlockLab can either time the actuation of a profile relative to the starting time of a test or as an absolute value in time (using UTC as time zone). Please consult the XML documentation for restrictions that apply.
'<samplingDivider>': FlockLab samples with a default rate of 14400SPS (samples per second, 69.44 us between samples respectively). Since the power profiling service generates a lot of data, it is a good idea to lower the sampling rate as much as possible. For this tutorial, we set the sampling divider (which is calculated as samplingDivider = 28800/SPS) to 128 which will result in a sampling rate of 225SPS which is more than sufficient to measure the power drawn by the LEDs since they only change once per second.
For this tutorial, we want to get a power profile for the complete test duration. To reduce the amount of data generated, we lower the sampling rate to 225 samples per second and run the test on only one observer.
Furthermore, we want to continuously trace the GPIO pins 'LED1', 'LED2' and 'LED3' to cross-check the activity of the blinking LEDs.
Running the test
You can run the test now. This is done the same way as in tutorial 3 by uploading the test configuration XML with the embedded target image directly to the FlockLab web interface.
Evaluating the test
As in all tutorials so far, you will get the test results by email and also over the web interface and WebDAV. In the archive, the files 'powerprofiling.csv', 'powerprofilingstats.csv' and 'gpiotracing.csv' are of interest to evaluate the test. In 'powerprofiling.csv', you get a list of all obtained samples. If you plot these values on e.g. Matlab, you should be able to see the current drawn by every single LED as it turns on and off. You can compare this plot to the GPIO traces recorded in 'gpiotracing.csv' and should be able to see that the power consumption correlates to the traced LEDs as well. The same graph can be found in the web interface by accessing the tests preview page:
As in tutorial 2, you will also get GPIO traces for when the node was turned on/off (GPIO pin 'RST').
For convenience, FlockLab provides statistics for the power consumption of every observer. In the file 'powerprofilingstats.csv' you can see an entry per observer (since this test only used one observer, you will barely get one line for this tutorial) stating the average current consumption per node.
Deleting tests and images
As a last step in this tutorial, delete the test configuration (and thus the test results) and the corresponding target image. Please proceed according to tutorial 2.