If you do not know what 'Pomodoro Timer' or 'Pomodoro Technique' mean, please see Pomodoro Timer v1 introduction. Version 1 had a few flaws that had become increasingly annoying over time:
- battery powered - I always forgot to charge it
- LEDs that show how much time is left were either on or off - I wanted to be able to estimate how much time I have in current pomodoro session - is it 11 or 14 minutes?
- resetting only by powering the device off and on
As you can see I made a few changes (in relation to the previous version). Placing a bigger microcontroller enabled me to get rid of shift register and to control the LEDs using PWM. I added 7805 voltage regulator to power the device from 12V (although using switching converter could have been a better choice). Two LEDs that display current mode were replaced by one RGB LED.
The code was written in C++ in object-oriented manner. I tried to make it as simple and maintainable as possible. The source code is available on GitHub. As you can see it consists of a few basic objects that take care of certain part/task of the system:
- interruptManager - update other objects at specified intervals
- pomodoroTimer - system 'supervisor'
- ledBar - display how much time is left
- button - user input (pausing/resuming and resetting)
- workLed, breakLed - display current state
- buzzer - emits sounds of specified length
Of course there's still some (quite a lot actually) room for improvement, but the device has already worked for over 3000 hours without any errors.