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 08-17-14, 06:04 PM   #221
buffalobillpatrick
Master EcoRenovator
 
Join Date: Mar 2014
Location: Florissant, Colorado
Posts: 599
Thanks: 814
Thanked 59 Times in 55 Posts
Default

A/C I can barely remember my name at 72

I'm gonna be gone for about 12 days. Son is getting married.

This code is not debugged. I think that LCD feedback will help.

Rev06
Code:
void loop() 
{
  readTemps();
  
  if (SKIP_FLOW_BOOL == false)    readFlows();
  
  demand = digitalRead(demandPin);
  
  demand = HIGH;  //debug

  unsigned long current_Time = millis();
    
  T1 =   current_Time;

  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("curr_Time = "));
  lcd.setCursor(0,1);
  lcd.print(current_Time);
  delay(5000);        //Delay 5 sec 
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("wait_Time = "));
  lcd.setCursor(0,1);
  lcd.print(wait_Time);
  delay(5000);        //Delay 5 sec 
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("wait_Time+2min= "));
  lcd.setCursor(0,1);
  lcd.print((wait_Time + Two_Min));
  delay(5000);        //Delay 5 sec 
 
 
     
  if (demand == true) 
  {   
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("demand=true"));
  lcd.setCursor(0,1);
  lcd.print(F("WAIT 2 MIN"));
  delay(5000);        //Delay 5 sec 
  }
  
  if ((demand == true) 
     && (current_Time >= (wait_Time + Two_Min)))  //Wait 2 min.
  { 
    
  if (runHP == false) hpStart_Time = current_Time;
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("hpStart_Time = "));
  lcd.setCursor(0,1);
  lcd.print(hpStart_Time);
  delay(5000);        //Delay 5 sec 
  
  
  runHP = true; 
      
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runHP = true"));
  delay(5000);        //Delay 5 sec      
      
  }
  
  else 
  {
  if (runHP == true) 
  {
    
  hpStop_Time = current_Time;
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("hpStop_Time = "));
  lcd.setCursor(0,1);
  lcd.print(hpStop_Time);
  delay(5000);        //Delay 5 sec 

  
  runHP = false;
      
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runHP = false"));
  delay(5000);        //Delay 5 sec      
      
  }
  }


  //*****HP startup cycle********
  if (runHP == true) 
  {
  runInPump = true;
    
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runInPump = true"));
  delay(5000);        //Delay 5 sec      
  }
  
  if ((runHP == true) 
     && (current_Time >= (hpStart_Time + Half_Min)))  //Wait 1/2 min comp start
  { 
    
  if (SKIP_FLOW_BOOL == false)
  {   
  if (HpLPM > minLPM)  runCompressor = true;
  }
  else runCompressor = true;
  }

    
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runComp = true"));
  delay(5000);        //Delay 5 sec      
      

  
  if ((runHP == true) 
     && (current_Time >= (hpStart_Time + One_Min)))  //Wait 1 min
  {
  runOutPump = true;           //Delay out pump start 60s after starting in pump
  ledState = true;             ///turn on pin 13 led after startup of HP
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runOutPump=true"));
  lcd.setCursor(0,1);
  lcd.print(F("ledState=true"));
  delay(5000);        //Delay 5 sec             
  }
 
 
  
  //*****HP shutdown cycle********
  if (runHP == false) 
  {
  runCompressor = false;
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runComp=OFF"));
  delay(5000);        //Delay 5 sec 
  } 
  
  if ((runHP == false) 
     && (current_Time >= (hpStop_Time + Two_Min)))  //Wait 2 min
  {
  runInPump = false;
   
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runInPump=OFF"));
  delay(5000);        //Delay 5 sec 
  }
      
  if ((runHP == false) 
     && (current_Time >= (hpStop_Time + Five_Min)))  //Wait 5 min  
  {
  runOutPump = false;
  
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("runOutPump=OFF"));
  delay(5000);        //Delay 5 sec 
  }
 
  
  wait_Time = current_Time;
     
  lcd.clear();  
  lcd.home (); // go home 
  lcd.print(F("wait_Time = "));
  lcd.setCursor(0,1);
  lcd.print(wait_Time);
  delay(5000);        //Delay 5 sec 
        
  ledState = false;               //turn off pin 13 led after shutdown of HP
  
 
 
  if (SKIP_FLOW_BOOL == false)
  {
  //***Check flow rates above min***
  if (HpLPM < minLPM || HpLPM1 < minLPM) 
  {
  runCompressor = false;
  
  if (runHP == true) hpStop_Time = current_Time;
  
  wait_Time = (current_Time + Ten_Min); //prevent cycle restart for 10m
  runHP = false;
  }
  }


 //***Check evaporator/condensor above/below limits*** 
 //   not intended for defrost purposes, halts system for 30m
  if (evap_Temp < minEv || cond_Temp > maxCon) 
  {
  runCompressor = false;
  
  if (runHP == true) hpStop_Time = current_Time;
  
  wait_Time = (current_Time + Thirty_Min); //prevent cycle restart for 30m
  runHP = false;
  }
    
  
  digitalWrite(led, ledState);
  digitalWrite(comp, runCompressor);
  digitalWrite(inPump, runInPump);
  digitalWrite(outPump, runOutPump);


  T2 = millis();

  TT = T2 - T1;
  
  lcd.clear();
  lcd.home (); // go home
  lcd.print(TT);    // 5 sec
  delay(5000); 
  
  
}


