I need to make a sound! A simple beep.

JPU

Senior Member
Hi

I bought the Piezo speaker from picaxe, however the sound generated was very quiet. I only have one PIN free on a 08M2. (Actually, I only have PIN 3 left, so big problems ,I guess?). I want to keep the electronics very simple due to space. I need the user of an LED light to know when the light is on or off as its on their head and used during the day((dont ask!!), and thought that a speaker would do the trick eg 1 one beep on, 2 beeps off.

The Piezo is to quiet and so I went a bought some fancy mini 10mm speakers from Farnell, http://uk.farnell.com/jsp/search/productdetail.jsp?SKU=1299880

They have turned up today and guess what, they are as quiet as the Piezo, so its not the Piezo at fault!:p

Can anyone help here, I just want two signals as I said as loud as an old casio watch alarm used to be in the 70s, however I don't have much space for Amps and only Pin 3 left.

Thanks for your help.
 

rs2845

Senior Member
Not sure if it's a great idea but do a Google search for a 1W transistor amplifier. Just make sure you use the correct rated components as the transistor can get very hot otherwise.

All you'd do is use the 'sound' command on the picaxe and connect that to the relevant part of the transistor amp.

I built a 2W transistor amp but took it apart for investigation as the transistor got really hot- but it was very loud!
 

sghioto

Senior Member
JPU,
Pin 3 on the 08M2 is an input only. You need an output pin to generate the signal to drive the piezo or speaker.

Steve G
 

oracacle

Senior Member
i am not as clever as some of th chaps on here but you did notice those speakers are only 0.3w didnt you? I would not have expected them to be load.

as for the piezo, they make more noise if the have there metal backs glued to something.

can you post a schematic and programme too, it may well be asked for and will be helpful for getting thins figured out.
 

manuka

Senior Member
What sort of sound freqs were you considering? Piezo transducer sounds are naturally high freq, but even my ancient ears can hear them clear across a room! You'll also have to drive them with an output (pin 0,1,2 or 4), as Pin 3 is indeed input only.

Perhaps check this for insights -

PICAXE tone generating syntax is in form PIN,(SOUND,DURATION) with SOUND values 0 (silence) to 128. The freq. generated is found by -

Output freq =12048/(128.1-SOUND)

Example (rounded): If sound =95 then output ~12000/(128-95)= 12000/33 =~364 Hz.
 

Hemi345

Senior Member
what oracacle said... glue the metal side of the piezo to a dixie cup or something. My alarm project i'm working on, uses this technique to amplify the sound. I'm also using an NPN with the base tied to a pin on the picaxe through a 10K resistor and the collector to the negative of the piezo. positive side of piezo is tied directly to 9V line (picaxe is on a vreg for 5V).
 

Buzby

Senior Member
As already mentioned, your first problem is pin 3 is input only, so you need to either find an output pin, or use the 'pullup' trick to make pin3 a feeble output, but then you need a transistor, if you've got room.

Again, as mentioned, piezos are much louder when glued to a flat surface.

Finally, piezos work best a their resonant frequency, so test it at different notes to find the sweet spot.

An off the wall idea, use a buzzer, piezo or other, in parallel with the LED. No extra pin needed.
 

MikeAusP

Member
It's surprising how much good acoustic design can boost the level.

Cup your hand, point the Piezo into it and then slowly move it away, to find the size of resonant cavity you need for maximum volume . . . bit first set the frequency to the resonant freq of the Piezo.
 

westaust55

Moderator
JPU,
Pin 3 on the 08M2 is an input only. You need an output pin to generate the signal to drive the piezo or speaker.

Steve G
@JPU

Or . . .

Is “Pin 3” the physical pin 3, which is PICAXE logical IO pin4 ?


Voltage is the key to a louder sound.
Either use 9 V for the Piezo with a transistor as a driver.
If you only have 4.5 Volts or 5 Volts available then use say a Hex inverter chip with the Piezo across the input and output of a logic gate. This will in effect switch the piezo between +4.5V and -4.5V giving the equivalent to a 9 V supply.

I also recall there is a thread on the PICAXE forum where a piezo driver in the same vien was done using a couple of transistors instead of a 74HCxx series logic gate when only one PICAXE IO pin was available. I leave it to you to do a forum search (my lunch break is ending).

some theory here:http://www.picaxeforum.co.uk/archive/index.php/t-11548.html
 

Dippy

Moderator
In addition to the good points above...

The figure of "0.3W" doesn't, per se, define how loud it's going to be.
A speaker sitting in mid-air will be quieter than one in a resonant enclosure.
That speaker is 8ohm nom impedance - way too low for direct driving from PICAXE O/P pin.

Which piezo from "picaxe" (Rev-Ed shop)?
SPE001?

You should be able to get a half-decent peep when used in the suitable frequency range.

Have you connected your sounder as in Manual 3?
A better circuit is this:-
(No gain but a cleaner sound and can play with values).
 

Attachments

srnet

Senior Member
Finally, piezos work best a their resonant frequency, so test it at different notes to find the sweet spot.
Absolutely.

Hitting the resonant frequency can make a very significant difference to the loudness, particularly for those Piezos inside a plastic case.
 

JPU

Senior Member
Hi All

Thanks for your replies. I was aware that pin 3 was ouput only and this is why it adds to my problem. I have tried this little program to test ,
Code:
for b1 = 1 to 100
sound 1, (b1,25)
next b1
which is from manual 3 and yes Dippy I did try that circuit in manual 3. The program produces a variable pitch however none of the sound is very audible.

I will try it today glued to the plastic enclosure as suggested.

What about this: Could I connect the the positive input of the Piezo to the power rail (3.7V) and then sink the speaker though the pin3. Would it be possible with some imaginary code to produce a beep!
 

manuka

Senior Member
I was aware that pin 3 was ouput only
Ahem- is this a typo? Surely you meant INPUT ONLY ? The piezo sounder normally goes from the output pin to ground - don't try anything fancy until at least this is tamed.

Can you please post a pix/web link for your exact piezo sounder. I've worked with some over the years that are indeed a tad quiet, but (as already stated) my coin sized flat standard one is readily heard across a quiet room by even my well worn ears. In fact -best we check - do you have good hearing ?
 

Attachments

Dippy

Moderator
Please clarify: are you suggesting Power+ve --- 8OhmSpeaker----PICAXE pin ?
Nothing in series with the speaker? Nasty!
Try it with the piezo. Try the same code. Try different frequencies.

I've used Piezo sounders in ancient PIC projects with the simple circuit I posted.
It was very audible around the resonant Fq of the sounder. Ears didn't bleed but very acceptable.

If you tried that circuit (Manual 3) please confirm the EXACT value of capacitor used.

Can you put the piezo on any other source to make sure yours is OK?
Did you only buy one? Have you another one to try?
 

JPU

Senior Member
Sorry guys,

Yes Manuka, I did mean "input only"..

I was suggesting +ve to Piezo to Pin 3, sorry I didn't make myself clear. Ill try your circuit first Dippy and and get back to you later.

Thanks for your help
 

Buzby

Senior Member
.... In fact - best we check - do you have good hearing ?

A bit OT, but it made me smile ...

** The Deaf Wife Problem **
Bert feared his wife Peg wasn't hearing as well as she used to and he thought she might need a hearing aid.

Not quite sure how to approach her, he called the family Doctor to discuss the problem.
The Doctor told him there is a simple informal test the husband could perform to give the Doctor a better idea about her hearing loss.

'Here's what you do,' said the Doctor, 'stand about 40 feet away from her, and in a normal conversational speaking tone see if she hears you.
If not, go to 30 feet, then 20 feet, and so on until you get a response.'


That evening, the wife is in the kitchen cooking dinner, and he was in the den.
He says to himself, 'I'm about 40 feet away, let's see what happens.' Then, in a normal tone he asks, 'Honey, what's for dinner ?'

No response.

So the husband moves closer, about 30 feet, and repeats, 'Peg, what's for dinner?'

No response.


Next he moves into the dining room, about 20 feet from his Wife, and asks, 'Honey, what's for dinner?'

No response.


So he walks up to the kitchen door, 'Honey, what's for dinner?'

No response.

Finally he walks right up behind her. 'Peg, what's for dinner?'


( Wait for it ...)


** 'For God's sake Bert, for the FIFTH time, it's CHICKEN ! **
 

hippy

Technical Support
Staff member
I need the user of an LED light to know when the light is on or off as its on their head and used during the day((dont ask!!), and thought that a speaker would do the trick eg 1 one beep on, 2 beeps off.
You can parallel the piezo alongside the LED+R if you don't mind some slight flickering when the LED turns on or off. Give a beep then keep the pin high, give two beeps then keep the pin low.

It is not recommended to keep a DC voltage across a piezo but you can probably get away with it.

All piezos I have ever used have been quite loud, certainly cased ones, so the question is why yours isn't. Are you actually using a piezo or something else ? The item from Farnell is a speaker rather than a piezo.

Uncased piezos may need holding against a solid surface in order to do their job; in free air they may be rather quiet.
 

austfox

New Member
Did you purchase the cased or the uncased piezo? Running the cased one is as loud as my alarm clock, especially when stuck onto a flat surface.

Code:
do
	
	sound 2,(120,50)
	pause 200

loop
I haven't tried the uncased one though.

Steven.
 

tmfkam

Senior Member
Just a thought.

If you are connecting the piezo from supply (3.7V?) directly to an output pin of the PicAxe it may be worth experimenting with a resistor in parallel with the piezo. Piezo transducers are largely capacitive and once switched on will charge up (and move), if there is no discharge path once the PicAxe turns off the piezo may not discharge (and return to it's rest state) fully before the PicAxe turns on again. If this is the case they can be suspiciously quiet. A parallel resistor across the piezo can work wonders. I'd perhaps start with a 10k or 4k7.
 

premelec

Senior Member
Of the many watches with a piezo on back I've decomposed there was an inductor to kick higher voltage to the piezo which is the other way to make one louder besides mechanical arrangements... basically a step up situation putting current through an inductor and then using the high voltage spike on fast turnoff to rattle the piezo.
 

JPU

Senior Member
Hi All

Thanks for all your suggestions and help.

I glued the Piezo to the inside if the project box and the sound level trippled. I then found its "sweet spot, tone" and that improved things also.

Hippy, to the rescue as usual, a simple idea of connecting it to the LED in parallel, but it works perfectly. A simple sound command before the LED flashes and it does the job lovely jubbly!

Thanks guys.
 
Top