Roland Andrag wrote: > >I have with success (after it was suggested on the Piclist) connected a >piezo device between two port pins to get an effective 10 V swing. > >RB0 -----piezo speaker------RB1 > >Start off with RB0 = 0 V, RB1 = 5 V. Now switch them to RB0 = 5 V, RB1 = 0. >Do this about 4000 times a second for a nice noise. A good idea is to play >around with the frequency - most piezo speakers have a narrow frequency band >in which they are really loud. > >I cannot remember what the verdict was on whether it is necessary to include >series resistors... > Roland: For a 'purer tone' you might want to try pulsing your piezo with a duty cycle of 2/3 (ie +ve for 2t, off for t, -ve for 2t and off for t). I believe if you do a Fourier analysis of this waveform, you'll find there are no 3rd and 9th harmonics, etc.(as well as no even ones due to the symmetry) giving you a cleaner sine wave than you would have with the 50% square wave that you're proposing. For experimental use, you'd likely get away with no series resistor, but I wouldn't do it. The piezo element is one big capacitor that you're charging/discharging so to limit the current add some resistance. ~1K is a good ballpark to try. Jim Nagy Elm Electronics ICs for Experimenters http://www.elmelectronics.com/