Last edited by buffalobillpatrick; 08-17-14 at 06:07 PM..
buffalobillpatrick is offline   Reply With Quote
Old 08-17-14, 06:08 PM   #222
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

(* delete *)
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...
AC_Hacker is offline   Reply With Quote
Old 08-17-14, 06:11 PM   #223
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 buffalobillpatrick View Post
A/C I can barely remember my name at 72
Your name is "BBP"...

Write it down!!

Have a good trip.

-AC (anyway, I think so)
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 08-17-14 at 06:14 PM..
AC_Hacker is offline   Reply With Quote
The Following User Says Thank You to AC_Hacker For This Useful Post:
buffalobillpatrick (08-17-14)
Old 08-18-14, 12:09 PM   #224
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

I rummaged through my Arduino rubble and recovered my LCD display that came with an I2C module.


I soldered on the module and also made the required 4-pin cable.


Then I , hooked up the leads properly and powered up the Uno, verified that power is correctly applied, and that otherwise, nothing else is happening.

So I hunting the web for the next step, and quickly came across THIS page that shows a simple sketch that will locate the address of the I2C.

Code:
//Written by Nick Gammon
 // Date: 20th April 2011

 #include <Wire.h>

 void setup() {
   Serial.begin (115200);

   // Leonardo: wait for serial port to connect
   while (!Serial)
     {
     }

   Serial.println ();
   Serial.println ("I2C scanner. Scanning ...");
   byte count = 0;
  
   Wire.begin();
   for (byte i = 1; i < 120; i++)
   {
     Wire.beginTransmission (i);
     if (Wire.endTransmission () == 0)
       {
       Serial.print ("Found address: ");
       Serial.print (i, DEC);
       Serial.print (" (0x");
       Serial.print (i, HEX);
       Serial.println (")");
       count++;
       delay (1);  // maybe unneeded?
       } // end of good response
   } // end of for loop
   Serial.println ("Done.");
   Serial.print ("Found ");
   Serial.print (count, DEC);
   Serial.println (" device(s).");
 }  // end of setup

 void loop() {}

I uploaded the sketch to the Uno.


Then I opened the serial window by pressing the "magnifying glass" button, as shown in the image above. Clicking the magnifying glass icon popped open the serial window as shown below.


At first, I was just getting gibberish, but by stepping through all the possible baud rate choices, I finally got the right one (115200 in my case), and was able to clearly read the information I needed to install the I2C LCD assembly.

EDIT: Subsequent examination reminds me that the sketch contained the lines:

