My dc fan doesnt work when connecting with transistor

I am trying to work my dc fan when temp rises with pwm. When I connect it with arduino's power supply(5V), it works with analogWrite(fan, tempMin, tempMax, 188, 255). But when I try to connect it with a 12V power supply, transistor and diod, it doesnt move a inch.

This is my code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,2,1,0,4,5,6,7,3, POSITIVE);
int tempPin = A1;
int fan = 3;
int temp;
int tempMin = 30;
int tempMax = 60;
int fanSpeed;
int fanLCD;

void setup() {
pinMode(fan, OUTPUT);
pinMode(tempPin, INPUT);
Serial.begin(9600);
lcd.begin(16,2);
}

void loop() {
temp = readTemp();
if(temp < tempMin) {
fanSpeed = 0;
analogWrite(fan, 0);
}
if((temp >= tempMin) && (temp <= tempMax)) {
fanSpeed = map(temp, tempMin, tempMax, 188, 255);
fanLCD = map(temp, tempMin, tempMax, 60, 100);
analogWrite(fan, fanSpeed);
}

Serial.println(analogRead(6));
lcd.print("TEMP: ");
lcd.print(temp);
lcd.print("C ");
lcd.setCursor(0,1);
lcd.print("FANS: ");
lcd.print(fanLCD);
lcd.print("%");
delay(200);
lcd.clear();
}

int readTemp() {
temp = analogRead(tempPin);
return temp * 0.48828125;
}

Note: There is also a lcd to show status which is connected to arduino's power supply which is from pc's usb connection.

"temp" is an int (integer) so multiplying it by 0.48828125 probably isn't going to do what you think.

But if nothing is moving then it's probably that you don't have enough power. What exactly is the power supply you're using? Is the motor powered from the 12V or from the Arduino 5V pin? What is powering the Arduino?

I can't see much from that Fritzing thing (where is the 12V in there?). Can you post a real circuit diagram with details of what components you're using (hand drawn is fine).

Steve