Searching \ for 'Piezo speaker with PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=speaker
Search entire site for: 'Piezo speaker with PIC'.

Truncated match.
PICList Thread
'Piezo speaker with PIC'
1998\05\28@210456 by NCS Products

flavicon
face
I want to add sounds to a product--beeps and boops and the like.

Can I just hook a piezo speaker to a PIC output pin?
Or should I use a resistor and/or capacitor in series?

1998\05\28@212012 by David VanHorn

flavicon
face
>I want to add sounds to a product--beeps and boops and the like.
>
>Can I just hook a piezo speaker to a PIC output pin?
>Or should I use a resistor and/or capacitor in series?

Yes but.

You'll be tempted to use two outputs to make it louder. This can, with
the wrong switching sequence, cause a voltage doubling effect, and
hang your processor with CMOS latchup!

Wrong sequence.

A  B      Voltage on pins at the moment of transition

L  L        0     0
L  H        0     5
H  H       5     10 (!)  Possible CPU hang.
H  L       5      0
L  L        0     0


Right sequence

A B

L L     0  0
L H     0  5
L L     0   0 (This state just has to happen, it dosen't have to stay there
any significant time)
H L     5  0
L L      0  0 (Same as above)

1998\05\28@212351 by hansen

flavicon
face
NCS Products wrote:
>
> I want to add sounds to a product--beeps and boops and the like.
>
> Can I just hook a piezo speaker to a PIC output pin?
> Or should I use a resistor and/or capacitor in series?

Just hook it up directly.  It works great.

John Hansen
spam_OUThansenTakeThisOuTspamfredonia.edu

1998\05\29@025548 by Douglas Braun

flavicon
face
If you have an extra I/O pin available, hook the piezo speaker
across two pins, and drive them in a complementary fashion.  This
gives you twice the voltage swing compared to having one pin grounded.

Doug Braun

> Can I just hook a piezo speaker to a PIC output pin?
> Or should I use a resistor and/or capacitor in series?

1998\05\29@034517 by Dr. Imre Bartfai

flavicon
face
On Thu, 28 May 1998, David VanHorn wrote:

> >I want to add sounds to a product--beeps and boops and the like.
> >
> >Can I just hook a piezo speaker to a PIC output pin?
> >Or should I use a resistor and/or capacitor in series?
>
> Yes but.
>
> You'll be tempted to use two outputs to make it louder. This can, with
> the wrong switching sequence, cause a voltage doubling effect, and
> hang your processor with CMOS latchup!

Hi,
at first I could not follow your arguments. The it became clearer.
However, I think, it is true only if the device connected between A and B
has enough capacity to hold some coulombs during pin transition. On the
other hand:
the piezo devices drain not too much current, i. e. you can put a serial
resistor between it and the PIC. Now, assuming the capacity is high enough
to satisfy the condition described above, nothing bad will happen as the
PIC has voltage clamping diodes. I guess 2 x 10k will work.

Imre

{Quote hidden}

1998\05\29@103827 by David VanHorn

flavicon
face
>Hi,
>at first I could not follow your arguments. The it became clearer.
>However, I think, it is true only if the device connected between A and B
>has enough capacity to hold some coulombs during pin transition. On the
>other hand:

That's correct, but I don't know how to determine what is going to be too
much.
I don't know if microchip does either.  The capacitor presented by a piezo
beeper is fairly large in these terms, so it's a significant hazard. Not for
the
casual experimenter, but if you make 1000 of your device, maybe some
number will suffer unexplained crashes, maybe none, maybe all.


>the piezo devices drain not too much current, i. e. you can put a serial
>resistor between it and the PIC. Now, assuming the capacity is high enough
>to satisfy the condition described above, nothing bad will happen as the
>PIC has voltage clamping diodes. I guess 2 x 10k will work.


Not that large an R.. Maybe 100 ohms or so, but 10k won't leave you any
sound.
It's not a problem at all if you sequence the outputs properly.

1998\05\29@105400 by Martin Green

flavicon
face
    I just hook a piezo up directly to the PIC pins, but if you excite the
    piezo at or near its resonant frequency you might need a resistor to
    prevent excessive flexing of the disc.  You won't need a capacitor if
    you drive the piezo with two output pins.  Drive the two pins in
    opposition (an XOR works well for this), and when the sound is off
    just make sure that both pins are set to the same level.  If you drive
    a peizo with one pin relative to GND or Vcc a series cap might be a
    good idea since otherwise the disc will be forced to flex in one
    direction only.

    A piece of advice - try several different types of piezos with your
    design, the actual sound level and sound quality produced varies
    widely.  If you find you are overdriving the piezo because you need to
    run it near its resonant frequency, trying a different piezo can solve
    the problem easily.


    CIAO - Martin.


______________________________ Reply Separator _________________________________
Subject: Piezo speaker with PIC
Author:  pic microcontroller discussion list <.....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU> at
Internet
Date:    5/28/98 9:04 PM


