Controlling temperature is very essential in many places such as smart houses, server rooms, 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 that, 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 of 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 contacts of 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
- DHT11 Temperature & Humidity Sensor
- 16×2 LCD Display
- 2N2222 Transistor
- 1KΩ Resistor
- 12 Volt DC Fan
- 12 Volt Power Supply
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.
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 the 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 their products. It takes only 3 to 15 days according to 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.
Guide for Ordering PCB From PCBWay
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 suitably Celsius value and drive 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 about the DHT11 on 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 digital value using successive approximation method. When the temperature value cross 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 of 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 in which this 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 on Temperature Value
Applications of Arduino Based Temperature Controlled Fan
- This device is useful for home automation system where temperature maintanence is essential with automated technic.
- Can be used in CPU cooling system to reduce extra energy consumption.
#include "DHT.h" //Library for DHT11 sensor
#include<LiquidCrystal.h> //Library for 16x2 LCD display
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); //Define 16x2 LCD display pins
#define DHTPIN A0 //Define analog pin A0 as DHT11 sensor pin
#define DHTTYPE DHT11
#define pwm 10 //Define digital pin 10 as PWM output
//You can use either D9 or D10 as a PWM output
byte degree =
//Initialize DHT sensor for normal 16MHz Arduino
DHT dht(DHTPIN, DHTTYPE);
lcd.print(" DC Fan ");
float t = dht.readTemperature();
Serial.println("Failed to Read From DHT Sensor");
lcd.print(t); //Showing temperature on LCD display
lcd.print("Fan Speed= 0% ");
lcd.print("Fan Speed= 20% ");
lcd.print("Fan Speed= 40% ");
lcd.print("Fan Speed= 60% ");
lcd.print("Fan Speed= 80% ");
lcd.print("Fan Speed= 100% ");
2 thoughts on “Arduino Based Temperature Controlled Fan Using DHT11 Sensor”
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)”.
Thank you for that clarification. It was my mistake