Coder Social home page Coder Social logo

xeno27 / energytrace-util Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carrotindustries/energytrace-util

0.0 0.0 0.0 17 KB

Utility for reading EnergyTrace data from TI debug hardware

License: GNU General Public License v3.0

C 94.15% Makefile 5.85%

energytrace-util's Introduction

Some MSP430 launchpads such as the MSP430FR4133 LaunchPad include the so-called "EnergyTrace™ technology". It consists of a software-controlled DC-DC converter that can measure the energy it is delivering. Looks like TI has patents on that: US20130154594, US20140253096

The "official" way to make use of this feature is TI's "Code Composer Studio" IDE. Since I don't use CCS, installing CCS just for measuring current consumption seems a bit silly. Fortunately there's a better way: TI provides an open-source library for communicating with some of their MSP430 programmers. As well as debugging control and programming the library also gives access to the EnergyTrace feature. So I wrote a small program based on an example that reads the EnergyTrace measurements.

Output Format

Data is written to stdout in 4 columns:

  1. Time in seconds
  2. Current in amps
  3. Voltage in volts
  4. Energy in Joules

Debug information gets prefixed with a #, so it gets ignored by gnuplot and the like. For some reason, differentiating and low-pass filtering the energy measurements leads to more accurate readings than the current measurement itself.

Dependencies

You'll need MSP430 debug stack (libmsp430.so) and the usual things like make and gcc. Unfortunately, building the MSP430 debug stack is a bit difficult at this time since it's missing some #include and triggers a compiler bug. Using Arch Linux? You're lucky, I've created a PKGBUILD and patches for easy installation: aur-mspds At the time of writing, the AUR package mspds is broken.

How do I build and run?

$ make
$ ./energytrace <measurement duration in seconds> > energytrace.log

Use you favourite tool for visualizing and processing the recorded data.

$ gnuplot

        G N U P L O T
        Version 5.2 patchlevel 2    last modified 2017-11-01 

        Copyright (C) 1986-1993, 1998, 2004, 2007-2017
        Thomas Williams, Colin Kelley and many others

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help FAQ"
        immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'
gnuplot> plot "energytrace.log" 
gnuplot> 

Conclusion

EnergyTrace comes in really handy for measuring the power consumption of MCUs as it saves you from fiddling with current shunts, differential amplifiers and oscilloscopes. Event when you're just using EnergyTrace, the MSP430FR4133 LaunchPad is pretty good value at $14.

This little program has proven to be useful during the development of pluto.

energytrace-util's People

Contributors

carrotindustries avatar travisgoodspeed avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.