I want to add sounds to a product--beeps and boops and the like.

Can I just hook a piezo speaker to a PIC output pin?
Or should I use a resistor and/or capacitor in series?

1998\05\29@120730 by STEENKAMP [M.ING E&E]

flavicon
picon face
Hi,

In addition to what was already said:
Most piezo devices are made to resonate at a particular frequency.
Driving it at that frequency will give you a good loud beep.  Other
frequencies are likely to be a lot softer.

Niki

1998\05\29@123840 by org Hager

flavicon
face
On Fri, 29 May 1998, Martin Green wrote:

>      ...
>      you drive the piezo with two output pins.  Drive the two pins in
>      opposition (an XOR works well for this), and when the sound is off
>      just make sure that both pins are set to the same level.

So does it damage or influence the piezo in any way when there is a
permanent voltage across it? In one app, I only have one output pin left
and I'd like to use this for a piezo connected over input and output of an
inverter (which is available).

Georg.

=========================================================================
Georg Hager             | Email:   ghagerspamKILLspamtheorie3.physik.uni-erlangen.de
Theoretische Physik III |                   Tel. (Uni): (+49)9131/85-8815
FAU Erlangen-N"urnberg  |                   Tel. (Pri):   (+49)911/735142
Staudtstr. 7            | Home URL:
D-91058 Erlangen,Germany| theorie3.physik.uni-erlangen.de/~ghager/
=========================================================================

1998\05\29@140620 by Alan King

picon face
On this note, does anyone know where to get some with an ultrasonic
resonant freq?  Been wanting to make a cleaner for a while but they're
tough to find..

N STEENKAMP [M.ING E&E] wrote:
>
> Hi,
>
> In addition to what was already said:
> Most piezo devices are made to resonate at a particular frequency.
> Driving it at that frequency will give you a good loud beep.  Other
> frequencies are likely to be a lot softer.
>
> Niki

1998\05\30@010442 by Don McKenzie

flavicon
face
>I want to add sounds to a product--beeps and boops and the like.
>Can I just hook a piezo speaker to a PIC output pin?
>Or should I use a resistor and/or capacitor in series?

http://www.dontronics.com/see.html#sound
may be an interesting study for producing sounds in the format:

; SOUND port, pin, frequency, duration
; Generates squarewave tones (notes) of the specified frequency and
; duration. This demonstration program shows how to use lookup tables to
; play tunes or effects from data stored in program memory.

This is an extract from the PIC Source Book/Disk by Scott Edwards found
at:
http://www.dontronics.com/see.html

Don McKenzie  .....donKILLspamspam.....dontronics.com   http://www.dontronics.com

Don's Download Dungeon: http://www.dontronics.com/download.html
For more details, send a blank message to EraseMEinfospam_OUTspamTakeThisOuTdontronics.com
or simstickspamspam_OUTdontronics.com or @spam@basicsKILLspamspamdontronics.com

1998\05\30@022837 by Russell McMahon

picon face
Beware piezos connected directly to processor pins. Tapping
the piezo surface can cause VERY high voltages (ever seen
the spark from a piezo gas lighting wand?). The voltages
will not be that high but they can destroy cpus. PIC has
some reasonable esd protection but I suspect a piezo could
make enough energy to give it a fright.

Try taking a piezo sounder and connecting it to an
oscilloscope. Tap the surface and observe the output. Note
that the scope probe probably had about 10 pf capacitance.
You'll probably want to be sure this doesn't happen when its
connected to your processor.



{Original Message removed}

1998\05\30@144818 by Michael Ghormley

flavicon
face
Dr. Imre Bartfai wrote:

> at first I could not follow your arguments. The it became clearer.  However, I
> think, it is true only if the device connected between A and B has enough > ca
pacity to hold some coulombs during pin transition. On the other hand:
> the piezo devices drain not too much current, i. e. you can put a serial
> resistor between it and the PIC. Now, assuming the capacity is high enough
> to satisfy the condition described above, nothing bad will happen as the
> PIC has voltage clamping diodes. I guess 2 x 10k will work.

But the 20k will diminish the increase in sound that you were trying to achieve
by using two pins, non?  If the large R's are necessary, then you might be
better off just using one pin and ground, methinks.

I think that what David is suggesting is right.  Perhaps one could think of it
as a first approximation of a sinewave that is being sampled at the peaks and
the zero-crossings?  Since the slope of the sinewave at the zero-crossing is
more steep than the slope at the peaks, the 0-0 period could be very small in
respect to the period of the signal.

I have not used this idea, but I will incorporate it the next piezo element that
I drive.  Thank you, David.

Just my opinion.  Your mileage may vary.

Michael

REMOVE THE .NS (NO SPAM) FROM MY ADDRESS TO REPLY
*************************************************************************
When the way of the Tao is forgotten, kindness and ethics must be taught.
Men must learn to pretend to be wise and good.  --  Lao Tzu
*************************************************************************

