I want to connect DC motor to raspberry PI Gpio. I have used Arduino, done some robots, but never did this on Raspberry Pi.
I want to control speed of DC motor and i was wondering whats the best way to do it. I want it for my raspberry fan.
For example: if CPU temp < 35C then Motor uses half of 5V, 2-3V (Between emiter and collector).
And if CPU temp > 35C then Motor runs of full speed using 5V.
The point is, i want to control Voltage on Transistor Base and use transistor as pot.
Using 2 GPIO outputs with Different Resistors on Base.
Example: Resistor X have more resistance than Y.
If CPU temp < 35C then GPIO 23 activated 3.3V goes on transistor base through resistor X and opening Transistors Emiter-Collector only by half - so i get 2-3V on motor.
If CPU temp < 35C then GPIO 24 activated 3.3V goes on transistor base through resistor Y and opening Transistors Emiter-Collector completely and i get 5V on motor.

Second way is to control motor speed by PWM, using one PWM PIN. So i can change voltage current on BASE by changing hz frequency.

ALSO:
What kind of NPN transistor can i use? I have some c945 npn transistor and some mosfet transistors.
sorry for my english
