Distorted Piezo

Steve2381

Senior Member
Hey all
I am driving a piezo directly off an 08M2 pin using the sound command and its pretty distorted. Its one of those small encased types you see in alarm keypads etc- about 10mm diameter.
Mounting on the case has not made it better. Tried a couple of other piezos - same issue.

Resistor in line? Its not very loud anyway (depending on what freq you drive it with). I thought a resistor would make it worse.

5v supply. Any ideas? No higher voltage available to boost it.

As a slight sideways question. Anyone got recommendations for decent hook-up wire? I am using old alarm cable multicore stripped down, but its horrible to solder with. The sleeving melts at very low temperature.
 

darb1972

Senior Member
Hey all
I am driving a piezo directly off an 08M2 pin using the sound command and its pretty distorted. Its one of those small encased types you see in alarm keypads etc- about 10mm diameter.
Mounting on the case has not made it better. Tried a couple of other piezos - same issue.

Resistor in line? Its not very loud anyway (depending on what freq you drive it with). I thought a resistor would make it worse.

5v supply. Any ideas? No higher voltage available to boost it.
Hello Steve. Can you please upload a datasheet for the device or a link for the spec sheet? It could be distorted for several reasons. Maybe the voltage is too high and something like a voltage divider is appropriate. Maybe the device is trying to draw too much current and the PICaxe is struggling to supply what is needed and this is distorting the waveform. Either way, a spec sheet will provide some guidance.

As a slight sideways question. Anyone got recommendations for decent hook-up wire? I am using old alarm cable multicore stripped down, but its horrible to solder with. The sleeving melts at very low temperature.
I think no matter what small hook-up wire you try to use, melting of the sheath is likely to happen. If you have a temperature control on your soldering iron, try reducing the heat so that you can still melt the solder but hopefully avoid melting the sheath. You could also try using serial and old parallel printer cables. These were usually soldered in the DB9/DB25/Centronics shells and probably withstood slightly more heat. I have also used old CAt5/CAT6 patch leads. The patch leads are (often) multi-core so the cable is flexible and easy to use. Try to steer clear of solid core (unless bread-boarding) as this is likely to break away at the joins.

Other than that, it's a matter of experimentation with different cables and different soldering temperatures.
 

westaust55

Moderator
For hook-up wire inn PCBs I often use "rainbow" (multicolour) flat ribbon cable which provides 8 different colors.
Same cable as the typical flat grey data cable used with IDC connectors only each core typically a different colour up to 8 cores and thereafter the 8 colour a start repeating.
 

techElder

Well-known member
If you are really describing a piezoelectric device, it should be capacitively coupled.

The piezoelectric device should be biased separately. Some can have tens of volts in bias.
 

Steve2381

Senior Member
OK thanks all.
Datasheet... Hmm. These are a pile of piezos salvaged from various pcbs over the years.
The Picaxe manual shows the piezo directly linked to the Picaxe pins. Via a capacitor then?
Maybe I will get some of those thin disc piezos, although they are not as easy to mount as a pcb version
 

westaust55

Moderator
are you trying to drive it as a buzzer or speakers?

What command are you using?

If you apply a straight 5Vec directly does it buzz or just click once as power applied/disconnected?

What is the resistance? If you measure a low resistance it will likely pull the PICAXE output down and give lower volume.
 

hippy

Technical Support
Staff member
I am driving a piezo directly off an 08M2 pin using the sound command and its pretty distorted.
In what way is it distorted and using what SOUND commands ?

I have not noticed anything that untowards when using cased piezos directly from I/O pins though the sound is usually better at higher frequencies. The 'button case' simply grips a disc piezo so it may be a physical issue. Have you tried other piezos ?

If you can provide a SOUND command which sounds distorted to you then others can test that with the piezos they have and report back.
 

stevesmythe

Senior Member
I have certainly noticed that the "tune" and "play" commands produce much nicer output (i.e. not at all distorted) than using the "sound" command, which can sound distorted at some frequencies (using the exact same hardware). I don't know what goes on "behind the scenes" with the "play" command, compared with the "sound" command.
 

inglewoodpete

Senior Member
These are a pile of piezos salvaged from various pcbs over the years.
The Picaxe manual shows the piezo directly linked to the Picaxe pins. Via a capacitor then?
Maybe I will get some of those thin disc piezos, although they are not as easy to mount as a pcb version
If I read what you're writing correctly, you have several piezo beepers that have an internal oscillator which drives the piezo element. These are meant to be driven from a constant DC source which powers the internal oscillator.

The "wafer thin" piezo speakers that are described in the PICAXE documentation are just the piezo element physically connected to a diaphragm "speaker". These only work when driven by an oscillating drive voltage.

As previous forum members have asked: "What happens when you connect a DC supply to your device(s)?"
 

Steve2381

Senior Member
I will have a look. Can't remember thee exact command (the laptop is at the workshop). Its the one I have always used. I get the tones, just its a bit messy and nasty.
Tried 4 different Piezos... all the same.
I will measure their resistance tonight and also try the tune and play to see if it improves.
Thanks all
 

Steve2381

Senior Member
No. They don't have internal drive circuits. DC voltage results in nothing much.

I am using something along the lines of sound c.0,(124,4).

Play is no good. I need tones and beeps, not tunes.
Tune is no good, as I cannot use the required pin 2 on my 08m2.

However, the resistance is very low and that is possibly the issue.
All of the sounders I have here are in the region of 150R.

How do I drive via a capacitor? Simply put an Electrolytic inline?
 

techElder

Well-known member
Steve, 150R is not what a stand-alone piezoelectric crystal should be. That one either has a short or there is a damping resistance across the element.
 

hippy

Technical Support
Staff member
All of the sounders I have here are in the region of 150R.
As Texasclodhopper says, that doesn't sound right. I'm wondering if they could be speakers rather than piezos. 150R is in the right ballpark for such a speaker. The piezo I measured with a DMM had a 10 megaohm resistance.
 

Steve2381

Senior Member
Well I robbed them over the years from various alarm panels etc. They are only 10mm in diameter total, so small speakers!
As i said, they do work, and some notes/freq are better than others. They just don't sound very clean or happy

Thanks all
 

westaust55

Moderator
With only 150 ohms resistance, that equates to 5 V / 150 R = 0.033 A ==> 33 mA.

That exceeds the max I/O rating of 25 mA and will definitely also be pulling the PICAXE pin voltage down significantly as I previously suggested causing low volume. Also likely some distortion.

Try driving one via a transistor.
if your project has higher than 5 Vdc e.g. 9 Vdc onboard then go from volts through speaker to transistor collector.
Emitter to 0 V and put say 1 kOhm from PICAXE output pin to the base.
 

stan74

Senior Member
Piezo have a limited frequency range from being small. The easiest way to get any volume is put it in a tube or horn/cone a la gramaphone needle. You won't hear any thing below 500Hz. A crystal earphone sounds ok if you stick it in your ear..and works in reverse as a microphone.
 
Top