I've been building a Arduino Watt meter for the past few weeks for a solar panel, and have successfully measured voltage and current separately. However I need to know both to calculate watts but can't seem to get the circuit I have working. I've attached the circuit I've attempted to build as well as a picture of the schematic I've followed. I only get 0's coming from this setup, which isn't helpful. If someone can see what is wrong with my circuit setup or schematic and point me in the right direction, I would be ecstatic.
The only difference between my setup and the schematic is the voltage divider, where I divide the voltage by a factor of 5 to keep the Arduino from frying. I'm also using the acs712 instead of the acs715.
The red wire going out of the picture goes to the positive end of the solar panel, the white wire with black tape going off screen goes to the negative end of the solar panel.
//#include SoftwareSerial.h
float sensorVals[] = {0};
void setup() {
Serial.begin(9600);
}
void loop() {
float sensorVolt = analogRead(A0);
float sensorVolt2 = analogRead(A1);
float sensorCurrent = analogRead(A5);
float amp = sensorCurrent * (5.0 / 1023.0);
float voltage = sensorVolt * (5.0 / 1023.0);
sensorVals[0] = voltage;
sensorVals[1] = amp - 2.51;
// print out the value you read:
Serial.print(sensorVals[0]);
Serial.print(", ");
Serial.println(sensorVals[1]);
delay(1000);
}
float sensorVals[] = {0};
so you create an array of 1 value, and then try to write two values into it later? \$\endgroup\$