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


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 01-03-16, 05:23 PM   #27
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....

Going through the code, and trying to find why it doesn't compile, you had an unterminated comment which I removed and a "booger" which was a single quote mark hanging out in space, which I also removed.

Here is your code with those errors removed:

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); 

 }

There are further errors in that you are using compressor in two different ways. First you define it as an integer and assign it a value of 5, then you are trying to use it as a true/false indicator.

I think if that part is fixed, it may well compile.

Give it a shot, we're getting close.

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


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 10:05 AM.


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