Devices & Components
16x2 LCD display with I²C interface
Arduino Uno Rev3
1 relay module 5 Vdc 10A (assembled)
12V adapter
5mm Red LED
TMP36- Analog Temperature sensor
Aligator Clips
CPU fan 12 volt
Male to male jumper wires
Jumper Male to Female 20 cm
Hardware & Tools
a laptop or a computer to test
Software & Tools
Arduino IDE
TINKERCAD
Project description
Code
Master Code (°C)
cpp
Master Code needed for this project! Degrees (°C)
1/* 2C++ code 3By Miles Peterson 4Date: 1/24/24 5Note that this is in degrees Celsius! 6*/ 7#include <Adafruit_LiquidCrystal.h> 8 9Adafruit_LiquidCrystal lcd_1(0); 10 11void setup() 12{ 13 lcd_1.begin(16, 2); 14 pinMode(A0, INPUT); 15 Serial.begin(9600); 16 pinMode(3, OUTPUT); 17 pinMode(5, OUTPUT); 18 19 lcd_1.print("LOADING."); 20 delay(1000); // Wait for 1000 millisecond(s) 21 lcd_1.print("."); 22 delay(1000); // Wait for 1000 millisecond(s) 23 lcd_1.print("."); 24 delay(1000); // Wait for 1000 millisecond(s) 25 lcd_1.print("."); 26 delay(1000); // Wait for 1000 millisecond(s) 27} 28 29void loop() 30{ 31 lcd_1.clear(); 32 if ((-40 + 0.488155 * (analogRead(A0) - 20)) >= 79) { 33 lcd_1.clear(); 34 Serial.println((-40 + 0.488155 * (analogRead(A0) - 20))); 35 lcd_1.print((-40 + 0.488155 * (analogRead(A0) - 20))); 36 Serial.println("Fan: ON"); 37 lcd_1.setCursor(0, 1); 38 lcd_1.print("Fan: ON"); 39 lcd_1.setCursor(6, 0); 40 lcd_1.print("*C"); 41 digitalWrite(3, HIGH); 42 digitalWrite(5, HIGH); 43 if ((-40 + 0.488155 * (analogRead(A0) - 20)) >= 93) { 44 lcd_1.setCursor(10, 0); 45 lcd_1.print("HIGH"); 46 lcd_1.setCursor(10, 1); 47 lcd_1.print("TEMP!"); 48 } 49 delay(2000); // Wait for 2000 millisecond(s) 50 } else { 51 lcd_1.clear(); 52 Serial.println((-40 + 0.488155 * (analogRead(A0) - 20))); 53 lcd_1.print((-40 + 0.488155 * (analogRead(A0) - 20))); 54 Serial.println("Fan: OFF"); 55 lcd_1.setCursor(0, 1); 56 lcd_1.print("Fan: OFF"); 57 lcd_1.setCursor(6, 0); 58 lcd_1.print("*C"); 59 digitalWrite(3, LOW); 60 digitalWrite(5, LOW); 61 delay(2000); // Wait for 2000 millisecond(s) 62 } 63}
Master Code (°F)
cpp
Master Code needed for this project! Degrees (°F)
1/* 2C++ code 3By Miles Peterson 4Date: 1/23/24 5Note that this is in degrees Fahrenheit! 6*/ 7 8#include <Adafruit_LiquidCrystal.h> 9 10Adafruit_LiquidCrystal lcd_1(0); 11 12void setup() 13{ 14 lcd_1.begin(16, 2); 15 pinMode(A0, INPUT); 16 Serial.begin(9600); 17 pinMode(3, OUTPUT); 18 pinMode(5, OUTPUT); 19 20 lcd_1.print("LOADING."); 21 delay(1000); // Wait for 1000 millisecond(s) 22 lcd_1.print("."); 23 delay(1000); // Wait for 1000 millisecond(s) 24 lcd_1.print("."); 25 delay(1000); // Wait for 1000 millisecond(s) 26 lcd_1.print("."); 27 delay(1000); // Wait for 1000 millisecond(s) 28} 29 30void loop() 31{ 32 lcd_1.clear(); 33 if ((-40 + 0.878679 * (analogRead(A0) - 20)) >= 175) { 34 lcd_1.clear(); 35 Serial.println((-40 + 0.878679 * (analogRead(A0) - 20))); 36 lcd_1.print((-40 + 0.878679 * (analogRead(A0) - 20))); 37 Serial.println("Fan: ON"); 38 lcd_1.setCursor(0, 1); 39 lcd_1.print("Fan: ON"); 40 lcd_1.setCursor(6, 0); 41 lcd_1.print("*F"); 42 digitalWrite(3, HIGH); 43 digitalWrite(5, HIGH); 44 if ((-40 + 0.878679 * (analogRead(A0) - 20)) >= 200) { 45 lcd_1.setCursor(10, 0); 46 lcd_1.print("HIGH"); 47 lcd_1.setCursor(10, 1); 48 lcd_1.print("TEMP!"); 49 } 50 delay(2000); // Wait for 2000 millisecond(s) 51 } else { 52 lcd_1.clear(); 53 Serial.println((-40 + 0.878679 * (analogRead(A0) - 20))); 54 lcd_1.print((-40 + 0.878679 * (analogRead(A0) - 20))); 55 Serial.println("Fan: OFF"); 56 lcd_1.setCursor(0, 1); 57 lcd_1.print("Fan: OFF"); 58 lcd_1.setCursor(6, 0); 59 lcd_1.print("*F"); 60 digitalWrite(3, LOW); 61 digitalWrite(5, LOW); 62 delay(2000); // Wait for 2000 millisecond(s) 63 } 64}
Downloadable files
Schematic
The schematic for this project, Very important!
Screenshot 2024-01-24 172020 (TINKER 2).png

Schematic (With captions)
The same schematic but with captions. Important!
Screenshot 2024-01-24 172555 (TINKER 3).png

Comments
Only logged in users can leave comments