Introduction: Solar Collector & Radiant Heat Controller

If you are like me and wish to take a stab at DYI solar collection and utilization you have probably found that it is not going to be cheap. This project is a step towards saving some of that hard earned cash. A adequate solar hot water heater controller would cost you around $200.00. A radiant heat controller will cost around the same.This project will do pretty much the same thing but only cost around $60.00, Plus, you can always add to it . (This was my very first project using an Arduino.)

Step 1: Things You Will Need.

1. Arduino Uno, Duemilanove or any other board type with the same pin set.

2. Relay shield

3. LCD w/button shield

4. Mini Breadboard

5. Breadboard wire, 3 Female/Female, and 7 x Male/Female

6. 2.2K resistors x 4

7. LM335 Temperature Sensors x 4

8. 2.54 mm Single Row (L 11MM) Male Header (you only need 7 pins, they can be cut down)

You'll also need a soldering iron,some silver solder and electrical tape.

Step 2: Add Headers for Sensors & Power

Lets go ahead and get the hardest part of the project done.

1.Count over 5 pins on your header strip and with snips or exact-o knife cut them off. Do the same for another header two pins long.

2.Insert the header from the back side of the board with the longest pins pointing away from the front of the shield (reference the picture above).

3.With a soldering iron heat the pad at each pin and solder header to the board with silver baring solder.

Step 3: The Breadboard

The next step in the project is to populate a breadboard with the resistors and sensors. You can solder the sensors to 22-gauge thermostat wire when you are ready to install the controller but for now we are just going to insert them into the breadboard where the wire will go when installed. ( I also included Eagle files if you wish to make a PBC to connect directly to the pins you added to the LCD shield. ) Refer to the schematic above to populate the bread board.

Step 4: Jumper Wires

The way the shields are configure individually the pins will conflict but there is an easy fix to this. Pull out your relay shield and look to the middle and you will see 4 jumper pins. they are labled D2, D7, D8, D10. You need to remove the jumpers from the D7,D8 and the D10 pins. We are going to use the F/F jumper wires to change the pin source but first we need to modify the jumper wire. If you look at the jumper wire ends closely you will see a little tab that is keeping the bare wire connector inserted into the shielding plastic. With a small flat-head screw driver pry this tab up and remove the shielding plastic from both ends. Now we want to bend the connector to a 90 degree angle like the picture above shows. Now we want to wrap a piece of electrical tape around the connector to re-insulate the bare connector. Now we just need to jump wire from the center pin of each 3 pin jumper connection on the board to the corresponding pin. D7 to D3, D8 to D11, and D10 to D12

Step 5: Assembling the Controller

We are ready to assemble the controller.

1. Align the pins of the relay shield to the Arduino and slowly press together.

2. Align the pins from the LCD shield to the relay shield and slowly press together. Take notice to the jumper wire connectors. If it looks as thou there is a chance that they can touch the solder connections on the bottom of the LCD shield then pull apart and add electrical tape to the solder joints to further insulate them. After that press the shields together completely.

3. Connect the M/F jumper wires from the pins of the LCD Shield that you added to the bread board and shown in the above photo.

Step 6: Programming the Arduino

The next step is adding the program code to the Arduino. For this we need to download some free IDE software from this site (http://arduino.cc/en/Main/Software). Download the most current IDE Software that is avaliable on the site.

1. Download and install the software from the site.

2. Open the program then connect the Arduino cluster to your computer Via the USB Port.

3. Select Tools/Board and select the Arduino that you are using.

3. Select Tools/Port and select the port that is selectable.

4. Download and open the file from below or Start a new file and copy and paste the code from below.

5. Press the right arrow button on the program bar to upload the sketch to your Arduino.

// Title: Solar Collector & Radiant Heat Grid Controller
// Date:12/01/14 // Author: Chris Biblis (My First Adruino Project )

#include LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // define some values used by the panel and buttons int lcd_key = 0; int adc_key_in = 0; #define btnRIGHT 0 #define btnUP 1 #define btnDOWN 2 #define btnLEFT 3 #define btnSELECT 4 #define btnNONE 5 // read the buttons int read_LCD_buttons(){ adc_key_in = analogRead(0); // buttons when read are centered at these valies: 0, 144, 329, 504, 741 // we add approx 50 to those values and check to see if we are close if (adc_key_in > 1000) return btnNONE; if (adc_key_in < 50) return btnRIGHT; if (adc_key_in < 250) return btnUP; if (adc_key_in < 450) return btnDOWN; if (adc_key_in < 625) return btnLEFT; //Changed value to 625 do to double read from select button Default is 650. if (adc_key_in < 850) return btnSELECT; return btnNONE; } // Setup relay shield pin array. //RELAY SHIELD PIN SWAPS, D7 = D3, D9 = D11, D10 = D12 int relayPin[] = {2, 3, 11, 12}; int pinCount = 4;

// Set On/Off Differentials for collector/tank temperatures. const int diffON = 5; const int diffOFF = 2;

// Set Default Thermostat temperature int setTemp = 60;

//Used for calibration int offSet[] = {-2, -1, 0, 1, 2};

//Button Variables. int select = 0; int up = 0; int down= 0; int backLight = 10; boolean BLbutton = false;

void setup(){ lcd.begin(16, 2); lcd.setCursor(0,0); //Introduction Screen lcd.print("Solar Collection"); lcd.setCursor(0,1); lcd.print("& Radiant Heater"); delay(2000); for (int thisPin = 0; thisPin < pinCount; thisPin++) { pinMode(relayPin[thisPin], OUTPUT);} } // Read average voltage from sensors int ReadSens(int x){ int i; int sval = 0; for (i = 0; i < 10; i++){ sval = sval + analogRead(x); } sval = sval / 10; return sval; } // Calculate temperature in F from voltage of sensors. int getTemp(int y){ //Convert to Celcius float a = (((y / 1024.0) * 5000)/10)-273.15; //Convert Celcius to Fahrenheit float b = a * 9.0 / 5.0 + 32.0; return b; }

void loop(){ // Get average Voltage int amb = ReadSens(1); int col = ReadSens(2); int tk = ReadSens(3); int tt1 = ReadSens(4); int tt2 = ReadSens(5); // Get Temperatures & Apply OffSet { -2, -1 , 0, 1, 2 } int ambient = (getTemp(amb) + offSet[0]); int collector = (getTemp(col) + offSet[0]); int tank = (getTemp(tk) + offSet[0]); int transferTemp = (getTemp(tt1) + offSet[0]); int transferTemp1 = (getTemp(tt2) + offSet[0]); //Backlight button selection... if (BLbutton == true){pinMode(backLight, INPUT);} //turn backlight off else{pinMode(backLight,OUTPUT);} //turn backlight on // Display screens if (select == 3){select = 0;} if (select == 0){ lcd.clear(); lcd.setCursor(0,0); lcd.print(" Ambient Temp "); lcd.setCursor(6,1); lcd.print(ambient); lcd.print(" F"); } if (select == 1) { lcd.clear(); lcd.setCursor(0,0); lcd.print("Set Ambient To:"); lcd.setCursor(6,1); lcd.print(setTemp); lcd.print(" F"); } if (select == 2) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("C: "); lcd.print(collector); lcd.print("F"); lcd.setCursor(9, 0); lcd.print("TK:"); lcd.print(tank); lcd.print("F"); lcd.setCursor(0, 1); lcd.print("T1:"); lcd.print(transferTemp); lcd.print("F"); lcd.setCursor(9, 1); lcd.print("T2:"); lcd.print(transferTemp1); lcd.print("F"); } lcd_key = read_LCD_buttons(); // read the buttons switch (lcd_key){ case btnSELECT:{ BLbutton = !BLbutton; delay(100); break; } case btnUP: { setTemp++; select = 1; delay(100); break; } case btnDOWN: { setTemp--; select = 1; delay(100); break; } case btnRIGHT: { select++; delay(100); break; } case btnLEFT: { select--; delay(100); break; } }

// Runs circulation pump from collector to tank. if(collector > (tank + diffON)) {digitalWrite(relayPin[0], HIGH);digitalWrite(relayPin[1], HIGH);} if(collector <= (tank + diffOFF)) {digitalWrite(relayPin[0], LOW);digitalWrite(relayPin[1], LOW);} //Runs circulation pump from tank to radiant heat grid. if ((ambient < setTemp) && (tank >= 100)) {digitalWrite(relayPin[2], HIGH);} if (tank <= (setTemp + 10)) {digitalWrite(relayPin[2], LOW);} if (ambient > (setTemp + 2)) {digitalWrite(relayPin[2], LOW);} delay(500); }

Step 7: Controller Functions

So now you have a functioning controller. You will have to connect the transformer to the Arduino in order for the relays to function. ( Note: At times when the transformer is disconnected and the relays try to activate the writing on the LCD get screwy because it drains to much power.)

- When you plug it up it will display the circuit title.

- After 2 seconds it will display the ambient temperature.

- To switch to the set ambient temperature screen click the right button.

- You can adjust the set temperature by using the up/down buttons

- Click the right button once more and it will display all of the sensor readings less the ambient temperature, which is displayed on the first screen.

- C: is the collector ( sensor goes in the collector),

- TK: is the tank ( sensor is taped to the steal tank behind the lower cover of a hot water heater) ,

- T1: and T2: are the transfer temperatures by default.( I taped them to my circulation pump housings to determine the amount of heat transfer. You can use them for what ever purpose you'd like.)

- The Select button with toggle the back light on/off.

- Notice that i only use three relays in the sketch. You can add to the sketch to use the fourth relay, it is connected just not used.

- The first thing to do is to note all of the temperatures being displayed. I wrote in an offset array to make them all read the same.

// Get Temperatures & Apply OffSet { -2, -1 , 0, 1, 2 }
int ambient = (getTemp(amb) + offSet[0]);

When adjusting sensors it will add the number written within the brackets. [0] = -2, [1] = -1, [2] = 0, ect.

Browse the sketch and adjust anything that you want. Once you have it the way you want it mount the controller somewhere safe from water ( I used a thermostat protector from lowe's in the HVAC section) then connect the power and your circulation pumps to the corresponding relays. Add your off to saving money.

Step 8: Walk Thru of My System.

I posted a youtube video for anyone interested in seeing it in action. It wouldn't hurt to watch this video if you plan to build this project or want to know why i wrote the code the way that i did.

That's it for now.

Thanks for any comment you leave and questions are welcome... Enjoy :)