# 🔥 Automatic Fan Speed Controller (Temperature-Based)
## 📌 Project Overview
The Automatic Fan Speed Controller is a smart automation system that automatically controls the speed of a DC fan based on temperature.
The system uses:
- Arduino Uno
- DHT11 temperature sensor
- MOSFET
- DC fan
When temperature increases, the fan speed increases automatically.
---
# 🛠️ Components Used
| Component | Function |
|---|---|
| Arduino Uno | Main controller |
| DHT11 Sensor | Reads temperature |
| DC Fan | Cooling device |
| MOSFET (IRLZ44N) | Controls fan speed |
| 10kΩ Resistor | Pull-up resistor |
| 220Ω Resistor | Protects MOSFET |
| 1N4007 Diode | Prevents voltage spikes |
| Power Supply | Powers the fan |
| Jumper Wires | Connections |
---
# 🔌 Pin Connections
## 🌡️ DHT11 Sensor
| DHT11 Pin | Arduino |
|---|---|
| VCC | 5V |
| DATA | D2 |
| GND | GND |
### Additional Connection
- 10kΩ resistor between VCC and DATA
---
## ⚡ MOSFET Connections
### MOSFET Pin Arrangement
```text
Flat side facing you:
LEFT = Gate (G)
MIDDLE = Drain (D)
RIGHT = Source (S)
```
| MOSFET Pin | Connection |
|---|---|
| Gate | Arduino D9 through 220Ω resistor |
| Drain | Fan negative (-) |
| Source | GND |
---
# 🌀 Fan Connection
| Fan Wire | Connection |
|---|---|
| Positive (+) | External Power Supply + |
| Negative (-) | MOSFET Drain |
---
# ⚠️ Diode Connection
| Diode Side | Connection |
|---|---|
| Stripe Side | Fan Positive (+) |
| Other Side | Fan Negative (-) |
---
# 🧠 Working Principle
1. DHT11 reads temperature.
2. Arduino processes the temperature value.
3. Arduino sends PWM signal to MOSFET.
4. MOSFET controls fan speed.
5. Higher temperature → higher fan speed.
6. Lower temperature → lower fan speed.
---
# 🚨 Problems Faced
| Problem | Solution |
|---|---|
| Error reading temperature | Corrected wiring and added resistor |
| Fan not spinning | Fixed MOSFET connection |
| Fan always full speed | Corrected PWM code |
---
# 💻 Arduino Code
```cpp
analogWrite(FAN_PIN, fanSpeed);
```
---
# 🌍 Applications
- Smart home cooling
- Computer cooling systems
- Industrial automation
- Greenhouse temperature control
---
# ✅ Conclusion
The Automatic Fan Speed Controller is an intelligent embedded system that improves cooling efficiency and automates temperature control using Arduino and sensors.