I'm using the PCM(http://highlowtech.org/?p=1963) library on the Arduino nano, I'm plugging the speaker(https://www.amazon.com/gp/product/B07WZP4QFK/ref=ox_sc_act_title_3?smid=A2O4FZXIRZDLHA&psc=1) into pin 11 and ground, but the example file won't work.

enter image description here

enter image description here

enter image description hereenter image description here

  • They don't say much about their wiring on that site. And you haven't shown your wiring. It seems likely that the code is fine but what you have attached to pin 11 isn't. Description, diagram, pictures etc would be helpful.
    – timemage
    Commented Dec 15, 2020 at 17:13
  • added a diagram
    – Epicmania
    Commented Dec 15, 2020 at 17:19
  • I have a sense of what the answer will be when someone posts it. It probably won't be me, unless on one else does. For their sake, show the actual speaker, and in particular, any writing on it. It may be useful for them in writing a more complete answer of what you need to do.
    – timemage
    Commented Dec 15, 2020 at 17:23
  • 1
    test the pin ... replace the speaker with an LED
    – jsotola
    Commented Dec 15, 2020 at 18:25
  • 2
    Perhaps. If you were testing it with the LED (and resistor) instead of speaker using the example sketch, you might as well go a step further and test that same pin by substituting its number into the blink sketch. I have some reservations about how you're hooking a 4 ohm speaker directly to an Arduino pin. It's possible that doing this killed the pin. Normally, I'd say likely, but that you "tried it on the uno and it works" casts some doubt on that theory. It seems like a bad idea in any case, and until you know differently I'd avoid hooking it directly to your pins.
    – timemage
    Commented Dec 16, 2020 at 2:23

1 Answer 1


I guess the Nano had a sketch which was setting pin 11 HIGH (using SPI?) as you turned it on with a 4 Ohm speaker attached without any other resistance. It created a short circuit and damaged the pin's circuit.

Using tone() or the PCM library with a speaker connected without additional resistor doesn't damage the pin immediately because it is then HIGH only for very short moments, but it stresses the pin circuit too.

The linked page recommends to use direct speaker connection because it is much louder then with a resistor in series, but this is a wrong advice. It should recommend an amplifier module for example with LM386 IC.

A piezo speaker has higher resistance so it can be connected directly to Arduino pin, but a piezo sounds loud only in high frequencies so with the PCM library the sound is like whispering.

  • so what can I do?
    – Epicmania
    Commented Dec 16, 2020 at 22:52
  • the thing you gain if you gain nothing, is experience
    – Juraj
    Commented Dec 17, 2020 at 5:45
  • is there really nothing I can do here, because I have more nano boards
    – Epicmania
    Commented Dec 17, 2020 at 13:23
  • use a 100 Ohm resistor in series with the speaker to test the library, but the sound will be weak. for good results use an amplifier module. shops have small amplifier modules for Arduino
    – Juraj
    Commented Dec 17, 2020 at 14:04
  • ok, thank you! If this project didn't work out, my dad might never buy me parts again so this really helps
    – Epicmania
    Commented Dec 17, 2020 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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