I like cooking, and there's always use for a timer in the kitchen. Sometimes a rough look at the clock will suffice, other times your standard egg timer will handle the situation. But then there are those cases where neither will do, where an egg timer is useless as you're interested in the elapsed time and not a countdown, but the nearest clock isn't precise enough for your own satisfaction - or you simply can't be bothered remembering what time it actually was again when you initially checked it.

It's moments where you just want to scream at Alexa to start a timer as you're in a situation where you should have thought about it before but didn't, and now the oil is already smoking, the water is perfect tempered, or the whatever-device-you-need is already running. You need a clock starting to tick right now. Well, I don't have an Alexa to scream at, and the stopwatch on my phone - provided I have it next to me - isn't really a good-enough alternative either as kitchen fingers aren't too compatible with capacitive touch screens, and things will either get messy or take too much time for this particularly heated moment.

Holding Out For A Hero

So I often ended up wishing I had a device that just starts counting a random elapsed time, which would require almost zero interaction to do so. Well, it was one too many times that I found myself in that situation now, and hence the cook'oo clock was born:

Its secret?

Magnets!

That pair of electrically conductive magnets essentially forms the two terminals of a switch that would toggle the device's power on and off - except there's no actual switch to toggle here. Instead, any conductive surface will take over that part, and there's plenty of those in an average kitchen: knives, cutlery, pots and pans, cheese graters, appliances, and so on. Not the fridge or other coated metal surfaces though - which makes them ideal places to actually keep the device stored (like, on the door, not like in the fridge..).

To start the clock, just smack it against your surface of choice, which requires just one semi free hand and around two seconds - one if you practice your aim and just throw it and let the magnets work their magic.

The Clock Is Tickin'

Once the circuit is closed, the coin cell will power up the ATtiny85, start its hardware timer, and set up the OLED that will show the elapsed time. The hardware timer causes an interrupt every second to update the time and display, which is practically all the controller's CPU needs to do. So for the remainder of the second until the next interrupt, it just goes to idle sleep mode and waits for the next interrupt.

If you want to restart the timer, you could of course just remove it from the surface and reattach it, but to have it easier, there's a button that gets it down as well - plus, it will retain the last elapsed time and display it as well.

Power Struggle

Using a meager coin cell as power source requires of course a few power consumption considerations.

  • The device is running at 1.0MHz (8.0MHz crystal with the default /8 clock prescale - 8.0MHz is what I had available, plus aiming for 1.024MHz later on, and 8.192MHz crystals are easier to source). This is a good compromise between power consumption and smoothness in the display update
  • 0.96" 128x64 OLED, which appears to be the least power-hungry solution
  • CPU idle via sleep mode instead of delay, it ain't much but it feels good. Deeper sleep modes won't have the timer function any more / wake up the device on timer interrupt, so that's no option
  • Firmware supports power saving mode to use power down sleep mode after a defined amount of minutes (see below)

The biggest consumer is definitely the OLED, but it's not too bad. Some measurements at 3.0V showed roughly 6.5mA on average in the initial counting mode, roughly 1mA extra if the previously counted time is displayed as well.

Some more measurements and tests showed that the device will still be operational at 1.3V, but that's definitely the limit....

Read more »