EcoRenovator  

Go Back   EcoRenovator > Improvements > Geothermal & Heat Pumps
Advanced Search
 


Blog 60+ Home Energy Saving Tips Recent Posts Search Today's Posts Mark Forums Read


Reply
 
Thread Tools Display Modes
Old 12-11-15, 08:00 PM   #321
jeff5may
Supreme EcoRenovator
 
Join Date: Jan 2010
Location: elizabethtown, ky, USA
Posts: 2,428
Thanks: 431
Thanked 619 Times in 517 Posts
Send a message via Yahoo to jeff5may
Default

I posted info in this thread.
My original intentions were for 3 sketches that could be loaded, for 3 modes of operation:
1: wall thermostat
2: slave outdoor unit device w/ defrost
3: Both #1 and #2

This is in post #140 of the thread.

While I was coding and prototyping, BBP and a few others got involved and began developing their own solutions. I think the rig BBP came up with had a Uno board everywhere there was equipment. Maybe 4 or 5. Somebody else started developing comms, and RS485 was suggested, which added a translator shield. Somebody else did flow sensing with the paddle-wheel counters. I could literally imagine BBP running back and forth between modules with a laptop, applying changes until all the bugs were driven from his rig.

I got the mode 1 board working and asked for help. No one came. So here it is:

Post 275: some trial pics

Github code

Post 298: No visitors to Github, so I posted my code inline.

