Practical case: Automating a fan with relay and thermostat

Schematic — Practical case: Automating a fan with relay and thermostat

Objective and use case

What you will build: A simple system that automatically turns a 12 V fan on and off using a mechanical thermostat (bimetal contact) and a relay. It will control ventilation only when the temperature exceeds a defined threshold (e.g. 40 °C).

What it is used for

  • Turning on a fan when the internal temperature of an electronics enclosure exceeds, for example, 40 °C.
  • Protecting a lab power supply or charger from overheating by activating a fan only when needed.
  • Cooling a small cabinet where you keep routers/switches that get hot.
  • Automating the ventilation of a 3D printer inside a closed box.
  • Controlling the fan of an inverter or battery in small solar installations.

Expected result

  • The relay is activated (audible click) when the thermostat reaches its configured trip temperature (for example, 40 °C ± 5 °C) and deactivates when it goes below that threshold.
  • Voltage at the fan: ~12 V when the relay is activated; ~0 V when it is deactivated.
  • Fan current: between 100 mA and 300 mA (depending on the model) when activated, measured in series with the fan.
  • Voltage at the relay coil: ~12 V when the thermostat closes the contact; ~0 V when it opens.
  • Time from when the thermostat closes until the fan starts: < 1 s (practically immediate activation).

Target audience: Electronics hobbyists, makers and technicians who want to automate basic cooling; Level: Beginner–intermediate (with some knowledge of DC and relays).

Architecture/flow: 12 V DC supply → mechanical thermostat (normally open/closed contact depending on model) → relay coil → relay power contacts in series with the 12 V fan. When the temperature exceeds the threshold, the thermostat closes the coil circuit, the relay switches and applies 12 V to the fan; when the temperature drops, the thermostat opens, the relay deactivates and the fan turns off.

Materials

  • 1 × 12 V DC power supply (adapter or lab supply, at least 1 A).
  • 1 × 12 V DC fan (PC type, 80 mm or 120 mm, 2 wires).
  • 1 × 12 V DC relay with SPDT contacts (1 changeover) and contact current ≥ 2 A.
  • 1 × Bimetal mechanical thermostat with normally open (NO) contact, 12 V / 1 A minimum (KSD type or similar).
  • 1 × Freewheel diode 1N4007 (or equivalent 1N400x).
  • 1 × Red or green indicator LED (approx. 2 V).
  • 1 × 1 kΩ 1/4 W resistor (to limit LED current).
  • 1 × Main switch (optional) 12 V / 2 A minimum.
  • 1 × Breadboard or terminal strip.
  • Breadboard jumpers or flexible wire for connections.
  • 1 × Digital multimeter.

Wiring guide

We will consider a single 12 V supply that powers the relay coil, the fan and the LED.

  • Main supply:
    • Connect the positive terminal of the 12 V supply to the node labeled “+12V”.
    • Connect the negative terminal of the 12 V supply to the node labeled “GND”.
  • Main switch (optional but recommended):
    • Connect one terminal of the switch to the +12V of the supply.
    • Connect the other terminal of the switch to the “+12V_SW” node (switched 12 V output).
    • The +12V_SW node will be the powered positive that we will use for the rest of the circuit.
  • Relay coil:
    • Connect one end of the relay coil (coil pin 1) to the +12V_SW node.
    • Connect the other end of the relay coil (coil pin 2) to the common contact of the thermostat (“COM_T” terminal).
    • Connect the normally open (NO) contact of the thermostat to the GND node.
    • In this way, when the thermostat detects high temperature, it closes the contact and connects the relay coil to GND.
  • Protection (freewheel) diode on the coil:
    • Connect the cathode of the 1N4007 diode (marked with the band) to the +12V_SW node (positive side of the coil).
    • Connect the anode of the 1N4007 diode to coil pin 2 (node between coil and thermostat, labeled “N_BOBINA”).
    • The diode will be in parallel with the coil, but reverse-biased (it does not conduct during normal operation).
  • Relay power contacts (for the fan):
    • Connect the common (COM) terminal of the relay contacts to +12V_SW.
    • Connect the relay’s normally open (NO) terminal to the fan’s positive wire (red).
    • Connect the fan’s negative wire (black) directly to GND.
    • Thus, when the relay is activated, the COM–NO contact closes and powers the fan.
  • Coil activation indicator LED:
    • Connect one end of the 1 kΩ resistor to the +12V_SW node.
    • Connect the other end of the 1 kΩ resistor to the LED anode.
    • Connect the LED cathode to the N_BOBINA node (coil pin 2, thermostat side).
    • The LED will light when current flows through the coil (when the thermostat is closed and the relay is activated).

Schematic

                                      +12V (fuente)
             |
          [SW1] Interruptor
             |
             +12V_SW node
             |
             +------------------------+
             |                        |
          [R1] 1kΩ                    |
             |                        |
             o N_LED                  |
             |                        |
          [LED1] LED                  |
             |                        |
             o N_BOBINA               |
             |                        |
          [K1] Bobina relé            |
             |                        |
             o COM_T (termostato)     |
             |                        |
       [TERM1] Termostato NO          |
             |                        |
            GND                       |
                                      |
          +---------------------------+
          |
        [D1] 1N4007
          |
          +---------------------+
          |                     |
             +12V_SW node          o N_BOBINA

