Hello all, I wrote a simple code for a home 4 channel thermometer, using the Mcp9700a probe. In my case, it control the outdoor, indoor, solar panel and fireplace temperatures, and show them on a inexpensive 20\4 display.
Thanks to markal "
http://starter-kit.nettigo.eu/2010/how-to-measure-temperature-with-arduino-and-mcp9700/" for the input in math calculation.
The display is connected to Arduino in the usual mode, and A0:A3 has been used for the measure input. For a stable measurement i've connected four 4700 ohm resistors between inputs and ground, and i've adjusted the "-0.5" factor in the formula, correcting it in "0.595". This gave me a more precise measure value. Probes are connected to the 3.3 V. That's all.
I hope this will be useful for someone else.
Below the sketch.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
float temp;
float temp1;
float temp2;
float temp3;
void setup() {
lcd.begin(20, 4);
}
void loop() {
temp = analogRead(0)*5/1024.0;
temp = temp - 0.592;
temp = temp / 0.01;
lcd.setCursor(0, 0);
lcd.print ("T Int. ");
lcd.print(temp);
lcd.print (" C");
lcd.print((char)223);
temp1 = analogRead(1)*5/1024.0;
temp1 = temp1 - 0.592;
temp1 = temp1 / 0.01;
lcd.setCursor(0, 1);
lcd.print ("T Est. ");
lcd.print(temp1);
lcd.print (" C");
lcd.print((char)223);
temp2 = analogRead(2)*5/1024.0;
temp2 = temp2 - 0.592;
temp2 = temp2 / 0.01;
lcd.setCursor(0, 2);
lcd.print ("T Bollit. ");
lcd.print(temp2);
lcd.print (" C");
lcd.print((char)223);
temp3 = analogRead(3)*5/1024.0;
temp3 = temp3 - 0.592;
temp3 = temp3 / 0.01;
lcd.setCursor(0, 3);
lcd.print ("T Camino ");
lcd.print(temp3);
lcd.print (" C");
lcd.print((char)223);
delay(10000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print ("Controllo" );
lcd.setCursor(0, 1);
lcd.print ("temperature casa");
delay(500);
lcd.clear();
}