“It’s now possible to build remote, low-power microcontroller projects that can operate indefinitely without batteries and still not crash, even if power is interrupted. Let that sink in.
As an example, we’ll show you how to build a LoRa-based weather station that’s powered solely by solar panels. Its code is written in CircuitPython, running on a popular hobby-grade microcontroller board: the Adafruit Metro M0 Express. The novelty is that it can keep the state of the weather measurement program, even during periods of complete darkness when it runs out of power. This is called intermittent computing or perpetual computing, and it opens up a new world of sustainable electronics, where many applications will work well, and practically forever, without reliance on a battery.
The trick is a specially modified version of the CircuitPython interpreter that is resilient to power failures. (Not the language — the CircuitPython syntax stays intact). This means we don’t have to supply our weather station with a continuous power source, such as a battery. Instead, we harvest energy from a solar cell and temporarily store it in a capacitor. The system will boot when the capacitor contains enough energy to execute some code, and the program will pick up where it left off before the power ran out. This way, we can opportunistically collect weather information without relying on a potentially polluting battery and frequent travel to replace that battery.
Finally we can build truly perpetual, battery-free, energy-autonomous embedded systems using off-the-shelf components! We proved the concept in 2020 with our Battery Free Game Boy project led by Jasper de Winkel, where we powered the game by solar panels and kinetic energy from the player’s button presses. Now we’ve brought it to CircuitPython.
We call our system BFree. You can program your microcontroller in regular CircuitPython, and a specially designed extension board stores the intermediate state of the computation during power failures. Then your microcontroller can pick up where it left off, and continue executing CircuitPython correctly when power resumes!”