Project tutorial
Automated Shower Boiler

Automated Shower Boiler

Do you live in a country where you use solar energy to warm up the water? Well, how about we automate the process of the shower boiler.

  • 4,009 views
  • 2 comments
  • 10 respects

Components and supplies

Apps and online services

About this project

The Concept

My project has to do with the solar heated shower boiler that most Mediterranean and sun bathed countries use. The concept is simple, there's a solar panel with a water tank on top and when the sun is out and about, the water heats up all the time. Now, what happens when it's a rainy or cloudy day, the only choice you have is to turn the heat on the boiler manually. The picture below clearly depicts an electrical water boiler typically found in North American and European homes.

The electrical part of the water heater is simple. For example, 230v 15amp power comes in, connects to the thermostat and in turn the thermostat is wired up to an element. Now the thermostat turns on via the circuit breaker it's connected to, which is found in the main panel. Below is a diagram of a thermostat.

So the idea is that we automate all of this process by using an Arduino/Genuino 101 instead of a thermostat. Below is a picture and a video of my project.

Wiring

As you can see the component connections are the following:

  • Relay: Pins 12 & 13, 5v, GND
  • Temperature Sensor: A3
  • LED: D8
  • LCD: I2C

Keep in mind that were also using the Arduino/Genuino Bluetooth capability for this project.

So the general idea is that if the temperature drops below a certain level as implied in the code, the LED turns on telling the user that the heater is on and, of course, the relay turns on where the "Hot" wire on the element passes through the Normally Open and Common wire inputs. To use the Bluetooth capability apart from the code, we connect another part of the "Hot" wire of the element to the relay on the Normally Open and Common wire inputs.

Code

Automated Shower Boiler CodeArduino
#include <math.h>
#include <CurieBLE.h>
#include <Wire.h>
#include "rgb_lcd.h"

rgb_lcd lcd;

const int colorR = 255;
const int colorG = 0;
const int colorB = 0;
const int B = 4275;
const int R0 = 100000;
const int pinTempSensor = A3;
const int relayPin = 13; 
const int ledPin = 12;
int Greenled = 8;

BLEPeripheral blePeripheral; // create peripheral instance

BLEService ledService("19B10000-E8F2-537E-4F6C-D104768A1214"); // create service

// create switch characteristic and allow remote device to read and write
BLECharCharacteristic switchChar("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(relayPin, OUTPUT); // use the relay on pin 13 as an output
  pinMode(ledPin, OUTPUT);
  pinMode(Greenled, OUTPUT);
  // set the local name peripheral advertises
  blePeripheral.setLocalName("LEDCB");
  // set the UUID for the service this peripheral advertises
  blePeripheral.setAdvertisedServiceUuid(ledService.uuid());

  // add service and characteristic
  blePeripheral.addAttribute(ledService);
  blePeripheral.addAttribute(switchChar);

  // assign event handlers for connected, disconnected to peripheral
  blePeripheral.setEventHandler(BLEConnected, blePeripheralConnectHandler);
  blePeripheral.setEventHandler(BLEDisconnected, blePeripheralDisconnectHandler);

  // assign event handlers for characteristic
  switchChar.setEventHandler(BLEWritten, switchCharacteristicWritten);
// set an initial value for the characteristic
  switchChar.setValue(0);

  // advertise the service
  blePeripheral.begin();
  Serial.println(("Bluetooth device active, waiting for connections..."));

// set up the LCD's number of columns and rows:
    lcd.begin(16, 1);
    
    lcd.setRGB(colorR, colorG, colorB);
    
    delay(1000);
}

void loop() {

    // poll peripheral
  blePeripheral.poll();

  // put your main code here, to run repeatedly:
      int a = analogRead(pinTempSensor);
      float R = 1023.0/((float)a)-1.0;
      R = 100000.0*R;

      float temperature=1.0/(log(R/100000.0)/B+1/298.15)-273.15;

       if (temperature < 20) {
    // turn LED on:
    digitalWrite(relayPin, HIGH);
    digitalWrite(Greenled, LOW);
  } else {
    // turn LED off:
    digitalWrite(relayPin, LOW);
    digitalWrite(Greenled, HIGH);
  }
      Serial.print("temperature= ");
      Serial.println(temperature);
      delay(1000);

    // Print a message to the LCD.
      lcd.print(" Temperature: ");
      lcd.print(temperature);
}

void blePeripheralConnectHandler(BLECentral& central) {
  // central connected event handler
  Serial.print("Connected event, central: ");
  Serial.println(central.address());
}

void blePeripheralDisconnectHandler(BLECentral& central) {
  // central disconnected event handler
  Serial.print("Disconnected event, central: ");
  Serial.println(central.address());
}

void switchCharacteristicWritten(BLECentral& central, BLECharacteristic& characteristic) {
  // central wrote new value to characteristic, update LED
  Serial.print("Characteristic event, written: ");

  if (switchChar.value()) {
    Serial.println("LED on");
    digitalWrite(ledPin, HIGH);
    digitalWrite(relayPin, HIGH);
  } else {
    Serial.println("LED off");
    digitalWrite(ledPin, LOW);
    digitalWrite(relayPin, LOW);
  }
    // scroll 13 positions (string length) to the left
    // to move it offscreen left:
    for (int positionCounter = 0; positionCounter < 13; positionCounter++) {
        // scroll one position left:
        lcd.scrollDisplayLeft();
        // wait a bit:
        delay(100);
    }

    // scroll 29 positions (string length + display length) to the right
    // to move it offscreen right:
    for (int positionCounter = 0; positionCounter < 29; positionCounter++) {
        // scroll one position right:
        lcd.scrollDisplayRight();
        // wait a bit:
        delay(100);
    }

    // scroll 16 positions (display length + string length) to the left
    // to move it back to center:
    for (int positionCounter = 0; positionCounter < 16; positionCounter++) {
        // scroll one position left:
        lcd.scrollDisplayLeft();
        // wait a bit:
        delay(100);
    }

    // delay at the end of the full loop:
    delay(150);
}

Comments

Similar projects you might like

Shower Regulator

Project tutorial by Ryan Chan

  • 5,560 views
  • 6 comments
  • 10 respects

Pill Me Please - The Automated Pill Packaging Machine!

Project tutorial by KevinZhangHK

  • 2,812 views
  • 0 comments
  • 18 respects

PIR Automated Intelligent Zebra Crossing

Project showcase by Adersh B

  • 2,265 views
  • 1 comment
  • 5 respects

Smart Garbage Monitoring System Using Arduino 101

Project tutorial by Technovation

  • 21,394 views
  • 7 comments
  • 32 respects

Automated Snake Enclosure with Camera

Project showcase by hagakure

  • 6,304 views
  • 9 comments
  • 17 respects

Eco-Thing #1 "Eco-Smart-Container V1.0"

Project tutorial by Alexis Santiago Allende

  • 5,305 views
  • 4 comments
  • 28 respects
Add projectSign up / Login