How to connect Buzzer to PIC?


Closed Thread
Results 1 to 33 of 33

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    A buzzer is a coil with a mechanical interrupter. When you apply a voltage, the coil energises, mechanically moves a core (usually soft iron) which in turn breaks a contact. The core moves back, contact is made once again and the process starts all over again. The core is usually connected to a sounding board (in better buzzers) to produce the noise, or in cheaper buzzers they just let the core movement produce the noise.

    The upside of the buzzer is you just apply volts and it works. The downside is that you have a COIL which is being switched on/off by it's own integral interruptor. This means (a) it's relatively power hungry, usually more than the 25mA maximum a PIC can drive, (b) in most cases requires more than 5v to drive to make a decent noise, but more importantly (c) the crappy ones can produce a significant back-emf which can easily destroy a transistor (or PIC pin) if you don't put a suppression diode across them. Connect a junk Buzzer (or use a Relay cross-connected in series with it's own contacts) to a Battery, and put your fingers across the Battery - the result is the kind of thing you use in prisoner interrogation (or job interviews) where they don't have handy AC volts comming out of the wall (you get the best tips and tricks on this forum - mention it in your Resume when you're applying for your next CIA job).

    A piezo sounder is a piece of crystal which changes shape (moves) when you apply a voltage across it (kinda like when you get strapped into old sparky). The movement is constant depending on the mechanical properties of the crystal.

    The upside of the piezo sounder is (a) low power, they have an impedance of meghoms therefore require next to no current to drive them, (b) they DO require a voltage to excite the piezo material but it can be as low as 1.5v, (c) they make a hell of a noise when you hit their resonant frequency. The downside is (a) they require being pulsed AT their resonant frequency (ie if it's a 4kHz piezo, they need to be driven at 4kHz), and (b) if you don't feed them with their desired frequency as a drive signal, the noise they produce is quite miserable.

    I never use buzzers with PICs because they're mechanically large, need suppression, and are power hungry so require additional circuitry to drive them.

    However with piezo's, the secret is you MUST hit that resonant frequency. In one application I used to drive a piezo sounder at 35v in order to get the sound output I desired. Only later I discovered my drive was off by some 300Hz, and by adjusting the software and hitting the right frequency I can now get the same output from the sounder at 5v direct from the PIC only going through a 100nF Capacitor.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Hi Melanie

    Thank you very much for the explanation, now I understand better.
    I think I will defenately use the piezo's.

    My piezo only use 1mA.

    I'm using the PWM function to produce a beep on a piezo.
    Will it be correct if I use the schematic displayed at the PWM section in the Picbasic Pro Manual.

    Currently I have connected the piezo directly between PortC.2 and GND and then in my code use <b>PWM PORTC.2,230,7</b>.
    Will this configuration of connecting the piezo directly between PortC.2 and GND affect my circuit in any way?

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


    Did you find this post helpful? Yes | No

    Default

    I normally connect a Piezo via a 100nF Capacitor (same sort I use for decoupling on my PCB's) because I once met a brand of Piezo's that randomly 'hung' when connected directly. See schematic. The Higher drive level option requires having one pin go High and the other Low alternatively. You can achieve this by manipulating the pins directly (you won't drive this conventionally 'as is' by using the PWM or HPWM commands).
    Attached Images Attached Images   

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thank you very much Melanie!

  5. #5
    steve@lumicycle's Avatar
    steve@lumicycle Guest


    Did you find this post helpful? Yes | No

    Default More PIC Piezo Questions

    I read your thread about getting a piezo buzzer to work on the pic. This I have done. However what I don't understand is why you can't drive the piezo very loudly through a mosfet. It doesn't really work at all just a faint noise. however if a 1k resistor is connected in series with the piezo it works ok but not that loudly. I think the frequency is OK. driving a loudspeaker through the mosfet works fine. There must be something about driving a piezo i don't understand. Any help gratefully received.

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by steve@lumicycle
    I read your thread about getting a piezo buzzer to work on the pic. This I have done. However what I don't understand is why you can't drive the piezo very loudly through a mosfet. It doesn't really work at all just a faint noise. however if a 1k resistor is connected in series with the piezo it works ok but not that loudly. I think the frequency is OK. driving a loudspeaker through the mosfet works fine. There must be something about driving a piezo i don't understand. Any help gratefully received.


    Pls read this:
    http://www.picbasic.co.uk/forum/showthread.php?t=4796


    --------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    Join Date
    Dec 2006
    Posts
    18


    Did you find this post helpful? Yes | No

    Default loud buzzer or sounder

    Hey guys

    im trying to make myself a boxing round timer. Im just about there but im have a bit of trouble with getting a buzzer or sounder loud enough. It needs to be loud enough to be heard over music. im using a 9v battery. My smoke alarm uses a 9v battery and thats loud as hell so the most be some way of doing it. any help much appreciated.

    Hoops

Similar Threads

  1. PIC keeps resetting when executing subroutine
    By jbirnsch in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 27th August 2009, 07:03
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. how to connect ac sensor to PIC ?
    By iugmoh in forum Schematics
    Replies: 3
    Last Post: - 1st June 2008, 18:35
  4. connect microphone to pic?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th January 2008, 08:33
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 1

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