Recently I got interested in electronics again. By "again" I mean that it always interested me, in a way that children want to build robots and know how things work. Even with that curiosity it somehow never stuck with me for longer than a semester at school. A few weeks ago, after connecting Spark Core to some LED strip controller and frying the whole thing I decided to give it another shot. The plan is to learn some basics to not break another board again and make few simple projects.
Ringodoro, my first project, is a pomodoro timer which uses multicolor LEDs to show the passage of time. Pomodoro is a technique in which you maximize your productive time by splitting it into roughly half an hour chunks - 25 minutes of work and 5 minutes of rest. That coincides with human's capacity of concentrating on one task effectively. I've heard of the technique multiple times and used it occasionally, but never gave it a proper chance to decide if it works for me. Ringodoro allows me to learn some electronics and test the technique at the same time.
The hardware part of the project is quite simple - a Neopixel RGB LED ring and an Arduino-compatible board to control the lights. The cool feature of Neopixels is that you can control each individual LED "pixel" with just one output pin (for the whole ring), using real time data protocol. My idea is to show passing time, using colors of each LED on the ring. The colors are based on the appearance of a tomato. When it's time to work, the ring fills with red lights as the time passes by. Then, after 25 minutes, the ring fills with green lights, letting you know that it's time to rest. Everything ends with an small dancing tomato animation.
I wrote and rewrote the firmware using few different boards. Starting with the "standard" Arduino Uno, then ESP8266-based board (which would allow to create a REST API for it) and finishing with much more suiting, tiny Digispark board, perfect for minimalistic design of the whole project.
The code needed few changes along the way for each board, but the most challenging part was to fit it on the ATtiny85. The MCU has only 8KB of memory, with only about 6KB for user program. My code consists of Ringodoro controller class, timer class, button handler, Neopixel library and sketch that connect all these things together. Seems very little but at some point it took 103% of available space and had to do some hardcoding, just to fit on the small chip. Interesting experience after working with current generation mobile devices or computers with lots of memory.
I painted the PCB black for more awesomeness, added a button to the initial design to be able to toggle between modes (idle animation, work, rest) and soldered everything together. And there it is - my first electronics project in a long time - a simple pomodoro timer.
All that's left now is to force myself to use it properly during work. I also want to clean up the code, since learning new stuff like this made it a bit too messy for my taste.
- It's much harder than "normal programming", where we're spoiled with software and hardware.
- At the same time it's much more accessible than I remember. Lots of good boards and components, widely available on the internet.
- It's much closer now to building from Lego blocks, than having to be electric engineer to do anything.
- Debugging is much harder, especially on a board with no
Serialsupport (like Digispark).
- And interacting more directly with physical world can be really surprising. Single press of a button, can be read as multiple, just because of mechanical construction of one and you have to be prepared for that.
Testing Ringodoro while trying out standing desk at work