An open-source platform for the battery-free Internet of Things

Mar 16, 2023

Project update 3 of 7

Intermittent Computing

by Kai G

In this update, we’re going to take a closer look at intermittency and how Riotee is able to run demanding workloads without a reliable power supply. To this end, we’re going to run three experiments and use a logic analyzer to look at what’s happening on a Riotee Board.

Experimental Setup

Let’s say our solar-powered device has to run a long-running task. This could be filtering and processing data collected from a sensor or running machine learning inference. To keep things simple here, we’ll use the following code to have our device find the prime factors of the number 3,210.

void setup(void) {
  pinMode(D3, OUTPUT);
  digitalWrite(D3, HIGH);

int prime(int prime_factors[], int num) {
  bool is_prime;
  int i = 0;

  for (int c = 2; c <= num; c++) {
    printf("[%d]", c);
    if (num % c == 0) {
      is_prime = true;
      for (int j = 2; j <= c / 2; j++) {
        if (c % j == 0) {
          is_prime = false;

      if (is_prime) {
        prime_factors[i++] = c;
  return i;

void loop() {
    int res[4];
    digitalWrite(D3, HIGH);
    int n_primes = prime(res, 3210);
    digitalWrite(D3, LOW);

The Problem

First, let’s see what happens when we run this code on the Riotee Board without any special measures.

On top you see the capacitor voltage. The second plot shows the 2 V supply voltage. The third plot shows the output from the Serial port, and on the bottom is the signal from pin D3.

Initially, the capacitor voltage is 0 V. After switching on a lamp, the capacitor starts increasing. When the capacitor is fully charged, the buck converter switches on the 2 V supply voltage and the device starts to operate. Now let’s zoom in a bit…

After the supply voltage switches on, it takes around 3 ms before the application starts to compute and output data. While active, the power consumption of the device exceeds the power harvested from the solar panel. As a result, the capacitor voltage decreases. After 7 ms of computing, the capacitor voltage falls below 2 V and the buck converter can no longer maintain the supply voltage. A few more milliseconds and the supply voltage drops below the brown-out threshold. The microcontroller powers off before the computation is finished, all progress is lost and the device has to start all over again when power is restored.

This cycle of charging, switching on, computing and being interrupted repeats indefinitely and we will never know what the prime factors of 3210 really are!

Intermittent Execution

Let’s repeat the experiment, but this time we will use Riotee’s support for intermittent computing.

Two comparators on the Riotee module compare the capacitor voltage to two user-defined voltage thresholds. When the capacitor voltage is above the high threshold (4.6 V), the Riotee runtime starts the application. Whenever the capacitor voltage falls below the low threshold (3 V), execution is paused and the device is put into a low power mode. This allows the capacitor voltage to rise again until execution can continue. All variables are retained and the application continues exactly where it was paused. This way, the application makes progress although the power consumption exceeds the harvested power.

But there is another problem.


Suppose our solar panel is temporarily covered by a shadow. For this experiment, we simply cover it with one hand.

After a few seconds without harvesting, the capacitor discharges and the power supply gets interrupted. Our progress should be lost, right?

Zooming in, we see on the Serial output that after the setup function, the application continues at iteration 1793, right where it was interrupted when we covered the panel. How is that possible? Whenever the capacitor voltage gets critically low, the Riotee Runtime automatically copies a snapshot of the application to non-volatile memory. When power is restored, this snapshot is copied back into RAM and registers, after which the application continues as if nothing had happened.

This way, against all odds, we finally get the result: 3210 = 2x3x5x107!


Riotee is the first commercially available platform that supports intermittent computing, which allows you to run demanding applications like signal processing and machine learning without batteries.

Do you have an application in mind for which this unique feature might come in handy? Are you curious to see this exciting technology in action? Head over to our campaign page and get yourself a Riotee Board to start your battery-free adventure!

Sign up to receive future updates for Riotee.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects