The Atomix team have used Toggl Time Tracking for almost three years, and we’ve watched their product grow along with our company.
It’s completely changed the way we keep track of our time spent on various tasks throughout each day, and we’ve seamlessly integrated it into most of our other internal systems.
It’s as simple as pressing “Start” when you start working on something, and “Stop” when you’ve finished.
The Toggl developers recently pushed out a new version of their Desktop Timer app, featuring global keyboard shortcuts.
You can now start and stop your timer without using your mouse, a great time saver when running multiple monitors with dozens of open windows on each.
Toggl also recently posted this photo of a “Toggl Button” on their blog, to promote their new Chrome extension:
As an electronics enthusiast in my spare time, this immediately made me think…could I build this?
The answer turned out to be a big “yes”.
Presenting my new TogglDesktop Timer Button:
The first thing you’ll notice is that I’ve hidden it inside a “Doomsday USB Hub” I originally purchased from ThinkGeek around 10 years ago. This is a novelty device I’ve had sitting on my desk for a while. Flipping the switches in the correct order and then pressing the main button caused it to play the sound of an explosion. It also has four USB ports in the back.
Unfortunately last year the sound effects stopped working, then eventually the USB hub itself died.
But it’s made the perfect enclosure for my Timer project!
- 5V Adafruit Trinket USB MicroController (US$7)
- Micro USB Cable
- 8mm LED (I used an 8mm NeoPixel)
Here’s a photo of the inside:
There’s really not much to this. The Trinket GND pin is connected to the main button, and then back to PIN #2. The NeoPixel is connected to 5V, GND, and PIN #0.
None of the other switches are currently connected, and the USB cable simply plugs into the Trinket through the small opening next to where the USB ports were.
The code itself was a little trickier. Trinkets only have around 5KB of flash memory, and combining the Adafruit TrinketHidCombo library with their NeoPixel library (I wanted to make the LED flash/fade/glow/pulse) used up almost all of it. For the next version I’ll try to use the Trinket Pro, which contains 28KB of flash memory, but for now the code just switches the LED on and sets it to “white”.
The TrinketHidCombo library allows the Trinket to emulate a USB keyboard, my starting point was the following tutorial:
Once I had it up and running, I was able to program the Trinket to send the “Ctrl+F8” key combination I’d configured TogglDesktop to listen to:
I also included some debounce code to prevent unpredictable key presses.
Now for the big test!
Not bad for a Friday night project!
Final Notes and Thoughts
As I mentioned earlier, using the Trinket Pro will let me do a lot more with this. I’ll probably connect the 3 remaining switches to the Trinket Pins and then activate various LED animations or key combinations with them. I originally considered replacing one with a potentiometer to use as a Volume Knob, but my shiny new DasKeyboard 4 Ultimate (yes, the blank one) has one built-in.
I’m sure you’re wondering “why doesn’t he make the LED only light up when the timer is running?”. I’d love to, but that would mean checking the Toggl API for currently running timers and that’s completely outside of the scope of this project. The Trinket has no network connectivity, and (as far as I know) no serial connection to the PC.
I had quite a bit of trouble uploading the code to the Trinket (mostly due to Windows driver issues), so next time I’ll try using my Ubuntu PC. Adafruit does have some excellent tutorials on this though.
One other issue I encountered was that “Record Shortcut” in TogglDesktop doesn’t detect the button press as “Ctrl+F8”, so I had to record the shortcut using my keyboard. As soon as I did that the button started working.
If you’d like to see the ugly code behind this project, here it is on GitHub: https://github.com/atomixdesign/TrinketToggl
This project was a lot of fun, and I’m looking forward to seeing if this button actually helps me or just gets in my way. If it does, I’m sure everyone else here will want one!
Chris Rossi is the Lead Developer/Code-Monkey at Atomix.
He obviously has too much free time on his hands.