Not able to reach wanted current on speaker via transistor

Hello,
I’m experiencing troubles with using a speaker (8ohm 0,5W) in my project. Firstly, i followed tutorial on wiring ATMega328p on breadboard to make it work as arduino uno (https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard). I can tell it works flawlessly for me. It’s powered by CP2102 USB Bridge (https://www.silabs.com/documents/public/data-sheets/CP2102-9.pdf).

Then i added SD card module (to the SPI pins 11,12,13, and CS pin to pin 10 of Atmega), and made pin 9 a signal pin. To make my speaker louder, i tried wiring transistor to circuit (CBCT639 NPN) (simple scheme attached).

I want speaker to use max power, so I need to put 2V on it (am I thinking in the right way?). By using voltage divider calculator I concluded that i need to put 12ohm resistor before it. Then i used transistor base resistor calculator. Since i just want to amplify the signal from pin 9 I assume hfe=10 as i found recommended on Internet, so it said I need 200 ohm resistor (I used 220 ohm).

After putting it all together it doesn’t work as expected. I checked with electricity meter, and I only get only 0.75 V on speaker and only 90mA going through it. I tried playing simple notes without SD module and i get simmilar results. I also checked current going from signal pin and it’s 7 mA (but it’s 50% duty cycle so maybe it’s actually 14mA, but still, with 220 ohm resistor there shall be going 23mA). The max current of CP2102 is 500mA, so it’s not the lead.

Please, could you explain to me what I’m doing wrong? :slight_smile:

I want like to know how to use full power of speaker, especially that i would like to change it to more powerful one later (I know that then I will have to change CP2102 to other power supply). Sorry for any mishaps, but it’s my first post and also these are my beginngs with electronics.

Here’s a code that i use:

#include "SD.h"
#define SD_ChipSelectPin 10
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

void setup()
{
tmrpcm.speakerPin=9;
tmrpcm.setVolume(6);
tmrpcm.play("test3.wav");
}

void loop() {

}

That's not how you amplify a signal to drive a speaker. You have DC passing through your speaker all the time, this is not good.

Search for a class D audio amplifier, you should be able to get one for about £2.50 or something, that will do what you want.

Not that it matters much but I could not find a datasheet for a CBCT638 and the symbol you have drawn is for a uni-junction transistor (sort of), which won't amplify audio.

You need to do your due diligence before posting on the forum.
First of all , if you have no clue how to draw a transistor, common sense dictates that you Google
Npn transistor symbol before posting your schematic (which looks like it was drawn by a child).
Second , if you don't know how to amplify an audio signal, common sense dictates that you Google
"simple audio amplifier"

You would then see that you need a capacitor before the base resistor, even if you did not know that audio is NOT dc , it is AC.

Had you had the foresight to do that you would have found this

True, you could ask us , but do you really need a panel of retired engineers to tell you what a simple
Google search could have told you ?
Seriously, it's not that we don't want to help you, but you should at least try Google first...
Come to us when you can't find what you need on Google in 5 minutes.

I suspect two issues…

I assume you know TMRpcm is actually PWM? It’s not analog either.

1. A multimeter won’t give accurate measurements with PWM so I don’t trust your voltage & current measurements.

2. The voltage drop across the transistor (VCE when on) is probably higher than you expect.

Test it briefly with a DC voltage by writing a digital “1” (high).

Unfiltered PWM can do “nasty things” to an amplifier so you can try it, but I wouldn’t connect my hi-fi amplifier.

If you’re going to use PWM, I’d stick with the single-transistor method unless you need a volume control. If you need more volume you can take-out the resistor and/or increase the voltage as long as the speaker & transistor can handle the current. And make sure the transistor is off when you’re not playing sound so you don’t send constant-DC through the speaker.

If you just put a 1uF axial electrolytic cap between the arduino output and the base resistor and
use the Tone Library, it should work, assuming the transistor is wired correctly with the speaker in series
with the collector and the emitter to GND.

Can you post a close up photo of the face of the transistor ?

Firstly, there’s no current going through speaker while pin 9 isn’t giving signal, so it seems ok.

raschemmel:
You need to do your due diligence before posting on the forum.
First of all , if you have no clue how to draw a transistor, common sense dictates that you Google
Npn transistor symbol before posting your schematic (which looks like it was drawn by a child).
Second , if you don’t know how to amplify an audio signal, common sense dictates that you Google
“simple audio amplifier”

Sorry for that transistor symbol, I was just thinking that it’s drawn this way :smiley:
I had been already googling for amplifiers etc. but I am just wondering why Ohm’s law doesn’t seem to work in this easy circut (obviously has to work some way).

DVDdoug:
I suspect two issues…

I assume you know TMRpcm is actually PWM? It’s not analog either.

1. A multimeter won’t give accurate measurements with PWM so I don’t trust your voltage & current measurements.

2. The voltage drop across the transistor (VCE when on) is probably higher than you expect.

Test it briefly with a DC voltage by writing a digital “1” (high).

Unfiltered PWM can do “nasty things” to an amplifier so you can try it, but I wouldn’t connect my hi-fi amplifier.

If you’re going to use PWM, I’d stick with the single-transistor method unless you need a volume control. If you need more volume you can take-out the resistor and/or increase the voltage as long as the speaker & transistor can handle the current. And make sure the transistor is off when you’re not playing sound so you don’t send constant-DC through the speaker.

Exactly! The voltage drop on transistor is quite big. While speaker is playing normally the voltage drop on transistor is about 1.5V. While testing it with digital 1 it reached 4,5V and speaker had 0.1 V as current at base resistor was 0.1mA. When I tested it with digital 0 no current was present as it shall be.
What does it mean?

raschemmel:
Can you post a close up photo of the face of the transistor ?

There you go :slight_smile:

ctbc639 Youtube video tutorial

DATASHEET

Google Search

Did you add the cap and try the Tone Library ?

I have seen all those links, but I still don't get it why transistor has that big voltage on itself.

raschemmel:
Did you add the cap and try the Tone Library ?

Yes, it doesn't work. There's no way it could since arduino pin gives PWM signal. But let me specify. I did not ask on how to make a signal filter, becasue as you said I can google that for myself. I just don't understand why I can't get 250mA going through speaker. It's something about transistor, but I don't know what. I even tried wiring it someday without resistors (i know stupid), which should technically destroy arduino pin and, but even then current didn't reach 250mA.

Well, actually maybe my electronic meter is that bad, that my measurements are very insignificant, I am afraid that it may be the other option.

You realize you can't measure current though a speaker that is being driven by PWM don't you ?
(for obvious reasons: the current is not constant).
In fact , I don't see how any current measurements you have taken could possibly be valid.
If it's volume you want then just use an LM386 audio amplifier chip.

Thank you, I will try that :slight_smile: