Driving a piezo with the sound function


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425

    Default Driving a piezo with the sound function

    I'd like to use a piezo buzzer for my application. I've ordered abotu 10 of them, all different sizes, and connected it to a 16F870 just like the PBP manual states (in the "sound" portion). It says to use a 10uF cap and that it will work.

    Well, it works but the volume is really low. How can I increase this volume on the piezo? Perhaps something easy with one or two components?

    I am using a 9V battery with a 5V regulator.

    Thanks!

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There are three kinds of Piezo things that make a noise...

    1. Piezo Transducer
    2. Piezo Buzzer
    3. Piezo Loudspeaker

    The first, Piezo Transducer makes a hell of a noise if you hit it at it's RESONANT FREQUENCY (eg 4kHz). The further away from it's preferred comfort zone, the crappier the sound. If you just connect a DC voltage to it, it usually just goes 'click'.

    The second is a Piezo Buzzer. You simply connect a DC voltage to it, and it makes a noise... it doesn't need any kind of external drive as it has an oscillator built-in (if you apply external drive you will usually get a horrible mess of a sound).

    Finally is the Piezo Speaker... much harder to find (and more expensive) than types 1 or 2. If you need one badly for your PIC, rip apart your friends most expensive prized LCD monitor.

    Sounds to me like you've got option 1 - unless it's not a Piezo...

    If you have got Option 1, then coupling it with 100nF is more than sufficient... find the correct Resonant Frequency (Datasheet) and it'll fill your world with noise...

  3. #3
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default

    Thanks for the reply. As an example, I've got two types. One is a self drive and the other is an external drive but both are piezo buzzers. The part numbers (Digi-key) are 102-1146-ND and 102-1135-ND respectively.

    If I understand correctly, I can use a 100nF cap in series with the buzzer and hit the resonant frequency (which appears to be 8, 16 or 20 KHz) and it will be loud? If I read the PBP manual correctly, the highest it will be is 20 Khz, correct?

    So, with a 100nF cap, one side of the buzzer connected to ground and with this line of code:

    SOUND PORTB.7,[250,10]

    This should get my ear drums bleeding? :0)

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I tend to find the Piezo Transducers need a little experimenting to hit it just right... and in typical Melanie fashion I don't use the in-built PBP Commands and tend to roll my own...

    Here's what works for me...

    Code:
    
    	BeepToneHi var Byte		' Variable for Beep High-Period
    	BeepToneLo var Byte		' Variable for Beep Low-Period
    	BeepLength var Word		' Number of Repitition Cycles to execute
    
    
    	'
    	'	Subroutine Produces Standard Beep for 2 Seconds
    	'	-----------------------------------------------
    BeepTwoSeconds:
    	BeepLength=8800					' For Two Seconds
    	Goto BeepRAW
    	'
    	'	Subroutine Produces Standard Beep for 100mS
    	'	-------------------------------------------
    BeepShort:
    	BeepLength=435					' For 100mS
    	Goto BeepRAW
    	'
    	'	Subroutine Produces Standard Beep for 250mS
    	'	-------------------------------------------
    Beep:
    	BeepLength=1100					' For 250mS
    BeepRaw:
    	BeepToneHi=111
    	BeepToneLo=BeepToneHi-49
    	For CounterC=0 to BeepLength
    		High Beeper
    		PauseUS BeepToneHi
    		Low Beeper
    		PauseUS BeepToneLo
    		Next CounterC
    	Return
    Let me tell you how sharply the roll-off is for a Piezo... for me BeepTone=111 is just right... 113 or higher gives about 12dB less Sound Output, 109 or lower similarly.

    I literally sat there with a Scope and a For-Next Loop giving me a two-second burst of every value from 50 to 200 to finally decide what value was loudest!

  5. #5
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    Hi,

    I also bought me a piezo buzzer from mouser (see link below) and using it with the commands SOUND and FREQOUT at the resonance frequency 4MHz didn't help too much. The sound was very low. It was even worst when I installed the PCB board with the buzzer attached to it inside a plastic enclosure. Inside the enclosure you can barely hear the buzzer.

    I will give it a try to Melany suggestion of using a square wave for the buzzer.

    Robert

    http://www.mouser.com/Search/Product...ub80XcMw%3d%3d

  6. #6


    Did you find this post helpful? Yes | No

    Default

    At the end of the data sheet is a suggested driver circuit. You may also want to try it. The data does not show any current requirements for thsi part so maybe the PIC can't drive it hard enough?
    Tim Barr

  7. #7
    Join Date
    Jun 2005
    Location
    West Australia
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Try parallel resonance

    Hi Folks,

    I use the piezo transducer types (need to be frequency driven) and find a small coil across the transducer works well as these sensors (yes they make good vibration detectors too!!) are capacitive. Some experimentation is required for the value of the coil inductance but these can easily be made.

    Note a current limiting resistor is now needed in series to safeguard the PIC pin as the coil basically makes the output a short circuit.

    HTH,
    Bill

  8. #8
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    This is how my piezo speaker is driven. The speaker connects between BUZZ and the ground.
    Attached Images Attached Images  

  9. #9
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,129


    Did you find this post helpful? Yes | No

    Default

    Risky Jerson!

    Does anyone know the relation between the numbers and the freq. in the SOUND command?

    Ioannis

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Wanted: Sound chip interfaced with pic
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 34
    Last Post: - 8th September 2008, 13:38
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. Sound and sound control with minimal parts
    By bartman in forum General
    Replies: 23
    Last Post: - 18th January 2005, 14:08
  5. Re: quick fix for sound command?
    By Melanie in forum Code Examples
    Replies: 0
    Last Post: - 9th July 2004, 01:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts