Can you help me change temperature code for fireplace?

Hi there. Can you help me change temperature code for my fireplace? - Rex in New Zealand.

Here is what we do with it:
We have a fireplace with a wetback / water heating piece of copper in it with water running through it. It then goes to our hot water cylinder.

On the top pipe of the wetback is a lm35 arduino sensor. It goes to the arduino uno. The arduino uno has an output to a relay which turns on a pump and waaalaa the water pumps off to the cylinder and we all get a shower.

The problem is when the cylinder reaches above the pre set temperature in the arduino code the pump stays on and consumes all our electricity.

What I need want is this: I want the arduino to turn the pump on when the temperature is above 39 Degrees but I also want the arduino to only run the pump for 20 seconds every 5 min after the arduino reaches 50 degrees.

We are not running a lcd display so you can delete the display code.

Below is the code we are using now.

Can you techie folks out there change my code to do the above and post it back here or email it to me rex@rexshort.co.nz

Thanks heaps. Rex in NZ.

#include <LiquidCrystal.h>
int reading = 0;
int sensorPin = A0;
int relay =7;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(relay,OUTPUT);
}

void loop() {
reading = analogRead(sensorPin);
int celsius = reading/2;
lcd.setCursor(0, 0);
lcd.print("Temperature:");
lcd.setCursor(0,1);
lcd.print(celsius, DEC);
lcd.print((char)223);
lcd.print("C");
if (celsius >39) {
digitalWrite(7,HIGH);
} else {
digitalWrite(7,LOW);
}
delay(10000);

lcd.clear();
}

fireplace.ino (738 Bytes)

Do not triple post.

What I need want is this: I want the arduino to turn the pump on when the temperature is above 39 Degrees but I also want the arduino to only run the pump for 20 seconds every 5 min after the arduino reaches 50 degrees.

Is the Arduino really going to reach 50 degrees?

You need to record when the Arduino senses that the temperature has changed to 50 degrees. If the temperature is 50 or above, and the time since that happened is more than 20 seconds, turn the pump off. If the temperature is above 50 degrees, and has been for more than 5 minutes, turn the pump on, and reset the on time to now.

Please put your code in its own window as seen in other posts. This can be done by placing     [code] and [/code]  around the code. This makes it easier for others to read.

I have a concern that the wetback is continuously being heated so what happens when the water boils?

Wetbacks are often used with thermosyphon so the water circulates by itself as it heats. With a pump in the pipe, the water cannot circulate so potentially can boil and builds up pressure.

You may need to have a safety setting so that at say 75 deg the pump continues to circulate until the temperature drops. You should also have pressure relief valves fitted.

Weedpharma

rexshort:
Hi there. Can you help me change temperature code for my fireplace? - Rex in New Zealand.

Here is what we do with it:
We have a fireplace with a wetback / water heating piece of copper in it with water running through it. It then goes to our hot water cylinder.

See Attached.

Chuck.

stove.ino (2.24 KB)

This is the code with the condition reaches 50 degrees.

#include <LiquidCrystal.h>

int reading = 0;
const byte sensorPin = A0; // A0 for LM35 temperature sensor, LM35 output 10.0mV/C
const byte relay =7;  // D7 for relay

const unsigned long pumpOnTime = 20000UL;  // 20 secounds in milliseconds
const unsigned long pumpWaitTime = 3600UL * 5000;  // 5 minutes in milliseconds

unsigned long pumplastOnTime;  // when the pump last changed state
unsigned long lastMillis;

boolean condition = false; //reaches 50 degrees for 20 sec
boolean isOn = false;    // pump is On

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  pinMode(relay,OUTPUT);
}

void loop() {
  reading = analogRead(sensorPin); // LM35 output 10.0mV/C is about 0.5°C per digital value
  int celsius = reading/2;
  lcd.setCursor(0, 0);
  lcd.print("Temperature:");      
  lcd.setCursor(0,1);
  lcd.print(celsius, DEC);
  lcd.print((char)223);
  lcd.print("C");
  if (celsius >39) {
    digitalWrite(relay,HIGH);
 isOn = true;
  } 
  else {
    digitalWrite(relay,LOW);
 isOn = false;
  }
  
  if (celsius >=50) {
  if (isOn && !condition)
  {
 pumplastOnTime = millis(); // start 20 secounds timer;
 condition = true;
  }
  else if (isOn && (millis() - pumplastOnTime >= pumpOnTime))
  {
 // 20 seconds passed; turn off pump;
    digitalWrite(relay,LOW);
 isOn = false;
 // reset the condition for a new 5 minutes timer;
 condition = false; 
 lastMillis = millis(); // Re-start 5 minutes timer; 
  }
  
  if (!isOn && (millis() - lastMillis >= pumpWaitTime))
  {
 // 5 minutes passed; turn on pump;
 digitalWrite(relay,HIGH);
 isOn = true;
 pumplastOnTime = millis(); // start 20 secounds timer;
  } 
    
  }

  delay(500);



  lcd.clear();
}

rexshort:
Hi there. Can you help me change temperature code for my fireplace? - Rex in New Zealand.

Question for you?

How hot can the plumbing stand?

If you only drive the pump 20 seconds per 5 minutes and the fireplace heats the hotplate above 100c you could generate steam in the pipes. Does your system have a pressure release? Or would the steam expansion (1700x) pressurize the plumbing until it exploded?

