# 8Ω speaker, what resistor values to use?

I want to connect 2 speakers of 8 ohm to 2 (different) pins of the Arduino. However, for this example one speaker is enough.

I came across a lot of circuits without or with a single resistor which on other foras was not adviced, where one pin directly controls the speaker. This way (assuming 0,02A is the max recommended output for a pin), the resulting power is like 0.02A * 5V = 0.1W.

My speaker is 0.5W (8 ohm) and I want to hear how hard that is :-)

But it seems I have to use something with a transistor to isolate the path. I came across this circuit:

However, when I would calculate the values or R1 and R2 myself I would get:

1. R2: Afaik, the recommended output for a pin is 0.02 A. This means: V = I * R <=> 5 = 0.02 * R <=> R = 5 / 0.02 = 250Ω -> 270Ω (nearest higher value)

2. R1: my speaker is 0.5W, 8Ω. P = V * I <=> 0.5 = 5 * I <=> I = 0.1A V = I * R <=> 5 = 0.1 * R => R = 50Ω, which is Rtotal below: Rtotal = Rspeaker + R1 <=> R1 = Rtotal - Rspeaker = 50 - 8 = 42Ω => 47Ω (nearest higher value)

This result in V = I * R <=> 5 = I * (R1 + Rspeaker) <=> I = 5 / (47 + 8) = 5 / 55 = 0.0909 A P = V * I = 5 * 0.0909 = 0.4545 W (so I lose 'just' 10%)

Are my calculations correct, and I assume the +5V pin of the Arduino will not have trouble giving 90.9 mA ?

Update:

I have some more questions regarding the accepted answer:

1. Would it mean if I use 7 transistors, all my voltages will be used for transistors and nothing is left (7 times 0.7 V which is approx. 5 V?) **** Answer = No, a transistor will add Voltage so 7*0.7= 4.9Volt added ***
2. I assume I can better use as less as possible to 'switch' a transistor? * Answer = No, 0.7-Volt required, 5V is fine depending on the rating of the transducer (but enough to be able to switch it) ? You say R2 can be smaller, but I can better make it higher not to waist voltage? Answer = Changing the resistor will change the volume, look at the wattage rating for the speaker *
3. I already built the circuit below (but with a BC547 transistor) ... using a 0,25W R1 resistor. I guess I was lucky (?) * Answer = No, luck has no part, that transistor would work fine within the parameters used, look at the datasheet *
4. Regarding the base pin of the transistor ... by making the resistor higher (see item 2 above) ... that would help also not to burn the transistor pin? * Answer = No... please view the datasheet and ratings for the hw *
5. Again about the transistor, so I should make the resistor R2 in such a way that the gain times the mA is driving the speaker? (need to calculate this again) * Answer No, and I think you are thinking of "Gain" the wrong way, "Gain" is a "DB" measure and is for how well AC is transferred between antenna. *
6. You say to remove R1 completely ... but than I expect V = I * R <=> 5 = I * 8 => I = 0.625A ... P = V * I = 5 * 0,625 = 3.1W which blows the speaker? * Answer = Wrong way of looking at the 8-Ohm Impedance rating, Impedance is AC *
• Also consider using an audio transformer, and see the linked questions..... May 21, 2017 at 0:58
• I'm voting to close this question as off-topic because it is about electronics and not about Arduino. Feb 11, 2018 at 18:18

Basically you are right and it should work.

But if you want to go to details, it would be better look on AVR328 documentation, as nothing is as easy as it looks in Arduino tutorials.

• maximum (really maximum) current on pin is 40mA for one DC pin and 200mA for all pins together (otherwise destruction of the processor is possible - never ever try to reach it), also datasheet states:

Although each I/O port can source more than the test conditions (20mA at V CC = 5V, 10mA at V CC = 3V) under steady state conditions (non-transient), the following must be observed: ATmega48A/PA/88A/PA/168A/PA/328/P: 1] The sum of all I OH , for ports C0 - C5, D0- D4, ADC7, RESET should not exceed 150mA. 2] The sum of all I OH , for ports B0 - B5, D5 - D7, ADC6, XTAL1, XTAL2 should not exceed 150mA. If II OH exceeds the test condition, V OH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition.

so 20mA is not `recomended` but is `maximum guaranteed to be provided under some more conditions met` - if you can, you should use less (also even if it works for one module on one pin, it may fail mysteriously for mor modules on more pins).

• Even if 20mA is guaranteed for one pin, the voltage on it would drop more then 0.5V if you drain so much
• you cannot draw as much on too many pins together
• also the maximum you can draw is less if you want higher frequency (I think the sound is not usually in category, where it matter too much)

In your equation 1 you used 5V/20mA, you should use 4.4V/20mA also keep in mind, that there is usually like 0.7V on base of open transistor (depends of type) - so the R2 can be even smaller, if you use only few pins.

