How to Control Fan Speed with Temperature using Arduino Uno

Controlling the speed of a fan based on temperature can be a useful way to maintain the temperature in a room, a computer, or even a greenhouse. This can be accomplished using an Arduino Uno board, which is an open-source microcontroller that can be programmed to perform various tasks, including controlling the speed of a fan. In this guide, we will walk you through the steps required to control fan speed with temperature using an Arduino Uno board.

Step 1: Gather Materials

To get started, you will need the following materials:

  • Arduino Uno board
  • Breadboard
  • Jumper wires
  • Temperature sensor (LM35 or DHT11)
  • NPN transistor (2N2222 or BC547)
  • DC fan
  • 1k ohm resistor

Step 2: Wiring

Before we can start programming the Arduino Uno board, we need to connect all the components together. First, we will connect the temperature sensor to the Arduino board. If you are using the LM35 temperature sensor, connect the following pins:

  • LM35 Vcc to Arduino 5V
  • LM35 GND to Arduino GND
  • LM35 Vout to Arduino A0

If you are using the DHT11 temperature and humidity sensor, connect the following pins:

  • DHT11 Vcc to Arduino 5V
  • DHT11 GND to Arduino GND
  • DHT11 data pin to Arduino D2

Next, we will connect the NPN transistor to the Arduino board. Connect the following pins:

  • NPN transistor emitter to Arduino GND
  • NPN transistor collector to the negative lead of the DC fan
  • NPN transistor base to Arduino D3 through a 1k ohm resistor

Finally, connect the positive lead of the DC fan to Arduino 5V.

Step 3: Programming

Now that we have all the components connected, we can start programming the Arduino Uno board. We will be using the Arduino IDE (Integrated Development Environment) to write and upload the code to the board. If you do not have the Arduino IDE installed, you can download it from the official Arduino website.

Step 4: Uploading and Testing

Once you have the code written, you can upload it to the Arduino Uno board by connecting the board to your computer via USB and selecting the correct board and port in the Arduino IDE. Then, click the “Upload” button to upload the code to the board.

After uploading the code, you can test the fan speed control by using a heat source, such as a hair dryer, to heat up the temperature sensor. As the temperature rises, the fan should start to spin faster. When the temperature drops below 30°C, the fan should stop spinning.

Conclusion

Controlling fan speed with temperature using an Arduino Uno board is a useful project for anyone who wants to maintain a certain temperature in a room or other environment. With the help of a temperature sensor and an NPN transistor, you can program the Arduino Uno board to control the speed of a DC fan. By following the steps outlined in this guide, you can easily set up your own fan speed control system using an Arduino Uno board.

Leave a Comment