# Measure current of solar panel

Hello guys, recently I've been trying to measure both voltage and current of solar panel to Arduino. Let's said I don't want to use any sensor, can I measure the current like the circuit in the diagram shown? Or I need some additional component to achieve this? I've read other post before, some people using the shunt resistor and I thought if this method is working, I think I won't buy any current sensor. I have a ACS712 current sensor but I always got some weird values so I try to use this method. Measure the voltage drop across the resistor and using ohm's law to calculate it. The value I got is not really same with the multimeter, so I just wanted to confirm the circuit whether is correct or not.

My questions are:

1. Does the circuit correct? Or I need to add additional component to make it more accurate/precise or the circuit is not correct at all.

2. If I wanted to use digital multimeter to measure current, how can I measure it? I need to see if the difference between the analog read and value shown on DMM is large or not. I'm not sure whether my ACS712 is defect or what, maybe I will purchase another current sensor.

Thanks.

*I forgot to change the resistor value, it supposed to be smaller resistance.

Hi,
OPs picture;

This would be better.

Tom....

Doesn't that mean that if the solar panel can deliver more than 0.5mA, you get more than 5V on your analog input?
Also, as long as the solar panel can deliver 1.2mA or more, you will always measure 12V at that point.

I guess what OP wants is: when using the solar panel to power a load, measure the current through the load.

menloon:
I have a ACS712 current sensor but I always got some weird values so I try to use this method.

Which ACS712, what current levels are you trying to measure? The ACS7xx family are crude hall
sensors, very noisy, not very accurate, but exceptionally low loss in the main circuit and

Using a shunt resistor to measure current without appreciable voltage loss means using an opamp
to boost the shunt voltage from mV levels to several volts for the ADC.

Or put another way how much voltage are you prepared to lose to the shunt?

You should provide all the voltage and current figures in your posting, details always matter in electronics.

MarkT:
Which ACS712, what current levels are you trying to measure? The ACS7xx family are crude hall
sensors, very noisy, not very accurate, but exceptionally low loss in the main circuit and

Using a shunt resistor to measure current without appreciable voltage loss means using an opamp
to boost the shunt voltage from mV levels to several volts for the ADC.

Or put another way how much voltage are you prepared to lose to the shunt?

You should provide all the voltage and current figures in your posting, details always matter in electronics.

Sorry for the late reply, I'm using ACS712 5A... I always got garbage value, I follow the code from other author but still gave me some weird value. I may use INA219 too in the future.

Jobi-Wan:
I guess what OP wants is: when using the solar panel to power a load, measure the current through the load.

Erm, yes. That it, I found out this method is much more accurate. ACS712 just not giving me true value.

TomGeorge:
This would be better.

Tom....

Sorry for asking noob question. In code, I supposed to be A1 - A2. But after A2 connected to GND, how can the code be modify?

``````#include <VoltageReference.h>

VoltageReference vcc;

long v1, v2;
float volt1, volt2;
float diff;
float Vcc;

void setup()
{
Serial.begin(9600);
vcc.begin();
}

void loop()
{
v1 = 0;
v2 = 0;
diff = 0;
float amp = 0;
for(int i = 0; i < 20; i++)
{
delay(5);
}

for(int b = 0; b < 20; b++)
{
delay(5);
}

diff = ((v1/20) - (v2/20)) * Vcc / 1023;
amp = (diff / 10.5)/1000;
Serial.println(amp , 4);
delay(400);
}
``````

2nd question, I didn't use the 5V because I heard those experts said the supply won't give exactly 5V and thus I used the voltage reference to calculate the ADC things. It is correct?

Here's three possibilities:

METHOD 1:

METHOD 2:

METHOD 3:

In Method 1, the schottkey diode prevents the input from going higher that 5.3V -- thus protecting the input. BUT, since the Sense Voltage shouldn't be going that high, anyway, Method 2 is a better choice -- just keep the Sense Voltage in a range between 0V and 0.5V.