About R1 - if you open the transistor, there can be like 0.2V on the collector, so the current is like 4.8V/6.8Ohm = 0.7A - on UNO board v3.0 is used NCP1117 as stabiliser, which can support even 1A (if powered not from USB, but 7V and higher source (if such source can give as much) so it could work too, but beware as it is about 4.8V*0.7A=3.4W so R1 should be able to stand at least as much if the pin is HIGH for any longer time. If the pin is oscilating, the SPKR adds it current to that, so the value can be even higher (I would not use anything under 5W for R1).

On the other hand - Q1 2N3904 can support Ic max 200mA, so you could burn it by setting the pin for HIGH (or for PWM with more like 20% HIGH or more - switching makes even more heat) so you should use othe transistor here.

And this Q1 have current gain over 30 even for such currents as 100mA, so you need just 1/30 of Ic go thru the base from pin (so you need supply only 3.3mA to have 100mA thru Q1, 6.6mA is able to force 200mA and burn the transistor, if not properly cooled. 20mA is clearly much more than needed anyway.)

I would suggest some darlington transistor here or something like that, if you want manipulate such currents.

If your speaker is 0.5W only, you will burn more power on the R1 than on the speaker - not good result. It would be better just manipulate the speaker directly (put it instead of R1 and leave the R1 and C1 out).

(but on usual Arduino setup the power source and all is usually so underrated, that there is a good chance, that it would not be able to supply enough power to burn your equipement out, just it would drop the voltage and maybe fail randomly. Who knows. Also breadboards and long thin wires with bad connection adds a lot of resistance and voltage drops and manufacturers publish as `maximal rating` what the product should survive, which is usually a lot les, than is needed to sure destroy it, so many `experiments` can survive even if they should burn on simple paper calculations - which is part of why Arduino is so popular - is cheap and usually does not burn even if managed out of specs.)

• I have to read multiple times to understand everything (which I still don't) ... more questions now than answers :-) But very good points to take care of ... I will think of how to formulate further questions... Thank you for the long and detailed answers what to think more (what I didn't knew about). May 20, 2017 at 22:53
• Thank you very much for your answers, bfter reading the answer several more times I have 6 additional questions (sorry for my lack of electronic 'practical' knowledge). It seems the ideal world differs a lot from theoretical 'ideal' circuits from high school text books. May 20, 2017 at 23:56
• Yes, exactly :) Arduino is for easy start on easy tasks, if you need go deeper, a lot can be obtained in `Electrical Engineering` - even about Arduino (once you start thinking about it little more like microprocessor AVRxxx and some electrical circuits around - change of philosofy or point of view, physically it is exactly the same). Anyway I use Arduino both ways - like simple tool for simple tasks the simple way (sometimes it is much faster than any other setup) and as AVR328 on simple board, which can be used in anything anyway. Also I made my own PCBs and programmed them both ways. May 21, 2017 at 1:10
• Arduino is really good starting point for many people and even if I changed my point of view on it and do a lot with more sofisticated setups, I still use Arduino platform for a lot of simple projects, as it does not need more. But sometimes you hit the limits of "simple world" and have to learn more. And sometimes you do not hit it and can do a task in simple way and then it is good to return fully to Arduino world. Aech task needs its tools and usually the simples can be used, the faster you get result :) So don't worry, be happy and have a fun any way you enjoy :) May 21, 2017 at 1:18
• That's why I like Arduino ... it's a quite easy environment (and also it doesn't break down if I make stupid mistakes, so far I only broke a LED, a IR receiver and one LED in an 8x8 matrix). But the best is there is a lot of documentation that can be found (although sometimes contradictory), and help from users here (which is highly valuable). I will try to answer my own questions (in the near future after reading more about it). May 21, 2017 at 15:12

The speaker rating of 8 Ω is AC resistance, speaker impedance. Impedance (AC-Resistance) changes based on the frequency of the signal fed into it.

If you are worried about hurting the speaker and need to calculate power driving that particular "load", look at the speaker Wattage rating. Say it is 1 W for example, and you are providing 5 V d.c., the amperage required will be: 0.2 A.

``````V * A = W
0.2 * 5 = 1
``````

So the DC resistance is actually:

``````V = I * R (0.2 / 5 = 0.04 Ω).
``````

Give it a higher amplitude... say 5.7 V to account for a transistor no resistor, and you get about 0.175 A. and a change in DC resistance again to 0.0301 Ω.

If the power supply is AC, the impedance needs to be matched to the speaker impedance to get best energy efficiency, otherwise the amplifier can be damaged.

For that circuit I suggest you place a variable resistor where the resistor is in your circuit to allow for a volume change. Also a flyback diode maybe a good idea, that will protect the speaker but take down voltage 0.7 V d.c. keep in mind you have that transistor there adding 0.7 V d.c.! so it evens things out too using that diode.

That diode placed on the high (+) side of the circuit, before the speaker and after the variable resistor.