Unipolar motor circuit

Hello people.

I have pulled a small fan from an old usb laptop cooler and I need to connect it to my arduino.

When I connect it directly to 5v it works as expected. But I need to control the speed of the motor/fan. To accomplish this I've connected it to a bipolar transistor(P2N2222A) and to pin 13 (for testing, I will use PWM) but it doesn't seem to work.

Anybody have any suggestions?

I did managed to get it working. I'm using this schematic

Instead of of a flyback diode I'm using regular LED. I know that this not the best practice but I need it for a project due in a few days and I can't get my hands on one in that short period of time. What is the worst that can happen wile using an LED? Are there alternatives to a diode?

Try 180 ohm, not 2k2. You want the transistor to be in saturation.

Smallest I have is 1k That will have to do.

You want the transistor to saturate to use it as a switch.

Antonio144: Smallest I have is 1k That will have to do.

That's NOT the way things work. If you have more 1K's, then you could put them in parallel for value (5 in parallel = 200ohms). If all you have is one 1k resistor then You can try connecting collector to 5V, put pin 13 to the base without a resistor, and place the motor between emitter and Gnd. You still need that diode, an LED isn't a substitute (alternative.) The worst thing that can happen: knock out your transistor and maybe your pin 13 with it.

Several hours later now and no replies.

He mentioned it’s a fan from a laptop cooler, so probably a brushless fan / internal driver. Why he used “unipolar motor” in the subject is of course … odd.

Chagrin: He mentioned it's a fan from a laptop cooler, so probably a brushless fan / internal driver. Why he used "unipolar motor" in the subject is of course ... odd.

Wouldn't be the first time that anyone used a jumble of terms about whatever it is and I was just anticipating "the worst", no matter what, as closely as I thought to approximate such.