The thing works off a generic (16Hertz) Uno board, the Dfrobot LCD keypad shield ( post #108), and a 1wire sensor DS18B20. I wired mine to a recycled power board for a portable dehumidifier for the TTL buffer and "sugar cube" relay control. Anybody could rig it through a relay shield like AC originally posted pics of.

I grabbed all the libraries from hacktronics after running into bugs with other source libraries.


Last edited by jeff5may; 12-11-15 at 09:10 PM..
jeff5may is offline   Reply With Quote
Old 12-27-15, 02:21 PM   #322
jeff5may
Supreme EcoRenovator
 
Join Date: Jan 2010
Location: elizabethtown, ky, USA
Posts: 2,428
Thanks: 431
Thanked 619 Times in 517 Posts
Send a message via Yahoo to jeff5may
Default

Quote:
Originally Posted by AC_Hacker View Post
BBP,

I was beginning to worry that you'd partied yourself right into the Great Refrigerant Reservoir in the sky... good to hear from you.

Regarding the controller project, I've gone through the available code(s) with the Arduino compiler, and also with the Arduino Simulator, and I'm pretty much at a standstill... I really have no idea if anything works in the available code(s) and with my limited programming experience, I'm not getting far with analyzing the code either.

Also there have been reliability issues reported regarding the flow sensors, so for this, the most basic controller, I am leaving out "pump flow verification".

I built a basic test fixture that I'll use for GPC#1.

Here's a photo:



I have it set up and tested and have verified that all the hardware elements are in place and working.

I have two lm35 type temp sensors, and have verified that they can send temperature data through the USB serial link. They are quite accurate, and in agreement.

I have tested that all the relevant inputs are correctly initialized and working.

I have tested that all the relevant outputs are correctly initialized and working and I can successfully send AC power to the 4 light bulbs.

The light bulbs are (L to R):

(compressor) (insidePump) (outsidePump) (axillary option).

Here's the code I've come up with.

It goes through it's power-up 2 minute wait (shortened to 15 sec for testing) successfully.

It then waits for the 5 volt "heat demand" signal

It then sequentially lights each of the bulbs in series for about 10 seconds each, in endless repetition.

Also the temperature sensor hardware, and code is working but I have commented out that code for now.



Code:
/*
  * General Purpose Controller for a water-to-water heat pump, basic version)
 ...
   delay(One_Sec); 
 }
I'm only going to have:
  • 2 minute delay at power on (maybe a blinking LED to indicate)
  • "on and waiting" (maybe a 'breathing' LED pattern to indicate)
  • respond to request for heat (true)
  • test for evaporator HX => 34 F = true (variable here)
  • test for storage tank temp =< 90 F = true (variable here)
  • if any of the above go false, then
  • cut power to compressor AND
  • keep running pumps for an additional 60 seconds (variable here)
  • return to initial "on and waiting"

So, I'm not really a programmer, and I'm not quite sure how to proceed at this point. I do know that if I read and try and test (and repeat), that I'll eventually get it to work.


I could use some help.

Best,

-AC
Since I am waist deep in trying out some defrost control code for my air-source version of a controller, I have been looking back through the posts. It sure looks like noone is willing to write any specific code except for their own needs. Everyone with expertise has come to their own endpoints, leaving us both to our own means.

Looking at the relative simplicity of yours vs mine, I thought I'd help you in the right direction. Here's a barebone rewrite of your code that should do what you say you want. I didn't put any serial messages into the loop, nor light flashes, to simplify the heart of the control functionality. It is very basic on purpose: let me know if it works.

Code:
/*
  * General Purpose Controller for a water-to-water heat pump, basic version)
  * Provides for:
  *     2 minute startup dalay for compressor protection
  *     Temperature monitoring of: 
  *         Evaporator HX temp
  *         Storage Tank Temp
  *     Controlling line voltage power to appropriate components:
  *         Outside loop pump
  *         Inside loop pump
  *         Compressor
  *         NOTE: Indoor operation is assumed, no compressor crankcase heater.
  *
  * PIN ASSIGNMENTS:
  * Digital Pins:
  *    D0 (reserved for USB & serial communication RX)
  *    D1 (reserved for USB & serial communication TX)
  *    D2 (* reserved for input loop flow data *)
  *    D3 (* reserved for output loop flow data *)
  *    D4 user input request for heat
  *    D5 output to Compressor SSR 
  *    D6 output to Inside Loop Pump SSR 
  *    D7 output to Outside Loop Pump SSR 
  *    D8 output to Auxillary Output SSR
  *    D9 (* not used *)
  *    D10 (* not used *)
  *    D11 (* not used *)
  *    D12 (* not used *)
  *    D13 LED (onboard)
  * Analog Pins:
  *    A0  input Temperature of Evaporator HX
  *    A1  input Temperature of Condenser Tank
  *    A2 (* not used *)
  *    A3 (* not used *)
  *    A4 (* not used *)
  *    A5 (* not used *)
  *
  */

#define  One_Sec              1000
#define  Quarter_Min         15000
#define  Half_Min            30000
#define  One_Min             60000
#define  Two_Min            120000
#define  Startup_delay      Quarter_Min

 float temp_in_celsius_0 = 0, 
       temp_in_celsius_1 = 1,  
       temp_in_kelvin_0 = 0,   
       temp_in_kelvin_1 = 0, 
       temp_in_fahrenheit_0 = 0,  
       temp_in_fahrenheit_1 = 0;
 
 // Associating Variable Names with pins      
 int HeatDemand = 4;
 int Compressor = 5;
 int inPump = 6;
 int outPump = 7;
 int auxOut = 8;
 int LED = 13;

 void setup()
  
 
 {
// Setting the mode of the digital pins   
pinMode(HeatDemand, INPUT); 
pinMode(Compressor, OUTPUT); 
pinMode(inPump, OUTPUT); 
pinMode(outPump, OUTPUT);
pinMode(auxOut, OUTPUT);
pinMode(LED, OUTPUT);  
   
   // Initialize print 
   Serial.begin(115200); 
   // 
// ****************** Startup Delay to Protect Compressor ********************
   Serial.print("begin startup delay");
   delay(15000);
   Serial.println(", end startup delay");
// ***************************** End Startup Delay ***************************  
  Serial.print("Activating Compressor");
  digitalWrite(Compressor, HIGH);
  delay(5000);
 Serial.println(", Deactivating Compressor");
  digitalWrite(Compressor, LOW);
  delay(500);

 Serial.print("Activating inPump");     
  digitalWrite(inPump, HIGH);
  delay(5000);
 Serial.println(", Deactivating inPump"); 
  digitalWrite(inPump, LOW);
  delay(500);

 Serial.print("Activating outPump");
  digitalWrite(outPump, HIGH);
  delay(5000);
 Serial.println(", Deactivating outPump"); 
  digitalWrite(outPump, LOW);
  delay(500);

 Serial.print("Activating Auxillary Output");
  digitalWrite(auxOut, HIGH);
  delay(5000);
 Serial.println(", Deactivating Auxillary Output"); 
  digitalWrite(auxOut, LOW);
  delay(500);  
 
// Serial.println("starting loop");
 

// {

   //Reads the input and converts it to Kelvin degrees
   temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; 
   
   //Reads the input and converts it to Kelvin degrees
   temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100;

/*   
   Converts Kelvin to Celsius minus 2.5 degrees error
   temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15; 
   
   Converts Kelvin to Celsius minus 2.5 degrees error
   temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15; 
*/   

   //Converts Kelvin to Celsius minus 2.5 degrees error  
   temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67;
   
   //Converts Kelvin to Celsius minus 2.5 degrees error  
   temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67;
   
   
/*
   //Print the temperature in Celsius to the serial port
   Serial.print("Celsius_0: ");
   Serial.print(temp_in_celsius_0); 

   //Print the temperature in Celsius to the serial port
   Serial.print("Celsius_1: ");
   Serial.println(temp_in_celsius_1);   
*/

   //Print the temperature in Fahrenheit to the serial port
   Serial.print("Temp_0: "); Serial.print(temp_in_fahrenheit_0);Serial.print(" deg.F"); Serial.print(", Temp_1: "); Serial.print(temp_in_fahrenheit_1);Serial.print(" deg.F");
   Serial.println();   


 }

/* 
 void loop()
 {
  temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; 
  temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100;
  temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15;
  temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15;
  temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67;
  temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67;
  if (HeatDemand)
	{outPump = true;
	`	if (temp_in_fahrenheit_0 > 34)
		{ digitalWrite(Compressor, HIGH);
			if (temp_in_fahrenheit_1 > 90)
				 digitalWrite(inPump, HIGH);
			else
				{
				digitalWrite(inPump, LOW);
				delay (Half_Min);
				}
		else
			{
			digitalWrite(Compressor, LOW);
			delay ( Half_Min);
			}
		
		}
	else
		{compressor = false;
		while(temp_in_fahrenheit_1 > 90)
			delay (One_Sec);
		digitalWrite(inPump, LOW);
		while (temp_in_fahrenheit_0 <34)
			delay(One_Sec);
		digitalWrite(outPump, LOW);
		}
	}
 delay(Two_Min); 
 }
Merry (belated) Christmas!

Last edited by jeff5may; 12-27-15 at 04:38 PM.. Reason: direct digital write vs assigning variables
jeff5may is offline   Reply With Quote
The Following User Says Thank You to jeff5may For This Useful Post:
AC_Hacker (12-31-15)
Old 12-27-15, 04:04 PM   #323
Mikesolar
Master EcoRenovator
 
Mikesolar's Avatar
 
Join Date: Aug 2012
Location: Toronto
Posts: 958
Thanks: 40
Thanked 158 Times in 150 Posts
Default

I would try to help but I blow up arduinos on a regular basis and although I do understand the steps needed, I have no concept of programming. Just saying.....guess I'm a torch monkey, haha



Quote:
Originally Posted by jeff5may View Post
Since I am waist deep in trying out some defrost control code for my air-source version of a controller, I have been looking back through the posts. It sure looks like noone is willing to write any specific code except for their own needs. Everyone with expertise has come to their own endpoints, leaving us both to our own means.

Looking at the relative simplicity of yours vs mine, I thought I'd help you in the right direction. Here's a barebone rewrite of your code that should do what you say you want. I didn't put any serial messages into the loop, nor light flashes, to simplify the heart of the control functionality. It is very basic on purpose: let me know if it works.

Code:
/*
  * General Purpose Controller for a water-to-water heat pump, basic version)
  * Provides for:
  *     2 minute startup dalay for compressor protection
  *     Temperature monitoring of: 
  *         Evaporator HX temp
  *         Storage Tank Temp
  *     Controlling line voltage power to appropriate components:
  *         Outside loop pump
  *         Inside loop pump
  *         Compressor
  *         NOTE: Indoor operation is assumed, no compressor crankcase heater.
  *
  * PIN ASSIGNMENTS:
  * Digital Pins:
  *    D0 (reserved for USB & serial communication RX)
  *    D1 (reserved for USB & serial communication TX)
  *    D2 (* reserved for input loop flow data *)
  *    D3 (* reserved for output loop flow data *)
  *    D4 user input request for heat
  *    D5 output to Compressor SSR 
  *    D6 output to Inside Loop Pump SSR 
  *    D7 output to Outside Loop Pump SSR 
  *    D8 output to Auxillary Output SSR
  *    D9 (* not used *)
  *    D10 (* not used *)
  *    D11 (* not used *)
  *    D12 (* not used *)
  *    D13 LED (onboard)
  * Analog Pins:
  *    A0  input Temperature of Evaporator HX
  *    A1  input Temperature of Condenser Tank
  *    A2 (* not used *)
  *    A3 (* not used *)
  *    A4 (* not used *)
  *    A5 (* not used *)
  *
  */

#define  One_Sec              1000
#define  Quarter_Min         15000
#define  Half_Min            30000
#define  One_Min             60000
#define  Two_Min            120000
#define  Startup_delay      Quarter_Min

 float temp_in_celsius_0 = 0, 
       temp_in_celsius_1 = 1,  
       temp_in_kelvin_0 = 0,   
       temp_in_kelvin_1 = 0, 
       temp_in_fahrenheit_0 = 0,  
       temp_in_fahrenheit_1 = 0;
 
 // Associating Variable Names with pins      
 int HeatDemand = 4;
 int Compressor = 5;
 int inPump = 6;
 int outPump = 7;
 int auxOut = 8;
 int LED = 13;

 void setup()
  
 
 {
// Setting the mode of the digital pins   
pinMode(HeatDemand, INPUT); 
pinMode(Compressor, OUTPUT); 
pinMode(inPump, OUTPUT); 
pinMode(outPump, OUTPUT);
pinMode(auxOut, OUTPUT);
pinMode(LED, OUTPUT);  
   
   // Initialize print 
   Serial.begin(115200); 
   // 
// ****************** Startup Delay to Protect Compressor ********************
   Serial.print("begin startup delay");
   delay(15000);
   Serial.println(", end startup delay");
// ***************************** End Startup Delay ***************************  
  Serial.print("Activating Compressor");
  digitalWrite(Compressor, HIGH);
  delay(5000);
 Serial.println(", Deactivating Compressor");
  digitalWrite(Compressor, LOW);
  delay(500);

 Serial.print("Activating inPump");     
  digitalWrite(inPump, HIGH);
  delay(5000);
 Serial.println(", Deactivating inPump"); 
  digitalWrite(inPump, LOW);
  delay(500);

 Serial.print("Activating outPump");
  digitalWrite(outPump, HIGH);
  delay(5000);
 Serial.println(", Deactivating outPump"); 
  digitalWrite(outPump, LOW);
  delay(500);

 Serial.print("Activating Auxillary Output");
  digitalWrite(auxOut, HIGH);
  delay(5000);
 Serial.println(", Deactivating Auxillary Output"); 
  digitalWrite(auxOut, LOW);
  delay(500);  
 
// Serial.println("starting loop");
 

// {

   //Reads the input and converts it to Kelvin degrees
   temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; 
   
   //Reads the input and converts it to Kelvin degrees
   temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100;

/*   
   Converts Kelvin to Celsius minus 2.5 degrees error
   temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15; 
   
   Converts Kelvin to Celsius minus 2.5 degrees error
   temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15; 
*/   

   //Converts Kelvin to Celsius minus 2.5 degrees error  
   temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67;
   
   //Converts Kelvin to Celsius minus 2.5 degrees error  
   temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67;
   
   
/*
   //Print the temperature in Celsius to the serial port
   Serial.print("Celsius_0: ");
   Serial.print(temp_in_celsius_0); 

   //Print the temperature in Celsius to the serial port
   Serial.print("Celsius_1: ");
   Serial.println(temp_in_celsius_1);   
*/

   //Print the temperature in Fahrenheit to the serial port
   Serial.print("Temp_0: "); Serial.print(temp_in_fahrenheit_0);Serial.print(" deg.F"); Serial.print(", Temp_1: "); Serial.print(temp_in_fahrenheit_1);Serial.print(" deg.F");
   Serial.println();   


 }

/* 
 void loop()
 {
  temp_in_kelvin_0 = analogRead(0) * 0.004882812 * 100; 
  temp_in_kelvin_1 = analogRead(1) * 0.004882812 * 100;
  temp_in_celsius_0 = temp_in_kelvin_0 - 2.5 - 273.15;
  temp_in_celsius_1 = temp_in_kelvin_1 - 2.5 - 273.15;
  temp_in_fahrenheit_0 = ((temp_in_kelvin_0 - 2.5) * 9 / 5) - 459.67;
  temp_in_fahrenheit_1 = ((temp_in_kelvin_1 - 2.5) * 9 / 5) - 459.67;
  if (HeatDemand)
	{outPump = true;
	`	if (temp_in_fahrenheit_0 > 34)
		{compressor = true;
			if (temp_in_fahrenheit_1 > 90)
				inPump = true;
			else
				{
				inPump = false;
				delay (Half_Min);
				}
		else
			{
			compressor = false;
			delay ( Half_Min);
			}
		
		}
	else
		{compressor = false;
		while(temp_in_fahrenheit_1 > 90)
			delay (One_Sec);
		inPump = false;
		while (temp_in_fahrenheit_0 <34)
			delay(One_Sec);
		outPump = false;
		}
	}
 delay(Two_Min); 
 }
Merry (belated) Christmas!
Mikesolar is offline   Reply With Quote
Old 12-31-15, 03:40 PM   #324
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default

Quote:
Originally Posted by jeff5may View Post
Looking at the relative simplicity of yours vs mine, I thought I'd help you in the right direction. Here's a barebone rewrite of your code that should do what you say you want. I didn't put any serial messages into the loop, nor light flashes, to simplify the heart of the control functionality. It is very basic on purpose: let me know if it works.
Thanks jeff5may,

Since you have no LED outputs, are you figuring on the light bulbs to indicate if things are functioning?

Can you give me a brief description of what you expect your code to do?

Best,
-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 12-31-15, 08:18 PM   #325
jeff5may
Supreme EcoRenovator
 
Join Date: Jan 2010
Location: elizabethtown, ky, USA
Posts: 2,428
Thanks: 431
Thanked 619 Times in 517 Posts
Send a message via Yahoo to jeff5may
Default

I don't have anything. This one is yours. Since I don't have yours, it might not even compile. If it works, try it out with sensors or potentiometers.
jeff5may is offline   Reply With Quote
Old 12-31-15, 09:13 PM   #326
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default

Quote:
Originally Posted by jeff5may View Post
I don't have anything. This one is yours. Since I don't have yours, it might not even compile. If it works, try it out with sensors or potentiometers.
Will do.

May take a day or two, what with all the general festivities...

Happy New Year Old Buddy!

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 12-31-15, 11:04 PM   #327
jeff5may
Supreme EcoRenovator
 
Join Date: Jan 2010
Location: elizabethtown, ky, USA
Posts: 2,428
Thanks: 431
Thanked 619 Times in 517 Posts
Send a message via Yahoo to jeff5may
Default

here is the flowchart I used to write the code.

I believe I may have put the check temperature step in so when there is no demand, temp doesn't get checked.

it should be fairly easy to check out operating states of the control by feeding a heating demand signal in and watching the light bulbs. if you rig up some fake sensor inputs, the various trigger conditions could be checked. a serial print line could be inserted immediately following the temperature check to keep an eye on the sensor values and to tweak delay times. If the thing doesn't have enough serial logging or flashy lights for you, that frill can be inserted after the light bulbs do what they are supposed to.

Good luck and happy new year.
Attached Thumbnails
Click image for larger version

Name:	20151231_232621.jpg
Views:	979
Size:	494.2 KB
ID:	6452  
jeff5may is offline   Reply With Quote
Old 01-03-16, 10:31 AM   #328
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default

Quote:
Originally Posted by jeff5may View Post
here is the flowchart I used to write the code.
Perfect!

Probably, tomorrow I'll d the deed.

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 01-03-16, 02:00 PM   #329
Acuario
Apprentice EcoRenovator
 
Join Date: May 2011
Location: Tortosa, Spain
Posts: 221
Thanks: 2
Thanked 81 Times in 46 Posts
Default

Quote:
Originally Posted by AC_Hacker View Post
Acurio,

I am shocked that I missed your offer to sart another thread using the RTOS.

By all means have at it!

Do you have links to RTOS?

-AC
Sorry for the delay in responding, I just saw your post...
The RTOS I'm using is NilRTOS and I've had my test rig on the bench for a few weeks now and it's performing well so soon it'll get 'fitted' into a real machine for field trials.

I'll post code on the other thread so as not to contaminate this one.
I did choose an Arduino Mega for the controller as I quickly ran out of space on the UNO.

Acuario
Acuario is offline   Reply With Quote
The Following User Says Thank You to Acuario For This Useful Post:
AC_Hacker (01-03-16)
Old 01-03-16, 03:47 PM   #330
AC_Hacker
Supreme EcoRenovator
 
AC_Hacker's Avatar
 
Join Date: Mar 2009
Location: Portland, OR
Posts: 4,004
Thanks: 303
Thanked 723 Times in 534 Posts
Default

OK Jeff, I'm snowed in. No better time to muck about with Arduino stuff.

I've had to re-boot my Arduino-brain. Seems a memory leak has caused all my knowledge to run out.

It's beginning to come back. Glad of the documentation I left in the code, I'd be a blob of jelly on the floor otherwise.

-AC

__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Ad Management by RedTyger
Inactive Reminders By Icora Web Design