• Home
  • Articles
  • Basics
  • Components
  • Projects
  • Communications
  • MCQ

WatElectronics.com

You are here: Home / Electronics / DIY USB Fan Powered by a Temperature Sensor

DIY USB Fan Powered by a Temperature Sensor

June 30, 2025 By WatElectronics

This article explains how to design a DIY USB fan that is powered by a temperature sensor. Additionally, it provides instructions on how to use a temperature sensor (LM35 or DHT11) to trigger a fan, how to power the project via USB, how to build a control circuit using a transistor, and how to test, calibrate, and upgrade the system.

DIY USB Fan Powered by a Temperature Sensor

The required components to make this DIY USB fan powered by a temperature sensor include the following.

DIY USB Fan Powered by a Temperature Sensor

DIY USB Fan Powered by a Temperature Sensor

  • LM35 or DHT11 Sensor.
  • USB Fan (or 5V DC Fan).
  • NPN Transistor (e.g., 2N2222 / BC547).
  • Diode (1N4007).
  • 10K Ohm Resistor.
  • USB Male Plug or Cable.
  • Breadboard or PCB.
  • Jumper Wires.
  • Optional: Arduino Uno (if using DHT11).

Working Principle

The temperature sensor reads ambient temperature. Once the temperature exceeds a set threshold, it activates a transistor, which turns on the fan by allowing current to flow. The fan shuts off when the temperature drops below the threshold.

DIY USB Fan Circuit Diagram Overview

  • LM35 connected: VCC to +5V, GND to GND, OUT to transistor base via 10K resistor.
  • Transistor: Collector to fan (+), Emitter to GND, Fan (-) to GND.
  • Flyback diode (1N4007) across fan terminals.

Step-by-Step Instructions

The step-by-step instructions for DIY USB fan powered by a temperature sensor include the following.

  • Connect the LM35 to power and the output pin.
  • Connect the fan via the transistor circuit.
  • Use USB 5V to power the setup.
  • Use heat (like your hand) to test the fan activation.

Optional Upgrade using Arduino

  • Use DHT11 with Arduino to read temperature and control the fan.
  • The sample code checks if the temperature > 30°C to turn on the fan via the digital pin.
  • Optional Upgrade Using Arduino
  • If using a DHT11 sensor, connect it to an Arduino:

Sample Arduino Code:

#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11, FAN_PIN 8
DHT dht(DHTPIN, DHTTYPE);
void setup() {
pinMode(FAN_PIN, OUTPUT);
dht.begin();
}
void loop() {
float temp = dht.readTemperature();
if (temp > 30) {
digitalWrite(FAN_PIN, HIGH);
} else {
digitalWrite(FAN_PIN, LOW);
}
delay(2000);
}

DIY USB Fan Estimated Cost

Item

Approx. Cost (INR/USD)

All Basic Components

300 INR / $4

With Arduino Upgrade

800 INR / $10

Tools (Breadboard, wires)

150 INR / $2

Total: 300 INR to 800 INR (~$4 to $10) depending on your setup.

Advantages

The advantages of a DIY USB fan include the following.

  • Low cost and easy to build
  • USB-powered (can run from power banks)
  • Great learning tool for beginners
  • Ideal for Raspberry Pi/Arduino enclosures

Safety & Tips

The safety tips for a DIY USB fan are mentioned below.

  • Don’t draw more than 500mA from a USB 2.0 port
  • Use transistor-rated fans only (5V types)
  • Add heatsinks or MOSFET if fan load exceeds 200mA

Conclusion

Building a USB fan controlled by a temperature sensor is a simple and rewarding electronics project
for anyone curious about automation, thermal control, or Arduino basics. Whether you’re using it to
cool a device or just as a smart desk fan, this project is scalable, customizable, and affordable.

Filed Under: Electronics Tagged With: Temperature Sensor, USB

Recent Posts

  • DIY Solar USB Phone Charger : Step-by-Step Guide
  • DIY USB Fan Powered by a Temperature Sensor
  • LM3876 IC : PinOut, Features, Specifications, Circuit, Working & Its Applications
  • KY-034 Module : PinOut, Features, Specifications, Interfacing, Working & Its Applications
  • Voice-Controlled Home Automation using IFTTT and ESP8266
  • LM7818 IC : PinOut, Features Equivalent, Circuit, Working, Datasheet & Its Applications
  • KY-012 Active Buzzer Module : PinOut, Features, Specifications, Interfacing, Working, Datasheet & Its Applications
  • KY-025 Module : PinOut, Features, Specifications, Interfacing, Working, Datasheet & Its Applications
  • SSD1306 OLED Display : PinOut, Features, Specifications, Interfacing & Its Applications
  • KY-011 LED Module : PinOut, Features, Specifications, Interfacing, Datasheet & Its Applications
  • LM1458 IC : PinOut, Features, Specifications, Circuit, Working, Datasheet & Its Applications
  • UM3561 IC : PinOut, Features, Specifications, Circuit, Working & Its Applications

Categories

  • Articles (20)
  • Basics (110)
  • Communications (54)
  • Components (237)
  • Digital Electronics (43)
  • Digital Signalling (3)
  • Electronics (227)
  • Embedded Systems (12)
  • Magnetism (5)
  • Microprocessors (3)
  • Modulation (1)
  • Projects (15)

Subscribe to Our Newsletter

Don’t miss these articles!

We don’t spam! Read our privacy policy for more info.

Check your inbox or spam folder to confirm your subscription.

Category

  • Electronics
  • Components
  • Digital Electronics
  • Embedded Systems
  • Projects

Copyright © 2025 · WatElectronics.com | Contact Us | Privacy Policy