Go Down

Topic: Temeratures control with outputs (Read 2 times) previous topic - next topic

kikitron

#5
Jan 25, 2013, 07:21 am Last Edit: Jan 25, 2013, 07:27 am by kikitron Reason: 1
Yes i would like to use 3 pieces of DS18B20 and yesterday I did the project with one DS18B20 from this page with LCD 1602, and it was working  :)
http://www.hacktronics.com/Tutorials/arduino-digital-temperature-sensor-tutorial.html

Is there any project with DS18B20 that has in program "if temp>XX do this" ... that I can learn it from there, because I dont know where to start  :~

Is it possible to use this project that I past the link and add "if temp>36 do this" or I have to start all from beginning?

UKHeliBob

You can use the project that you already have working as a basis for what you want to do.  The temperature in Centigrade, or at least the non decimal part of it, is in a variable Whole and the Farenheit conversion is in FWhole.  Comparing it with another value is easy.

The project reads the temperature using function getTemp and prints it using function printTemp.  You could add another function that compares the temperature with set values and makes things happen.  As a start try adding a new function, perhaps called tempAction called after printTemp that puts a message on the LCD if the temperature is out of range.  Then you can move on to making something happen.  Extending the program to read and deal with 3 sensors will be relatively easy once you understand what it is currently doing.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

kikitron

Thanke you for the answer.
This is exactly what I need compare the temperature with set values and making things happen. I will need only temperature in centigrade without farenheit.
Is there any manual with this functions that i can know how to add it?

UKHeliBob

You write your own function.  Something like this :

Code: [Select]
void tempAction()
{
  if (Whole > 60)
  {
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("High temp !");
  }
}


Look at the functions already in the program to see where to put it and how to call it.  If you don't know how to do this then I seriously suggest that you work through the examples provided with the IDE.  Instead of just putting a message on the LCD you will need to turn relays on/off.  There are examples of how to turn LEDs on and off which is fundamentally no different than turning relays on and off.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Nick_Pyner

#9
Jan 25, 2013, 03:10 pm Last Edit: Jan 26, 2013, 01:06 am by Nick_Pyner Reason: 1

Yes i would like to use 3 pieces of DS18B20 and yesterday I did the project with one DS18B20 from this page with LCD 1602, and it was working  :)
http://www.hacktronics.com/Tutorials/arduino-digital-temperature-sensor-tutorial.html

Is it possible to use this project that I past the link and add "if temp>36 do this" or I have to start all from beginning?


I found the Hacktronics tutorial the best, and I am running three DS18B20s based on it. I just slipped the code below into the loop as a test.  You can can have a command to start a pump instead of print to LCD

Code: [Select]

if ( InTemp > 30.00)
{
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("30+");
 lcd.setCursor(0,1);
 lcd.print(InTemp);
 delay(2000);
}


Go Up