EcoRenovator  

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


Blog 60+ Home Energy Saving Tips Recent Posts


 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 01-25-15, 03:23 PM   #22
buffalobillpatrick
Master EcoRenovator
 
Join Date: Mar 2014
Location: Florissant, Colorado
Posts: 599
Thanks: 814
Thanked 59 Times in 55 Posts
Default

http://www.taco-hvac.com/uploads/Fil...ves003-008.pdf

Updated code

Code:
/********************************************************
 *
 * ARDUINO Taco 008 Flow.
 *
 * In Setup, Source & Load pumps are set OFF
 *     , read Source pump static pressure, convert to Feet of Head & save
 *     , read Load pump static pressure, convert to Feet of Head & save
 *
 * In Void Loop, Source & Load pumps are set ON
 *     , read Source pump ON pressure , convert to Feet of Head
 *     , calculate Source pump Delta pressure (ON - OFF)
 *     , estimate Source pump GPM
 *
 *     , read Load pump ON pressure , convert to Feet of Head
 *     , calculate Load pump Delta pressure (ON - OFF)
 *     , estimate Load pump GPM
 * Repeat
 *
 *
 * Change History: 
 * 01/27/15 Coded
 *
 *
 *
 ********************************************************/

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #else
  #include "WProgram.h"
  #endif

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>


#define DEBUG 1
//#define DEBUG 0


#define I2C_ADDR    0x3F // <<----- Add your address here.  Find it from I2C Scanner
                       //D3
#define BACKLIGHT_PIN     3  //define LCD digital pins
#define En_pin  2
#define Rw_pin  1             //can't use D0 & D1 Tx, Rx
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5              //can use D2 -> D12 below in code
#define D6_pin  6
#define D7_pin  7

LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

#define SDA                           A4  //RESERVE I2C for LCD           
#define SCL                           A5  

//  pinMode(A0, OUTPUT);     //This works acording 
                             //  http://arduino.cc/en/Tutorial/AnalogInputPins
//  digitalWrite(A0, HIGH);  //



#define Source_Pump_relay_pin    2   // D2 Buffer tank Pump Relay D1102  2.5A
#define Load_Pump_relay_pin      3   // D3 Buffer tank Pump Relay D1102  2.5A

#define Source_pump_sensor_pin      A0  // 
#define Load_pump_sensor_pin        A1  // 
 
float Src_on_head,       Load_on_head;
float Src_on_delta_head, Load_on_delta_head;
float Src_off_head,      Load_off_head;
float Src_on_flow,       Load_on_flow;

int I, W, Y;



void setup(void)       //Start Setup
  {
        
  pinMode (Source_pump_sensor_pin,   INPUT);
  pinMode (Load_pump_sensor_pin,     INPUT);
 
  pinMode (Source_Pump_relay_pin,    OUTPUT);  
  pinMode (Load_Pump_relay_pin,      OUTPUT);  

 
 // Serial.begin(9600); // start serial communication
 // delay(10000);      //time to enable monitor window
 // Serial.println(F("........Hello world!......."));
 // delay(100); 
 
  
  lcd.begin (16,2); //  <<----- My LCD is 16x2
  lcd.clear();
 
  //Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);


  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("008 FLOW"));
  delay(10000);


  if(DEBUG)
  {       
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("DEBUG = ON"));
  delay(10000);
  }
  else 
  {       
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("DEBUG = OFF"));
  delay(10000);
  }


  digitalWrite (Source_Pump_relay_pin, HIGH);  //Source Pump OFF
  digitalWrite (Load_Pump_relay_pin, HIGH);    //Load Pump OFF
  delay(10000);
 
  W = analogRead(Source_pump_sensor_pin);  //read Src pump off pressure

if(DEBUG){ W = 500;}
    
  Src_off_head = convert_raw_sensor_to_head(W);
  
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("SRC_PUMP_OFF_HD"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Src_off_head);  
  lcd.print(F(" Feet"));
  delay(10000);
  
  
  W = analogRead(Load_pump_sensor_pin);  //read Load pump off pressure         
 
