Do I need a resistor with a piezo?

Hi.

I don't know a whole lot about wiring up electronics. I've built a few circuits, but I don't have a firm grasp of what exactly is going on yet.

Anyway, i'm thinking about getting a piezo speaker to use with my arduino. One of these two probably:

http://www.projectsunlimited.com/audioproducts/movieclips/products/drawings/AT-1438-TWT-R.pdf
http://www.projectsunlimited.com/audioproducts/movieclips/products/drawings/AT-1750-TFL-LW95-R.pdf

Both look like they can run off 5v, so hooking them up to one of the analog pins should be okay, but I noticed the smaller one can only handle 1ma of current, and I know the Arduino pins can put out much more than that.

So my question is, just because the Arduino pro mini CAN put out 40ma on a pin, WILL it, in the case of these piezos? Do I need to stick a resistor in series with them to prevent them from being burned out, or what? If not, would I need to do that if they could handle more than 40ma?

I was also wondering how well a magnetic transducer would work with the Arduino. Would that need to be amplified like a speaker, or is it interchangable iwth a piezo?

If you connect the speaker to pin 13 then No. You'll be using the internal resistor on that pin. Any other pin and it would be a good idea to have a resistor so you don't blow the speaker.

thats not really great advice, not all arduinos have a resistor on pin 13 (mine doesnt)

yes you need one

How large of a resistor should I have for each of those? I'm thinking I need a larger one for the one which can only handle 1ma?

Also, I have the pro mini 5v from sparkfun, does that have the resistor on pin 13? I don't see any mention of one on the hardware page.

thats not really great advice, not all arduinos have a resistor on pin 13 (mine doesnt)

yes you need one

Actually it's worst then that, it's very poor advice and false and misleading. Even boards that have an internal resistor/LED wired to pin 13, does not protect pin 13 at the connector, which wires directly to the chips pin. So you have no more protection on pin 13 then any other of the digital pins as far as potential damage if you try and draw too much current from the pin. Refer to the published schematics if you don't understand this.

As far as do Piezos requiring a current limiting resistor, I don't think so. They are constructed more like a capacitor with no DC resistance, just an AC impedenace. However one really should refer to it's datasheet to be certain.

Lefty

Okay, I'm gonna try to calculate the resistor I need myself since I really need to learn how to do this. If someone could tell me if I've got this right, it would be a big help.

So, my little piezo there can only handle 1ma. 1ma is 1/1000th of an amp. So, I (being in amps, not milliamps) = 0.001

V = 5v because that's what's coming out of the pin.

So, if ohms law says R = V / I then:

5 / .001 = 5000

So R being in ohms, I need a 5000 ohm resistor to protect my piezo which can handle only 1ma, from my 5v source which can safely put out up to 40ma.

Is that right?

[edit]

Also, based on that, I calculate that larger piezo which can handle up to 9ma requires a 556 ohm resistor.

I agree with Lefty. It's an unfortunate misconception.

I can't check the schematics right now, but I think the resistor on some boards is connected in parallel with the pin header itself to the chip's output.

[edit]Yup, that's how it is.[/edit]

So R being in ohms, I need a 5000 ohm resistor to protect my piezo which can handle only 1ma

For any other component, that'd be correct, but as Lefty said, I don't think you need one for a piezo.

Is that right?

Correct as your logic goes, however I'm not sure DC calculations are what is called for on a piezo. Your calculated resistor will certainly prevent any damage to both the pin and the piezo, however the volume may be very small. You might want to experiment with a 5K pot (use to wiper and one end terminals) and adjust down from 5K until you get a volume that is useful, or until you let the magic smoke out. :wink:
Lefty

I thought you just said you didn't need a resistor with a pot though?

I posted the datasheets above. They don't make any mention of a resistor.

I thought you just said you didn't need a resistor with a pot though?

Not sure I understand your question. I'm proposing instead of using a fixed series resistor, use a 5k pot wired as a variable resistor that you can use to adjust for desired volume.

I posted the datasheets above. They don't make any mention of a resistor.

The datasheet is a little sparse and shows no typical hook-up. My gut says you can wire it directly to an Arduino digital output pin without needing a resistor at all, however that's just a guess and I would never recommend something like that unless I've tested it out myself.

