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? ![]()
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() {
}

