You are currently viewing Automatic Temperature Controlled Fan

Automatic Temperature Controlled Fan

Automatic Temperature Controlled Fan DIY kit

This project is based on the Real-Time temperature fan control .We use a DHT11 module which can measure the temperature and humidity fairly accurately and a 3inch cpu fan

 

Requirements :
● Computer with an internet connection
● Download and install Arduino IDE

Components

DHT11 Temperature and humidity sensor

5v Relay Module

3 inch CPU fan

Arduino UNO

Jumper wires

9v battery

9v Battery

Hardware

Getting
Started with
Arduino UNO

Arduino Uno

Although there are many types of boards from arduino . Here we are going to be using the Arduino UNO as it is the most commonly used one. The arudino UNO has :

  • The operating voltage is 5V
  • The recommended input voltage will range from 7v to 12V
  • Digital input/output pins are 14
  • Analog i/p pins are 6
  • DC Current for each input/output pin is 40 mA
  • Flash Memory is 32 KB
  • SRAM is 2 KB
  • EEPROM is 1 KB
  • CLK Speed is 16MHz

Another wonderful feature of the arduino is the option of using a add-on boards to the arduino which comes as a module and they are known as “Shields”

Pin out diagram
Arduino UNO

DHT11 Temperature and Humidity Sensor

The DHT 11 is a low powered electronic device with lets us get the value of the temperature and the moisture and it use 1 wire protocol

The three pins of the DHT 11 is the VCC , GND , and DATA pin and through the DATA pin will the information of the temperature and the humidity will be sent. DHT 11 is not the best temperature and humidity sensing module out in the market but it is reasonably accurate .It is about +-5% and +-2% accurate for temperature and humidity 

 

What is humidity?

Humidity is the amount of moisture content in the air , here we are checking the humidity as the percentage (sofor example if the DHT module is showing 60% , that means the amount of water vapour in the air is about 60%. If the DHT is showing 100% , then the DHT module might not be working or if the DHT module is under water.

The world’s lowest recorded relative humidity value occurred at Coober Pedy in the South Australia desert when the temperature was 93 degrees and the dew point was minus 21 degrees producing a relative humidity of 1 percent. (source: ‘www.chicagotribune.com’)

Circuit Diagram

dht 11 arudino

STEP 1: CONNECTING A THREE PIN DHT11

  •  DHT11 VCC -> Arduino 3v3
  •  DHT11 Signal -> Arduino Analog pin A0
  •  DHT11  GND -> Arduino GND
relay arduino

STEP2: CONNECTING THE RELAY MODULE

  • DHT11 VCC -> Arduino 5v
  • DHT11 Signal -> Arduino 3 (Digital pin 3)
  • DHT11  GND -> Arduino GND
fan temp

wire up the Relay module‘s COM (common) and NO (normally open) to the fan and the 9V battery 

The final circuit should look like this

 

Getting started with Arduino

Before starting any project with the arduino , you need to first let the arduino connect and communicate with your computer .This is done by using the software which is used for programming the arduino called the Arduino IDE

Installing The Arduino Software Package On Windows

Head over to the arduino.cc website or superkits.com to download arduino IDE and continue with the project

Download Arduino IDE

 

 

After installing the arduino IDE , we then need to use the printer usb cable which is provided with the arduino . We plug in one of the ends to the arduino and the other to the Desktop 

If you used the Installer, as soon as you connect your board the Windows – from XP up to 10 – will install drivers automatically

If the board is not properly recognized when the zip package is downloaded and expanded, please follow the procedure below.

  • START menu> CONTROL PANEL MENU
  • From the control panel, check for System and Security
  • Select system
  • Select Device Manager from the System window
  • Select open port named “Arduino UNO (COMxx)”, under Ports (COM & LPT). If there is no COM & LPT section, check “Other Devices” for “Unknown Device”.
  • Choose the “Update Driver Software” option by right-clicking on the “Arduino UNO (COmxx)” port
  • Navigate to the “Browse my computer for Driver software” option.
  • Choose the driver file named “arduino. inf”, located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB Drivers” sub-directory). If you are using an old version of the IDE (1.0.3 or older), Choose the Uno driver file named “Arduino UNO.inf”, If an old version of the IDE (1.0.3 or older) is used
  • Thus the windows driver installation is completed

Install DHT11 Library for Arduino IDE

1.Install DHT11 as ZIP file in Arduino IDE

DHT11 library is available as a downloadable ZIP.

Click the link to download the DHT11 library

 Download DHT11 Library

(Do not unzip the library file which you downloaded)

  1. Open Arduino IDE, and then goto Sketch > Include Library > Add .ZIP Library. Select the option “Add .ZIP Library‘ 
  2. Select the library zip file which you have downloaded. 
  3. Return to Sketch>Iclude Library menu.
    you should now be able to see the new library which we just installed ,at the bottom of the menu ,which we are able to be used in our sketch

Select your board type : Arduino Uno and port

Go to port>tools> serial device
here you select the serial device of the board. (ex. COM3/COM4/COMxx) 

To find out which COM port your arduino board might be , you can always disconnect the arduino ,then open the port drop down tab. After seeing which COM port got disconnected , you can choose that after reconnecting the Arduino board


Press CNTRL + A and press DELETE on keyboard for clearing the Arduino IDE page

Upload the program

Now, click the “UPLOAD button”
and you will be able to see the RX and TX leds on the board flashing. If the upload is done successfully then the message “Done uploading ” will appear in the status bar.

Sketch Code

#include <dht.h>
#define dht_apin A0 // Analog Pin sensor is connected to dht data pin
#define temp 35 //change this number to your prefered temperature
float Temp = 0;
dht DHT; //initialize the dht sensor


const int RELAY_PIN_1 = 3; //relay pin is at digital pin 3

void setup() {
  Serial.begin(9600);
  pinMode(RELAY_PIN_1, OUTPUT);//serial port communication begins with the arduino
  delay(1500);//Wait before accessing Sensor

}

void loop() {
  DHT.read11(dht_apin);  //read dht11 data value
  Temp = DHT.temperature;
  Serial.println(Temp);
  if (Temp > temp)
    digitalWrite(RELAY_PIN_1, LOW); //if the temp is greater , the fan is turns on
  if (Temp < temp)
    digitalWrite(RELAY_PIN_1, HIGH); //if the temp is lower , the fan is turned off
  delay(2000);//Wait 5 seconds before accessing sensor again.

} 

Output

You should see the fan turn on and off according to the temperature difference.

Leave a Reply