Contactos de potencia del relé y ventilador:

             +12V_SW node
             |
          [K1] COM contacto
             |
             o N_COM_RELE
             |
          [K1] NO contacto
             |
             o N_FAN+
             |
        Ventilador +
             |
        Ventilador -
             |
            GND
Schematic (ASCII)

Measurements and tests

  • Supply verification:
    • Measure the voltage between +12V and GND with the multimeter in DC voltmeter mode; you should read between 11.5 V and 12.5 V.
    • With switch SW1 closed, measure the voltage between +12V_SW and GND; it should be approximately the same as at the supply.
    • With SW1 open, the voltage between +12V_SW and GND should be 0 V.
  • Checking the relay coil:
    • With the system cold (thermostat open), measure the voltage between N_BOBINA and GND: it should be ~0 V (not activated).
    • Heat the thermostat (for example, with a hair dryer at a safe distance) until it activates:
      • You should hear a “click” in the relay.
      • Measure the voltage between N_BOBINA and GND: it should be close to 0 V (because that side of the coil is connected to GND through the thermostat).
      • Measure the voltage between +12V_SW and N_BOBINA: you should see ~12 V (drop across the coil and LED).
  • Checking the indicator LED:
    • With the thermostat open (cold), verify that the LED is off; measure the voltage between N_LED and N_BOBINA:
      • It should be ~0 V because no current is flowing.
    • With the thermostat hot (contact closed) and the relay activated:
      • The LED should light.
      • Measure the voltage between N_LED (resistor side) and N_BOBINA (LED cathode side): there should be around 2 V across the LED and the rest (~10 V) across resistor R1.
      • This indicates that the current through the LED is I_LED ≈ (12 V − 2 V) / 1 kΩ ≈ 10 mA, a safe value.
  • Checking the fan:
    • Measure the voltage between N_FAN+ (fan positive wire) and GND:
      • Cold thermostat (relay deactivated): ~0 V, fan stopped.
      • Hot thermostat (relay activated): ~12 V, fan spinning at nominal speed.
    • If your multimeter has a current function:
      • Place the multimeter in series with the fan positive wire (between N_FAN+ and the fan) and measure the current I_FAN:
        • Typical values between 0.1 A and 0.3 A for small PC fans.
        • Make sure not to exceed the relay contacts’ maximum current.

Common mistakes and how to avoid them

  • Reversing the 1N4007 diode:
    • If you connect the diode the other way round (anode to +12V_SW and cathode to N_BOBINA), a direct short circuit will occur when powering the system.
    • Remember: the diode’s band (cathode) goes to +12V_SW, the anode to N_BOBINA.
  • Confusing coil contacts with relay power contacts:
    • Check in the datasheet or package diagram which pins are the coil and which are COM, NO and NC.
    • A typical mistake is connecting the fan to the coil pins, which will not work and may damage the coil or the fan.
  • Forgetting the freewheel diode:
    • Without the diode, when the thermostat opens, a high voltage spike is generated by the coil that can damage the thermostat, the switch or the supply.
    • Always place the diode in parallel with the relay coil.
  • Underestimating the fan current:
    • Make sure the relay supports at least 2–3 times the fan’s nominal current as a safety margin, especially if the fan has a hard start.
    • Check the specs on the fan housing (for example, “12 V 0.18 A”).

Safety

  • Always work with low voltage (12 V DC in this case); do not connect anything directly to the 230 V/120 V mains.
  • Before modifying wires or changing connections, disconnect the power supply.
  • Double-check polarity (+ and GND) before powering:
    • An accidental polarity reversal can damage the fan, the relay and the LED.
  • Do not completely block the fan during tests; let air circulate freely so as not to strain the motor.

Possible improvements

  • Replace the mechanical thermostat with a temperature sensor (for example, NTC or digital sensor) and a microcontroller (Arduino) to set the trip temperature in software.
  • Add a second relay or a buzzer that indicates excessive temperature when the fan does not start (fault).
  • Use a MOSFET and a solid-state relay if you later want to switch higher power loads or at higher frequency.
  • Integrate a fuse in series with the fan for short-circuit protection.

With this practical case you will have learned to use a relay to switch a moderate power load (the fan) from a simple low-power control signal (the thermostat), as well as to apply good practices such as the freewheel diode and the use of LED indicators.

More Practical Cases at Prometeo.blog

Find this product and/or books on this topic on Amazon

Go to Amazon

As an Amazon affiliate, I earn from qualifying purchases. If you buy through this link, you help keep this project going.

Quick Quiz

Question 1: What voltage does the fan operate at when the relay is activated?




Question 2: What is the purpose of the mechanical thermostat in the system?




Question 3: What temperature threshold is mentioned for activating the fan?




Question 4: What is the current range of the fan when activated?




Question 5: How quickly does the fan activate after the thermostat closes?




Question 6: Who is the target audience for this cooling automation system?




Question 7: What happens to the voltage at the relay coil when the thermostat opens?




Question 8: What is one application of the fan control system?




Question 9: What component is used to switch the fan on and off?




Question 10: What is the expected result when the temperature goes below the threshold?




More Practical Cases on Prometeo.blog

Carlos Núñez Zorrilla
Carlos Núñez Zorrilla
Electronics & Computer Engineer

Telecommunications Electronics Engineer and Computer Engineer (official degrees in Spain).

Follow me:
Scroll to Top