Fan Control System

by 844932 in Circuits > Arduino

208 Views, 2 Favorites, 0 Comments

Fan Control System

IMG_0266.jpg
IMG_0298.jpg

Hello, my name is Suvan Khasnobish, and for my final project, I used Arduino to create software for a PC fan control system. In this circuit, I used an OLED display to show the current room temperature, fan mode (automatic or manual), and fan status (on/off). In this project, the joystick and the push button serve as input devices, and the DC fan serves as an output device that can be toggled on and off based on the room temperature if it is in Automatic mode or if the joystick is pulled to the left side in Manual mode.

Supplies

IMG_0299.jpg

1) x1 OLED Display

2) x1 Push button

3) x1 Joystick

4) x1 DC Fan

5) x13 Jumper wires

6) x1 10k Ohm resistor

7) x1 LM35 Temperature sensor

8) x1 Breadboard

6) x1 Arduino board & cable

OLED

In the first step, I downloaded the Adafruit libraries for the OLED display and connected them to the appropriate ports. I intended to use the OLED display to read real-time temperature values obtained from the LM35 temperature sensor, as well as to display the fan mode and status, similar to how fan controlling software is found to be in many modern-day gaming computers.

Joystick

In my second step, I correctly wired the PS2 joystick using the RFID Kit website as a guide. After that, I programmed the joystick to act as an input device to control the fan, turning it on when the joystick was left in neutral and off when it was moved to the left side (reading an x-value of 0). As a result, the joystick served as a switch for the fan's manual mode, allowing the user to turn it on and off at any time.

Push Button

The push-button in this project was used to switch between the fan control system's automatic and manual modes. I connected one leg of the button to power, the other leg to ground via a 10k Ohm resistor, and a jumper wire from the ground side to an Arduino digital pin. This enabled me to program the button to digitally read its status and switch to the Automatic fan mode when pressed. While the button is pressed, I coded the circuit to turn off the fan and display the live room temperature on the OLED display.

Temperature Sensor

I wired the temperature sensor's outer legs to ground and power, then connected the middle leg to an Arduino digital pin. I used the temperature sensor in my control system's Automatic fan mode to save energy by automatically disabling the DC fan when the sensor reads a room temperature of less than 18 degrees Celsius. When the push button was pressed, it also displayed real-time room temperature, allowing the user to understand when the fan would turn off.

DC Fan

Finally, I connected one of the fan's ports to the breadboard's ground rail and the power to a digital pin on the Arduino board. Because I had already written the majority of the program, all I had to do was upload it to the Arduino to improve and debug it after ensuring that my fan worked as expected.

Final Program

Screenshot 2022-06-20 152511.png
Screenshot 2022-06-20 152541.png
Screenshot 2022-06-20 152600.png

The first section of code simply declares all variables, including the ports to which each component is connected, as well as the OLED and LM35 libraries. In Void Setup, I specify the push button as an input and the fan as an output, and then, on line 30, I initialize the OLED display and configure the font size, text colour, and position. When called at a specific position on the screen, the function "Void oledDisplaycenter" reads the temperature value from the LM35 and prints it. In line 62 in "void loop", I created an "if" statement for the joystick so that every time the stick is pulled to the left side and the x-value becomes 0, the Arduino board will read the analog value of the x Pin and do two tasks at once. It will first prepare the information to be printed on the OLED by selecting an appropriate position and font size, and then it will digitally write the fan value as "LOW" to turn off the DC fan. The fan mode and fan status will then be printed and displayed on the OLED screen. If these conditions are not met, the else statement at line 74 will take effect, allowing the fan to run as long as the joystick is not pulled to the left. At line 88, I added a while loop so that whenever the user presses the button, the Arduino will read the ADC values from the LM35 sensor and convert them to Celsius so that they can be displayed correctly after calling the "void oledDisplayCenter" function at line 101. Furthermore, while holding down the button, it will print a new Fan mode of "Automatic" so that the user can differentiate between the two modes using the OLED screen. Finally, at line 107, I added another while loop to turn off the fan if the temperature is less than 18. This concludes my project, and I would like to thank you for taking the time to watch my presentation.