
Learn-to-code platform supports energy-harvesting devices
Called Battery-free MakeCode, the tool is based on Microsoft MakeCode, a popular free online learn-to-code platform that introduces beginners to coding basics. With the visual platform, which is designed to makes programming easy, users simply drag and drop blocks of pre-made code to build games like Tetris, program devices that can count steps or make sounds, and create apps that connect sensors, screens, buttons and motors.
Battery-free MakeCode uses an extension that automatically and invisibly transforms MakeCode into a version that supports programming electronic devices that harvest energy from ambient sources, such as vibrations, movement, radio frequency transmissions and the sun. The tool, say the researchers, bridges the gap between sustainable computing efforts, the maker movement, and novice-focused programming environments with MakeCode-Iceberg, a set of compiler extensions to Microsoft’s open-source MakeCode project.
“Current end-to-end approaches like Microsoft MakeCode require tethered or battery-powered devices like a micro:bit, limiting usefulness and applicability, as well as abdicating responsibility for teaching sustainable practices,” say the researchers. “Unfortunately, energy harvesting computing devices are usually only programmable by experts and require significant supporting toolchains and knowledge across multiple engineering and computing disciplines to work effectively.”
The main problem, say the researchers, is that energy harvesting is unpredictable, so programs running on battery-free devices might fail every time the sun ducks behind a cloud or the user takes a break from mashing buttons. Programming these devices is especially hard because developers have to consider how to safely, quickly and correctly guard against intermittent power failures and then restore that state once energy has returned.
Battery-free MakeCode enables students who are learning to code battery-free devices avoid these issues, so they can instead focus on designing devices and exploring energy sources. Rather than writing complex code to handle intermittent power failures, students can think more about how energy is harvested and used — important concepts for future programmers.
“Some gaming systems use more energy when idle than a refrigerator,” says Northwestern’s Josiah Hester, the study’s senior author. “That’s exactly what we want future programmers to avoid.”
The new extension transforms the original MakeCode program to enable fault tolerance, ensuring the program state persists under intermittent energy supplies.
“Battery-free MakeCode accomplishes this task with little more than a memory chip, solar panel or other energy harvesters,” says Christopher Kraemer, a Ph.D. candidate in Hester’s laboratory. “These steps are oblivious to the programmer, giving them complete freedom to be as creative as possible.”
Because MakeCode is fully online, the only requirements to program sustainable smart devices are internet access and less than $40 worth of electronics, say the researchers.
“Across the nation, coding is becoming a standard part of curricula, and students are learning how to code earlier and earlier,” says Hester. “Our hope is that as students learn to code, they also learn about concepts around energy and sustainability. With Battery-free MakeCode, we want to enable educators to instruct a new generation of programmers who understand sustainable computing and programming practices.”
“The tech industry is likely to increase battery-free devices in the next five to 10 years,” adds Kraemer. “So there is a need to improve education around the battery-free programming domain.”
The platform does not require any custom-made hardware and is available free online. For more about the research behind the project, see “Battery-free MakeCode: Accessible Programming for Intermittent Computing.”
