One Man's Adventures into Renewal Energy

Solar Panel

Night - 0 Watts

Battery Bank

Very Low - 11.97 Volts
Battery and Panel Stats Updated @ 28/04/2017 03:02
Please help me to continue hosting this website & associated costs by donating £2.
In return, I'll email you a ZIP file containing arduino code + all images from the website + some extra ones that aren't on the website...all in high res (370MB of pics!).

Solar Monitor with Arduino

The Code

int analogPin0 = 0;
int val0 = 0; // variable to store the value read
int calc0 = 0;
int analogPin1 = 1;
int val1 = 0;
int x = 1;
float volts = 0;
float amps = 0;
int relayPin8 = 8;
int mainsOn = 0;

long readVcc() {
long result;
// Read 1.1V reference against AVcc
ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = 1126400L / result; // Back-calculate AVcc in mV
return result ;
}



void setup()
{
delay(10000);
// Open serial communications and wait for port to open:
Serial.begin(115200);
pinMode(relayPin8, OUTPUT);
digitalWrite(relayPin8, HIGH);
}


void loop(){
x = 1;
volts = 0;
amps = 0;



while (x < 600) // loops for approx 600 seconds (10 minutes)
{
//start of battery voltage
val0 = analogRead(analogPin0); // read the input pin
calc0 = ( (float) val0 * (float) readVcc() / 1000 );
Serial.print ("Pin 0 Voltage = ") ;
Serial.println ((float) val0 / 100 );

Serial.print ("Reference Voltage = ") ;
Serial.println ( (float) readVcc() / 1000);

Serial.print ("Calculated Voltage = ") ;
Serial.println (((float) calc0) /327);
delay(500) ;
volts = ((((float) calc0) /327) + volts );
volts = float (volts / 2);


//end of battery voltage

// start of watts
val1 = analogRead(analogPin1); // read the input pin

Serial.print ("Pin 1 Reading (amps) = ") ;
Serial.println (float (513 - val1) * 50 / 1023 );
amps = ((float (513 - val1) * 50 / 1023 ) + amps );
amps = float (amps / 2);
delay(500);

//end of watts
x = (x + 1);
Serial.println (x);
}





Serial.println ("---------------end of loop");
Serial.println (volts);
if (volts > 13)
{
digitalWrite(relayPin8, LOW);
Serial.println("LOW");
mainsOn = 1;
}
else
{
digitalWrite(relayPin8, HIGH);
Serial.println("HIGH");
mainsOn = 0;
}
delay(2000);
Serial.print ("Total Volts = ");
Serial.println ((float) volts);

Serial.print ("Total Amps = ");
Serial.println ((float) amps);




Serial.print("AT+WD\r\n");
delay(500);
Serial.print("AT+WAUTH=2\r\n"); // set WEP authentication
delay(500);
Serial.print("AT+WWPA=**********\r\n"); // set Passphrase
delay(500);
Serial.print("AT+WA=********\r\n"); // SSID of your wireless
delay(20000); // wait sufficient time for it to connect
Serial.print("AT+NCTCP=000.000.000.000,00\r\n"); // IP address of Server and Port
delay(500);
Serial.print("\x1B" "S");
delay(500);
Serial.print("0\r\n");
delay(500);
Serial.print("HELO\r\n");
delay(500);
Serial.print("MAIL FROM:someone@something.com\r\n");
delay(500);
Serial.print("RCPT TO:someone@something.com\r\n");
delay(500);
Serial.print("data\r\n");
delay(500);
Serial.print("\x1B" "E\r\n");
delay(500);
Serial.print("\x1B" "S");
delay(500);
Serial.print("0\r\n");
delay(500);
Serial.print("referenceVoltage=");
delay(500);
Serial.println ( (float) readVcc() / 1000);
Serial.print("voltage=");
delay(500);
Serial.println (((float) volts));
delay(500);
Serial.print("amps=");
delay(500);
Serial.println (((float) amps));
delay(500);
Serial.print("mains=");
delay(500);
Serial.println (mainsOn);
delay(500);

Serial.print("\r\n.\r\n");
delay(500);
Serial.print("QUIT\r\n");
delay(500);
Serial.print("\x1B" "E\r\n");
delay(500);
Serial.print("AT+WD\r\n");
}









Next - Wind Generator MkII



Comments

Adam - 14/10/2016 14:39:25
Hi there Would you be able to share what parts you used in creating the Arduino Solar PV monitoring device? and also a picture/diagram showing how it all connects? Happy to donate for this? Thanks Adam

Name

Email Address (won't be shown)

Human Check - What colour is the sky?

Comment











Copyright 2017 BinaryOrbit.org