Pomodoro Timer

Pomodoro Timer


Francesco Cirillo introduced the Pomodoro Technique in the late 1980’s as a productivity time management method. The heart of the method is to block out chunks of uninterrupted time to focus on getting things done. The rules of the method are:

  1. A Pomodoro is 25 minutes of work and a 5 minute break
  2. After completing four Pomodoros take a 15-30 minute break
  3. Breaks are real breaks- take a walk, get some coffee, socialize
  4. Protect each Pomodoro from interruptions (both external and internal!)
  5. An undeflected interruption cancels the Pomodoro- it doesn’t count even if almost done
  6. Combine/batch small tasks into a single Pomodoro
  7. Break larger tasks in Pomodoro chunks

Cirillo prefers a physical timer over software (his is a tomato-shaped kitchen timer, hence the name Pomodoro) since the act of winding up is a ritual when starting that enforces getting ready to focus. He also recommends logging Pomodoros to see your progress in getting and staying focused.

It is a great technique to help overcome procrastination since it can minimize self-created distraction (email checking, social networking, etc.). The selection of 25 minute work sprints is pretty good- we’ve spent decades getting trained by TV shows to be engaged for this long before needing a break. Critics maintain they don’t want to break away from a task when in a ‘flow’ state (‘the zone’), but taking a short break often helps creativity.

The Pomodoro Technique is a great compliment to a personal Kanban board- for example. You can use a Kanban board (Trello is a great tool for this) to organize Next Actions (ala Getting Things Done) and prioritize what is the next thing you’ll work on. Then use the Pomodoro Technique to focus on completing the task.

This project replaces the wind-up timer with the Aspect enclosure and shield to implement a Pomodoro timer that is started by physically tapping the unit. It also leverages the connectivity of the Spark Core to record each Pomodoro (or interruption) in a Google Drive spreadsheet.


This application was developed on the Aspect Prototype V which uses a Spark Core controller and WiFi. The Spark pins used are:

Spark Core Pin Functions
Pin Function
A7 Lamp bank 0 (front right)
A6 Lamp bank 1 (front left)
A5 Lamp bank 1 (back left)
A4 Lamp bank 1 (back rigth)
D2 Touch sense (pulse send)
D3 Touch sense (pulse receive)
D5 Vibration motor (haptic)



The update functions in the Loop() use timing periods to check if they need to execute. These have a typical form of:

if (millis() > lastUpdate + UPDATE_INTERVAL) { // do the update }

State Machine

The state machine for the Pomodoro application is shown below:

Pomodoro StateMachine.jpg

At startup, the state machine enters the Idle state after Setup. It remains in the Idle state until a Start is initiated by a tap on the touch sensor. The machine then moves to the Pomodoro state where either it completes the pomodoro (25 minutes) or is interrupted by another tap on the touch sensor.

Touch Sensor

The touch sensor was implemented with capacitive sensing using the Spark micros() and attachInterupt() functions. Details can be found here.

Lamp Control

The project uses Fades whenever an LED brightness level is changed. This is a more natural mode- think about relaxing it is to watch shadows from tree branches sway in the wind versus the tension of a ‘Las Vegas’ style blinking marquee. We’re conditioned to trust slow, gentle movements and distrust fast ones (probably related to being attacked in ages past…).

One mode of the lamps is ‘Breathing’, where all the lamps fade from dark to bright and back in roughly the time a relaxed breath takes.

A conceptual model of a moving virtual inside the lightguide area was used. As the virtual point source approaches a corner, the lamps get brighter as if the source is closer. Interesting patterns can then be traced by the source. This project implemented a function to create Lissajous patterns.

Corner Illumination Model

A simplifying linear approximation was used to model the intensity of a virtual source approaching a corner:

Pomodoro CornerModel.png

A plane is used to give the intensity (z) as a function of (x,y) position from the corner. Note that the coordinates are referenced to the corner, but the virtual particle ‘lives’ in a square with center (0,0) with corners at:

  • Lamp0: (+1,-1)
  • Lamp1: (-1,-1)
  • Lamp2: (-1,+1)
  • Lamp3: (+1,+1)

The code uses a translation and rotation to translate the virtual source coordinates (u,v) to each corner (x,y)

Lissajous Model

Lissajous patterns are typically generated with sine and cosine functions each drive by a parameter like time. In order to keep the code size small (ie, avoid pulling in the math library), a triangle wave function was substituted. A simple formula with a fixed period of 4 was implemented as a basis generator function (see here) and the input was scaled and offset to control the period and phase. here is a comparison of sinusoidal and triangular waveforms:

Pomodoro Waveforms.png

Here is a comparison of a standard and triangular-based Lissajous pattern:

Pomodoro Lissajous.png

Google Drive Recording

While there are, no doubt, more elegant ways to accomplish logging to a Google Drive spreadsheet, the following approach was used:

  1. Send a POST notification to a small PHP script on a server with the Pomodoro information
  2. The script then sends an email to a Gmail account linked to IFTTT with the hashtags: #IFTTT #pomodoro. The body of the message contains the Pomodoro data.
  3. An IFTTT recipe then reads the email and appends the data to a Google Drive spreadsheet.


Not terribly elegant, but it works!


The code is released under GNU Lesser General Public License Version 3.

The code for both the Spark Core and PHP script can be found at the Aspect Github repository.

The IFTTT recipe can be found at Pomodoro Logging Recipe