I have seen the results of a 'closed solar' system explosion. A recirculating hotwater system with a 3'x6' insulated panel to a 50 gallon tank exceeded 400 degrees Fahrenheit before the tank exploded into steam, 200 psi. Blew the roof right off the house.

Can the heat exchanger run dry? without damage?

The LM35 is rated to 150C only. without water cooling bad things could happen.

You might want to add a max temp trip to turn on the pump, and/or trigger an alarm.

Chuck.

In my house (in Ireland) we had a water heater like the OP mentions. It was generally referred to as a "back boiler" or (for the better ones) a "wrap-around boiler". It was plumbed in such a way that there is no possibility of a dangerous pressure build up and it used a closed-loop cooling system so the pump could not empty the water. The water that is drawn by a shower came from a different reservoir. We used to switch on our pump manually when the "boiler" started to make noise - which was quite distinctive. The pump was just there to augment a natural siphon system (hot water rises etc). For the purpose of this Thread I don't think there is any need for safety concerns.

I presume the OP's interest is to prevent the reservoir from heating the "boiler" before the fire has raised the water temperature above the reservoir temperature.

@rexshort, as far as timing is concerned you should look at several things at a time which illustrates how to use millis(). Do not use the delay() function as the Arduino can do nothing in the middle of a delay().

...R

@rexshort: Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the "Code" icon above the posting area. It is the first icon, with the symbol: </>

Hi there. Can you help me change temperature code for my fireplace? - Rex in New Zealand.

Here is what we do with it:
We have a fireplace with a wetback / water heating piece of copper in it with water running through it. It then goes to our hot water cylinder.

On the top pipe of the wetback is a lm35 arduino sensor. It goes to the arduino uno. The arduino uno has an output to a relay which turns on a pump and waaalaa the water pumps off to the cylinder and we all get a shower.

The problem is when the cylinder reaches above the pre set temperature in the arduino code the pump stays on and consumes all our electricity.

What I need want is this: I want the arduino to turn the pump on when the temperature is above 39 Degrees but I also want the arduino to only run the pump for 20 seconds every 5 min after the arduino reaches 50 degrees.

We are not running a lcd display so you can delete the display code.

Below is the code we are using now.

Can you techie folks out there change my code to do the above and post it back here or email it to me rex@rexshort.co.nz

Thanks heaps. Rex in NZ.

Code: [select]

#include <LiquidCrystal.h>
int reading = 0;
int sensorPin = A0;
int relay =7;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
pinMode(relay,OUTPUT);
}

void loop() {
reading = analogRead(sensorPin);
int celsius = reading/2;
lcd.setCursor(0, 0);
lcd.print("Temperature:");
lcd.setCursor(0,1);
lcd.print(celsius, DEC);
lcd.print((char)223);
lcd.print("C");
if (celsius >39) {
digitalWrite(7,HIGH);
} else {
digitalWrite(7,LOW);
}
delay(10000);

lcd.clear();
}

Code: [select]

http://forum.arduino.cc/index.php?topic=336563.0

You can modify your code to wait for 39° (50°?), then do all of this: turn on the pump for some time (20s), turn it off for the pause (5min).

Then look at "Blink without delay" and MultiBlink, how to get rid of the delay() calls to allow for other actions at the same time.

Hi,
It seems you are trying to keep the boiler hot while showering by using a timer on the pump if the wetback is up to temp.

Wouldn't it be better to, apart from the sensor on the pipe to detect wetback temp, to fit a sensor to the hotwater service to see if it needs to be heated. That way you only pump when the service needs heat, and your batteries would be under less stress.

Also is your hotwater service, level or higher than the wetback?

Our house used to have a similar system, we never ran out of hot water and never had a pump. The hotwater service was at the same level as the stove it was connected to, the electric boost was never turned on.

Tom.... :slight_smile:

Why are you double posting ? You have already received a lot of info in your other Thread. Don't waste people's time.

...R

rexshort:
Here is what we do with it:
We have a fireplace with a wetback / water heating piece of copper in it with water running through it. It then goes to our hot water cylinder.

To me it looks as if you need a second temperature sensor:
1st temperature sensor ==> measures wetback water temperature
2nd temperature sensor ==> measures water temperature of hot water cylinder

And then you should control the pump by the "temperature difference".

Perhaps with a programming logic like that:

  • if (1st temperature > 2nd temperature+6) ==> switch pump state ON
  • if (1st temperature < 2nd temperature+3) ==> switch pump state OFF
  • if (2nd temperature >=50) switch pump state OFF
  • in all other cases ==> leave pump state unchanged

In that case the pump will only start if there is a significant temperature difference.
And the pump will be stopped if either the temperature difference falls below a threshold or if the final temperature in the cylinder has been reached.

With the programming logic you descibed in your initial posting and only one temperature sensor, it may happen that the water temperature in the wetback is lower than the water temperature in the cylinder, and the pump starts pumping colder water in the cylinder than it already has. Your initial programming logic would easily do this:

  • wetback temperature = 40 degrees
  • cylinder temperature = 50 degrees
    ==> pump will pump water of 40 degrees into the cylinder
    That would be a bad "water heating" appliance, wouldn't it?

I'd say, you need two temperature sensors: One for the water temperature in the wetback and one for the water temperature in the cylinder. And pump switching is then mostly based on "temperature difference" and not "absolute temperature".

Something like this.

LM35_temp_x2.zip (1.56 KB)