Arduino Based Temperature Controlled Fan Using DHT11 Sensor

Controlling temperature is very essential in many places such as smart houses, server rooms, and various types of industries where cooling is essential at all times. So this Arduino based temperature controlled fan can be very useful for understanding the basic principle, of how can we operate and maintain the temperature at our home. We can use this project anywhere as a portable device where the fan changes speed with the change in temperature.

In this project, I am going with a very common DHT11 temperature and humidity sensor for better results. This project can also be done in other simple ways as well using a thermistor or other temperature sensors like LM35, DS18B20 etc. But thermistor needs physical contact with hot surfaces which is not accurate in some cases and contactless sensors are costly. While DHT11 is a cost-effective sensor and also a minimal contactless sensor.

With this device, we can be able to change the fan speed in our home or any place according to the room temperature. It also displays the real-time temperature and the changes of fan speed on a 16×2 LCD display. We are using here an Arduino, a 16×2 LCD display, a DHT11 sensor module, and a DC fan.

Must Read Temperature Controlled DC Fan Without Any Microcontroller


Arduino Based Temperature Controlled Fan
Arduino Based Temperature Controlled Fan

Circuit Diagram

Arduino Based Temperature Controlled Fan Circuit Diagram
Arduino Based Temperature Controlled Fan Circuit Diagram

Components Required

  • Arduino
  • DHT11 Temperature & Humidity Sensor
  • 16×2 LCD Display
  • 2N2222 Transistor
  • 1KΩ Resistor
  • 12 Volt DC Fan
  • Breadboard
  • 12 Volt Power Supply
  • Wires

PCB Design

For removing messy wiring and give a clean look, I designed a PCB prototype for this project. It is also helpful for troubleshooting that runs great without any errors. To design this PCB board, I used EasyEDA as it is too easy to use. For ordering PCB for this, I prefer PCBWay.

Gerber file for Temperature Controlled Fan Using Arduino Gerber.

PCB View

Arduino Based Temperature Controlled Fan 2D View
2D View
Arduino Based Temperature Controlled Fan 3D View
3D View

Order PCB From PCBWay

There are so many forums or communities for electronics online in today’s technical world, and one of the famous ones for PCB manufacturing is PCBWay. PCBWay is a place that brings manufacturers and customers together. They have more than a decade of experience in this field of fabrication, prototyping and assembling PCBs. PCBWay have proved their focus to their customers’ needs in terms of cost-effectiveness, delivery, and quality.

Monthly Submission for PCBWay

Great opportunity for showing your creativity in electronics right now. PCBWay’s Open Source Community is a platform for sharing creative electronic projects and insightful knowledge for global project makers.

You can express your own ideas about electronics and also receive feedback from the community that is ready for you! Whenever you have some useful and practical ideas on how to design or develop an electronic project, or anything that you think should be discussed at PCBWay. By writing articles on your own unique ideas, you can earn reward points basis on your project as well as earn money. You are always welcome to post articles about electronic projects in their community. For detailed information just check out this link and start a fresh beginning. Monthly Submission for PCBWay.

How PCB Manufacturing Process Done in PCBWay

Standard quality for any product needs to be maintained using some parameters. PCBWay gives that opportunity by quality control in designing and manufacturing. At first, they ensure accuracy, clarity, validity of the PCB files that we sent to them.

Then all the boards will go through the most stringent tests other than the basic visual check. They adopt most of the testing and inspecting equipment used in the industry, such as Flying Probe Tester, X-Ray Inspection Machine, Automated Optical Inspection (AOI) Machine. PCBWay are having 50+ new engineers on the daily basis around the world using PCBs for their work, who trust for their reliable quality. They produce high-quality pink, orange, grey, even transparent solder mask. Moreover, according to people’s needs, they can also provide Black core PCB. Check it out for a High-Quality PCB solder mask. There are some pictures below of the new colours of solder musks.

Features of PCBWay

PCB Prototyping & Manufacturing: PCBWay produces FR-4 and Aluminum boards and advanced PCBs like Rogers, HDI, Flexible and Rigid-Flex boards, at a very reasonable price. Just check this Instant Quote to order premium PCBs for your hobby projects.

PCB Assembly: It not only offers PCB Prototyping but also offers PCB Assembly service. You can order a full PCB board with attached components by uploading your file. SMT & THT assembly starts from only 30$ including free stencil and worldwide shipping. The components can be sourced and provided by PCBWay, or by clients themselves.

Open Source Community: It not only offers PCB Prototype & Assembly service but also gives opportunities to students for sponsorships. I think this is so great. They feature their projects on the website also.

3D Printing & CNC: It also produces Rapid Prototyping like 3D printing, CNC Machining, Sheet Metal Fabrication, and Injection Molding. The quality of the product is too premium and reliable. And also the best part is that you will receive your order within a minimum of 3 days.

PCBWay Store: More boutique gift modules are waiting for you to discover, giving your creativity wings. You can order all types of electronic equipment, components and many more with exciting offers. Go with the link and buy your needs, PCBWay Store.

Services: PCBWay offers great servicing of its products. It takes only 3 to 15 days according to the courier service to deliver your products. Also, it has a live support facility. Whenever you have any problems, you can always reach a live customer service person to respond to your emails or messages. They have the “Return and Refund” principle, for every unusable board caused by PCBWay, they will rebuild and refund the order soon.

Working Principle of Arduino Based Temperature Controlled Fan

This project has three different parts. In the first part, the DHT11 sensor senses the surrounding temperature. In the second part, the microcontroller reads the input data from the DHT11 sensor and converts that data to a suitable Celsius value and drives the speed of the dc fan using a PWM signal. And the third one includes the display part where the 16×2 LCD display shows the real-time temperature and the speed of the dc fan.

A detailed demo of the DHT11 temperature and humidity measuring system where you will find the working principle of the DHT11 sensor.

The Analog value is then applied to the Analog to Digital converter pin of the Arduino. After that, the Analog value will be converted into a digital value using successive approximation methods. When the temperature value crosses the threshold value, Arduino sends a command signal to the motor driver using PWM output to switch on the dc fan.

We have created a PWM signal at the PWM pin of the Arduino board and applied it at the base terminal of the 2N2222 NPN transistor. Then transistor creates a voltage according to the PWM input given.

What is PWM Signal?

Pulse Width Modulation (PWM) or Pulse Duration Modulation (PDM) is a technique for reducing the average power delivered by an electrical signal. The average value of voltage or current fed to the load is controlled by turning the switch between supply and load on and off at a fast rate. It is basically a square wave which operates as a switch constantly on and off. It is widely used to control the speed of a DC motor and dimmable light bulb.

Working Value of DC Fan According to Temperature Value

TempPWM ValueSpeed

Applications of Arduino Based Temperature Controlled Fan

  • This device is useful for home automation systems where temperature maintenance is essential with automated technic.
  • Can be used in a CPU cooling system to reduce extra energy consumption.

Arduino Code

2 thoughts on “Arduino Based Temperature Controlled Fan Using DHT11 Sensor”

  1. Hi,
    I think there is a mistake in line 65.
    I think it should have been “else if(t==27)” and not “else if(t==20)”.

    Best regards,
    Avi Salto

Leave a Comment