Arduino - Control Fan
Arduino can not only turn on/off the fan but also control the fan's speed.
In this tutorial, we are going to learn how to turn on/off a fan using Arduino. Controlling the fan's speed will be presented in another tutorial.
|1||×||Arduino UNO or Genuino UNO|
|1||×||USB 2.0 cable type A/B|
|1||×||12V Cooling Fan|
|1||×||12V Power Adapter|
How to Control Fan
- If 12V fan is powered by 12V power supply, it run with full speed.
- If 12V fan is powered by 12V PWM signal, The fan's speed can be controlled.
In this tutorial, we are going to learn how to turn on/off a fan using Arduino. Controlling the fan's speed will be presented in another tutorial. To turn on/off a fan, we need to use a relay in between Arduino and fan. Arduino can turn on/off the fan via the relay. If you do not know about relay (pinout, how it works, how to program ...), learn about relay in the Arduino - Relay tutorial
Image is developed using Fritzing. Click to enlarge image
The below code repeatedly turns the fan ON in five seconds and OFF in five seconds,
- Connect Arduino to PC via USB cable
- Open Arduino IDE, select the right board and port
- Copy the above code and open with Arduino IDE
- Click Upload button on Arduino IDE to upload code to Arduino
- See the fan's state
Read the line-by-line explanation in comment lines of code!
We are considering to make the video tutorials. If you think the video tutorials are essential, please subscribe to our YouTube channel to give us motivation for making the videos.
Do more with fan
The Best Arduino Starter Kit
- Arduino - Relay
- Arduino - Controls Pump
- Arduino - Button - Relay
- Arduino - Button Toggle Relay
- Arduino - Potentiometer Triggers Relay
- Arduino - Light Sensor Triggers Relay
- Arduino - Ultrasonic Sensor - Relay
- Arduino - Motion Sensor - Relay
- Arduino - Cooling System using DHT Sensor
- Arduino - Cooling System using DS18B20 Temperature Sensor
- Arduino - Touch Sensor - Relay
- Arduino - Touch Sensor Toggle Relay
- Arduino - Door Sensor - Relay
- Arduino - Door Sensor Toggle Relay