TEMPERATURE INDICATOR AND FAN CONTROLLER

Photo of author

By Jackson Taylor

Home » Examples » Project Done In 2014-15 » TEMPERATURE INDICATOR AND FAN CONTROLLER

As an Amazon Associate we earn from qualifying purchases.

A temperature controlled fan switches itself on when a room, enclosure or piece of equipment gets too warm. This project shows a simple analog version: a temperature sensor, an op amp, a potentiometer to set the limit, and a relay that switches the fan. It needs no microcontroller and no programming, which makes it a good first circuit for anyone learning how sensors and comparators work together.

How the circuit works

The fan turns on when the temperature reaches a pre-selected limit. A two-way switch is used in the circuit for this purpose. The rest of the design is built from four main parts:

  • LM35 temperature sensor: senses the temperature.
  • LM324 op amp: receives the sensor output and compares it with a reference voltage.
  • Potentiometer: sets the pre-selected range, meaning the temperature at which the fan switches on.
  • SPST relay: acts as the driver that switches the fan on and off.
Circuit diagram of LM35 temperature sensor, LM324 op amp, potentiometer and relay driving a fan
Circuit of the temperature indicator and fan controller.

The role of each component

LM35 sensor

The LM35 is an analog sensor whose output voltage rises in a straight line with temperature, at about 10 mV for every degree Celsius. That makes the maths easy: a reading of 300 mV corresponds to roughly 30 °C. Because the output is a plain voltage, you can feed it straight into an op amp without extra conversion.

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video

LM324 as a comparator

The LM324 contains four op amps in one package. Here one of them is used as a comparator. The sensor voltage goes to one input and the voltage from the potentiometer goes to the other. When the sensor voltage rises above the reference, the output of the op amp swings high, and that signal is used to switch the relay.

Potentiometer for the set point

The potentiometer works as a voltage divider that produces the reference voltage. Turning it up or down moves the temperature at which the fan starts. This is what lets you choose the pre-selected range without changing any components.

See also
QUADRUPLE BOOST CONVERTER CLOSED LOOP SIMULATION USING FUZZY LOGIC IN MATLAB

Relay and fan

The op amp output cannot supply enough current to drive a relay coil directly in most cases, so a small transistor is normally placed between them. The SPST relay then closes its contact and powers the fan. A diode placed across the relay coil protects the rest of the circuit from the voltage spike that appears when the coil turns off.

Parts you will need

Building and setting up the circuit

  1. Wire the LM35 to the supply and ground, and connect its output pin to one input of the LM324 comparator stage.
  2. Connect the potentiometer between the supply and ground, and take its middle pin to the other comparator input.
  3. Connect the op amp output to the transistor base through a resistor, and put the relay coil and its protection diode in the transistor collector path.
  4. Wire the fan through the relay contacts. Check that the contacts are rated for the fan’s voltage and current.
  5. Add an LED with a series resistor if you want to see when the fan has been switched on.
  6. Power the circuit and turn the potentiometer until the fan is just off at room temperature.
  7. Warm the sensor gently, for example with your fingers, and check that the fan switches on. Adjust the potentiometer for the temperature you actually want.

Tips for better results

  • Add a little hysteresis. Without it, the relay can chatter on and off when the temperature sits right at the set point. A high-value resistor from the op amp output back to its non-inverting input is the usual fix.
  • Place the sensor carefully. Keep it near the heat source or in the air you want to measure, and away from the fan’s own airflow if that causes false readings.
  • Keep sensor wires short. Long leads can pick up noise, which matters because the signal is only a few hundred millivolts.
  • Check the supply. Make sure the supply suits the LM35, the LM324 and the relay coil. A regulated supply gives a more stable set point.
See also
RELAY - SOLID STATE

Safety when switching a mains fan

The low-voltage control side of this circuit is safe to experiment with. The fan side is different. If you switch a mains-powered fan through the relay, the contacts will carry dangerous voltage. Use a relay rated for mains, keep the wiring insulated and inside an enclosure, and keep it separate from the low-voltage section. If you are not experienced with mains wiring, use a low-voltage DC fan instead.

Ways to extend the project

Once the basic circuit works, you can add more features. Extra LEDs can show temperature bands, or you can add a buzzer for over-temperature warnings. If you prefer a programmable approach, you can learn how to read a temperature sensor with Arduino and set the fan threshold in code. It is also worth comparing other temperature sensors if you need a different range or a digital output.

The same switching idea appears in other home projects. You can see how to control a light and fan with a TV remote, or build a Wi-Fi controlled fan that also lets you change the speed.

Frequently asked questions

Can I build this without a microcontroller?

Yes. This design uses only an LM35 sensor, an LM324 op amp, a potentiometer, a transistor and a relay. All the decision-making happens in the comparator, so no code is required.

How do I change the temperature at which the fan turns on?

Turn the potentiometer. It sets the reference voltage that the sensor voltage is compared against, so moving it shifts the switching point up or down.

Why does the relay need a diode across its coil?

When the coil is switched off, it produces a voltage spike that can damage the transistor or the op amp. The diode gives that energy a safe path.

Can I use this to cool electronics or a PC enclosure?

Yes, with a suitable low-voltage DC fan and a relay or transistor rated for it. Place the sensor close to the parts that get hot, and set the potentiometer so the fan starts before temperatures become a concern.

Sustainable Tech

Keep Toxic E-Waste Out of Landfills

Don't throw away your failing laptop, phone, or car batteries. Learn how to recondition them at home in just a few hours. It's better for the planet—and your wallet.

Learn How It Works
See also
Hall Effect Sensor A3144

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works