Pages: [1]   Go Down
 Author Topic: Thermometer  (Read 631 times) 0 Members and 1 Guest are viewing this topic.
Zafferana Etnea, Italy
Offline
Newbie
Karma: 1
Posts: 10
 « on: January 14, 2013, 05:08:23 am » Bigger Smaller Reset

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.

Quote
#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 = 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 = 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 = 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 = 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();

}

 Logged

Netherlands
Offline
Tesla Member
Karma: 101
Posts: 9551
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #1 on: January 14, 2013, 01:39:03 pm » Bigger Smaller Reset

Thanks for posting,

some tips:

Learn to use arrays and loops so repeating pieces of code can be made easier:

(not tested, but it would become something like this.
Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float temp[4];
char text[4][] = { "T Int. ", "T Est. ", "T Camino ", "Controllo" };

void setup()
{
lcd.begin(20, 4);
}

void loop()
{
for (int i = 0; i< 4; i++)
{
temp[i] -= 0.592;
temp[i] *= 100;
lcd.setCursor(0, i);
lcd.print (text[i]);
lcd.print(temp[i], 1);
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();

}
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Offline
God Member
Karma: 9
Posts: 839
 « Reply #2 on: January 14, 2013, 10:51:35 pm » Bigger Smaller Reset

I'm more interested in how you control the outdoor temperature.
 Logged

Tasmania - Australia
Offline
Sr. Member
Karma: 7
Posts: 253
 « Reply #3 on: January 14, 2013, 10:59:22 pm » Bigger Smaller Reset

Quote
michinyon wote:
I'm more interested in how you control the outdoor temperature

Wow, that would be interesting indeed, just how much of the outdoor temperature do you want to control, please don't tell me the world?
Now I think I know where this global warming is coming from . . . . . . Arduino hackers controlling the outdoor climate  ]

Paul
 Logged

Renewable Energy Monitor Project http://paulalting.com/hydrosolar.php     No, I don't really suffer from insanity, I enjoy it.     I do it with Eclipse IDE and Jantje's AVR plugin http://baeyens.it/eclipse/

Zafferana Etnea, Italy
Offline
Newbie
Karma: 1
Posts: 10
 « Reply #4 on: January 15, 2013, 04:21:21 am » Bigger Smaller Reset

I'm more interested in how you control the outdoor temperature.
Simple!! I live near the Etna volcano ( google 37.695231,15.104799 ).
Thru a valves array i drive the lava close or far from my house.

My english is not perfect, in italian language "controllo" means control or to check
 « Last Edit: January 15, 2013, 04:42:04 am by Cammelo » Logged

Zafferana Etnea, Italy
Offline
Newbie
Karma: 1
Posts: 10
 « Reply #5 on: January 15, 2013, 04:35:28 am » Bigger Smaller Reset

Thanks for posting,

some tips:

Learn to use arrays and loops so repeating pieces of code can be made easier:

(not tested, but it would become something like this.
Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

float temp[4];
char text[4][] = { "T Int. ", "T Est. ", "T Camino ", "Controllo" };

void setup()
{
lcd.begin(20, 4);
}

void loop()
{
for (int i = 0; i< 4; i++)
{
temp[i] -= 0.592;
temp[i] *= 100;
lcd.setCursor(0, i);
lcd.print (text[i]);
lcd.print(temp[i], 1);
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();

}

You welcome. My job is in the analog electronics, from 20 year. This is my first project with a microcontroller, i'm sure that is not perfect, but it works well and i'm very proud
 Logged

Netherlands
Offline
Tesla Member
Karma: 101
Posts: 9551
In theory there is no difference between theory and practice, however in practice there are many...
 « Reply #6 on: January 15, 2013, 02:26:10 pm » Bigger Smaller Reset

Quote
and i'm very proud
you have all rights to be proud! you finished a working project!
 Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

Tasmania - Australia
Offline
Sr. Member
Karma: 7
Posts: 253
 « Reply #7 on: January 15, 2013, 06:38:56 pm » Bigger Smaller Reset

Quote
Cammelo wrote:
Simple!! I live near the Etna volcano ( google 37.695231,15.104799 ).
Thru a valves array i drive the lava close or far from my house.

My english is not perfect, in italian language "controllo" means control or to check

Very interesting idea Cammelo.
So my understanding is you use an Arduino to read temperature sensors located in four different areas of your home and then control valves that allow either hot water or hot air to flow to those locations, is that right?

Do you use a heat exchanger to convert heat from the ground to heat the water or air?

Cammelo, you are lucky to have a natural energy source.
Maybe you have some photos or diagrams of this project you can share with us?