Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: BANE on December 06, 2007, 05:09:37 PM

Title: activating a piezo speaker from a battery???
Post by: BANE on December 06, 2007, 05:09:37 PM
Hey again, can anybody tell me how to use a piezo speaker in a simple circle with a 5VDC power source? 
Also, in general, how to convert current into a frequency (what conponents would you use)?

Thanks

Bane
Title: Re: activating a piezo speaker from a battery???
Post by: ed1380 on December 06, 2007, 05:45:25 PM
I think voltage will influance the sound of the piezo. not current.


put a pot in the circuit and you'll be able to control voltage

no special circuitry needed. just connect to a battery (use pot if wanted)
Title: Re: activating a piezo speaker from a battery???
Post by: BANE on December 06, 2007, 05:53:40 PM
hey ed, I tryed using a 10K pot and it still wont work.  Is 10K to much?
Title: Re: activating a piezo speaker from a battery???
Post by: ed1380 on December 06, 2007, 07:23:50 PM
what battery? if it's around 5v try it without the pot
Title: Re: activating a piezo speaker from a battery???
Post by: HDL_CinC_Dragon on December 06, 2007, 07:28:21 PM
if im not mistaken, piezo speakers require a frequency... If thats the case, use a 555 timer circuit to generate the desired frequency
Title: Re: activating a piezo speaker from a battery???
Post by: airman00 on December 06, 2007, 09:45:59 PM
Quote
Piezo speakers (also known as piezo buzzers or piezo beepers) can be directly driven from PIC outputs, in either a single-ended or differential fashion.

Single ended drive has the advantage of only needing a single output port pin. The piezo can be connected directly between the port pin and ground (or the positive supply. The port pin should be driven to the appropriate level when the piezo is idle in order to avoid applying a DC bias.

Differential drive uses two output port pins which are driven to complementary levels. This creates twice the voltage swing across the piezo, which results in higher volume. When the piezo is not being driven, both output pins should be driven to the same output level in order to avoid a DC bias.

Piezo speakers have strong peaks in their frequency response. If you are just using a piezo as a simple audible indicator, you may want to choose a frequency near a peak in order to achieve maximum volume. If a lower frequency is desirable you can use an odd submultiple of the peak fequency; since the drive is a square wave the odd harmonics (especially the third) will have fairly high amplitueds.

Rich and I have found that it is useful to include a piezo in almost any microcontroller based project during the debugging stage even if it is not needed in the finished product. In particular, if you include code to generate a beep at startup time, it provides a quick indication that power is OK, the oscillator is running, and the CPU works.