Smart Cooling Fan
Inventor · Ages 13–16
- 1Read the conceptLearn the big idea behind this project.
- 2Check the partsSee which parts the robot needs.
- 3Follow the build stepsBuild it step by step, then test it.
- 4Answer the quizTap one answer for each of the 10 questions to earn XP.
💡 The concept
A temperature sensor measures how warm the room is. Your program compares the reading with a target: when the room gets hotter than 26°C it switches a small fan on, and when it cools down the fan stops. The fan changes the very thing being measured — that loop is automatic feedback control, exactly how an air conditioner works.
Parts you need
- Temperature sensor (DHT11)
- Small DC fan (5V)
- Transistor + diode (or relay)
- Microcontroller
- Battery
🔎 Parts specification
Exactly what each part is, which models to buy, and what it does.
Microcontroller▸
Suggested models: Arduino Uno R3, Raspberry Pi Pico, or ESP32
Features: Reads the sensor and switches the fan through a transistor. The DHT11 needs one digital pin and the free 'DHT sensor library'. An ESP32 could also send the temperature to your phone over Wi-Fi.
Temperature sensor▸
Suggested models: DHT11 (blue) or DHT22 (white, more accurate)
Features: Measures temperature (0–50°C, ±2°C) and humidity in one tiny package. Three pins: power, data, ground. Always read sensors through a library — never guess the numbers.
Fan▸
Suggested models: 5V DC brushless fan, 30–80mm (an old PC case fan is perfect)
Features: Spins whenever you give it 5V. PC case fans are cheap, quiet, and easy to rescue from an old computer with a grown-up's help.
Transistor + diode▸
Suggested models: TIP120 or 2N2222 with a 1N4001 diode, or a relay module
Features: A microcontroller pin is far too weak to spin a fan. The transistor is an electric switch: a tiny signal from the board lets battery power flow to the fan. The diode protects the board from the fan's 'kick-back' when it stops.
Battery / power▸
Suggested models: 4×AA pack or USB
Features: Fan and board must share a common ground. Keep the battery off while wiring.
💻 Program the microcontroller
📲 App to use: Arduino IDE with the free 'DHT sensor library' + 'Adafruit Unified Sensor' (install both from Library Manager)
MicroPython option: on a Raspberry Pi Pico use Thonny and the dht module — dht.DHT11(Pin(2)).measure() then dht.temperature().
// Arduino IDE (C++) — Smart Cooling Fan
#include <DHT.h>
DHT dht(2, DHT11); // sensor data on pin 2
const int FAN = 8; // transistor pin
const int HOT = 26; // degrees C
void setup() {
dht.begin();
pinMode(FAN, OUTPUT);
}
void loop() {
float temp = dht.readTemperature();
if (temp > HOT) {
digitalWrite(FAN, HIGH); // cool down!
} else {
digitalWrite(FAN, LOW);
}
delay(2000);
}🧠 How it works: readTemperature() returns degrees Celsius as a decimal number (a float). If it is above 26, the fan pin goes HIGH and the transistor lets battery power spin the fan. Checking only every 2 seconds stops the fan flicking on and off. To stop it chattering right at the limit, use two numbers: switch on above 27 and off below 25 — that trick is called hysteresis.
🛠️ Build it step by step
Press Play to watch every part go into place and every wire connect. Ask a grown-up to help with real wiring!
Step 1 of 6
🔋 Power the board
Connect the battery pack to the microcontroller and make sure the fan's power and the board share a common ground. Battery OFF for now.