An Arduino Pomodoro Timer

A cool event that happens every quarter at Shutterstock is Coderage, a 24-hour period of time where all of the developers can work on whatever they want. The project doesn't have to be related to work, though we often leverage tools that we use everyday to bootstrap something together quickly. Some of the things I've worked on in the past include a plug-in for Phergie, refactoring an application to use a new version of PHP, and basic analysis of customer data. During last week's Coderage I wanted to do something fun with an Arduino Uno that's been sitting in my office for the last few months.

To be more specific, I wanted to create a Pomodoro timer with the Arduino. The Pomodoro technique is a time management methodology that combines task-driven planning with periods of focused time broken up with short rest periods. This is traditionally a twenty-five minute interval with five minute rest periods. It is an appealing technique for people in technology, with clear metrics, easy processes, and a baked-in excuse to ignore e-mail and other notifications. Building a timer is not only a good off-manual project to work on, it would give me an excuse to try out the technique.

I sketched out some ideas before wiring anything up. I wanted to create some sort of rudimentary timer to track how far along the intervals were while not getting too sophisticated. Also, I didn't want to stare at a blinking LED to know if an interval was complete, so I figured some sort of tune would be a good alert to know when the Pomodoro or rest period was over. Some buttons would be nice too, for both acknowledging (and proceeding) to the next step of the timer or for discarding the current interval (in case of a necessary disruption).

The 25-minute interval and 5-minute break made for a pleasant symmetry. Six LEDs (5 blue and 1 green) could track where the timer was. On minute '1' I'd have the first blue LED blinking, minute '7' the first blue would be solid and the second blinking, and when the twenty-five minute Pomodoro was complete all five blue ones would be solid. An alert would go off when it was complete and then the program would pause until a button was pressed, signaling that I was ready to move on to the break to check my email and prepare for the next interval. I decided to not have a reset button, because that's as simple as unplugging and plugging back in.

Code and wiring was easier than I thought it would be. There are enough examples in the manual to show how to set up the resistors for the LEDs and the piezo buzzer. The only tricky thing was how to 'pause' things for a button press, something that is not an explicit command on the Arduino or explained in detail. I ended up doing a while loop, which felt hacky but worked just fine.

  1. while(digitalRead(ackButton) != LOW) {}

Near the end of the project I decided to have a little fun with the tones. After all, a single note just wouldn't do. I looked around a little and, with the help of my musically-inclined wife, mapped a few tones from Super Mario over to my code. It was a minor addition that gave us a little chuckle while finishing off the project.

Pomodoro Timer on the Arduino Uno

Pomodoro Timer on the Arduino Uno

While I didn't end up presenting my project (trying to angle my laptop camera around to show it off sounded tough) it was a fun thing to work on. I've only used it once during work so far with limited success, as I get far too many distractions during the day for a true uninterrupted twenty-five minutes of focus. I'm going to keep it around for a few more days at least before pulling all the wires out and building something new… Though it's hard to say what that'll be.

Note: the code and schematic is up on Github: jacobemerick/pomodoro-arduino.