How to connect Buzzer to PIC?


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks! I've glanced through it and it's the best info I've seen sofar. I'll need some time but I'm going to work on a simple solution for pics (need to read up on inductors etc). Seems like this is something that gets asked about often on the forum.

    regards,
    mike

  2. #2


    Did you find this post helpful? Yes | No

    Default

    After some thought, I think I will go with max232/3232 or equivalent. May get back to this if sound output is not satisfactory...

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Will that help? I'm going off the top of my head but you'd have to use both outputs and invert the signal going into one of the inputs to get the voltage swing across the piezo (assuming using one output pin on the PIC)? You'd only get about 14VAC? What is the capactive loading spec of the 232 device; can it drive a cap load (piezo's are normally a "relatively speaking" large capacitive load).

    Have a look at this website: http://www.discovercircuits.com/P/piezo.htm. There are a couple of circuits shown. All you really need is a small inductor, a transistor and the piezo. The PIC is your oscillator. I'd have to think this is cheaper and easier than a MAX232?

    Keep in mind the resonant frequency of the device as well. Thinking back, one of the problems that the car alarms I worked on had when I was brought in was the guy before me was trying to brute force the piezo to get the output needed (+120db @ 3 feet). It was at around +97db. Tweaking the frequency made it jump to over +120db. The other thing that is more important than you'd think is in the way the piezo is held. I've done edge fixture mostly; the tighter this is clamped the better for output.

    I invented the "Singing Balloon"; this uses a piezo attached to a "foam speaker". It is edge mounted as well and driven with PWM from the sound chip. The output is around 10VAC to the piezo (in this case it reproduces music). The piezo *really* needed about 30VAC but the product (disposable in every sense of the word) couldn't stand the cost of the added circuitry to make it happen. I think to date there's been about 30-35 million of them produced.

    Mike Tripoli

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Hi Mike!

    Thanks for the post... I worked on a very lengthy reply and then lost it unfortunately =(...
    The main pointers of that message were:

    I'm looking for a small solution that can run on for example 3.3 volt, and haven't been satified with inverted pin output which is shown so often

    Unfortunately I came to the conclusion that I don't understand enough to design a flyback solution in the limited time I can currently allocate.

    I checked several resources, and then availability and size of split smd coils and their pricing. I had doubts as to whether there was much of an advantage of using a flyback converter here..

    I had uncertainties on whether I could build the coils myself (aircoil? pcb inductor?)

    Reading the schematics I had several difficulties as well...
    (for example @ http://en.wikipedia.org/wiki/Flyback_converter) I was unsure how the split inductor should really be connected to the PCB.

    PCB Die bonding made close analysis of the dissected circuit difficult.

    Thats why I decided to follow a different route at the moment....

    Anyway, in my search for a reasonable solution I did find some very nice chips from maxim (~1$) which I indend to try out. For example the MAX9738...
    These also typically have 14-16VP-P so I hope my RS232 method will work... I do hope it will work because many hobbyists already have that chip at home.

    I also figured the max3232 solution may also offer protection from Voltage spikes (from trauma or intended tapping) of the piezo (sensing by linking rs232 input and RS232 output).

    Here some interesting links:
    http://www.instructables.com/id/Extr...ep14/All-Done/
    http://video.google.co.uk/videoplay?...7327995034061#

    I'm still missing some caps for my test but I will post soon...

    regards,
    Michael

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hi! I got a chance to look at your singing ballons on youtube... nice...
    I'd actually be quite content if I reach that volume... You wanted them even louder?

  6. #6


    Did you find this post helpful? Yes | No

    Default

    To answer the last question first: I'm not sure what video you saw of the "Singing Balloon". The sound level output of the balloon is satisfactory; I wanted the higher voltage to get more headroom. In order to get the volume you hear I had to severely clip the (original) waveform. With a higher voltage (more headroom) I could have clipped the sound less and it would have sounded much (much) better. As with any disposable product, sub-fractions of a penny add up fast.

    I didn't listen to the videos you attached but I think I get it; the card is programmed with DTMF tones (http://en.wikipedia.org/wiki/Dual-tone_multi-frequency) that are recorded (or generated via code) and reproduced into the mouthpiece of the phone. Phone systems recognize this and dial the number. Lot's of products have been on the shelves over the years that do this. The business card is cute but I'm not so sure of the practicality (my opinion - but we're not talking about that). You didn't say if this is exactly what you want to do. If it is, I'd offer the following...

    The links I posted show how to connect the inductor for operation. I don't know that this would help anyway. When using an inductor in an oscillator you are tuning the components for the target frequency. With DTMF you are generating a couple of different frequencies so (if) you get it to oscillate it will not be very efficient and the voltage generated will be all over the place. Frankly, I'd abandon that approach.

    You *could* however design a small high voltage step-up circuit. I'm going straight from memory but I think both Maxim and Linear Technology make IC's to do this. I have no idea of the Vmin values... You could then use this with a transistor to power just the piezo. I think these devices are current hungry and you won't get far with a lithium coin cell (they probably have an enable of some sort to turn them on and off, but...). And then there is the noise on the supply rail to deal with...

    However.

    You don't need high volumes to make this work, the XOR'd output from two pins driving the piezo should be fine; with 3V you get 6Vp-p like this (5 gets you 10). You're not going for resonant frequency so you can pretty much ignore anything to do with that other than holding the piezo solidly.

    Keep in mind that waveform is not going to be a perfect square-wave when driving the piezo, nor will you get all the way to the rails.

    I'd look for the piezo devices that have a crystal element on both sides of the brass coin. These are more efficient than than the single sided and only cost a few pennies more.

    The thing you need to keep in mind doing this is the stability and accuracy of the frequencies being generated and that the tones are sine wave, not square. As I recall from doing a DTMF decoder years ago was that you have a very small window of deviation from the center tones to make it work.

    PBP has a DTMFout routine that needs a 20Mhz to get it right. It's PWM from one pin and needs a filter to get it "sine-wavy". You'll loose voltage through the filter so don't think it'll be anywhere near the rail (its meant for going to into an amp). I've seen assembly code years ago to generate DTMF and used a few but that was a long time ago.

    Good luck.

    P.S. When preparing a lengthy post, before posting it copy it to the clipboard. If the session has timed out you can just paste it back in.

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Hi Mike,

    Sorry for the late reply, and thank you for all the great information and the great links...

    I'm sure I've had several past projects with badly mounted piezos, and
    thanks to this thread I've finally taken the time to look at boost converters. I actually do a lot of my prototyping in smd and I've scrapped the flyback idea for now. (Common mode chokes are quite expensive and have lead times of >2months with farnell.at)

    However, I've skimmed the Microchip technical briefs (TB053, AN258, ccp tips and tricks) on the regular boost converters in discontinuous mode, and I will be adding some chip inductors to my next order. Once I get my parts, I will test a small high voltage stepup (Ip = 10mA) and transistor method.

    I'm actually not working on an embedded project at the time...
    Just trying to learn a bit for future endeavors. The business card link was just an example of a battery driven, tiny gadget (the type of device I like to work on). Also, I was interested in sensing of Voltage spikes, and ways to protect the io pins incase of shock/trauma.


    best regards,
    Michael
    Last edited by Michael Wakileh; - 11th February 2010 at 20:40.

Similar Threads

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