const float BETA = 3950; // should match the Beta Coefficient of the thermistor
// Relay pin
const int motorRelay = 2;
void setup() {
// initializes serial communication at 9600 bits per second:
Serial.begin(9600);
//sets the relay pin to output
pinMode(motorRelay, OUTPUT);
// sets the relay to the starting state
digitalWrite(motorRelay, HIGH);
}
void loop() {
// reads the sensor
int analogSensorOne = analogRead(A0);
// calculates the temperature in C°
float motorOne = 1 / (log(1 / (1023. / analogSensorOne - 1)) / BETA + 1.0 / 298.15) - 273.15;
// prints out the value
Serial.print("Temperature: ");
Serial.print(motorOne);
Serial.println("°C");
// Monitors the temperature and switches the relay acordingly
if (motorOne > 60) {
digitalWrite(motorRelay, LOW);
}
}
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
ntc1:GND
ntc1:VCC
ntc1:OUT
relay2:VCC
relay2:GND
relay2:IN
relay2:NC
relay2:COM
relay2:NO
led2:A
led2:C
led3:A
led3:C
r2:1
r2:2
r3:1
r3:2
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r