Hardware timeboxing timer

I use Anki spaced repetition software every day. It features support for timeboxing, a time management technique perhaps best know by the Pomodoro Technique. I find this useful in Anki, and it could be useful for other things too. There are many software timers for this, but a dedicated hardware device is more convenient. I decided to prototype one with an Arduino clone + breadboard.

To display the progress of the timer I could use a 7-segment 4-digit LED numeric display, but the changing numbers are visually distracting. I think a better option is to use a ten segment LED bar graph display. The decreasing graph can represent the passage of time. The bar flashing can represent a completed time segment, and the classic 4017 counter "chasing LED" effect for pauses. The ATmega has enough pins and enough current sourcing capability that I can directly drive each individual segment through a 1K resistor. The LEDs are adequately bright at 5V, although total power with all of them lit is rather high so instead of a solid bar I'll only light the end segments of the area that would otherwise be lit.

To keep the interface as simple as possible I'm using only a single button. Long press to toggle power, short press to pause. To avoid accidental activation when in soft-off an excessively long button press will not turn the system on. The system can be modeled as a finite state machine, which is very easy to visualize in GraphViz:

State transition diagram for timeboxing timer

GraphViz is very useful for generating these kinds of diagrams. The default settings usually give reasonable graphs, and it fits well with a text editor/version control/compiler workflow.

A genuine Pomodoro timer makes a ticking noise, and there could be some classical conditioning going on where the sound becomes associated with a mental state conducive to work. This could be an important part of the technique, so it's worth investigating. I find the sound of ticking mechanical watches very distracting, but I can usually work with background music, particularly lyric-less EDM. Minimal techno seems particularly non-distracting and might even be beneficial if I'm doing something boring.

I suspect that the problem with the ticking watch is that it's too slow. With a watch ticking at 60bpm I hear each individual tick and there's enough time to actively anticipate the next. Measuring the BPM of music I listen to most frequently, it's mostly in the 125 to 150 bpm range. At these rates I can hear it as a continuous stream of beats, which takes much less mental effort. The Pomodoro timer makes a more complicated ticking noise that feels like 140bpm when I think of it as music.

I can make a piezo buzzer click by putting a very short voltage spike across it. Following the datasheet's advice, I added a 1Kohm resistor in parallel.

Simple Arduino sketch for testing:

/* Ticking piezo buzzer test */

int buzzer = 2;

void setup() {
  pinMode(buzzer, OUTPUT);

void loop() {

  // a single pulse works, but very short square wave is louder with similar tone
  for (int i = 0; i<10; i++)
    digitalWrite(buzzer, HIGH);
    digitalWrite(buzzer, LOW);

  delay(460);               // approx 130bpm

This is reasonably loud driving the piezo at 5V with a 2N3904. 130bpm seems a reasonable tempo. It feels relaxed while still sounding like a continuous beat rather than individual clicks. 60bpm is as annoying as a mechanical watch.

I connected the parts on a breadboard:

Timeboxing timer prototype on breadboard

I wrote some Arduino software to implement the state machine (taking into account the additional delays needed for switch debouncing). It's available on my GitHub account. It works as proof of concept but needs a case and power supply to be really useful. As a bonus for reading this far, here is a photo of a frog.