replacing 8 ohm speaker with piezzo buzzer

It is ok to replace 8 ohm resistor with pizzo buzzer. I’m bit confuse, because in the tutorial ( built in examples) Keybord. in the menu it say “A three-key musical keyboard using force sensors and a piezo speaker”. But when iI open the tutorials it say the hardware required is " 8 ohm speaker" not a piezo. So it is ok if I using a piezzo instead?

The impedance of 8 ohm is too low, and the capacitance of a piezo is too high. Both need a protection resistor.

It is best to use a series resistor of 150 ohm for the speaker or the piezo. If a piezo is connected without a resistor, the Arduino will probably not be damaged, but there will be very short nasty current peaks.

Big difference between a piezo buzzer and a piezo speaker.

A piezo buzzer (with a + and/or - stamped on the casing) can’t be used for music.
A piezo speaker (usually bigger and flat) can be used for music.

OK, here’s the rules:

  • Post a link to the tutorial in question, or otherwise include the circuit diagram in your posting.
  • Show a link to, or a picture of your “piezo buzzer”. tutorial link my piezzo buzzer look like this

Yes, okay, you are right. But as I wrote, if you use the series resistor for protection, you can use either a 8 ohm speaker or piezo element.

There is confusion about 'piezo'.

Piezo : can be anything Piezo buzzer : apply 5V to it and it is buzzing, it can not be used for a speaker Piezo round disc or piezo element : that can be used as a speaker.

So what I must do? Is somebody have a suggestion?

Do you already have a piezo-something ? The apply 5V to it, if it starts buzzing, then it is a buzzer and it can not be used as a speaker.

If you have a round disc piezo (it can be found in many toys), then you can use that for a speaker. As I wrote, you can use a 8 ohm speaker or piezo element, as long as the protection is used. It does not matter.

If this is a piezo element only: