Introduction:

Using an Arduino, a DHT11 temperature sensor, a 5V fan, a potentiometer, and a 16x2 LCD display, we'll walk you through the process of building a temperature-controlled fan system in this tutorial. This project will give you a useful example of Arduino-based automation by enabling you to automatically change the fan speed based on the outside temperature.

Components Needed:

  1. Arduino Uno
  2. DHT11 Temperature Sensor
  3. 5V DC Fan
  4. Potentiometer
  5. 16x2 LCD Display (with I2C interface for simplicity)

Step 1: Connect the DHT11 Temperature Sensor

Begin by connecting the DHT11 temperature sensor, which will be responsible for reading the ambient temperature.

  • Connect the VCC (Power) pin of the DHT11 to the 5V pin on the Arduino.
  • Connect the GND (Ground) pin of the DHT11 to the GND pin on the Arduino.
  • Connect the DATA pin of the DHT11 to digital pin 2 on the Arduino.

Explanation: The DHT11 sensor communicates with the Arduino through the digital pin 2. It requires a power source (5V) and a ground connection for proper operation.

Step 2: Connect the 5V DC Fan

Note :-  you can use relay to use Ceiling Fan but in project i’m using this small dc fan

Next, connect the 5V DC fan. This fan will be controlled based on the temperature readings from the DHT11 sensor.

  • Connect the positive (red) wire of the fan to one terminal of the potentiometer.
  • Connect the other terminal of the potentiometer to the collector (middle pin) of a NPN transistor (e.g., 2N3904).
  • Connect the emitter (left pin) of the transistor to the GND pin on the Arduino.
  • Connect the base (right pin) of the transistor to digital pin 3 on the Arduino.

Explanation: The NPN transistor acts as a switch, allowing the Arduino to control the fan. By adjusting the potentiometer, we set the threshold temperature at which the fan will turn on.

Step 3: Connect the Potentiometer

Now, let's connect the potentiometer, which will allow us to set the threshold temperature for fan control.

  • Connect one end of the potentiometer to the 5V pin on the Arduino.
  • Connect the other end of the potentiometer to the GND pin on the Arduino.
  • Connect the middle pin (wiper) of the potentiometer to analog pin A0 on the Arduino.

Explanation: The potentiometer acts as a variable resistor, and by adjusting it, we can set the threshold temperature for fan activation. The analog reading from the potentiometer will be used to determine this threshold.

Step 4: Connect the 16x2 LCD Display (with I2C interface)

Finally, connect the 16x2 LCD display to provide a visual representation of the temperature and threshold.

  • Connect the VCC (Power) pin of the LCD to the 5V pin on the Arduino.
  • Connect the GND (Ground) pin of the LCD to the GND pin on the Arduino.
  • Connect the SDA pin of the LCD to analog pin A4 on the Arduino (for I2C data).
  • Connect the SCL pin of the LCD to analog pin A5 on the Arduino (for I2C clock).

Explanation: The I2C interface simplifies the connection to the LCD display. It requires power, ground, and two communication wires (SDA and SCL) to interface with the Arduino.

Arduino Code:

Now, let's take a look at the Arduino code that controls the temperature-controlled fan system. This code reads the temperature from the DHT11 sensor, compares it to the threshold set by the potentiometer, and controls the fan accordingly.

Explanation: The code initializes the DHT sensor, defines the pin connections, and continuously reads the temperature and adjusts the fan based on the threshold.

Step 5: Troubleshooting Tips:

If the fan is not working or you encounter issues, consider the following troubleshooting tips:

  • Double-check wiring connections for accuracy.
  • Ensure power is supplied to the fan, and the transistor is connected correctly.
  • Use the Serial Monitor to debug and print temperature readings and threshold

For more information whatch this video :- Indian Life Hacker https://www.youtube.com/watch?v=eg8AlYlV0PM