# LM324 - Op-Amp Non-Inverting Amplifier to measure current from solar panel on Arduino

#### Nuno Tavares

Joined Mar 18, 2017
7
Hi everyone,
I'm designing a circuit to measure the current from a mini-solar panel (0.5 W) which normally reaches 80-100 mA. My circuit is attached to this post.
I have a Gain of 6 with the resistors R2=5k and R1=1k because G=1+(R2/R1). Normally the input voltage on op-amp (LM324) is 0.2-0.4 V and always the output voltage is under 3.7-3.8 V. I don't understand why this happens. If 0.3 V is the input voltage and with gain of 6, the output voltage would be 1.8 V (0.3*6=1.8).
The power supply of op-amp is the +5V and GND from Arduino.
Can you help me with this ?

#### hp1729

Joined Nov 23, 2015
2,304
Hi everyone,
I'm designing a circuit to measure the current from a mini-solar panel (0.5 W) which normally reaches 80-100 mA. My circuit is attached to this post.
I have a Gain of 6 with the resistors R2=5k and R1=1k because G=1+(R2/R1). Normally the input voltage on op-amp (LM324) is 0.2-0.4 V and always the output voltage is under 3.7-3.8 V. I don't understand why this happens. If 0.3 V is the input voltage and with gain of 6, the output voltage would be 1.8 V (0.3*6=1.8).
The power supply of op-amp is the +5V and GND from Arduino.
Can you help me with this ?
0.3 V in across 0.5 Ohms is 0.6 Amps. With 5 V VCC the output is maxed out.
If the current should be < 100 mA the voltage across the 0.5 ohm resistor should be < 50 mV.
Is your 56 ohm resistor 5.6 ohms?

Last edited:

#### crutschow

Joined Mar 14, 2008
24,376
Have you measured the op amp (+) input voltage?
Where is this 0.2-0.4V coming from?
100mA through 0.5Ω is only 50mV.

#### Nuno Tavares

Joined Mar 18, 2017
7
0.3 V in across 0.5 Ohms is 0.6 Amps. With 5 V VCC the output s maxed out.
Sorry didn't understand what you mean, can you explain it better please ?

#### ericgibbs

Joined Jan 29, 2010
9,563
hi NT,
Why have you connected Vcc to the wiper of the pot.
If you said one half if the pot is Ra and the other half is Rb, this means Ra and Rb are in parallel, so the gain is R5/Ra||Rb
E

#### Nuno Tavares

Joined Mar 18, 2017
7
Have you measured the op amp (+) input voltage?
Where is this 0.2-0.4V coming from?
100mA through 0.5Ω is only 50mV.
The op amp (+) input voltage is normally 0.2 V - 0.4 V

#### dl324

Joined Mar 30, 2015
10,072
• Nuno Tavares

#### Nuno Tavares

Joined Mar 18, 2017
7
The way you have drawn the schematic isn't very useful. It is easier to discern desired function if you draw the schematic as shown below. The part designators in your description don't match the schematic:
View attachment 122758
What is the panel voltage?
The panel voltage is around 5-6 V

#### dl324

Joined Mar 30, 2015
10,072
The panel voltage is around 5-6 V
The voltage divider on the panel is going to give you essentially no voltage:
$$\small V_{div} = V_{panel}*\frac{0.5}{56.5}=5*0.009=0.04V$$

#### Nuno Tavares

Joined Mar 18, 2017
7
The voltage divider on the panel is going to give you essentially no voltage:
$$\small V_{div} = V_{panel}*\frac{0.5}{56.5}=5*0.009=0.04V$$
The op amp serves to amplify that voltage to be possible read on analog pin the voltage coming from that voltage divider.

#### dl324

Joined Mar 30, 2015
10,072
The op amp serves to amplify that voltage to be possible read on analog pin the voltage coming from that voltage divider.
By choosing such a low voltage, the non-ideal attributes of the opamp can become a significant percentage of of the input signal.

#### Nuno Tavares

Joined Mar 18, 2017
7
By choosing such a low voltage, the non-ideal attributes of the opamp can become a significant percentage of of the input signal.
So what's the best way to measure the current by Arduino ?
And I can't use a current sensor, need to develop one.

#### crutschow

Joined Mar 14, 2008
24,376
The op amp (+) input voltage is normally 0.2 V - 0.4 V
Where is the 0.2V-0.4V "normal" input voltage coming from?

Op amp inputs don't generate voltage (unless they are an open circuit) and there is nothing on your schematic that would generate such a voltage.

#### dl324

Joined Mar 30, 2015
10,072
So what's the best way to measure the current by Arduino ?
And I can't use a current sensor, need to develop one.
The usual method is to use a low value series resistor. A voltage divider across the solar panel tells you nothing about the current being drawn by a load.

#### Alec_t

Joined Sep 17, 2013
10,913
I'm designing a circuit to measure the current from a mini-solar panel
Are you trying to measure the short-circuit current of the panel, or the current through some load driven by the panel?

#### Nuno Tavares

Joined Mar 18, 2017
7
Are you trying to measure the short-circuit current of the panel, or the current through some load driven by the panel?
I'm trying to mesure the current through the Load (which is my RL) driven by the panel.

#### dl324

Joined Mar 30, 2015
10,072
I'm trying to mesure the current through the Load (which is my RL) driven by the panel.
Then use more gain in the opamp to get a more meaningful number.

#### hp1729

Joined Nov 23, 2015
2,304
Sorry didn't understand what you mean, can you explain it better please ?
You measure about 0.3 V at the input? it should only be 50 mV. It acts like your 56 ohm load resistor is 5.6 ohms. Check the other resistor values also. That 3.8 ish volts out is about all you will get out of an LM324 when it is maxed out so your gain calculations are meaningless. What you describe for symptoms sounds like wrong resistor values. Your schematic looks workable as it is designed.

#### KeepItSimpleStupid

Joined Mar 4, 2014
3,905
Having been in the solar cell research biz, that's probably a bad way of doing it, but it depends on what you need to do. Our research cells were less than 25 mA. I did design a 4-terminal I-V converter using the feedback ammeter approach that could handle +-100 mA. Although it was optimized for AC measurements, in DC it had about < 1 mV drop and 40 pA of offset.

#### elnona

Joined Nov 16, 2017
2
Hi! I already made my own "USB charge Doctor" to display current draw from usb. Using:
arduino
1802 display,
lm324,
47k resistor,
2k2 resistor as R2 and r1 (gain of 22)
shunt resistor of 0.05 ohms.

using your circuit and it works well.
at 1 amp i read 50mv at the input of the opamp and 1150mv at the output.