MOV AX, BLOG

Electronics, Photography, Gadgets

Tag: timer

First Project Using The PICAXE-08 Proto Board Kit

After building the first prototype of our timer device and then making preparations to use the PICAXE 08M and save space by using a single NPN transistor as a NOT gate, we have finally completed our project using the PICAXE-08 Proto Board Kit. As usual, I purchased the Proto Board and PICAXE chips from those reliable folks at techsupplies in the U.K. For around 5 Euros, the  PICAXE-08 Proto Board Kit with a PICAXE-08M microcontroller is a real bargain. It has almost everything you need to get going – the only extras you will require are a USB cable for programming the PICAXE and a battery box for holding 3 AA batteries to supply the circuit with 4.5v. I found the size of the prototyping area on the board to be ample for simple projects. Please note that the kit comes in component form, shown in the picture below, and has to be assembled using a soldering iron and a little bit of time – it is not complicated.

PICAXE-08 Proto Board kit

Moving the timer to the PICAXE-08M from the PICAXE-20M prototype was relatively straight forward. The new circuit uses pins 0, 1 and 2 to power the “minute/seconds LEDs” while pin 3, which is an input pin only, is used to select the device’s function (eggs or teeth) and pin 4 is used to power the piezo buzzer. On the prototyping area I placed the resistors to drive the LEDs and a voltage regulator to power the circuit from a 9v battery. In our circuit pin 3 is also pulled down to 0v using a 10k resistor. Below is the code for the device.

symbol counter = b0
symbol teeth = b1
symbol eggs = b2
symbol loopCounter = b3
init:
pause 200
loopCounter = 0
if pin3 = 1 then
teeth = 1
eggs = 0
else
eggs = 1
teeth = 0
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 4
elseif counter > 55 and eggs = 1 and loopCounter = 1 then
high 4
endif
pause 500
low 4
next
if eggs = 1 and loopCounter = 0 then
loopCounter = 1
goto start
endif
end:
high 4
pause 1000
low 4

Luckily, as mentioned previously, we had prepared to save space in the enclosure – which is good because the space available turned out to be even smaller than I thought. The wiring to the LEDs and switches added quite a bit of bulk and as a result the whole circuit plus battery only just squeezes in. The image below helps to illustrate just how much bulk the wiring added to the internals of the device.

Unexpected Added Bulk Through Wiring

After many hours of work, the device is now completed and we used it tonight to time the brushing of our teeth. Tomorrow morning, we’ll use it for the first time to time our soft boiled eggs ;-).

The Completed Eggs-Teeth Timer

Building Something Useful With Counters

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.

© 2017 MOV AX, BLOG

Theme by Anders NorenUp ↑