View previous topic :: View next topic |
Author |
Message |
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
piezo buzzer drive: generate a 'click' |
Posted: Fri May 12, 2006 1:22 am |
|
|
Hi,
our device has a 20 button keypad. As our device is a notetaker for visually impaired people, I'd like to add a click tone every time you press a button. Compare with a cell-phone.
Now this is the wiring:
Piezo buzzer pin 1 to port E2
Piezo buzzer pin 0 to ground.
This is my function to generate a beep:
Code: | void BUZZER()
{
int8 i;
for (i = 0 ; i < 170 ; i++ )
{
output_high(BUZZ);
delay_us(200);
output_low(BUZZ);
delay_us(300);
}
} |
Now how can I adapt this to let the buzzer generate a "click" ?
thx |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Fri May 12, 2006 3:56 am |
|
|
'click' is a wideband sound, while your buzzer probably is designed to produces something close to a tone. I'm not sure if it will work, but try turning your buzzer for a very short time - one cycle of the buzzer's acustic frequency. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Fri May 12, 2006 6:20 am |
|
|
It sounds like he has a bare piezo element, as he is turning it on and off at a 2kHz rate (more of a squeak than a buzz). So if he gives it just one or two cycles it should give a click. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Fri May 12, 2006 9:16 am |
|
|
I will "third" what you've been told.
I have an ultrasonic distance measurment sensor which operates at 50 kHz and has a range of 40' (12.2m). This thing is LOUD! I can't actually hear the 50 kHz whistle, but when it transmits, you can hear a very loud "clack". You can actually hear the returning echo too.
The secret to generating your audible click is to power the piezo speaker for a very short time - perhaps 50 - 500 us. Play with the delay until you find one that gives the best click. |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Wed May 17, 2006 8:58 am |
|
|
What do you mean by 'power'?
Send pulses to it or give it a DC voltage? |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Wed May 17, 2006 9:45 am |
|
|
Christophe wrote: | Send pulses to it or give it a DC voltage? |
It's hard to answer this question without knowing more specific details about your particular buzzer. Your buzzer either has an internal oscillator or it doesn't. But in either case, a single rectangular pulse might produce a click. If you post the part number for your buzzer, I might give you a more enlighted answer. |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Wed May 17, 2006 10:18 am |
|
|
kender wrote: | Christophe wrote: | Send pulses to it or give it a DC voltage? |
It's hard to answer this question without knowing more specific details about your particular buzzer. Your buzzer either has an internal oscillator or it doesn't. But in either case, a single rectangular pulse might produce a click. If you post the part number for your buzzer, I might give you a more enlighted answer. |
First try applying a DC level. Something like:
Code: | output_high(BUZZER_PIN);
delay_us(100);
output_low(BUZZER_PIN); |
You should hear a click. Whether you find it to be acceptably loud is another story.
As an aside, I have a Micro Engineering Labs (www.melabs.com) Lab X1 board. It comes with a piezo buzzer which is connected to one of the port C pins. If I use that pin as a digital I/O line, I can hear a faint click coming from the piezo buzzer every time the line changes state. I'm fairly certain that the clicks you'll be able to produce without amplification will be very quiet.
It may be better to produce short beeps instead of clicks. The least processor-intensive way to do that is to configure the PWM to run at the resonant frequency of the piezo buzzer. Then simply gate the buzzer for a short period of time in response to a button press/whatever. All you have to do is change the PWM pin from being an input (no sound) to an output (so the buzzer gets driven by the PWM), wait a short period of time, then change the pin back to being an input (no sound). |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Thu May 18, 2006 8:11 am |
|
|
It says that the max voltage is 20V AC.
Pump up the voltage.
Use a transformer to increase the pwm output.
OR
Maybe use the 3V pic output to control a FET that controls perhaps the source voltage before the 3V regulator.
Last edited by treitmey on Thu May 18, 2006 12:23 pm; edited 1 time in total |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1911
|
|
Posted: Thu May 18, 2006 9:11 am |
|
|
treitmey wrote: | It says that the max voltage is 20V AC.
Pump up the voltage.
Use a transformer to increase the pwm output. |
I was going to suggest a transformer too, but it really depends on the sound that is required. If a tone is acceptable, then the piezo can either be driven directly from the PIC, or it may need a transformer between the piezo and the PIC. It all depends on how loud the piezo is when driven directly from the PIC. Drive it at its resonant frequency for maximum volume.
If a click is desired (not a beep), then his options are kind of limited. Unless there is a "click transducer", of course. |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
$0.02 |
Posted: Thu May 18, 2006 4:44 pm |
|
|
Christophe wrote: | our device has a 20 button keypad. As our device is a notetaker for visually impaired people, I'd like to add a click tone every time you press a button. Compare with a cell-phone. |
Looked at the datasheet for the buzzer you're using. I guess, you are feeding it a square wave, which sets the primary frequency for the buzzer. Here's my $0.02: from a product design standpoint, you might be better off producing tones for button presses. Different tone for each button or a group of buttons. That might give the visually impared user an aditional feedback about whether or not the correct button has been actually pressed. |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Fri May 19, 2006 12:56 am |
|
|
Hi kender,
thx for your input again. Your suggestion is good, however there are too much button combinations possible. I just want a small click on any keypress, just like with a cell phone.
Here is a picture of the device:
[img]http://users.[spam].be/chs/Werk/ES20.jpg [/img] |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
Anther $0.02 |
Posted: Fri May 19, 2006 7:03 am |
|
|
Christophe wrote: | Here is a picture of the device:
|
Nice industrial design! Since the device is fairly large, you could take advantage of setereo effect by locating 2 buzzers on different ends. |
|
|
Christophe
Joined: 10 May 2005 Posts: 323 Location: Belgium
|
|
Posted: Fri May 19, 2006 7:23 am |
|
|
Another good idea however again difficult as the production pcb's are allready being made, so I cannot change anything more for this batch of boards.
On the next run, I'll drive it with a higher voltage. |
|
|
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
Posted: Fri May 19, 2006 7:37 am |
|
|
Or you could throw a relay. The mechanical action might make a nice click. |
|
|
|