Toothbrush Timer

dr_robert

New Member
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

pebble toothbrush timer.png

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

Last edited:

westaust55

Moderator
Well done dr_robert (and son)

The 08M2 (and all) PICAXE chips only draw a few microamps themselves so maybe your multimeter cannot detect the very low current.
The main current draw from the supply comes through driving LED’s and other components where milli-amps can become the total load current.

Can you find a piezo speaker with a cone akin to a electromagnetic speaker.
Alternatively try and fashion a cone from some thin cardboard and attach to the front of the piezo speaker.
 

hippy

Technical Support
Staff member
1) ... 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?
You could be measuring it wrong. You need to measure in series, measure the current flowing from the battery positive into leg 1 (V+). It should be fairly low so may not be showing on your meter.

2) The sound is too quiet.
Most piezos should be reasonably loud but loudness can depend on which you have, how they are mounted or secured, and which tones are generated.
 
Last edited:

dr_robert

New Member
Well done dr_robert (and son)

The 08M2 (and all) PICAXE chips only draw a few microamps themselves so maybe your multimeter cannot detect the very low current.
The main current draw from the supply comes through driving LED’s and other components where milli-amps can become the total load current.

Can you find a piezo speaker with a cone akin to a electromagnetic speaker.
Alternatively try and fashion a cone from some thin cardboard and attach to the front of the piezo speaker.
Thanks for the reply! I did measure in series but I'll retest, my multi-meter is only a cheapy but does have several settings for current so I may have picked the wrong one.

Even if it is drawing some current when not in the counting phase, I think I can live with that...I set up a test with a CR2032 and a resistorised blue LED and it has been permantantly on (albeit rather faint now) for nearly 7 weeks so I should get good life in this set up.

The peizo volume has done my head in, and I have read loads on the subject on this forum and elsewhere. I think I am muddling the behaviour of piezos and speakers and also what transistors can and can't do. Back to basics for me there and I'm reading up on class a and b amplifiers and also the TBA820M amplifier so hopefully will understand the limitations of the kit and when I should use alternatives.

Thanks again for your reply

Rob
 

dr_robert

New Member
You could be measuring it wrong. You need to measure in series, measure the current flowing from the battery positive into leg 8. It should be fairly low so may not be showing on your meter.



Most piezos should be reasonably loud but loudness can depend on which you have, how they are mounted or secured, and which tones are generated.
Thanks Hippy - I think I was measuring in series but possibly on the wrong scale on my multimeter so will try that again - sounds like the consensus is though that even when a programme has run and all outputs are low, the chip will still draw some current.

The piezo I had was a tiny surface mounted one - I am now looking to use a speaker and try some other amplifcations like the TBA820M that the manual recomends, also as noted to wetsaust55, I am reading up on class a and b amplifier circuits...watch this space for Mark II!

Thanks again,

Rob
 

hippy

Technical Support
Staff member
sounds like the consensus is though that even when a programme has run and all outputs are low, the chip will still draw some current.
That is correct, though it should only be in the order of milliamps. There are some ways that can be reduced when battery powered.

Note I changed the leg to measure; 1 (V+) not 8 (0V). I occasionally forget Microchip PICmicro's don't follow the common logic chip usage of top-right being V+.
 

hippy

Technical Support
Staff member
I tested an 08m2 and an SPE002 piezo. That seemed to have good volume in free air even at 2.5V and can hear it clearly some 30 feet away. Might be worth checking the piezo and whether there are any not so good connections to the breadboard.

Code:
#Picaxe 08M2
Do
  Pause 1000 : Sound C.2, ( 80,10, 110,10 )
  Pause 1000 : Tune C.2, 8,( $00, $02, $04 ) 
  Pause 1000 : Play 0, 0
Loop
 

dr_robert

New Member
I tested an 08m2 and an SPE002 piezo. That seemed to have good volume in free air even at 2.5V and can hear it clearly some 30 feet away. Might be worth checking the piezo and whether there are any not so good connections to the breadboard.

Code:
#Picaxe 08M2
Do
  Pause 1000 : Sound C.2, ( 80,10, 110,10 )
  Pause 1000 : Tune C.2, 8,( $00, $02, $04 ) 
  Pause 1000 : Play 0, 0
Loop
wow! thanks for this - I'll look at that part and compare to what I'm using...just to be clear, you are connecting the piezo directly to the pin right?

really appreciate you taking the time to help with this,

Rob
 
Top