if(DEBUG){ W = 500;}

  Load_off_head = convert_raw_sensor_to_head(W);
 
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("LOAD_PUMP_OFF_HD"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Load_off_head);  
  lcd.print(F(" Feet"));
  delay(10000); 

  }    //end setup




  void loop ()
{ 
   
  digitalWrite (Source_Pump_relay_pin, LOW);  //Source Pump ON
  digitalWrite (Load_Pump_relay_pin,   LOW);  //Load Pump ON
  delay(10000);
 
  W = analogRead(Source_pump_sensor_pin);   //read Src pump ON pressure         
 
if(DEBUG){ W = 600;}

  Src_on_head = convert_raw_sensor_to_head(W); 
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("SRC_PUMP_ON_HD"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Src_on_head);  
  lcd.print(F(" Feet"));
  delay(10000);

  Src_on_delta_head = Src_on_head - Src_off_head; 
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("SRC_PUMP_ON_DLT"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Src_on_delta_head);  
  lcd.print(F(" Feet"));
  delay(10000);
  
  Src_on_flow = estimate_008_flow(Src_on_delta_head);
  if (Src_on_flow == -1)
  {
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("SRC_DELTA_HD_NG"));   
  lcd.setCursor(0,1);
  lcd.print(F("HANG_FOREVER_1"));   
  do{Y = Y;} while (Y == Y);  //hang forever
  }      
  
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("SRC_P_ON_FLOW"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Src_on_flow);  
  lcd.print(F(" GPM"));
  delay(10000);
   
 
 
 
  
  W = analogRead(Load_pump_sensor_pin);     //read Load pump ON pressure         

if(DEBUG){ W = 650;}

  Load_on_head = convert_raw_sensor_to_head(W);
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("LOAD_PUMP_ON_HD"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Load_on_head);  
  lcd.print(F(" Feet"));
  delay(10000);

  Load_on_delta_head = Load_on_head - Load_off_head; 
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("LOAD_PUMP_ON_DLT"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Load_on_delta_head);  
  lcd.print(F(" Feet"));
  delay(10000);
  
  Load_on_flow = estimate_008_flow(Load_on_delta_head); 
  if (Load_on_flow == -1)
  {
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("LOAD_DELTA_HD_NG"));   
  lcd.setCursor(0,1);
  lcd.print(F("HANG_FOREVER_2"));   
  do{Y = Y;} while (Y == Y);  //hang forever
  }    
    
  lcd.clear();
  lcd.home (); // go home
  lcd.print(F("LOAD_P_ON_FLOW"));
  lcd.setCursor(0,1);
  lcd.print(F("= "));
  lcd.print(Load_on_flow);  
  lcd.print(F(" GPM"));
  delay(10000); 
  
 
}  //end forever loop



float convert_raw_sensor_to_head(float Raw)
{
  //Pressure sensor output .5v = 0 PSI, 4.5v = 30 PSI
  //analogRead results     .5v = 102,   4.5v = 921
  
#define PSI_0                           102
#define PSI_30                          921
#define PSI_max                         30
#define Convert_psi_to_head     2.31

  return ((((Raw - PSI_0) / (PSI_30 - PSI_0)) * PSI_max) * Convert_psi_to_head);
}




float estimate_008_flow(float Delta_head)
{ 
/* 
 * http://www.taco-hvac.com/uploads/Fil...ves003-008.pdf
 *
 * Pretty tricky array usage, the array element values (feet of head) 
 * are taken from the Taco 008 pump performance curve Y-axis 
 * at each GPM along X-axis, 
 * array index is whole GPM along X-axis
 *
 * Flow in GPM is returned to caller after interpolation between 
 * whole GPM values along X-axis, 
 * or ERROR is returned (-1) if "out of array bounds" 
 * ie. not between array highest & lowest head values
 *
 */
 
#define Array_size            16

float Array_008 [Array_size] = {15.25,15.05,14.8,14.35,13.75,13.15,12.35, 
                                11.3,10.4,9.15,7.8,6.45,4.8,3.1,1.3, -1.0};
                                
float Val, Next_val, Span, GPM; 


  if ((Delta_head < Array_008[0]) && (Delta_head > 0)) //Bounds check
  {
  // in bounds, continue
  
  for (I=0; I< Array_size; I++) //Scan array to find where Delta_head falls
  {  
  Val = Array_008[I];           //get array value
  Next_val = Array_008[I+1];    //get Next array value
  Span = Val - Next_val;        //Calc Span

  if((Delta_head <= Val) && (Delta_head >= Next_val)){break;}
  }  //end for loop when Delta_head falls between elements, I = whole GPM
  
  GPM = (I + ((Val - Delta_head) / Span));  //interpolate to get decimals
  return (GPM);                             // return GPM

  }  //end if in bounds
  else {return (-1);}       // error return, out of bounds 

}  // end of estimate_008_flow

Last edited by buffalobillpatrick; 01-28-15 at 12:03 PM..
buffalobillpatrick is offline   Reply With Quote
 



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 12:59 PM.


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