BUT, because it's good to keep the Sense Voltage as low as possible, for a couple of reasons [see below], you'll want a bit of amplification before feeding it to the Arduino. Method 3 uses an OpAmp to achieve this. Select an OpAmp designed for a "single rail" supply, like that used on an UNO, with inputs that can go all the way down to Ground.

"n*10k", on the Method 3 circuit, means how many times greater than 10k that resistor needs to be, to achieve the amount of amplification needed. In other words, the amount of amplification is determined by the following formula:

R2 in this case, is the n*10k resistor. And, OK, yes...to say 'n' is the gain is an approximation [a very close approximation]. R1 of course, is the 10k resistor [the input resistor, whereas, the n*10k resistor is the feedback resistor].

Why keep the Sense Voltage low? So it doesn't steal power from the Load, and so it can be a low wattage resistor. Lower wattage shunt resistors [the type typically used for this kind of current sensing], are less expensive. BUT, use a high enough wattage so it doesn't heat up a lot, 'cuz there's more possibility the resistance will change, and skew the reading.

You might get away with an OpAmp that can run off 5V, but make sure the output can go high enough to satisfy whatever Analog Input requirement you have.

The diode pairs, shown in Method 2 and Method 3 can be the 1N914 or 1N4148.

Keep lines short and the circuit compact, in Method 3. also, if the Sense Voltages are very small, it might be necessary to cover the OpAmp circuit with a shield. This is typically done by making a metallic cap to cover the circuitry. I've used tin snips to cut out a form from tin plates steal, or copper foil. Then I fold it into the intended shape and solder it to ground traces on the PCB.

Note: In Methods 1 & 2, that 2k resistor is a bit conservative. It can, probably, go as high as 10k, without adversely affecting the ADC Sample-and-Hold. If a higher value is desired, then throw a 100nF capacitor across the Analog input. This will slow the response rate down, but will also double as a noise filter.

Note 2: The choice of A4 as the input, in all three of the circuit diagrams [above], is arbitrary. Any of the Analog inputs can be used.

Hi All,
The 10K resistor is not a shunt. It is the load resistor for the
solar cell. This circuit measures the output voltage of the cell.
When we measure current in a circuit, we use a current sense
resistor (Rs). It is connected in series with the load. The current
flowing around the circuit will flow through Rs. We can then
measure the voltage across Rs and calculate the current
flowing in the circuit. This Rs should be very small compared
to the load so as not to affect the current very much. Now,
Rs becomes a voltage source for the measuring device. That
device should be a high resistance voltage measuring device,
Alternately, we may use a current meter. We remove the Rs
and connect the ammeter in its place, since it has its own
shunt resistor inside.
Herb

herbschwarz:
Hi All,
The 10K resistor is not a shunt.

Yeah, I knew this. But what if I add another component to replace the shunt resistor? Like I put a LED and add a 10 ohm resistor, can it work like this?

Hi guys, since this post is still active, so do help me to see if I connected the ACS712 and solar panel correctly or not?

menloon:
Hi guys, since this post is still active, so do help me to see if I connected the ACS712 and solar panel correctly or not?

Not familiar with the ACS712, but a cursory look at the Datasheet tells me you have the input connected correctly. I assume the 10Ω resistor is intended as the load, right?

But, the output connection is not correct. This device has a current mode output. You need, at least, a resistor to ground [from VIOUT to GND], to convert that current into a voltage, before it reaches the Arduino Analog Input.

Currently, only you possess the necessary information needed to go any further -- as you haven't given us much to go on.

Have a look at: How To Use This Forum It will go a long way towards teaching you how to provide us the information we need, in order to properly help you.

Plus, it will teach you how to insert images into a post [which would be VERY helpful to us]...

The OP's schematic from their previous post:

ReverseEMF:
Currently, you possess the necessary information needed to go any further -- as you haven't given us much to go on.

I will try to update your guys if anything is correct or wrong. Thanks for it.