 # Connecting arduino to speaker using 2n3904 npn transistor

Hello I am studying electronics and I am using the arduino to create a musical instrument for a project. I want to connect a digital output pin to a 6 Watt 8 ohm speaker and use the tone() library to play different notes! I know you need a resistor to connect the speaker to the digital pin to prevent it drawing too much current from the pin. I want to use the 2n3904 to amplify the current for the speaker. I have connected up the following circuit to the digital output pin and it is working well:

https://www.circuitlab.com/circuit/fqbp6z/speaker-output/

However I have to know for the report of the project how to calculate the resistor I should use? For the speaker the max power is 7 watts so I just used P = (I^2)*R with P = 7 watts and R = 8 ohms to get max I = 0.935 A. Therefore my Ic (from transistor) has to be smaller than 0.935 A. Is this right? Also the voltage out of the digital output pin is 5 Volts and the max output current from these pins is 40mA therefore the resistor I have to use to limit the current drawn from the pin has to be bigger than 125 ohms (using V = IR)? Is this correct? How do I calculate the Ic from the Ib for the transistor? The datasheet is here:

http://www.fairchildsemi.com/ds/2N/2N3904.pdf

I want to choose a resistance that does not draw too much current from the pin while also supplying a current to the base of the BJT which gets amplified to a current which is less than the max allowed current for the speaker. The ic has to be less than 200 mA aswell I think (max ic from datasheet!). I need to show these calculations for the report of the project. If anyone can help me I would greatly appreciate it!

Hello I am studying electronics

Did you search for "speaker transistor" etc. in this forum?? Study means research.. http://forum.arduino.cc/index.php?topic=171105.0