A bustling intersection—cars rev, honk; pedestrians’ hurried feet cross yellow lane paint; traffic lights flare red to green. Amidst the cacophony lie many quiet observers: sensors upon sensors upon sensors, in pavement, traffic lights, parking meters, parsing each noisy symbol of a functioning junction, collecting and directing data.

With the number of embedded sensors in our environment growing every day, the biggest challenge is power. With so many sensors around us, it would be costly and impractical to keep changing the batteries on each device every few months. But batteries that can power devices on the scale of years are physically large and expensive, so the designers of sensors need to go further back to the root of energy efficiency: the code itself.

“How do you engineer software and hardware that’s so reliable, so power-careful, and so power-aware, that you don’t have to touch it again?” says Bob Iannucci. “This is where PowerDué comes in.”

Iannucci, a professor of electrical and computer engineering at Carnegie Mellon’s Silicon Valley campus, and his Ph.D. students Ervin Teng, João Diogo De Menezes Falcão, and Cef Ramirez, have developed the PowerDué: a prototyping platform that allows programmers, students, and makers alike to build their intuition about how much energy their code is using, and how to build better efficiency into their code from the get-go.

\

The PowerDué is both hardware and software. The Arduino-programmable circuit board contains a processor, Bluetooth and Wi-Fi radios, and expansion ports for attaching sensors and actuators, with a custom-designed power distribution system for separating components into four channels. Built into the board is an instrumentation processor that measures the power consumption of each channel, then streams the data to a piece of software on a laptop computer over USB. By displaying the energy each line of code uses in a visually intuitive, real-time user interface, PowerDué can make developers aware of the energy and power consequences of their code.

When PowerDué is plugged into a user’s computer, the user can type code to program a device, such as a camera or sensor, and the PowerDué will display an interface that maps for the user how much energy each line of their code will use. By incorporating energy-saving into the code itself, a programmer can design sensors to run at lower power, meaning the sensor’s battery can last for five years, rather than five minutes.

“If we think about the Internet of Things (IoT), and in particular sensors in the environment like a smart city, most of these devices have to be subject to what we call the OHIO principle, which means ‘Only Handle It Once,’” says Iannucci, a professor of electrical and computer engineering. “Whatever energy source is built into a sensor, and in particular its battery, has got to sustain the sensor for the lifetime of the device. Scavenged power, such as from a solar cell, can help.  But sending someone out to replace 10 billion smart city sensor batteries every month is simply unrealistic.  So it falls to the sensor engineers—hardware and software—to make sure that precious energy drawn from the battery is only used for things that really matter.”

How do you engineer software and hardware that’s so reliable, so power-careful, and so power-aware, that you don’t have to touch it again? This is where PowerDué comes in.

Bob Iannucci, Professor, Electrical and Computer Engineering, Carnegie Mellon University Silicon Valley

The PowerDué is technical enough that researchers can use it to improve their specialized devices, but simple enough to be accessible to high schoolers and students new to programming. Designed as a tool to teach students how their code affects devices’ power consumption, Iannucci uses the PowerDué in his own university courses to teach his students about low-power coding, and the PowerDué itself was conceptualized because of a problem that developed in one of Iannucci’s courses.

“There was a pain point in our class where the students had to measure power, but they didn’t really have the right instruments to do so,” explains Falcão, one of Iannucci’s Ph.D. students and a teaching assistant for the course. “They were cutting cables and soldering resistors in between them, and then using oscilloscopes to measure that. It was all kind of hacked together and prone to blowing up, and you really only got to measure power for one device at a time. For PowerDué, we wanted to integrate all of that into one device that could both be the thing that the students wrote their code on, as well as the power measurement instrument.”

Combining the feedback from the PowerDué with the power of human intuition, programmers can quickly learn how to tune their software for sensors that have to be so energy-efficient that you can only handle them once—and that, says Iannucci, is the gap PowerDué fills. A teaching tool meant for classrooms and maker spaces, the team ultimately hopes PowerDué will enable present and future programmers of IoT technologies to efficiently power the smart cities of the future.

“We’d like to think that everywhere there is IoT software being developed,” says Iannucci, “there will be a CMU engineer leading the effort. And that engineer will have learned those skills on PowerDué.”