I'm wondering how to drive a speaker using an arduino output pin. I am using a pwm playback method with a sound data file. If you wire a speaker across an output pin and ground then how do you calculate what speaker power and impedence you can use without damaging the arduino? Is there a reference making these calculations?


2 Answers 2


The Arduino can supply 5V at max 20mA so 5/0.02 ⇒ 250Ω (if you can find such a beast).

NOTE you should use a capacitor to prevent DC flow if using a conventional speaker.

In general the larger the speaker the better. Tiny speakers are inefficient transducers. Hi-Fi speakers are not a good choice, as they are often inefficient, trading efficiency for linearity.

An alternative, if you are a scrounger, is to scavenge a transformer from an old transistor radio - this should give the best match.

  • Typically the pins of an MCU are current sources, so a smaller load might be fairly harmless (if ineffective). The capacitor will help too in limiting average current. Commented Jul 8, 2016 at 16:51
  • I thought the sound volume and quality from a smartphone loudspeaker would be about right. Not the earpiece but the one used for the loudspeaker. Some are 10x15mm, most are 8ohm, .5 - 1W. 90dB ex.) knowles.com/eng/Products/Receivers-and-speakers/… But I don't now how they are driven, probably a proprietary and expensive amp circuit. To get the most value in the toy I'm interested in the simplest system, thus the single transistor method. Commented Jul 8, 2016 at 21:44
  • Milliways - The max current for the Uno is 40mA/IO pin. Is this really how you size a speaker? I have been told it has to do with the relative impedance of the devices but I haven't 'googlefound' any good references yet :( BTW 5V/30mA = 167 ohms and I have found 150 ohm speakers but I still don't know if this is the right way to match a speaker and source. Commented Jul 8, 2016 at 21:49
  • @perigalacticon That is a rough engineering calculation. I am not sure the Arduino can deliver 40mA @ 5V (I have never measured). In fact the duty cycle would be 50% because the load is only actively driven on half cycle. Any higher impedance less current, lower less voltage swing. Speakers from phones are generally lower impedance, but the have higher powered drive circuitry. You could get more with a simple transistor amplifier.
    – Milliways
    Commented Jul 9, 2016 at 0:08
  • @Milliways with 20mA due to 50% D.C. for lower impedance the voltage swing would only be reduced if the source was unable to provide the current correct? Do you know of a source for more calculations? Commented Jul 9, 2016 at 4:37

Only very small ones with 20-30mA. Earbud-size and slightly larger. You can buy a 2x3W amplifier which runs on 5V, and gives you two audio channels - but it works fine for mono. It can drive my 4 ohm desktop speaker, and is probably too powerful for that. Read about signal voltage and resistance for speakers. IIRC small audio outputs (like from an mp3 player) switch from -2.5V to 2.5V, giving an RMS of 5V. Or perhaps that was just my player. The only way to know this is to measure it - I played a sine wave and got a circa value. Offhand I can't say how to drive negative voltages from an arduino without extra circuitry. Hope it helps (and show us your code :)

  • USer400344 - I am trying to get max value into the toy so trying to I prefer to avoid the amp chip. How do you calculate the size of speaker you can power with a given current? Thanks. Commented Jul 8, 2016 at 21:52
  • The max value of your output pin is 5V/30mA (I would limit it to 20mA) - so 0.15W. As I said a speaker needs negative voltage as well. A PC speaker (the builtin kind for beeping BIOS codes) is probably driven by a transformed 5V source.
    – user400344
    Commented Jul 9, 2016 at 7:47
  • You need the speakers impedance for this as well, google audio output, 3.5mm TRS and RMS.
    – user400344
    Commented Jul 9, 2016 at 7:48
  • And I should add that driving 40mA from an uno pin is advised against by most of the arduino guys at arduino.cc - on USB power you can expect a total (all pins) of 400mA, on voltage regulator (raw/vcc) I would not go above 200mA. If you need to drive something with 40-60mA, you can attach pins in tandem (but keep each pin a few pins away from your other pin), and it will only work with digitalWrite(), not analogWrite()... I did this with a relay than needed 50mA to toggle (S pin), worked well. It's a good method if you have pins to spare, and don't want to add a transistor... offtopic, sorry.
    – user400344
    Commented Jul 10, 2016 at 9:45
  • so I can let the pin drive the speaker at 30mA. If I progrogram the playback code to provide a signal centered at 2.5V then the signal can be 5V p-p. With an amplitude of 2.5V this is an rms value of 1.7vrms. Multiply by peak current 30mA gives .053Wrms power, is this what I use for speaker selection? Do I choose the speaker ohms by 5V/.030A = 167ohms? How much does the speaker inductance effect the impedence? Thanks. Commented Jul 13, 2016 at 2:49

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.