You can find the schematic ready to edit and go on EasyEDA here.

Source code for the Arduino sketch is attached and below. Note that it uses the TimerOne library to provide higher-resolution Timer1 frequency control for the Pulse Width Modulation to control the fan speed.

THEORY OF OPERATION

The controller uses a 10K thermistor to sense remote temperature from the target device.... in my case, a large heat sink on a 160 watt linear amplifier. I used Kapton tape to insulate the themistor from direct contact with the heat sink.  My goal was to keep the temperature below 150 degrees F, as the amplifier has a shutdown temp of 170 degrees and was becoming too hot for my liking during extended usage periods. 

The thermistor is part of a voltage divider circuit, which is fed into A0, an analog input port whereby the voltage reading is taken. That reading is then scaled based upon the known 5 VDC reference voltage provided as part of the Arduino nano. This reference voltage is particularly accurate, but for this application close is good enough. In practice, I found the temperature readings to be within a degree or so.

The temperature is scaled and converted into degrees C, then degrees F, then used to make control decisions. I wanted the fan to switch on anytime the temperature rises above 90 degrees F and to start out at a medium speed. I found that lower speeds weren't especially useful and caused the PC fan to make unseemly sounds that didn't seem healthy, so I opted for a moderate low temperature fan speed.

As the temperature rises, the PWM duty cycle is modified in a linear fashion to speed the fan up and increase its cooling capacity. Once the temperature exceeds the maximum target, the fan is switched to full-speed mode.

Since the Nano has a built-in LED, I decided to blink that LED whenever the relay is closed to indicate the fan should be running.

The relay chosen is a 1-coil latching relay - a Panasonic ADW1105HLW capable of switching 16 amps - totally overkill for this application, but I also had this component from another project, so I grabbed it and used it.  Latching relays switch between states (open / close) by providing a 30 millisecond or longer pulse to the single coil. In this case, the 5 VDC relay requires up to 40 ma. for 50 milliseconds to switch the relay, after which there's no need to continue providing any current as the relay latches into the desired state and stays there.  

I used a couple of digital output pins and a simple timer to provide the latching relay polarity reversal logic and switching pulse. While the maximum per pin current of 40 ma. of the Arduino is being used, I didn't feel like adding another external component like a transistor was warranted as it's within the Arduino's maximum current rating and only flows for 50 ms.

This project works perfectly and keeps my amplifier cool and purring like a kitten!  And it was fun learning some new things about Arduino, PC fans, PWM and thermistors in the process.

SKETCH

//
// TempFanController - Temperature-based Fan Controller
//
// 6-2-2018   W5FCX (R. Braddy)
//
//  This Arduino Nano sketch manages variable speed fan for cooling a ham radio linear amplifier. It switches the fan on above the low temperature cutoff then ramps the
//  fan speed up to full speed using timer1 for high-res pulse width modulation. For this application, a Panasonic ADW1105HLW 1-coil latching relay left over from
//  another project was used to switch the 12 VDC to an inexpensive Nidec BETA V TA450DC variable speed fan. This fan has a built-in MOSFET and 4-wire fan control
//  designed for PC cooling and draws about 0.8 amps. The thermister is a common 10K NDC device coupled with a 10K voltage divider resistor.
//
//  TimerOne library provides the 22.5 KHz output frequency for PWM use on pin 9 using Timer1.
//
//  This sketch derived from various articles and experimentation. The Thermister temperature calculation from:
//    https://learn.adafruit.com/thermistor/using-a-thermistor
//
//  Fan:  Nidec BETA V TA450DC 4-wire variable speed PC fan
//  Fan wires:  Red: +12V, Black: Gnd, Blue: PWM speed control (to fan's MOSFET speed controller), Yellow: Tachometer (unused)
//  Relay: Panasonic ADW1105HLW 1-coil latching relay
//  Thermistor: 10K NDC thermistor
//

#include <TimerOne.h>

// which analog pin to connect
#define THERMISTORPIN A0 
// which pin for PWM output (must use pin 9/10 due to timer1)
#define PWM 9  
// Latching relay pins
#define RLYPIN1   4
#define RLYPIN2   5
#define RELAY_OPEN    1
#define RELAY_CLOSE   2

#define LED_NANO_BUILTIN  13

// resistance at 25 degrees C
#define THERMISTORNOMINAL 10000      
// temp. for nominal resistance (almost always 25 C)
#define TEMPERATURENOMINAL 25   
// how many samples to take and average, more takes longer
// but is more 'smooth'
#define NUMSAMPLES 5
// The beta coefficient of the thermistor (usually 3000-4000)
#define BCOEFFICIENT 3950
// the value of the 'other' resistor
#define SERIESRESISTOR 10000   
//Fan PWM design frequency is 22500 hertz (44.44444 uS)
#define MICROSECS 44  

