Help needed to run a dc motor using NPN Transistor, BC547B

Hello all,
This is my first post in this forum and I have just started with arduino.

I have arduino UNO board and I am trying to change the speed of the motor with help of a PWM pin 9

I am using NPN BC547B transistor as a switch.
Following are the connections made on the breadboard.

Following steps are then carried out

->Connected a 2K resistor in series between pin 9 of arduino and base of the transistor.
->Grounded the emitter of bjt.
->Connected the motor between the 9v external source and the collector terminal.
->Connected a diode 140007 parallel with the motor (implemented as flyback diode).
->grounded the external 9v source negative on breadboard(connected to the same reference of emitter)
->Grounded the reference from arduino (from the power pins)

Loaded the sketch and nothing happened.

Hence I put a multimeter and saw that current was fluctuating correctly.
Then to check if my observations were correct, I replaced the motor with an LED(which had 1K resistor in series with it) and it worked.

Therefore I concluded that the current was not enough to drive the DC Motor.

For this I referred to Jermey Blum's tutorials and his was working without any current amplification.

Just wanted to know if my component selection is correct and how to make a DC Motor run with arduino.

Please help.

Thank you.

Try a lower value base resistor, 330 ohms (that could be 3 1k resistors in parallel.)

BC547
100 mA collector current (max.) Is that correct?
If so, it's not for les moteurs.]

Thank you Runaway Pancake,
Would putting such low resistor help in protecting my arduino pin (pin 9)?
If something shorts out then I think it can just destroy my PWM pin 9.

How did you calculate it though?

I tried to do this without a arduino board connected, I took the same 9v supply and connected it to the base with value of 100 Ohms, Motor did turn, however, the transistor was very hot, and by hot I mean really very very hot.

I think that I might have passed excessive current through the transistor.

Just would like to know how experienced guys come up with values and component selections and what care should be taken to protect the components that are involved in the circuit.

I would never like to do is burn up pins from arduino board.

Thanks.

Would putting such low resistor help in protecting my arduino pin (pin 9)?

Yes it would. Anything greater than 120R keeps the current from the pin below the limit.

If something shorts out then I think it can just destroy my PWM pin 9.

Resistors with this little current do not short out.

I think that I might have passed excessive current through the transistor.

Yes I think so as well.

Just would like to know how experienced guys come up with values and component selections

See this:-

okidoki:
How did you calculate it though?

Base current -
"Ideal": 5V / 330 ohms = 15 mA
"Real World": (4.8 V - 0.8V) / 330 = 12 mA

With regard to the motor and selection of transistor, part of my explanation here would be relevant.

BC547 is a small signal transistor, driving heavy loads like motors is completely
out of its league.

First question you need to ask is what is the stall current of the motor?
Then you find a switching device that can handle that...

If you want to stay with the BCxxx family, then a BC337 is a better choice.
That one is happy with base resistors upto 330ohm.
Only for small motors though.
Leo..

You can't stay with the BC family, the C in BC means "small signal low frequency",
just as BF means "small signal high frequency" and BD means "high power low frequency"...

A MOSFET is actually a far better bet, bipolar switching devices have low current gain
(10 to 20 is commonplace).

Thank you all for the replies.

I think I would go for PN2222 transistor to drive this dc motor.

Or use a Low Rds, Logic Level, N-channel MOSFET

When on, will provide the most voltage for your motor, vs losing 0.5 to 0.7V across an NPN.