Okay thats good.
So it looks pretty well calibrated.
Now we calculate for 5V.
#define ANALOG_PIN A2 // Analog pin
#define RESISTANCE 10 // Resistance in thousands of ohms
#define PANEL_LENGTH 200 // Length of solar cell in mm
#define PANEL_WIDTH 130 // Width of solar cell in mm
float Area;
float Power;
float Radiation;
int rawVolts;
float voltsInput;
float voltsLoad;
/*
Main Setup function
*/
void setup() {
// Begin serial communication
Serial.begin(9600);
while (!Serial);
Serial.println("Solar panel power meter");
analogReference(INTERNAL);
delay(1000);
}
/*
Main Setup function
*/
void loop() {
Area = 0.026 ; // (( PANEL_LENGTH * PANEL_WIDTH )/ 1000000 ) we are dividing by 10000 get the area in square meters
rawVolts = analogRead(A2); // read the ADC
Serial.print(rawVolts);
Serial.println(" = rawVolts at A2 Pin"); //print the voltage AT the A0 pin
voltsInput = (float)rawVolts * 1.1 / 1023.0 ; // convert the ADC to a voltage.
Serial.print(voltsInput);
Serial.println("V at A2 Pin"); //print the voltage AT the A2 pin
voltsLoad = voltsInput * 5.0;
Serial.print(voltsLoad);
Serial.println("V across load Resistor");
//Power = pow(analogRead(ANALOG_PIN), 2) / RESISTANCE ; // Calculating power
//Radiation = Power / Area;
//char *msg;
//Serial.print("The Solar Radiation is %f W/M2 : ");
//Serial.println(Radiation);
delay(1000);
}
Still leave the 5V connection, no PV or Load resistor.
Hi,
Try this code, it should print out most of what you need.
#define ANALOG_PIN A2 // Analog pin
#define RESISTANCE 10 // Load Resistance in Ohms
#define PANEL_LENGTH 200 // Length of solar cell in mm
#define PANEL_WIDTH 130 // Width of solar cell in mm
float Area;
float Power;
float Radiation;
int rawVolts;
float voltsInput;
float voltsLoad;
/*
Main Setup function
*/
void setup() {
// Begin serial communication
Serial.begin(9600);
while (!Serial);
Serial.println("Solar panel power meter");
analogReference(INTERNAL);
delay(1000);
}
/*
Main Setup function
*/
void loop() {
Area = (PANEL_LENGTH * PANEL_WIDTH ) / 1000000.0; // (( PANEL_LENGTH * PANEL_WIDTH )/ 1000000 ) we are dividing by 10000000 get the area in square meters
rawVolts = analogRead(A2); // read the ADC
Serial.print(rawVolts);
Serial.println(" = rawVolts at A2 Pin"); //print the voltage AT the A0 pin
voltsInput = (float)rawVolts * 1.1 / 1023.0 ; // convert the ADC to a voltage.
Serial.print(voltsInput);
Serial.println("V at A2 Pin"); //print the voltage AT the A2 pin
voltsLoad = voltsInput * 5.0;
Serial.print(voltsLoad);
Serial.println("V across load Resistor");
Power = (voltsLoad * voltsLoad) / RESISTANCE ; // Calculating power P = V * V / R
Serial.print(Power);
Serial.println("Watts Power dissipated in Load Resistor");
Serial.print(Area, 3); // Prints value to 3 decimal points
Serial.println("Square Meters Panel Area");
Serial.println("======================================");
Radiation = Power / Area;
char *msg;
Serial.print("The Solar Radiation is %f W/M2 : ");
Serial.println(Radiation);
Serial.println("======================================");
delay(1000);
}
NOTE; you will have to change;
#define RESISTANCE 10 // Load Resistance in Ohms
To the value that your new load resistor measures.