connecting speaker to microcontroller

t06afre

Joined May 11, 2009
5,934
In this case I would perhaps use a 555 timer in ASTABLE configuration. Then tune Tune the 555 frequency to get the loudest output. You could then connect the 555 circuit pin 4 to your controller to turn the sound on/off. How many volt will your power supply be?
 

Audioguru

Joined Dec 20, 2007
11,251
The spec's for the tiny Chinese speaker does not say the distance where it produces 93dB.
Since its tested input is only 60mV then maybe you must wear it like an earphone to hear 93dB.
 

SgtWookie

Joined Jul 17, 2007
22,210
I see that it's rated for 30mW, with 50mW being the absolute maximum.
150 Ohms and 30mW means the voltage across it would be ~2.12v.
2.74v across it would exceed the maximum rating of 50mW. You want to stay well under that.

In order to keep the maximum power dissipation down to ~30mW, current needs to be limited to ~14.13mA tops, or as stated above, voltage across it limited to 2.12v.

You could simply subtract 2.12v from your supply voltage, and then divide that result by 14.13mA to determine the resistance you need to add between the speaker and the I/O pin.

Example: Vdd=5v
Rspeaker >= (5v-2.12v)/14.12mA = 2.88/0.01412 = 203.966 Ohms.
In this case, 220 Ohms would add a margin of safety; after all you don't want to damage the speaker.
Double-checking:
5v/(150+220)= 5/370 = 13.51mA; P(Watts)=I(Amperes)^2*R(Ohms), so P= 13.51^2*150 = 27.4mW.

The ATmega8 can sink or source up to 40mA from it's I/O pins, so you're good there.

It would probably be a good idea to use a 1uF cap from the I/O pin to the speaker to block DC from flowing through it.
 

Audioguru

Joined Dec 20, 2007
11,251
Audioguru, what does the 93dB mark represent? Is it a human hearing threshold?
Real speakers have their sound pressure level measured at a distance of 1m and a power of 1W. Most are about 90dB.
93dB is fairly loud. Look in Google to see how loud is a whisper or a closeby jet airplane.
 

t06afre

Joined May 11, 2009
5,934
This device is more a buzzer than speaker. The frequency range is somewhat limeted. 300 to 3.4 KHz. As a small buzzer it might work in a microcontroller setting.
 

Audioguru

Joined Dec 20, 2007
11,251
An old fashioned telephone had an earpiece that mechanically filtered sounds below 300Hz and above 3kHz. Similar to this little "speaker".
 
Top