Hi folks,
After a few years of tinkering and a drawer full of half completed projects, I have finally got one over the finish line. It was my son's idea and it's a 2 minute timer so he knows how long to brush his teeth. All simple stuff really, but we think it's quite fun so I have attached the schematic and the code. The idea is that you press the reset button and it starts to flash a tri-colour led. First red for ~ 40s, then amber (green and red) for ~40s then green. The flashes get progressively faster and we play a little fanfare at the end.
I'd welcome any suggestions for how I might improve either the code or the circuit and I do have two specific questions that I'd be interested in people's thoughts on:
1) I have used a normally closed push button switch as a start/reset button. This means that there is no "off" per se, but when the programme is complete I have measured the current across pins 1 and 8 of the chip and it is zero. Does this really mean that the circuit is drawing no current, or am I interpreting this wrong?
2) The sound is too quiet. I tried a piezo at first and found a great idea from Hippy (I think) that can double the sound of a Piezo, but it only works with the "sound" command and not "tune". I tried transistors to amplify but I think my problem is that with only 3v in from the coin cell, I am limited. Does anyone have other ideas? An amplifier seems overkill because I think I'm using a digitial signal with tune, rather than an analogue signal from a mic for instance. Could I maybe use two coin cells in series and then a voltage divider to reduce the voltage for the Picaxe and still use the 6v for the piezo/speaker.
Anyway - it was good fun and works as is and has inspired me to finish some of my other half done kits!
Cheers
Rob
After a few years of tinkering and a drawer full of half completed projects, I have finally got one over the finish line. It was my son's idea and it's a 2 minute timer so he knows how long to brush his teeth. All simple stuff really, but we think it's quite fun so I have attached the schematic and the code. The idea is that you press the reset button and it starts to flash a tri-colour led. First red for ~ 40s, then amber (green and red) for ~40s then green. The flashes get progressively faster and we play a little fanfare at the end.
I'd welcome any suggestions for how I might improve either the code or the circuit and I do have two specific questions that I'd be interested in people's thoughts on:
1) I have used a normally closed push button switch as a start/reset button. This means that there is no "off" per se, but when the programme is complete I have measured the current across pins 1 and 8 of the chip and it is zero. Does this really mean that the circuit is drawing no current, or am I interpreting this wrong?
2) The sound is too quiet. I tried a piezo at first and found a great idea from Hippy (I think) that can double the sound of a Piezo, but it only works with the "sound" command and not "tune". I tried transistors to amplify but I think my problem is that with only 3v in from the coin cell, I am limited. Does anyone have other ideas? An amplifier seems overkill because I think I'm using a digitial signal with tune, rather than an analogue signal from a mic for instance. Could I maybe use two coin cells in series and then a voltage divider to reduce the voltage for the Picaxe and still use the 6v for the piezo/speaker.
Anyway - it was good fun and works as is and has inspired me to finish some of my other half done kits!
Cheers
Rob
Code:
'toothbrush timer v2
'w1 = 950 and b1 = 8 gives a 2min countdown
'initialise
init:
symbol red_led = C.1
symbol green_led = C.4
w1=950
b1=8
low red_led
low green_led
'red phase
for b0=1 to 24
high red_led
pause w1
low red_led
pause w1
w1=w1-b1
next b0
'amber phase
for b0=1 to 30
high red_led
high green_led
pause w1
low red_led
low green_led
pause w1
w1=w1-b1
next b0
'green phase
for b0=1 to 55
high green_led
pause w1
low green_led
w1=w1-b1
pause w1
next b0
high green_led
tune 0,2,($C0,$41,$C4,$C7,$04,$87)
pause 1000
low green_led
tune 0,2,($C0,$41,$C4,$C7,$04,$87)
Attachments
-
53.1 KB Views: 19
Last edited: