22 feb 2015

"Smart" solar water heater - My first Arduino project


Short time ago a friend of mine gave me an Arduino board, a sort of tunable programmer that can suit your needs, relatively low cost and backed up with a community of passionate makers. Electronics for newbies. So this small electronic board came to make my spare time busy. In this video I stand marveled at the stat of the art:



So I decided to try to make reality a basic and simple idea that had been arrounf my head long ago. As it is by everyone well known, a water pipe left to the sun, spetially when black, do tent to heat up the water contained in them, up to temperatures that can burn the skin (when intense radiation conditions are achieved).

The idea would be to actually know when it is suitable to recirculate water from a heat accumulator, know when the pipe would be full of hot water, and know when we can pour cold water to be heated.


For such porpoise was needed:


- Water tank. Better if isolated, but for testing porpoises I wanted it to be with no pressure, that is open air deposit.



- Pipe, better if black, and accessories.


- A water recirculation pump. I am using my good old electric pump that so much weater has been moving around. It fears more staying still (thus rusty) that being operative.


- Two temperature sensor  (I did not get pictures right) and a Relay.


- And nevertheless our Arduino board, wires  -notice I have used conventional network cable RJ45 that allow you to take sensors and relay "just where you need them", and a protoboard usually used to this kind of experiments

Physic connection goes, more or less, as follows:

- Temperature sensors: Both sensors have 5 V line input (the one bringing electricity), an information pin that will be connected to an analog input in order to measure analog readings, and a ground pin that "closes" the electrical flow.

- The Relay: Relay is basicly the same, except that signal will be connected to a digital pin as we will only need to deal with either if is on or off. In my situation relay is normally open (NO). On the other side of it we connect a conventional switch installation governed by the relay. Please excuse there are no pictures but once in its place it was quite hard to make such.

Remark here that I used conventional RJ45 network wire to place the sensors and relay where I needed them to be, and observed to be a simple and effective solution.

And after the code to be loaded in our Arduino board. I simply copypasted code found in references, and last lines "simply came to my mind"... It was very easy to do what I had in mind. Now is on testing stage, to see what it can do, and iI can tune it up. This is that:

//......................................................................
// SOLAR THERMAL ENERGY FOR ALL (S.T.E.F.A. V_0.01)
//......................................................................
// this code allows to activate a relay according to a temperature differential
// the role of this program is to operate a reculation water pumpel
// only when heating conditions are optimal
//......................................................................
int sensorPin1 = 0;
int sensorPin2 = 1;
int Relay = 8;
// we activate both temperature sensor and relay

void setup()
// this code only runs once
{
  Serial.begin(9600);
  // activates "Monitor Serial" in our computer
 
  pinMode(Relay, OUTPUT);
  // defines relay on or off
 
  Serial.println("More sun, more water. Less sun, less water.");
}

void loop()
// this code goes over and over...
{

Serial.println(".....................................");

//......................................................................
// TEMPERATURE SENSOR 1
//......................................................................
int reading1 = analogRead(sensorPin1);
// gets the reading

float voltage1 = reading1 * 5.0;
voltage1 /= 1024.0;
// calculates voltage output

float temperatureC1 = (voltage1 - 0.5) * 100;
// calculates temperature from voltage

Serial.print(temperatureC1); Serial.println(" C degrees...... tank sensor...");
// prints temperature from sensor 1

//......................................................................
// TEMPERATURE SENSOR 2
//......................................................................
int reading2 = analogRead(sensorPin2);
// gets the reading

float voltage2 = reading2 * 5.0;
voltage2 /= 1024.0;
// calculates voltage output

float temperatureC2 = (voltage2 - 0.5) * 100;
// calculates temperature from voltage

Serial.print(temperatureC2); Serial.println(" C degrees ...... pipe sensor");
// prints temperature from sensor 2

//......................................................................
// TEMPERATURE DIFFERENTIAL
//......................................................................
float diferencialT = temperatureC1 - temperatureC2;
// calculates temperature differential

Serial.print(diferencialT); Serial.println(" grados C diferencial temperatura");
// prints temperature differential

//......................................................................
// RELAY CONTROL
//......................................................................
if( temperatureC2 < temperatureC1 + 05.00 )
// Establishes activation on differential temperature. 05.00 is 5 Celsius degrees.
// Tune this value to suit your needs
{
  digitalWrite(Relay, HIGH);
// Activates relay (normally open), thus deactivates circulation
}

else if( temperatureC1 < temperatureC2 +- 99.00 )
//in case wire connexion is lost
{
  digitalWrite(Relay, HIGH);
// thus will not activate on error read.
}

else
{
  digitalWrite(Relay, LOW);
  Serial.println("........WATER RECIRCULATING........");
// makes relay off, Since NO activates electricity flow
// and thus moves water

}

delay(8220);
// waiting time between reading and action

}


//......................................................................
//......................................................................
// Luis Rodriguez Alonso. February 2015. habitainer@gmail.com
// http://habican.blogspot.com.es/
// published under GNU GENERAL PUBLIC LICENSE
// https://gnu.org/licenses/gpl-3.0.en.html
// this document has been made up with information and code from:
// http://descargas.cetronic.es/TMP36.pdf
// http://tech.yeesiang.com/control-real-devices-using-relay/
// http://arduino.cc/en/pmwiki.php?n=Reference/Else
//......................................................................
//......................................................................


And, could not be otherwise, a small 3D capture of water tank and pipe:


No hay comentarios:

Publicar un comentario