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?

  • Take a look at the tone() function, it may suit your purpose. – Paolo Zanchi 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. :) – Paolo Zanchi Mar 13 '15 at 15:43

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

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.