Tomdee

16Feb/111

Controlling a central heating boiler using an arduino

To control my central heating, I needed some way of turning my boiler onand off.

First Attempt

Initially I thought I would have a direct connection to the boiler. So I managed to find the manuals on the Worcester Bosch web site and proceeded to dismantle my boiler to find out where I would need to make the conections. My boiler requires mains voltage signals to request heat so I built a relay to allow me to use 5V signals from my arduino to control the boiler.

I wasn't feeling masively positive about this approach since it would require me to have an arduino next to my boiler. Since I only had one arduino, this would mean I'd have to buy another for monitoring my gas usage - not ideal.

Second Attempt

Which brings me to my second attempt at designing this. I have a standard British Gas wireless thermostat.

British Gas Wireless Thermostat

The display on the front usually shows the current temperature, but when the dial on the front is rotated, it shows the desired temperature.

Inside, there's a small thermistor and a couple of switches. The dial on the front is had ridges on the back that trigger the switches as it turns. The two switches are out of phase with each other compared to the ridges, so turning the dial causes one switch to trigger before the other. The order of the triggering determines the direction of the dial.

With some help from GarethDEdwards I soldered some tidy wires to the back of the circuit board. I hen connected those to 3.5 mm audio jack on the bottom so I could easily plug it into my arduino.

Sample (simple?) code for control by arduino is below


////////////////////////////////////////////////
// Thermostat control section
////////////////////////////////////////////////
int delayTime = 10;

void setTemp(int desiredTemp)
{
  if (desiredTemp == currentTemp)
  {
    // Do Nothing
    //    Serial.println("Doing nothing"); 
  }
  else if (desiredTemp <=5)
  {
    // Requested a minimum temp, make sure we're really on the min temp...
    int numberOfDowns = 30;
    while (numberOfDowns > 0)
    {
      down();
      numberOfDowns--;
    } 
    currentTemp = 5;
  }
  else if (desiredTemp >=30)
  {
    // Requested a maximum temp, make sure we're really on the max temp...
    int numberOfUps = 30;
    while (numberOfUps > 0)
    {
      up();
      numberOfUps--;
    }
    currentTemp = 30;
  } 
  else
  {
    while (desiredTemp != currentTemp)
    {
      if (desiredTemp > currentTemp)
      {
        up();
        currentTemp++;
      }
      else
      {
        down();
        currentTemp--; 
      }
    } 
  }


}  
void down()
{
  //Serial.println("DOWN");
  leftDown();
  rightDown();
  leftUp();
  rightUp();
}

void up()
{
  //  Serial.println("UP");
  rightDown();
  leftDown();
  rightUp();
  leftUp();
}

void leftUp()
{
  //Serial.println("LU");
  pinMode(leftPin, INPUT);
  delay(delayTime);
}

void leftDown()
{
  //Serial.println("LD");
  pinMode(leftPin, OUTPUT);
  digitalWrite(leftPin, LOW);
  delay(delayTime);
}

void rightUp()
{
  //Serial.println("RU");
  pinMode(rightPin, INPUT); 
  delay(delayTime);
}

void rightDown()
{
  //Serial.println("RD");
  pinMode(rightPin, OUTPUT);
  digitalWrite(rightPin, LOW);
  delay(delayTime);
}

Comments (1) Trackbacks (0)
  1. I like your approach. I have the same boiler here, but with only a rotary scheduler and no thermostat. I could just add a wireless thermostat but I’d rather have the convenience of altering the heating schedule on a whim from anywhere.

    Do you have the details of the boiler for hooking up a thermostat on/off connection? I’m considering using an Arduino to “live” with the boiler and send commands via this.


Leave a comment

No trackbacks yet.