Lefty

I don't want to adjust volume, I just don't want to blow up the arduino.

A 5K pot would let me adjust the resistance, but it won't really tell me what a safe resistance is, if in fact, a resistor is required.

1 Like

Hm...

This page says you shouldn't put over 100ohms on a piezo because it affects the high frequency response of it:

http://members.misty.com/don/pzfix.html

Sheesh. You'd think it wouldn't be so hard to get trustworthy info about something so basic as hooking up a piezo speaker. :confused:

welcome to electronics, it all depends

my little piezo there can only handle 1ma

your piezo consumes 1mA

If you have a source capable of providing 5V at 10A (like a PC power supply) and connect it to your piezo, your piezo will still take only 1 mA.

Where is Grumpy_Mike when you need him? :slight_smile:

V = 5v because that's what's coming out of the pin.

So, if ohms law says R = V / I then:

5 / .001 = 5000

So R being in ohms, I need a 5000 ohm resistor to protect my piezo which can handle only 1ma, from my 5v source which can safely put out up to 40ma.

You just calculated the impedance of your piezo.

Where is Grumpy_Mike when you need him?

He's around. You just have to search for him. :wink:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1255352439/all

That thread is about a magnetic buzzer, so the stuff about a resistor may not apply in my case.

Dang! Sorry about that.

Where is Grumpy_Mike when you need him

Well at that time I am in bed asleep.

Good morning. :slight_smile:

That thread is about a magnetic buzzer

No it was about a piezo.

It is not so much the current that it takes but the fact that a piezo looks like a capacitor. If you apply a voltage across a discharged capacitor initially it looks like a short circuit. Therefore you are stressing the arduino's output pin. My tests show you can get pulse currents in excess of 250mA from a low impedance let alone a short.
To limit this initial inrush current you need a resistor, one that is going to limit the current to something below the 40mA absolute maximum. This is why a small resistor is recommended when connecting FETs and it is why I recommend one here.

You are not instantly going to break your arduino if you don't use one but you are over stressing it and that will take it's toll eventually. For more on over stressing the arduino's output look at:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html

No it was about a piezo.

You sure about that?

Hello, I'm writing a tutorial for newbs (also as a newb) that describes how to play music using an Arduino and CEM-1203 buzzer.

http://parts.digikey.com/1/parts/42-buzzer-2-048khz-12mm-pc-mount-cem-1203-42.html
"Type: Magnetic Transducer, External Drive"

Even the spec sheet you posted in the thread refers to it as a magnetic buzzer:

It is not so much the current that it takes but the fact that a piezo looks like a capacitor. If you apply a voltage across a discharged capacitor initially it looks like a short circuit. Therefore you are stressing the arduino's output pin.

This makes perfect sense. I was actually wondering about this, but since folks were saying it didn't need one because it behaved like a capacitor, I assumed that the current was so brief that it didn't hurt the pin.

I'm now thinking though that while it would only flow briefly when charging the piezo, in order to make sound the thing's gotta charge and discharge thousands of times a second, doesn't it? So it might as well be a constant current.

Hm... So what's the smallest resistor I need to keep the current below 40ma?

Based on R = V / I, I calculate it to be:

R = 5v / .040 amps

Or 125 ohms.

And resistors often have a +-5% tolerance, which if I understand that correctly means a 125 ohm resistor might actually be as little as 114 ohms. So to be safe I should go with one that is at least 132 ohms.

That sound about right?

Luckilly, I ordered some 150 ohm resistors, so I guess I'll stick one of those on there.

But wait...

I used the LED array wizard to calculate how big of resistors I needed to power my LED's. I input 20ma of current, and the voltage across the LED, and for my blue and white led's it spit out 82 ohms.

So what's going on here? Is my calculation about needing a minimum of 150 ohms of resistance per pin wrong, or did I not input the correct value into the led wizard for the current?

You're supposed to input the current you want to flow across it, aren't you? And the voltage you want to run the LED at?

Here's the LED calcualtor I used:
http://led.linear1.org/led.wiz

For the blue and white LED's I input 3.5v and 20ma.

Is using an 82ohm resistor here going to stress my pins? Or is there something else going on with the LED's that makes them different from the piezo?

God I just know it's gonna end with me blowing this thing up.