So I've got an standard-issue Lench 0.5W, 8 ohm speaker. I'm going to use the Arduino as a tone generator and experiment with modifying sound on the breadboard. First thing I want to try is an audio amplifier. What do I need to do to make sure I don't inadvertantly blow the speaker?
Make sure the maximum output power of the amplifier is 0.5W or limit the input to a point where the output is less than half a watt. But this is obvious so I guess I am missing something in your question.
Power = V^2/R Sqrt (Power * R) = V Sqrt (0.5 x 8) = 2 So make sure to put less than 2V across the speaker Also, 2V/8ohm = 250mA. So there's your limits.
griphus: So I've got an standard-issue Lench 0.5W, 8 ohm speaker. I'm going to use the Arduino as a tone generator and experiment with modifying sound on the breadboard. First thing I want to try is an audio amplifier. What do I need to do to make sure I don't inadvertantly blow the speaker?
The normal way is to wire a volume control pot between the source signal (the arduino tone output signal) and the input of the audio amp (via a series coupling capacitor), then adjust the volume to that what the speaker can handle safely. That way you don't have to worry about trying to match the amp's maximum output power to the speaker's power limit. This could be a small trimmer pot that you set once and leave alone as the arduino output signal will not change in amplitude.
You might also want to put a high value capacitor, say 1000mF, rated at 12 volt minimum, in series with the speaker lead to block any DC component that your amplifier circuit will put out. DC component will cause gross distortion on your speaker's audio output because it pulls (or pushes) the cone out of its neutral position.
Try connecting a capacitor (470uF or 1000uF) and 150 ohm resistor in series with that speaker, and connect the whole arrangement between an Arduino output pin a ground. You may find it is loud enough like that without an amplifier (I have a similar arrangement that is loud enough for me). See attached diagram.
If it isn’t loud enough, use transistors as shown in the second diagram. In either case, increase the series resistor to reduce the volume.
[EDIT: if the first arrangement is almost loud enough, you could safely get a little more volume by decreasing the resistor to 100 ohms.]
5/(150 + 8) = 31mA 5/108 = 46mA, will blow the output pin eventually.
CrossRoads: 5/(150 + 8) = 31mA 5/108 = 46mA, will blow the output pin eventually.
In the steady state with a tone playing, the capacitor will be charged to 2.5V if the pin is driven with a square wave, so the current will be half that worst case value. Also, if you load an Arduino pin with 108 ohms, you won't get 5V out of it, more like 4V because of voltage drop in the pin driver. That's why I think 100 ohms is ok, although I wouldn't want to go any lower, and in a commercial design I probably wouldn't go quite that low.