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----- From: Dr. Imre Bartfai To: PICLIST@MITVMA.MIT.EDU Date: Friday, 29 May 1998 19:45 Subject: Re: Piezo speaker with PIC >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 > >> >> 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) >> >> >