Arduino for monitoring a remote solar powered router volts/current/thermal/light

i have made more progress on this project the only thing still to finish is the current monitoring since i havent received the sensor yet

i have hooked up 30k and 4.7k resistors as a voltage divider and calibrated it for my 3.3v arduino,
10k LDR and 10k resistor to measure sunlight
TMP36 thermistor is working but needs better calibrated
i have a graphing function now too using Simplot

the only thing stopping me installing this in a router just now is waiting for my current sensor.

//volts  
int batMonPin = A0;    // input pin for the voltage divider
int batVal = 0;       // variable for the A/D value
float pinVoltage = 0; // variable to hold the calculated voltage
float batteryVoltage = 0;


//current 
int analogInPin = A1;  // Analog input pin that the carrier board OUT is connected to
int sensorValue = 0;        // value read from the carrier board
int outputValue = 0;        // output in milliamps
unsigned long msec = 0;
float time = 0.0;
int sample = 0;
float totalCharge = 0.0;
float averageAmps = 0.0;
float ampSeconds = 0.0;
float ampHours = 0.0;
float wattHours = 0.0;
float amps = 0.0;


int R1 = 30000; // Resistance of R1 in ohms
int R2 = 4620; // Resistance of R2 in ohms
float ratio = 0;  // Calculated from R1 / R2


//Temperature

int tempPin = A2;     // TMP36 data pin
const int pinLDR = A3; // Analog Pin A0 connects across LDR

//Brightness
float valueBrightness;




//graphing
int buffer[20];
float deltaAngle = 3.14/51; //Arbitrary angle increment size
float angle = 0;
int amplitude = 100;


void setup()
{
  Serial.begin(9600);          //  setup serial
}

void loop()
{
  
  
  int data1;
  int data2;
  int data3;
  int data4;
  
  

  
  
  // Voltage Calculation
    
int sampleBVal = 0;
int avgBVal = 0; 
int sampleAmpVal = 0;
int avgSAV = 0;
 
for (int x = 0; x < 10; x++){ // run through loop 10x

  // read the analog in value:
  sensorValue = analogRead(analogInPin);  
  sampleAmpVal = sampleAmpVal + sensorValue; // add samples together

  batVal = analogRead(batMonPin);    // read the voltage on the divider
  sampleBVal = sampleBVal + batVal; // add samples together
 
  delay (10); // let ADC settle before next 0sample

}

avgBVal = sampleBVal / 10; //divide by 10 (number of samples) to get a steady reading

  pinVoltage = avgBVal * 0.00334;       //  Calculate the voltage on the A/D pin
                           
  ratio = (float)R1 / (float)R2;
  batteryVoltage = pinVoltage * ratio;    //  Use the ratio calculated for the voltage divider
                                          //  to calculate the battery voltage
                                         

  
  
  // temp calculaton
  int reading = analogRead(tempPin);    // read the input pin

 // converting that reading to voltage, for 3.3v arduino use 3.3
 float voltage = reading * 3.3 / 1024; 
 

 


  //current monitor

  float amps = 0;
  for(int i = 0; i < 1000; i++) {
    amps = amps + (.0264 * analogRead(A1) -13.51) / 1000;
    delay(1);
  }



 //light dependsnt resistor
 

  valueBrightness = map(analogRead(pinLDR),200,0,0,100);

  //uptime
  msec = millis();
  time = (float) msec / 1000.0;

 




// serial output
  Serial.print("Volts = " );                      
  Serial.print(batteryVoltage);     
  Serial.print("\t Current (amps) = ");     
  Serial.print(amps); 
  float watts = amps * batteryVoltage;
  Serial.print("\t Power (Watts) = ");  
  Serial.print(watts);  
 
   float temperatureC = (voltage - 0.5) * 100;
  Serial.print("\t degrees C = ");
  Serial.print(temperatureC);
 
  Serial.print("\t Solar output % = ");  
  Serial.print(valueBrightness);
  
  Serial.print("\t Time (hours) = ");
  Serial.println(time/3600);
  
  
  
  //Generating data that will be plotted
  data1 = batteryVoltage;
  data2 = watts;
  
  data3 = temperatureC;
  data4 = valueBrightness;
  
  angle = angle + deltaAngle;
  
  plot(data1,data2,data3,data4);
  
  delay(100); //Need some delay else the program gets swamped with data
  
} 

void plot(int data1, int data2, int data3, int data4)
{
  int pktSize;
  
  buffer[0] = 0xCDAB;             //SimPlot packet header. Indicates start of data packet
  buffer[1] = 4*sizeof(int);      //Size of data in bytes. Does not include the header and size fields
  buffer[2] = data1;
  buffer[3] = data2;
  buffer[4] = data3;
  buffer[5] = data4;
    
  pktSize = 2 + 2 + (4*sizeof(int)); //Header bytes + size field bytes + data
  
  //IMPORTANT: Change to serial port that is connected to PC
  Serial.write((uint8_t * )buffer, pktSize);

  
  
  

}