1998\05\30@145858 by David VanHorn

flavicon
face
>I think that what David is suggesting is right.  Perhaps one could think of
it
>as a first approximation of a sinewave that is being sampled at the peaks
and
>the zero-crossings?  Since the slope of the sinewave at the zero-crossing
is
>more steep than the slope at the peaks, the 0-0 period could be very small
in
>respect to the period of the signal.


Interesting, that wasn't my intention, but that is the result.    I've
scoped the lines
on a piezo driven with the "wrong" cadence, and I have seen the voltage
doubling
effect working. It wasn't double, as it was dumpng into the uP protection
diodes,
but that's the whole point. We don't want to put much current into those
diodes,
and the basic limit here is the uP's own output current.  I think if you ask
your
uP vendor, they won't reccomend dumping 20mA into the protection diodes :-P

>I have not used this idea, but I will incorporate it the next piezo element
that
>I drive.  Thank you, David.


:)


An additional note, someone suggested that impact or vibration could cause
the
same effect, and I agree.  I'm leaning twoard a pair of zeners out there.

A magnetic beeper wouldn't have as many potential problems, maybe that's a
better
path.

1998\05\30@150648 by Michael Ghormley

flavicon
face
Alan King wrote:

> On this note, does anyone know where to get some with an ultrasonic
> resonant freq?  Been wanting to make a cleaner for a while but they're
> tough to find..

As you might know, the "garden variety" piezo elements don't have enough
power to be used in an ultrasonic cleaner.

A few years back, Radio Shack (or Tandy, in Europe) sold a 50W "Super
Tweeter" that had a frequency response of 5k-40kHz.  I used it @ 32kHz
and got good results even though I skimped on the coupling.  I have also
used it when I built a "critter ridder" that has freed my back yard of a
pesky mocking bird that liked to sing all night!

I have not set foot in a RS for years, but the part number then was:
  40-1310b

If you need more info on it, please write to me privately.

I hope this helps,

Michael

REMOVE THE .NS (NO SPAM) FROM MY ADDRESS TO REPLY
*************************************************************************When th
e way of the Tao is forgotten, kindness and ethics must be taught.
Men must learn to pretend to be wise and good.  --  Lao Tzu
*************************************************************************


'Piezo speaker with PIC'
1998\06\02@025448 by Dr. Imre Bartfai
flavicon
face
Hi,
in the catalogue stands:

input clamp current: +/- 20 mA. It means it is enough to put such
resistors which limits to this value, i.e. instead of my first suggestion
2 x 250 ohms must be sufficient (2 x 5 V = 10V, 10V / 500 ohm = 20 mA). I
think here won't suffer the volume.

Regards,
Imre


On Sat, 30 May 1998, David VanHorn wrote:

{Quote hidden}

1998\06\02@111617 by Dan Larson

flavicon
face
On Tue, 2 Jun 1998 08:43:25 +0200, Dr. Imre Bartfai wrote:

>Hi,
>in the catalogue stands:
>
>input clamp current: +/- 20 mA. It means it is enough to put such
>resistors which limits to this value, i.e. instead of my first suggestion
>2 x 250 ohms must be sufficient (2 x 5 V = 10V, 10V / 500 ohm = 20 mA). I
>think here won't suffer the volume.
>
>Regards,
>Imre
>

How about adding your own external clamp diodes?


Dan

1998\06\03@004334 by ape

flavicon
face
Dr. Imre Bartfai wrote:

> Hi,
> in the catalogue stands:
>
> input clamp current: +/- 20 mA. It means it is enough to put such
> resistors which limits to this value, i.e. instead of my first suggestion
> 2 x 250 ohms must be sufficient (2 x 5 V = 10V, 10V / 500 ohm = 20 mA). I
> think here won't suffer the volume.

20mA should be enough to drive the piezo but if you put 500 ohms in series
with it at 10V you will no longer have 20mA.  Remember that the piezo
has its own internal resistance.  To make things simple (math wise), if the
piezo had a inductance of 500 ohms and you put another 500 ohms in
series with it.......  Do I need to say more?  Ever heard of a voltage divider.

1998\06\03@192236 by David VanHorn

flavicon
face
>20mA should be enough to drive the piezo but if you put 500 ohms in series
>with it at 10V you will no longer have 20mA.  Remember that the piezo
>has its own internal resistance.  To make things simple (math wise), if the
>piezo had a inductance of 500 ohms and you put another 500 ohms in
>series with it.......  Do I need to say more?  Ever heard of a voltage
divider.

Remember, 20mA is just a number I pulled out of the air.
10mA or 1mA might be too much, I have no idea.  From
experience, if I'm dumping current into a pin, I limit it to 10mA
max, unless I KNOW the pins can take more.

More... (looser matching)
- Last day of these posts
- In 1998 , 1999 only
- Today
- New search...