After building a 4bit counter using JK flip-flops last week, my son and I thought about what we could build using counters which would be of use around the house. We thought of two things – a 3 minute timer for timing how long you have brushed your teeth and a 6 minute timer for soft boiled eggs. The 9bit counter circuit required to build a 6 minute timer using JK flip-flops would require 5 chips plus a 555 timer set to “tick” once per second and quite a bit of discrete logic to turn on and blink the LEDs at the correct times. Knowing how much work this would involve to design it and then build it using strip board, I turned to the trusty PICAXE microcontroller to simplify things.

The advantage of using a microcontroller is that it is pretty simple to build what would be complex using discrete logic and therefore we decided to build an egg-teeth timer, i.e. both of the timers in one device. We used a PICAXE 20M to build the first prototype with output pins 0, 1 and 2 connected to 330 ohm resistors and then yellow LEDs. Input Pin5 is used to select the function of the device, i.e. eggs or teeth with output pins 4 and 5 connected to 330 ohm resistors and then green LEDs to indicate which function has been selected. A piezo buzzer is connected to output pin 3 to give an audible signal once the counter has reached either 3 or 6 minutes depending on the selected function. The code for the device is listed below:

symbol counter = b0
symbol teeth = b1
symbol eggs = b2
symbol loopCounter = b3
init:
pause 200
loopCounter = 0
if pin5 = 1 then
teeth = 1
eggs = 0
high 4
else
eggs = 1
teeth = 0
high 5
endif
start:
for counter = 1 to 60
low 0
pause 500
high 0
pause 500
next
for counter = 1 to 60
low 1
pause 500
high 1
pause 500
next
for counter = 1 to 60
low 2
pause 500
high 2
if counter > 55 and teeth = 1 then
high 3
elseif counter > 55 and eggs = 1 and loopCounter = 1 then
high 3
endif
pause 500
low 3
next
if eggs = 1 and loopCounter = 0 then
loopCounter = 1
goto start
endif
end:
high 3
pause 1000
low 3

Having built the first prototype, the next step was to build an enclosure for the device, below is an image of the prototype and the device’s enclosure.

The Eggs, Teeth Timer Prototype and Enclosure

The next step is to move the prototype into the enclosure, but before doing so we are going to redesign the device around a PICAXE-08 Proto Board and a PICAXE-08M microcontroller in an effort to reduce the space required in the enclosure and to use a “simple” microcontroller more appropriate to the devices’ functionality.