Created
March 15, 2017 03:14
-
-
Save andytlr/c788f7b23418731f6fc2418e6ed698fe to your computer and use it in GitHub Desktop.
Bread Proofer Arduino Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
int ThermistorPin = 0; | |
int relayPin = 10; | |
int Vo; | |
float R1 = 10000; | |
float logR2, R2, T, Tc; | |
float Tdesired = 27.0; | |
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(relayPin, OUTPUT); | |
} | |
void loop() { | |
lcd.begin(16, 2); | |
Vo = analogRead(ThermistorPin); | |
R2 = R1 * (1023.0 / (float)Vo - 1.0); | |
logR2 = log(R2); | |
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2)); | |
Tc = T - 273.15; | |
Tc = round(Tc*10)/10.0; | |
Serial.print(Tc); | |
Serial.println(" C"); | |
lcd.print(Tc,1); | |
lcd.print((char)223); | |
lcd.print("C"); | |
lcd.print(" -> "); | |
lcd.print(Tdesired,1); | |
lcd.print((char)223); | |
lcd.print("C"); | |
if (Tc < Tdesired) { | |
digitalWrite(relayPin, HIGH); | |
lcd.setCursor(0, 1); | |
lcd.print("Heater on"); | |
} else { | |
digitalWrite(relayPin, LOW); | |
lcd.setCursor(0, 1); | |
lcd.print("Heater off"); | |
} | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment