Beruflich Dokumente
Kultur Dokumente
- Arduino
- Relay Module
- Thermistor
- Resistor 220Ω
Fairly simple concept here, we set the Arduino to kick the fan on if temps exceed 73 degrees Fahrenheit
and stay off otherwise. By opening the serial monitor on baud 115200 you can view the current
temperature in real time. You can also modify the values in the code to change when the fan kicks on if
you like it warmer xP. Here is my layout i created with Fritzing and the code below.
Have fun!
#include <math.h> //loads the more advanced math functions
#define RELAY1 6
void setup() { //This function gets called when the Arduino starts
Serial.begin(115200); //This code sets up the Serial port at 115200 baud rate
pinMode(RELAY1, OUTPUT);
double Thermister(int RawADC) { //Function to perform the fancy math of the Steinhart-Hart equation
double Temp;
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Celsius to Fahrenheit - comment out this line if you need Celsius
return Temp;
val=analogRead(0); //Read the analog port 0 and store the value in val
digitalWrite(RELAY1,LOW);
digitalWrite(RELAY1,HIGH);