Pages: [1]   Go Down
Author Topic: Thermometer  (Read 1409 times)
0 Members and 1 Guest are viewing this topic.
Zafferana Etnea, Italy
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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 = 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(); 
  
  
  
}


Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14009
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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] = analogRead(i) * 5.0/1024.0;
    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 -
(Please do not PM for private consultancy)

Offline Offline
Faraday Member
**
Karma: 62
Posts: 3080
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Tasmania - Australia
Offline Offline
Sr. Member
****
Karma: 16
Posts: 322
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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  smiley-evil

Paul
Logged


Zafferana Etnea, Italy
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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  smiley-roll-blue
« Last Edit: January 15, 2013, 04:42:04 am by Cammelo » Logged

Zafferana Etnea, Italy
Offline Offline
Newbie
*
Karma: 1
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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] = analogRead(i) * 5.0/1024.0;
    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  smiley-eek-blue smiley-eek-blue
Logged

Global Moderator
Netherlands
Online Online
Shannon Member
*****
Karma: 227
Posts: 14009
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset 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 -
(Please do not PM for private consultancy)

Tasmania - Australia
Offline Offline
Sr. Member
****
Karma: 16
Posts: 322
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset 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?

Well done for your project.

Paul.
Logged


Pages: [1]   Go Up
Jump to: