Will the below schematic work? Arduino Mega 2560, 3 x 8 ohm speakers hooked to one digital pin through breadboard.
It will do something but it is not the best way.
Put the speakers in series not parallel. Then add the current limiting resistor into that.
Well, depends on the resistor value, and how loud you want the sound to be. I would first suggest that you wire the speakers in series, rather than in parallel. That would give you 24 ohms. then make your resistor a bit larger (you do the math) but around 1k for starters. Then, yes, it will produce reasonable sounds.
EDIT: Hi Grumpy. Maybe it is all those resistors here in Texas, but it is up to 103F here right now. No wonder I am inside. LOL
Ok I made the changes to a 1K ohm resistor and setup the speakers in a series connection. Thanks for the feedback and let me know if I actually understood what you were saying...
You can drop the resistor to a minimum of 100 ohms if you want it louder.
@dmillsap06, yes, the schematic looks great.
Aren't we supposed to limit the Arduino pins to 20 mA?
I calculate that to be 250 ohms total, 220 ohm resistor.
Aren't we supposed to limit the Arduino pins to 20 mA?
No 40mA.
20mA is the current where the parametric voltages for high and low are valid.
40mA is the absolute maximum so with 3 * 8 ohms for the speaker giving 24R and a 100R resistor you have 124R. At 5V this gives a current of 40mA.
If you want to be ultra safe then a 120R resistor would drop this to 35mA.
This seems to be a point of some dispute here and there, with some people claiming that exceeding the 20mA is going to cause "wear" on the device.
I doubt it, but - just mentioning ...
This seems to be a point of some dispute here and there,
In general underrating or derating a component as it is called is better for it. There is some evidence to say that derating it under 20% is harmful. The industry standard for derating is about 80% which would suggest the optimum value is 32mA, but a lot depends on context.
It is a complex business and I used to do these sorts of calculations / measurements for a living.