void setup() {
Serial.begin (115200);


...which determined that the baud rate would be 115200.

* * *

But all of this begs the question: If I am installing the I2C LCD module, in order to be able to monitor the working of the sketch, why go to the bother and expense of buying and installing the I2C LCD module, when I can simply use the serial window itself to monitor the workings of the sketch??

So for now, that is exactly what I am going to do. All the variants of the LCD display go back into the Arduino parts box...

Best,

-AC
Attached Thumbnails
Click image for larger version

Name:	Arduino Serial.jpg
Views:	1133
Size:	74.5 KB
ID:	4572   Click image for larger version

Name:	serial window.jpg
Views:	1106
Size:	27.1 KB
ID:	4573   Click image for larger version

Name:	I2C LCD & cable.jpg
Views:	1088
Size:	33.7 KB
ID:	4574   Click image for larger version

Name:	LCD & I2C module.jpg
Views:	1088
Size:	28.5 KB
ID:	4575  
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 08-18-14 at 03:05 PM..
AC_Hacker is offline   Reply With Quote
The Following User Says Thank You to AC_Hacker For This Useful Post:
buffalobillpatrick (08-18-14)
Old 08-18-14, 01:08 PM   #225
buffalobillpatrick
Master EcoRenovator
 
Join Date: Mar 2014
Location: Florissant, Colorado
Posts: 599
Thanks: 814
Thanked 59 Times in 55 Posts
Default

See 1st line of code. your 0x27 goes there.

Serial Monitor window is just fine for debug, but won't be available later when HP Controller is remote from your PC.

& if HP Controller hangs once in a while, when you power it off & connect to a PC then problem might not replicate in reasonable amount of time.

When I use to do Microcode & Power-On Self Test Diagnostic code for a living, I even added a circular Trace Buffer where code continuously traced it's path.

Every functions 1st line of code wrote it's ID into Trace Buffer & any other troublesome area like interrupt handlers.

Great aid for debug & intermittent errors.

And yes, computers, microprocessors, Arduinos, have intermittent errors.

Last edited by buffalobillpatrick; 08-18-14 at 01:57 PM..
buffalobillpatrick is offline   Reply With Quote
The Following User Says Thank You to buffalobillpatrick For This Useful Post:
AC_Hacker (08-18-14)
Old 08-18-14, 02:01 PM   #226
buffalobillpatrick
Master EcoRenovator
 
Join Date: Mar 2014
Location: Florissant, Colorado
Posts: 599
Thanks: 814
Thanked 59 Times in 55 Posts
Default

I have some questions:

Why delay between In & Out pumps?

Why delay between pumps & compressor?

Why delay on powering down Compressor & pumps?

I think that I understand the need for startup delay. (To avoid Power glitch restarting compressor too soon)

I have no hands on experience on HP

Last edited by buffalobillpatrick; 08-18-14 at 02:09 PM..
buffalobillpatrick is offline   Reply With Quote
Old 08-18-14, 02:03 PM   #227
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

(re: post #225)

All very good advice, BBP.

Right now, I'm just trying to verify that I have a sketch, any sketch, that is capable of performing it's very basic functioning.

I have no certainty that we have reached that point right now.

So I am focusing my efforts toward that one goal.

Best,

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 08-18-14 at 03:07 PM..
AC_Hacker is offline   Reply With Quote
The Following User Says Thank You to AC_Hacker For This Useful Post:
buffalobillpatrick (08-18-14)
Old 08-18-14, 02:43 PM   #228
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 buffalobillpatrick View Post
Why delay between In & Out pumps?
I'm not completely certain of Ormston's rationale, but it is required to have a delay between a power lapse and the restarting of the compressor, to protect the compressor against starting when filled with liquid. This is vital.

Then there is the issue that you want to assure that water is flowing before you start the compressor, so that you don't chill the evaporator HX to sub freezing by running the compressor, with no water circulation. This would burst the evaporator HX in an very short time. This is vital. There is a corollary to this which is that you need to make sure that water that has flowed through your evaporator HX is exiting at a temperature that is comfortably above freezing. You need to assure that you have water flowing here to make a measurement of water exiting the evaporator HX. This is vital.

There is an additional issue that it would be preferable, that you have a heated condition in the condenser HX before starting the condenser pump, so you don't pump cold water into the hot water storage tank. This is preferable.

Quote:
Originally Posted by buffalobillpatrick View Post
Why delay between pumps & compressor?
See above. Plus Ormston is going with flow measuring sensors (I don't yet see any other way to do it other than the way he has chosen), so it could take some time to get everything up to speed before measuring.

Quote:
Originally Posted by buffalobillpatrick View Post
Why delay on powering down Compressor & pumps?
So that you can squeeze every last BTU out of the HX (the condenser HX) before shutting down the inside loop pump. This delay wouldn't require too much time.
at the same time as the compressor.

I hope Ormston chimes in here, I'd be interested to see what his thinking is regarding the various delays.

Best,

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 08-18-14 at 03:11 PM..
AC_Hacker is offline   Reply With Quote
The Following User Says Thank You to AC_Hacker For This Useful Post:
buffalobillpatrick (08-18-14)
Old 08-18-14, 03:13 PM   #229
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 buffalobillpatrick View Post
Why delay between In & Out pumps?
I'm not completely certain of Ormston's rationale, but it is required to have a delay between a power lapse and the restarting of the compressor, to protect the compressor against starting when filled with liquid. This is vital.

Then there is the issue that you want to assure that water is flowing before you start the compressor, so that you don't chill the evaporator HX to sub freezing by running the compressor, with no water circulation. This would burst the evaporator HX in an very short time. This is vital. There is a corollary to this which is that you need to make sure that water that has flowed through your evaporator HX is exiting at a temperature that is comfortably above freezing. You need to assure that you have water flowing here to make a measurement of water exiting the evaporator HX.

There is an additional issue that it would be preferable, that you have a heated condition in the condenser HX before starting the condenser pump, so you don't pump cold water into the hot water storage tank. This is preferable.

Quote:
Originally Posted by buffalobillpatrick View Post
Why delay between pumps & compressor?
See above. Plus Ormston is going with flow measuring sensors (I don't yet see any other way to do it other than the way he has chosen), so it could take some time to get everything up to speed before measuring.

Quote:
Originally Posted by buffalobillpatrick View Post
Why delay on powering down Compressor & pumps?
So that you can squeeze every last BTU out of the condenser HX before shutdown. This delay shouldn't require too much time.

I see no reason why the outside loop pump (evaporator HX circuit) could not be shut down at the same time as the compressor.

I hope Ormston chimes in here, I'd be interested to see what his thinking is regarding the various delays.

Best,

-AC
__________________
I'm not an HVAC technician. In fact, I'm barely even a hacker...

Last edited by AC_Hacker; 08-18-14 at 03:15 PM..
AC_Hacker is offline   Reply With Quote
The Following User Says Thank You to AC_Hacker For This Useful Post:
buffalobillpatrick (08-18-14)
Old 08-18-14, 04:13 PM   #230
Ormston
Apprentice EcoRenovator
 
Join Date: Mar 2013
Location: UK
Posts: 131
Thanks: 13
Thanked 35 Times in 32 Posts
Default

AC/BBP

My thinking behind the delays which may well be flawed.

Startup inlet pump and wait to make sure temp is above minimum including water from far end of ground loop, also make sure flow Meyer is functioning and flow is adequate.

Start compressor.

Output pump delay
From monitoring my ASHP it takes some time from when the compressor starts to when useful heat is available. In my case it takes 5 mins but that is with water flowing through the condenser.

Shutdown
Stop compressor

Delay to stop inlet pump as refrigerant will be passing through expansion device for some time and will continue to remove heat from the evaporator.

Delay to stop outlet pump to extract as much useful heat as possible from condenser as you have already paid for it. This would be better done with in and out temp sensors.

Steve

Ormston is offline   Reply With Quote
The Following User Says Thank You to Ormston For This Useful Post:
buffalobillpatrick (08-18-14)
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 03:28 PM.


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