Resistance is constant, impedance is not, but, I approve the amplifier advocacy.
It is because the resistance they have is not linear. I like to think of it like this. A linear resistance will be the same no matter what the voltage it receives, therefore you can apply ohms law to it. A plot of voltage against current is a straight line at 45 degrees.
An LED is not linear, it changes very sharply with the voltage applied to it and a plot of voltage against current looks like this.
When the On voltage is reach all of a sudden it starts conducting lots of current. The on voltage depends on the material the LED is made from which determines the colour.
A real LED does not transition quite that fast and looks more like this.
That is why we can't use ohms law on the LED, so we resort to the trick of just dealing with the resistor for calculations. Also most LED data sheets give the forward voltage drop ( on voltage ) at a specific current, typically 20mA.
Note that these calculations only really work for when the resistor is dropping a good percentage, of the voltage across it. Also it is also only valid if the resulting resistor is not too low, say above 50R. If the resistor is lower than this it is likely you are trying to use a power LED, one taking over 60mA. These need feeding with a constant current supply and are not well suited to just using a resistor.
Many comments not addressing the real issue.
You want to produce sound. You can generate a 5V square or pulse wave with an arduino.
5V 20mA = 250 ohms - so you need a 250 ohm load.
5V pk-pk = 2V rms
20mA pk-pk = 7mA rms
2V * 7mA = 14mW Not a lot but enough to hear if matched to a suitable speaker.
now lets look at matching the "8 ohm" speaker using a 270 ohm resisitor.
The voltage is dropped by a factor of 8/280 = 1/35
the POWER is dropped by a factor of 1/35^2 = 1/1000
Nor do I. It would reduce the power even more. I dont think you would impress Black Sabbath with an output power of 1uW.
Thanks for all the replies, this is truly an amazing forum, I tried yesterday but the volume was very low, would an amplifier solve this?
Funny, that. Look at what @johnerrington wrote.
Alternatively, if you just want some noise, you can get one of those generic TMB12A05 piezo buzzer modules. They can be connected directly to an Arduino pin and make a very audible 'beep' sound.
May I ask what the connection with the amplifier would be?
Depends on the amplifier.
Typically an amplifier will need a power supply connection, a connection to ground, a signal input and a speaker output - assuming that the signal input and speaker outputs reference to GND. In case that assumption does not hold, you may have two signal inputs and/or two speaker outputs for a single channel.
A bit of googling will find you this
That 270 in parallel with a 2200 gets 240. With a 2700 gets 245. And then, tolerances.
Is there a point to this comment? Is my comment incorrect in any way?
you talk so sense, thanks for suggestion
Um. Still "about 20mA" though the speaker, so I get ~3mW via P=I*I*R (plus an RMS correction, I guess. But I don't think you need to "correct" both the current and the voltage...)
But yeah, if you want "loud" out of a microcontroller, you need some kind of amplifier before the speaker. The wattage rating of JUST a speaker is like the current rating of an LED - how much power you can put into it before you start to do physical damage. (although the power rating of an amplified speaker (like a computer speaker) probably refers to the max the amplifier can put out, whether or not the speaker part can actually handle it.)
You are forgetting to change peak-peak value to peak value.
(plus an RMS correction, I guess. But I don't think you need to "correct" both the current and the voltage...)
well, if its a sine wave you do. The rms of a square wave is Vrms = Vpk (=Vpk-pk /2)
Does something have to be wrong to show a way to get closer to value?
Does it have to be something that needs defending against?
Is there something wrong with tuning resistance with parallel resistors?
If there isn't, what is the problem then?
If it is relevant to the problem.
In this case, totally irrelevant.
I wouldn't drive a (relatively) big load like a speaker directly from a uC pin. What about using a transistor?
You can get audio quality op-amps for low prices.
If it's for real audio, yes, of course. If it just happens to be for some square wave generated by the uC (an alarm, a beep, you name it), maybe it's overkill. It all depends on what signal the OP will feed into the speaker.
Why has NO ONE suggested a proper transformer would solve the OP's problem.
I don't think that's correct, @killzone_kid. At resonance the "resistance" (we should really be saying impedance) becomes much higher, not much lower.