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. enter image description here

Circuit Schematic

//#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);
}
  • Please add code too. There might be a problem just in code. – Jakey Jun 20 '16 at 2:16
  • Certainly. I've been stumped since I can get the code to work if I'm just measuring current or voltage, but if I try to measure both I get zero's. That why I think it is my circuit. – Giovanni Jun 20 '16 at 2:25
  • 2
    float sensorVals[] = {0}; so you create an array of 1 value, and then try to write two values into it later? – Tom Carpenter Jun 20 '16 at 3:59
  • Also, can you draw out a proper schematic of what you have wired up - your current one is not what you have wired up. – Tom Carpenter Jun 20 '16 at 4:02
  • If you just print the as-read values of sensorVolt, sensorVolt2 (which is unused?) and sensorCurent, do you get sensible answers? – pjc50 Jun 20 '16 at 9:09

Note that this declaration:

float sensorVals[] = {0};

actually declares an array of one float, while you want 2.
Change it to

float sensorVals[2] = {0};

or

float sensorVals[] = {0, 0};


Also, your 110K + 50K voltage divider might not be appropriate - 12V solar panels could easily output much higher voltage (I got one rated 12V but outputting 20+V with no load in good sunlight). Just to be safe, measure its open circuit no-load voltage under best sunlight and then adjust your voltage divider so it will drop that voltage (+ some safety margin) to a voltage < your VCC.
Speaking of VCC, unless it is regulated 5V your analog readings will be quite incorrect - (5.0 / 1023.0) is only correct if VCC is 5V (or to be precise, if AREF is 5.0V).
Also, do you have common ground between Arduino and the solar panel? I am a bit confused by the label "Arduino ground" in your schematic. I think they should share ground for your voltage readings to work properly.
And finally, at least in my experience, these hall-effect current sensors are quite unreliable at low currents (e.g. < 100ma). It might be just mine though. Just in case, measure their output with a multimeter or even better with an oscilloscope, just to make sure they work as you expect.

  • 2
    This is at most an assortment of comments, it is in no way an answer. – Chris Stratton Jun 20 '16 at 4:41

There are many things wrong here:

  1. In your drawing output of ACS712 goes to A0 then in the software you put A5.
  2. Output of ACS712 = 512 by 0 Amp
  3. Max output of ACS712 = 4.8V so don't use 5.0/1024. 983=5A 512=0A 41=-5A
  4. When charging a lead acid battery, battery voltage can go to 15.5V and for solar panels the voltage can get up to 22V.
  5. Use a 50k multiturn potmeter for your voltage divider, connect to 5v and the wiper to A1 and turn the potmeter until you read 300 as analog value, its then calibrated for 17v max(after remove the 5v).

5amp(acs712-5) is a charge current for a 50Ah battery and a 100Wp solar panel

  • Welcome to EE.SE! Your answer is a wall of text and missing capital letters at start of sentances and punctation. Can you clear it up a bit? – winny Aug 10 at 12:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.