Temperature Activated Fan
This a project I decided to take on because I have spent a lot of this quarantine playing video games on my Desktop. I got this idea from originally building my home PC and looking at the different components and how they work. I thought it would be cool to design my own CPU Cooler that lets you know when it's overheating by playing a sound and turning on a fan much like how a real one would work. It also has adjustable volume in case you do not want the sound to be loud or to be heard at all. It won't look like that picture, but it will work the same way it does.
Supplies
You will need
- Piezo
- 2 LEDs
- Breadboard
- Arduino Uno
- Wires
- DC Motor
- H-Bridge
- Potentiometer
- Temperature Sensor
Implementing the Components
Since we're using a breadboard we have to be organized and efficient with our space, so this is how I decided to organize the main components on the breadboard.
Wiring
The wiring is going to be the longest step since it requires a lot of parts to be connected to other parts. We will go component by component to make it easier. The image is roughly what the wires are supposed to look like.
Arduino
- 5V --> Power Bus
- GND --> Ground Bus
Breadboard
- Power Bus (Bottom) --> Power Bus (Top)
- Ground Bus (Bottom) --> Ground Bus (Top)
H-Bridge:
- Enable 1 & 2 --> D2
- Input 1 --> D3
- Output 1 --> Terminal 1 (DC Motor)
- Ground --> Ground Bus
- Ground --> Ground Bus
- Output 2 --> Terminal 2 (DC Motor)
- Input 2 --> D4
- Power 2 --> Power Bus
- Power 1 --> Power Bus
DC Motor
- Terminal 1 --> Output 1 (H-Bridge)
- Terminal 2 --> Output 2 (H-Bridge)
TMP36
- Power --> Power Bus
- Vout --> A0
- GND --> Ground Bus
Potentiometer
- Terminal 1 --> Ground Bus
- Wiper --> Positive (Piezo)
- Terminal 2 --> D7
Piezo
- Positive --> Wiper (Potentiometer)
- Negative --> Ground Bus
Green LED
- Anode --> D5
- Cathode --> Ground Bus
Red LED
- Anode --> D6
- Cathode --> Ground Bus
Code
The code will make this project actually work. It's quite short and simple, but effective. It's messy because there are no indentations, but it works so that's all that matters.
Code
int TEMP_PIN = A0;
int IC_1 = 3;
int IC_2 = 4;
int IC_ENABLE = 2;
void setup() {
//Serial Monitor
Serial.begin(9600);
//TMP36
pinMode(TEMP_PIN, INPUT);
pinMode(IC_1, OUTPUT);
pinMode(IC_2, OUTPUT);
pinMode(IC_ENABLE, OUTPUT);
//Piezo
pinMode(7, OUTPUT);
}
void loop() {
temp();
}
void temp() {
int TEMP_VALUE = analogRead(TEMP_PIN);
Serial.println(TEMP_VALUE);
float voltage = TEMP_VALUE * 5.0;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100;
Serial.println(temperatureC);
if(TEMP_VALUE > 145){
digitalWrite(IC_ENABLE, 50);
digitalWrite(IC_1, LOW);
digitalWrite(IC_2, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
noise();
}
if(TEMP_VALUE < 144){
digitalWrite(IC_ENABLE, 0);
digitalWrite(IC_1, LOW);
digitalWrite(IC_2, LOW);
digitalWrite(5, LOW);
digitalWrite(6, HIGH);
}
}
void noise() {
tone(7, 300, 200);
}