I have a little problem with my project.
Since I have only some background in coding, but none whatsoever in electronics, this might seem trivial to you but I would really appreciate some help.
I am trying to program a small kitchen timer and whenever the speaker kicks in the whole thing goes down the drain. I assume that the arduino board itself doesnt get enough power to begin with, which is why it resets and the sound never occurs.
In the small sketch I only included the most important things. Attached to the Arduino itself is additionally a button and a small display that needs some power as well.
Here are some details:
Arduino Pro-Mini 3.3V
Speaker: 8 Ohm, 0.5W
Transistor: TIP120
Power Supply: 2 AA batteries connected in series
It worked in the beginning for like a day or two, but now it always stops whenever the timer reaches 0 and should make a sound. The display and everything else still works fine and the batteries still have power.
I tried it without the transistor by connecting the aanalog out from the arduino directly to the speaker with yields the same results.
Correct me if I'm wrong but I think the transistor allows a higher voltage into the speaker (not only the 3.3V from the board) so that it is a bit louder.
I tried it with 100, 200, and 300 Ohms now and none seems to work
It works however if I skip the transistor and connect the arduino to 200 Ohms and then to the speaker directly. This is however very quiet and therefore no good solution.
That schematic can't be right. If you actually connected it that way, I can imagine it doesn't work.
TIP120 is an NPN transistor but you show it wired as a high-side switch - assuming you actually drew the battery the wrong way round as well, which I assume you did since you don't mention any smoke or flames.
Add a resistor of about 200 ohms between the Arduino output and the transistor base.
move the speaker to connect between +V and the transistor collector. You might want to put a 50 or 100 ohm resistor in series with the speaker. Speakers are usually around 8 ohms. The resulting current will be over 1/2 amp.
Connect the transistor emitter to ground.
Verify your polarity on the supply. Its drawn reversed. I'm assuming that is a drawing error.
For more information on this configuration of an NPN transistor google "common emitter". And this would be a switch application, not an amplifier.
This is only slightly louder than connecting it directly to the board though.
I'm not quite sure why.
Is a TIP120 transistor maybe not suitable for this usage? I don't really understand the differences in different transistor types yet to be honest.
That looks much better! The TIP120 looks like massive overkill for this job, but it'll work.
If this is not loud enough you'll have to look at an actual amplifier. Convenient modules are available.
Remember that the housing of a speaker I.e. its box does a lot for the volume it can produce.
Sorry I didn't see this sooner. I hadn't looked the TIP120 for the last response.
The TIP120 is a double transistor called a Darlington. The issue is a Darlington transistor will need
about 2.5 to 3 volts from base to emitter before any real current goes into the base.
With a 3.3 Volt supply and and maybe 3V from the GPIO output there isn't enough voltage to create the current needed to turn the transistor.
If you have other transistors on hand let us know, maybe you have a better alternative already.
What you need is a non Darlington (most devices are this type) NPN transistor that will handle 1 or more amps.
Okay!
Thanks everyone for your help.
A few hours ago I was just putting components next to each other hoping they would work but now I actually understand what I'm doing and where I can improve stuff even further.
I guess I have to buy some new NPN transistors (and some PNP while I'M at it) and maybe try some amplifyer components.
Nonetheless Thanks everyone!
Good! You'll get what you need, I'm sure.
Btw, if I want a Arduino to make some beeping noise, i usually just use a piezo buzzer. They are easy to use and loud at low power levels. I generally drive them with a small mosfet to keep the microprocessor pin current low. Not exactly hifi (ahum) but plenty good enough for a signal beeping here and there. You'll have to decide for your application if this is a option for you.
buzzers were my first go-to sound making device, but I guess I just dont like their sound very much.
They are however louder than my current solution, which is more important for a kitchen timer than nice sound i guess
Sorry, you're right. I wasn't paying attention.
Still, Vbe=2.5V max for Ic=3A whereas actual current draw will be closer to something like 500mA. Should be OK assuming a ca. 3V digital pin output with a couple hundred Ohms to the base and not a lot of current passing through that base, don't you think? It's a darlington after all, so voltage drop over the base resistor will be pretty small, I'd say.
TIP120 is terrible for that.
Look at N-channel MOSFET instead, can find them with just tens of milliohms on-resistance, letting your 3.3V put the most current into the 8 ohm load.
3.3V/8ohm = 400mA.
P = V^2/R = 3.3 x 3.3 /8 = 1.3W, so that kind of limits the loudness you can achieve.
If you use a 4 ohm speaker with high sensitivity, it can seem a lot louder.
This little guy cranks! https://www.mpja.com/4-Ohm-Mini-Speaker/productinfo/14618+SP/
It's still a good idea to limit DC current in some way. I'm not sure if it's a good idea to design a circuit that allows a 400mA DC current to flow through a small speaker in case of a little programming mishap. But you're right that a little over 90% of the power is dissipated in the resistor.