This guide walks you through the process of building a Temperature-Controlled Fan System using an Arduino, DHT11 Sensor, and a Relay Module to automate your fan's operation based on the ambient temperature.
- Arduino (Uno/Nano): This will be the brain of the system, controlling the sensor and the relay.
- DHT11 Sensor: Used to monitor the temperature.
- Relay Module: To control the fan based on the sensor data.
- Fan: A 5V or 12V fan that will be controlled by the relay.
- Diode (1N4007): To protect the relay from voltage spikes when switching.
- Jumper Wires and Breadboard: To make the connections between components.
- VCC → Connect to the 5V pin on Arduino.
- GND → Connect to the GND pin on Arduino.
- DATA → Connect to Digital Pin 2 on Arduino.
- VCC → Connect to the 5V pin on Arduino.
- GND → Connect to GND pin on Arduino.
- IN → Connect to Digital Pin 3 on Arduino.
- NO (Normally Open) → Connect to the positive terminal of the fan.
- COM (Common) → Connect to the fan’s power supply.
- Connect the fan’s power wire to the NO terminal of the relay.
- Connect the fan’s ground wire to the COM terminal of the relay.
The main code is located in the fan_control.ino file. You can find the code in the repository.
- Open the Arduino IDE.
- Select your Arduino model under Tools > Board.
- Select the correct COM port under Tools > Port.
- Open the fan_control.ino file in Arduino IDE.
- Click Upload to upload the code to your Arduino.
- Power on the system using the Arduino and fan.
- Open the Serial Monitor in the Arduino IDE to see the temperature readings.
- If the temperature exceeds the threshold set in the code, the fan will automatically turn on.
- If the temperature is below the threshold, the fan will turn off.
- Ensure all connections are correct: Double-check the wiring of the sensor and relay.
- Serial Monitor doesn’t show readings: Make sure you have the correct DHT11 library installed and the correct sensor pin defined in the code.
- Fan doesn’t turn on/off: Check the relay wiring and ensure the fan is powered correctly.
- Relay Module: Relay Module on Amazon
- DHT11 Sensor: DHT11 Sensor on Amazon
- Arduino Uno: Arduino Uno on Amazon
This project is for educational purposes. Feel free to modify and build upon it. However, the code is shared for personal, non-commercial use only.
Created by [Your Name].