.Net Gadgeteer Pomodoro Timer

I’ve been looking into methods of time management that may help me be more productive, my biggest issue is getting distracted by shiny things, interesting articles or the latest topic of intense debate amongst my friends on Facebook.  Someone suggested I take a look at something called Pomodoro, the simple premise is you concentrate on your task for 25 minutes solid then have 5 minutes to do whatever you want, rinse and repeat.

I’ve been trying various tools to assist and when stuck at a set of traffic lights on the way home realised that a device that sits on my desk and changes colour may be the best bet, I’m a person who responds strongly to visual stimulus after all.  To that end I threw together a simple timer using .NET Gadgeteer that is currently sitting on my desk, I’ll try it for a few days and if it works I’ll build something more permanent.

The idea is simple and follows this logic;

  1. If in a work period the light is red
  2. If in a rest period the light is green
  3. If at the end of an interval the light flashes orange

Here is a screen grab of the modules as connected and you can find the code below.  Please note that the reason it says “GT.Colour.Purple” is because for reasons unknown that displays as Orange from my LED module.  I assume that the definition of Orange is true for displaying on the screen but that the RBG LED uses different values, this isn’t uncommon.

Pomodoro Timer

 

using Microsoft.SPOT;

using GT = Gadgeteer;
using Gadgeteer.Modules.GHIElectronics;

namespace Pomodoro
{
    public partial class Program
    {
        //  default starting state is not working
        public bool working = false;
        public GT.Timer work_timer = new GT.Timer(60000);

        // these periods give the time in minutes for each period
        public int work_period =  25;
        public int rest_period =  5;
        public int time_remaining = 0;

        void ProgramStarted()
        {
            //  Attach event handlers for the timer and button
            button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
            work_timer.Tick +=new GT.Timer.TickEventHandler(work_timer_Tick);

            //  Blink LED to get attention
            led.BlinkRepeatedly(GT.Color.Purple);

            Debug.Print("Program Started");
        }

        void button_ButtonPressed(Button sender, Button.ButtonState state)
        {
            //  Button press either starts a work interval or resets to the interim state
            if (working)
            {
                working = false;
                work_timer.Stop();
                led.BlinkRepeatedly(GT.Color.Orange);
            }
            else
            {
                working = true;
                time_remaining = work_period;
                led.TurnRed();
                work_timer.Start();
            }
        }

        void work_timer_Tick(GT.Timer timer)
        {
            //  Timer ticks onces per minute
            time_remaining -= 1;
            Debug.Print("Time remaining: " + time_remaining.ToString() +
                " intervals");

            //  If counter = zero, either enter rest or interim period
            if (time_remaining == 0)
            {
                if (working)
                {
                    working = false;
                    led.TurnGreen();
                    time_remaining = rest_period;
                }
                else
                {
                    led.BlinkRepeatedly(GT.Color.Purple);
                    work_timer.Stop();
                }
            }
        }
    }
}

 

If you build one of these and put it in an enclosure put a link in the comments and I’d be happy to update the post with details of your project.  A photo of my finished prototype sitting between my monitors can be seen below.  The stand is from an old webcam, the button is wrapped around the base and the LED tied to the top.  Not bad for the time it took and it’s already working wonders for my focus.  Simple but effective.

Pomodoro Timer Prototype

Enjoy,
Keegan
    • Thanks Mike, taking thinks up a notch a life logging device that combined these features with a camera and GPS could be quite cool. It would keep you productive, upright and would track your life ingeneral. Not sure how cool it would look hanging like a necklace but could be an interesting project for sure!

  1. There are quite a number of devices in production now that monitor various personal and physiological data. Here’s a list that I got from Ira Laefsky, who is aggregating data from as many of them as possible:

    http://www.polar.fi/en/products/accessories/G1_GPS_sensor
    http://www.emotiv.com/
    http://www.fitbit.com/product
    http://www.myzeo.com/sleep/shop/featured-products/zeo-sleep-manager-bedside.html

    Libraries for getting data from them: http://www.openyou.org/libs/

    If this area interests you Ira would like to hear from you!

Leave a Reply