Help! arduino controlling dc motor speed

Hi I'm new to arduino and would like to control the speed of the dc motor by using a npn transister and the pwm output pin. I have a arduino uno (freetronics clone)

Here is my schematic:

The NPN transitor i'm using is the TIP122 NPN Transistor
http://www.jaycar.com.au/products_uploaded/TIP120-7.pdf

The motor is a 12v dc motor, i cant find the link for the specifcations for it but i know it uses 12v, has 2.7kg/cm torque and spins at about 11000 rpm

the problem is, when i hook this up, nothing happens, the motor does not spin at all. I have made sure i uploaded the sketch to my arduino uno, Im using pin 10 which is a pwm output pin. I am stumped here, many guides for controlling motor speed with arduino have similar schematics to this. I have used analogWrite(255) etc and even digitalWrite(10, HIGH) but the motor does not run at all. I have checked and the transistor is capable of much more current than required and the motor is being supplied with a 12v battery which should be enough.

So i am asking anyone out there, what am i doing wrong? thanks alot

Did you connect transitor ground and Arduino ground together? If not do it.

You can test the circuit without arduino by connecting 5V between transistor ground (-) and the 1kohm base resitor (+). 3 AA batteries will do it

yes i have conneced the arduino ground pins to the negative terminal of the battery, the transistor ground was also connected tot he negative terminal of the battery. There is 3 groudn pnis on my arduino i ahve tried with each different ground pin connected to the battery aswell.

thnaks for the quick reply i wil test the circuit with 3 AA batteries now!

so testing the circuit without the arduino, i connected the emitter pin of the transistor the negative terminal of the 6v battery and than connected the negative terminal of the battery to the negative terminal of the 12v power supply ( to make all ground the same?) and i connected the base pin to a resistor than to the positive terminal of the 6v battery( i coulndt find 3 AA battery so i used a 6v), the motor doesnt run?

Are you sure your motor is OK ?
Try connect it directly to the 12V, without anything else connected.
If it is spinnning connect the diode the same way you do now, if it dosn't spin, then your diode is connected the wrong way around.
If this works, the only thing left is the transistor, wrong connection?, blown up ?

Yep, Motor is fine, i have connected it to a 12v supply directly and it works good. Then i connected it to the diode in parallel like in my original schematics, still works.

Hm my transistor, i just bought it yesterday for $2, TIP 122 NPN, it should be able to handle more than enough for the current for the motor, i've also read the info pdf about it which i have linked on my original post, so i am sure all the pins are connected right.

I don't know if its blown up though? since i just got it yesterday, maybe ill buy another one on my way to school and try it again, fingers crossed. Thanks for all the help so far!

PS. I was curious about the diode, so after the test i tried the diode in parallel but in the other direction than my original schematics, motor still ran fine.

so i just bought a new tip 122 npn transistor and i hooked it up with arduino like the original setup, now the motor runs! i tried with the old transistor, the motor didn't run, so now i can say it was a faulty transistor.

but... the motor runs at full speed, i cannot control it with the arduino. I have tried: analogWrite(9, 1), the motor still runs at full speed

digitalWrite(9, LOW) and the motor runs
does anyone know whats wrong?

edit: so i tested PWN pins 10 and 11, they were able to control the speed of the motor usign analogWrite(10, 30); however PWm pin 9 now is still uncontrollable and will only let the motor run at full speed, i guess i can continue on with my project with PIN 10 and 11 working, but im still curious if anyone has any explanation as to why pin 9 would behave like that.

I don't know how heavy your motor is, but the 1k base resistor seems a bit high.
At least lower it to 220 ohms, what you would use to push 20 ma through an LED.
The transistor shows a B-E votage of like 2.5 volts when full on (and at 3a).
You would be putting only 2 ma of base current into it. Even with high current gain that might not be enough
to fully power the motor.

so i tested PWN pins 10 and 11, they were able to control the speed of the motor usign analogWrite(10, 30); however PWm pin 9 now is still uncontrollable and will only let the motor run at full speed, i guess i can continue on with my project with PIN 10 and 11 working, but im still curious if anyone has any explanation as to why pin 9 would behave like that.

Without seeing your code, no. PWM is timer based, and so are some other things. If you are using one of those other things, like the Servo library, that will disable PWM. However, writing 0 to the pin should have turned it off.

The likelihood of buying a bad transistor is pretty low. The likelihood of you having fried the transistor (and the Arduino pin) is, in my opinion, MUCH higher.