#define LOWTEMPCUTOFF   90
#define HIGHTEMPMAX    150
 
uint16_t samples[NUMSAMPLES];
int   relayState;
int   ledState;

//
// Operate single-coil latching relay - pulse for 50 ms. to switch.
// Latching relay coils are actuated by applying current flow in one direction or the other for a brief time.
// After the relay is latched into position, no further flow current is required (or desired), so the relay is only actuated once.
//
void  relayCmd( int rlycmd )
{
    int rly1State, rly2State;

    if( relayState == rlycmd )
        return;                     // relay already in commanded state
    if( rlycmd == RELAY_OPEN )
    {
        rly1State = LOW;
        rly2State = HIGH;
        relayState = RELAY_OPEN;
        Serial.println("Open relay - FAN OFF"); 
    }
    else // RELAY_CLOSE
    {
        rly1State = HIGH;
        rly2State = LOW;      
        relayState = RELAY_CLOSE;
        Serial.println("Close relay - FAN ON"); 
    }
    // Set/Reset the latching relay coil w/ 50 ms. pulse
    digitalWrite(RLYPIN1, rly1State);
    digitalWrite(RLYPIN2, rly2State);
    delay(50);
    // No further current flow
    digitalWrite(RLYPIN1, LOW);
    digitalWrite(RLYPIN2, LOW);    
}

 void setup(void) {
  Serial.begin(9600);
  pinMode(THERMISTORPIN, INPUT);
  pinMode(RLYPIN1, OUTPUT);
  pinMode(RLYPIN2, OUTPUT);
  relayState = -1;                // ensure relayCmd() operates first time through
  ledState = 0;
  relayCmd( RELAY_OPEN );         // begin with relay open (fan off) 
  pinMode(PWM, OUTPUT);
  Timer1.initialize(MICROSECS);   // the period in microseconds for timer1
}

void loop(void) {
  uint8_t i;
  int PWMVal;
  float average;
 
  // take N samples in a row, with a slight delay
  for (i=0; i< NUMSAMPLES; i++) {
   samples[i] = analogRead(THERMISTORPIN);
   delay(10);
  }
 
  // average all the samples out
  average = 0;
  for (i=0; i< NUMSAMPLES; i++) {
     average += samples[i];
  }
  average /= NUMSAMPLES;
 
  Serial.print("Average analog reading "); 
  Serial.println(average);
 
  // convert the value to resistance
  average = 1023 / average - 1;
  average = SERIESRESISTOR / average;
  Serial.print("Thermistor resistance "); 
  Serial.println(average);
 
  float steinhart;
  steinhart = average / THERMISTORNOMINAL;     // (R/Ro)
  steinhart = log(steinhart);                  // ln(R/Ro)
  steinhart /= BCOEFFICIENT;                   // 1/B * ln(R/Ro)
  steinhart += 1.0 / (TEMPERATURENOMINAL + 273.15); // + (1/To)
  steinhart = 1.0 / steinhart;                 // Invert
  steinhart -= 273.15;                         // convert to C
 
  Serial.print("Temperature "); 
  Serial.print(steinhart);
  Serial.println(" *C");
  // Convert to degrees F
  int Tf = steinhart *1.8 + 32;
  Serial.print("Temperature "); 
  Serial.print(Tf);
  Serial.println(" *F"); 
  
  //map and assign pwm values to the fan output 0 to 1023 corresponds to 0 to 100% duty cycle
  PWMVal = map(Tf, LOWTEMPCUTOFF, HIGHTEMPMAX, 920, 1023);  // 89% to 100% duty cycle for medium to full fan speed through 0.47 uF capacitor to blue wire

  //set LOWTEMPCUTOFF degrees F as  cutout limit where the fan switches off
  if(Tf < LOWTEMPCUTOFF){
    PWMVal = 920;             // slowest fan speed
    relayCmd( RELAY_OPEN );   // fan off     
  }
  else if( Tf > HIGHTEMPMAX )
  {
    relayCmd( RELAY_CLOSE );  // fan on     
    PWMVal = 0;               // wide open - fastest fan speed
  }
  else                        // somewhere in between (fan on)
  {
    relayCmd( RELAY_CLOSE );  // fan on         
  }

  Serial.print("PWMVal: "); 
  Serial.print(PWMVal);
  Serial.println(""); 
  Timer1.pwm(PWM, PWMVal);    // set PWMVal as the duty cycle

  if( relayState == RELAY_CLOSE )
  {
      int state = ledState == 0 ?  HIGH : LOW;
      digitalWrite(LED_NANO_BUILTIN, state);   
      ledState = ledState == 0 ? 1 : 0;
  } 
  delay(1000);
}