DIY solar panel hooked to the web

I’m living in Chile, and in my region, the sun don’t shine regularly, so after having hoked up my DIY solar panel to a timer to pomp hot water to an 200 liter isolated tank, I decided to push the game a bit further connecting it to an Arduino, with some zx-thermometer, an relay shield and an 16X2 LCD .
The next step was to put it on line for monitoring purpose with my phone
Serial data communication with my OpenSuse server was a brise,
writing some script http://demartin.dyndns.org/Solar_monitor.sh ,
Gnuplot script http://demartin.dyndns.org/Solar_Plot_1hour.sh
and Apache get it formatted and running
Here is my result and Code
http://demartin.dyndns.org/Case.jpg
http://demartin.dyndns.org/Last12Hour.html

#include <LiquidCrystal.h>
LiquidCrystal lcd( 11, 10, 9, 8, 7, 6);
int alertCunt = 0;   // set the initial alert counter
int timeCunt = 0 ;
int PumpStartTemp = 400;      // set the default temp for the pump triger
void setup()
{
  Serial.begin(9600);
  pinMode(5, OUTPUT); 
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  // Print a message to the LCD.
  lcd.print("Panel Temp:");
  lcd.setCursor(0, 1);
  lcd.print(" Tank Temp:");

}



void loop()
{
   int PanelMesure1 = analogRead(0) ; //averaging the reading in 5 diferent take
   delay(10);
   int PanelMesure2 = analogRead(0) ;
   delay(10);
   int PanelMesure3 = analogRead(0) ;
   delay(10);
   int PanelMesure4 = analogRead(0) ;
   delay(10);
   int PanelMesure5 = analogRead(0) ;
   int PanelMesureAverage = (PanelMesure1 + PanelMesure2 + PanelMesure3 + PanelMesure4 + PanelMesure5) / 5 ;
   int PanelTempRaw = map(PanelMesureAverage,396,535,200,370);  // average reads 396-535, corresponds to 20C to 37C
   float PanelTemp = PanelTempRaw /  10.0;          // divide by 10; map() uses integers
   
   int TankMesure1 = analogRead(2) ;
   delay(10);
   int TankMesure2 = analogRead(2) ;
   delay(10);
   int TankMesure3 = analogRead(2) ;
   delay(10);
   int TankMesure4 = analogRead(2) ;
   delay(10);
   int TankMesure5 = analogRead(2) ;
   delay(10);
   int TankMesure6 = analogRead(2) ;
   delay(10);
   int TankMesure7 = analogRead(2) ;
   delay(10);
   int TankMesure8 = analogRead(2) ;
   delay(10);
   int TankMesure9 = analogRead(2) ;
   delay(10);
   int TankMesure10 = analogRead(2) ;
   int TankMesureAverage = (TankMesure1 + TankMesure2 + TankMesure3 + TankMesure4 + TankMesure5+TankMesure6 + TankMesure7 + TankMesure8 + TankMesure9 + TankMesure10) / 10 ;
//   Serial.println(TankMesureAverage);
   int TankTempRaw = map(TankMesureAverage,534,999,370,999);  // Average reads 534-999, corresponds to 37C to 997C
   float TankTemp = TankTempRaw /  10.0;    // divide by 10; map() uses integers
   
  
//  if (TankTempRaw > 400)   {
//       PumpStartTemp = TankTempRaw + 100;
//    
//  }
//  else 
  if (PanelTempRaw > 620) {
        PumpStartTemp = TankTempRaw + 70;
  }
  
  else {
       PumpStartTemp = TankTempRaw + 100;
  }
  lcd.setCursor(11, 0);
  lcd.print(PanelTemp);
  lcd.setCursor(11, 1);
  lcd.print(TankTemp);
   Serial.print(PanelTemp);
   Serial.print("  ");
   Serial.print(TankTemp);  
   Serial.print("  ");
   Serial.println("OFF");
;
    delay(1000);
 // Serial.println("º");
     if (PanelTempRaw > PumpStartTemp)  {
       alertCunt = 0 ; //reset the alert cunt
        timeCunt = 0 ;
      while (PanelTempRaw > PumpStartTemp) {
        alertCunt++ ;
        timeCunt++  ;
        int PanelTempRaw = map(analogRead(0),396,535,200,370);  // analog pin reads 250-700, corresponds to 1.4C to 44.1C
        float PanelTemp = PanelTempRaw /  10.0;          // divide by 10; map() uses integers
        int TankTempRaw = map(analogRead(2),534,999,370,999);  // analog pin reads 396-535, corresponds to 20C to 37C
        float TankTemp = TankTempRaw /  10.0;          // divide by 10; map() uses integers
        digitalWrite(5, HIGH);
         Serial.print(PanelTemp);
         Serial.print("  ");
         Serial.print(TankTemp);  
         Serial.print("  ");
         Serial.println("ON");         
          lcd.setCursor(11, 0);
          lcd.print(PanelTemp);
          lcd.setCursor(0, 1);
          lcd.print("Pumping...");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print(".Pumping..");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("..Pumping.");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("...Pumping");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("g...Pumpin");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("ng...Pumpi");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("ing...Pump");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("ping...Pum");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("mping...Pu");
          delay(200);
          lcd.setCursor(0, 1);
          lcd.print("umping...P");
          delay(200);

          lcd.setCursor(11, 1);
          lcd.print("     ");
          lcd.setCursor(11, 1);
          lcd.print(TankTemp);
        


                  int LimitTriger = TankTempRaw + 50 ;
                  if  (PanelTempRaw < LimitTriger){      // get out of the loop if the temp get down as espected
                  lcd.setCursor(0, 1);
                  Serial.print(PanelTemp);
                  Serial.print("  ");
                  Serial.print(TankTemp);  
                  Serial.print("  ");
                  Serial.println("ON");
                  lcd.print("Finish Pumping  ");
                  delay(20000);        // wait 20 second                      
                  break; 
                  }
//                  if  (timeCunt > 90 ){      // Alert condition, the temp did not fall as espected
//                      break; }
                  if  (alertCunt > 200 ){      // Alert condition, the temp did not fall as espected
                      goto alert; }
    PanelTempRaw;
      
      }
  }
else {

   digitalWrite(4, LOW);  // set the   BLUE  LED on
   analogWrite(3,2);  // set the   BLUE  LED on
   digitalWrite(2, LOW);   // set the   RED   LED off
   digitalWrite(2, LOW);   // set the   RED   LED off
   digitalWrite(5, LOW);   // set the   PUMP      off
   lcd.setCursor(0, 1);
   lcd.print(" Tank Temp:");
   
   delay(1000);        // wait 1 secund
   int alertCunt = 0;   // reset the alertCunt to 0
 }
 
      if  (PanelTempRaw > 620){   
        alert:
           lcd.setCursor(0, 1);
           lcd.print("  !!! ALERT !!!   ");
           lcd.setCursor(0, 0);
           lcd.print("                  ");
          digitalWrite(5, LOW);   // set the pomp off
          digitalWrite(2, HIGH);   // set the LED on
          delay(500);              // wait for a second
          lcd.setCursor(0, 1);
           lcd.print("                 ");
           lcd.setCursor(0, 0);
           lcd.print("  !!! ALERT !!!   ");
          digitalWrite(2, LOW);    // set the LED off
          delay(500);
                  delay(200);

         goto alert;
    }
}

Nice job. It's fun doing things like this around the house.

You could use a 'for' loop to get that sensor data.

  int TankMeasureAverage;
  int PanelMeasureAverage;
  for (int i=0;i=5;i++);
  {
    PanelMeasureAverage += analogRead(0);
    delay(10);
  }
  PanelMeasureAverage /= 5;

  for (int i=0;i=10;i++);
  {
    TankMeasureAverage += analogRead(2);
    delay(10);
  }
  TankMeasureAverage /= 10;

Note: I corrected the spelling of 'measure'.

Also, sometimes I find it necessary to map floating point data. Here is a function to do just that.

//floatMap
//copy of map function using floating point math
float floatMap(float x, float in_min, float in_max, float out_min, float out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

Thank's, Of course the loop solution if more elegant And I did not know the floatmap function so I just use a*10 temp base to divide it /10 after the map.... and got just what I wanted .

The “floatmap” function is just a modified version of the “map” function that I wrote to handle floating point mapping.