0

I've looted this speaker from my old PC and trying to understand how to connect it to Arduino to produce simple sound notification (and not fry anything in the process).

As far as I understand this is a piezo speaker, there is no markings on it. Here is how it looks:

speaker front speaker back

How do I connect\control it?

Should I connect it to PWM pin? If so, what are the safe values to output on PWM pin?

Should I use resistor when connecting speaker? What resistor should I use?

2
  • Take a look at the tone() function, it may suit your purpose. Mar 13 '15 at 15:40
  • As far as connections go, I would connect the red wire to a PWM pin and the black one to a GND pin, but I'm not sure if a resistor is needed, wait for someone more expert than me to answer. :) Mar 13 '15 at 15:43
2

No need for a resistor. Just connect black to ground, and red to a IO pin. Use the tone function to specify a frequency.

4
  • I'd recommend using a resistor. The piezo conducts quite well and might fry the pin. arduino.cc/en/Tutorial/Tone Also see uchobby.com/index.php/2007/11/11/arduino-sound-part-1
    – Mr Jones
    Mar 13 '15 at 19:07
  • @MrJones A resistor might be needed for (electromagnetic) speakers, not for piezos. A piezo is more like a capacitor, and doesn't conduct any current.
    – Gerben
    Mar 13 '15 at 20:34
  • Why is no resistor needed? I don't exactly know OP's speaker, but my speaker says 8 Ohm. 8 Ohm at 5V is much more than an Arduino can handle, isn't it? Oct 10 at 9:37
  • @ThomasWeller OPs "Speaker" is actually a piezo. A piezo you can drive with an Arduino pin. With a (8-ohm) speaker, you can't do that.
    – Gerben
    Oct 10 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.