Do I need a resistor to connect a passive buzzer?

Good day! I want to connect a passive buzzer to the PWM input of arduino for playing melodies. Question: Do I need to use a resistor? The most important thing is that the buzzer does not make any extraneous sounds. Thank you in advance for your cooperation! |500x500

Suyano: Good day! I want to connect a passive buzzer to the PWM input of arduino for playing melodies. Question: Do I need to use a resistor? The most important thing is that the buzzer does not make any extraneous sounds. Thank you in advance for your cooperation!

No, you do not need a resistor for your piezo buzzer afaik. If worried about extraneous sounds, you can use a capacitor.

Assuming you are powering it with the Arduino.

It looks like a piezo-buzzer. Those can be connected directly to your PWM output with no problems.

If you require more volume, a hack can be to put them between two PWM-pins and drive them in reverse phase. Then the speaker "sees" the double voltage.

extraneous sounds? What do you mean by that?

// Per.

quamikazee: No, you do not need a resistor for your piezo buzzer afaik. If worried about extraneous sounds, you can use a capacitor.

Assuming you are powering it with the Arduino.

Zapro: It looks like a piezo-buzzer. Those can be connected directly to your PWM output with no problems.

If you require more volume, a hack can be to put them between two PWM-pins and drive them in reverse phase. Then the speaker "sees" the double voltage.

extraneous sounds? What do you mean by that?

// Per.

quamikazee, Zapro, Thank you very much! By extraneous sound I mean a small wheeze. Now I know that it can be eliminated with a capacitor.

Zapro: If you require more volume, a hack can be to put them between two PWM-pins and drive them in reverse phase. Then the speaker "sees" the double voltage.

Or use the "toneAC" library. https://playground.arduino.cc/Code/ToneAC Leo..

small wheeze? The mind boggles of what you mean.

In short: It will not make a sound unless you are generating it with the Arduino.

Adding a Capacitor makes no sense.

// Per.

quamikazee: If worried about extraneous sounds, you can use a capacitor.

If... this is a piezo, then you are already (over) loading the pin with a capacitor. A second capacitor across the piezo would be an even havier load on the Arduino pin.

I would use a resistor in series with the pin. 220ohm if you want to keep full volume of the piezo, and up to 1kohm if you want to remove the 'sharpness' from the sound. Remember that a piezo buzzer is made for high frequent stuff (musical greeting card sound). If you don't want that, use a normal speaker + amplifier. Leo..