Temeratures control with outputs

This is working OK:

So, the temperature in tank 1 will never be between 25 and 26.5?

In tank 2, the ranges overlap. Stuff happens in the first block if the temperature is between 24 and 25. Stuff happens in the second block for temperatures in that same range. Is that OK? Stuff happens in the 2nd and 3rd block for temperatures in the range 25 to 26. Is that OK?

Adding a Serial.print() statement just before the tank3temp stuff would confirm the temperature in tank 3. A Serial.print() would confirm whether or not the statement evaluated to true.

Than I have to write a new code?
I dont know how can I read tank1temp, tank2temp and tank3temp differently like i wrote.

I need to write : if (tank1temp >= 25) than power on pump1 and grean led....

Than I have to write a new code?

To some extent, yes. That's not the end of the world.
void float pringetTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
~~ float t1tempC = sensors.getTempC(tank1Thermometer);~~
~~ float t2tempC = sensors.getTempC(tank2Thermometer);~~
~~ float t3tempC = sensors.getTempC(tank2Thermometer);~~
if (tempC == -127.00) {
lcd.print("Err");
} else {
// lcd.print(tempC);
// lcd.print("/");
tank1temp = t1tempC;
tank2temp = t2tempC;
tank3temp = t3tempC;
lcd.print(tempC);
}
return tempC;
}

Then, change printTemperature to getTemperature() in loop, and store the returned value in the appropriate variable.

tank1temp = getTemperature(tank1Thermometer);

I will have different temperatures at the end. Now I have lower temerature so I can test it in the room.

At the and should be like that:

if (tank1temp <= 59)
{
  digitalWrite(tank1, LOW); // pump1 ON
  digitalWrite(tank1RLED, HIGH); // read led OFF
  digitalWrite(tank1GLED, HIGH); // green led OFF
  digitalWrite(tank1BLED, HIGH); // blue led ON
}

if (tank1temp >= 60 && tank1temp <= 62)

{
  digitalWrite(tank1, HIGH);
  digitalWrite(tank1RLED, HIGH);
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1BLED, HIGH);
}

if (tank1temp >= 65)
{
  digitalWrite(tank1, LOW);
  digitalWrite(tank1RLED, HIGH);
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1BLED, HIGH);
}


if (tank2temp <= 35)
{
  digitalWrite(tank1, HIGH);
  digitalWrite(tank2BLED, HIGH);
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2RLED, HIGH);
}

if (tank2temp >= 36 && tank2temp <= 38)

{
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2RLED, HIGH);
  digitalWrite(tank2BLED, HIGH);
}

if (tank2temp >= 40)
{
  digitalWrite(tank1, LOW);
  digitalWrite(tank2, LOW);
  digitalWrite(tank1RLED, HIGH);
  digitalWrite(tank1GLED, HIGH);
  digitalWrite(tank1BLED, HIGH);
  digitalWrite(tank2RLED, HIGH);
  digitalWrite(tank2GLED, HIGH);
  digitalWrite(tank2BLED, HIGH);
}


if (tank3temp >= 70)
{
  digitalWrite(tank3, HIGH);
}

kikitron:
I have another question about LCD that I have it 1602.
The text on it is realy hard to see (very dark), I can see it only from upper angle and on the front you cant see it. Backlight is working ok but text is realy bad.
Do I have to change something in the program that the text will be lighter?

I have QUAPASS 1602A bluescreen and I think that text should be white.

How do you have it wired? Are you using a potentiometer for the contrast like this:
http://arduino.cc/en/Tutorial/LiquidCrystal

No i didnt use potentiometer. I wired like this:

LCD pin 1 (VSS) -> Arduion pin GND
LCD pin 2 (VDD) -> Arduion pin +5V
LCD pin 3 (VO) -> Arduion pin GND throo 270ohm resistor
LCD pin 4 (RS) -> Arduion pin 12
LCD pin 5 (RW) -> Arduion pin 11
LCD pin 6 (E) -> Arduion pin 10
LCD pin 11 (D4) -> Arduion pin 5
LCD pin 12 (D5) -> Arduion pin 4
LCD pin 13 (D6) -> Arduion pin 3
LCD pin 14 (D7) -> Arduion pin 2
LCD pin 15 (A) -> Arduion pin +5V throo 270ohm resistor
LCD pin 16 (K) -> Arduion pin GND

Thanke you @Quick5pnt0 I fixed lcd with potentiometer 8)

@PaulS I changed the lines that you wrote me but now I dont get temperatures reading on LCD, I see only T1,2 and 3 without temperatures.

@PaulS I changed the lines that you wrote me but now I dont get temperatures reading on LCD, I see only T1,2 and 3 without temperatures.

Because I don't think functions should do two things. I renamed the function to getTemperature(). I expect that if you want to print the temperature after you get it, you do that in the function where you call getTemperature(), not in the getTemperature() function. (And, yes, the code you started from was crap.)

@PaulS thanke you for all your help.
I was trying to add different codes and I didnt manage to work so I give up :frowning:
I think it is too difficult project for me, because Im pure beginner with arduino and certainly code looks crap as my knowledge about programming.

Regards

I was trying to add different codes and I didnt manage to work so I give up

The getTemperature() method, when it was called printTemperature(), used to write the temperature to the LCD. Now, it no longer does. It should be relatively simple to look at the old function, and see where it is writing the temperature to the LCD. Add that function call to loop(), after each call to getTemperature().

I think it is too difficult project for me, because Im pure beginner with arduino and certainly code looks crap as my knowledge about programming.

I think you choose a project that was too ambitious, and failed to focus on small parts of the project. Reading a temperature is easy. Printing a value on the LCD is easy. Turning pins on and off based on the temperature is easy.

What is hard is trying to do the entire project without understanding anything about programming. I'm sure that if you printed out the code that you have now, and wrote all over the paper, describing what each block of code/function is doing, that you'd see that you have code that does all the "easy" stuff I listed above.

All that is left to do is organize the code in the proper order. I think that giving up at the 99% point is a mistake.

I think you are right about giving up. I have problems with understanding with that code like you wrote.
But i dont know if i can use that code that I past it anymore or should I start writing the new code from begining. I think that fixing the old code is harder then writing a new one with understanding.
I will try again from begining.

Thanke you PaulS

Have you looked here

and here

It will help

I finaly found what was wrong with the code: There should be (tank3Thermometer) insted of (tank2Thermometer)

void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  float t1tempC = sensors.getTempC(tank1Thermometer);
  float t2tempC = sensors.getTempC(tank2Thermometer);
  float t3tempC = sensors.getTempC(tank2Thermometer);  // PROBLEM IN tank2!
  if (tempC == -127.00) {
lcd.print("Err");
} else {
// lcd.print(tempC);
// lcd.print("/");
tank1temp = t1tempC;
tank2temp = t2tempC;
tank3temp = t3tempC;
lcd.print(tempC);
  }
}

Now temperature sensor 3 function is workink ok :slight_smile:

Kilitron, I read your post and you are working in a similar
Project that I want to develop. I going to start a small micro distillery
And I need some to monitor/control/log the temp of a still
I need one monitor/control by a set point/ log data of the still tank
And monitor/control by set point/ log data of the reflux column.
I not have any idea of the code. I have experience with the electronic.
Can you help me with that thanks