# Measuring current from solar panel using an arduino?

I am designing a MPPT buck converter and bought ACS712 30A arduino current sensor and it is awful. Not accurate at all. so I find two configurations circuits that might help find an alternative to this. However, I really can't find a link or reference that explain the theory behind that and how to design them.

• Define "awful" - are you aware that you have a device where zero current has an offset voltage? The things you've shown are differential amplifiers, if you want to minimze the circuitry you could look at an INA219 module. But overall, you do not have a specifically answerable question - state your actual goal including the magnitude of current you are trying to measure. – Chris Stratton Apr 28 at 6:19
• @ChrisStratton I am trying to measure current from 1A to 15A. I know that there is an offset voltage, which I already made it starts from zero volt. For example, when I pass 1A to 2A, the measured value is always changing and it is off by more than 0.5A like off by 0.8 or 0.9A – f321 Apr 28 at 6:26
• This is probably noise in your circuit design, especially the part after the sensor. Good analog design is hard. – Chris Stratton Apr 28 at 6:29
• I wouldn't be too quick to dismiss the ACS712. It should work OK. They are in mass production. As Chris said, there could be some noise getting in. Maybe a filter could help. If there is a 20A version, maybe it would provide more sensitivity to current changes. – mkeith Apr 28 at 6:33
• How do you ZERO-adjust the system? – analogsystemsrf Apr 28 at 7:16

When designing current sensing circuits the first thing to determine is what current range needs to be sensed. Then determine where to place the current sense resistor, before or after the load. If it is before the load (in series), then it's high side current sensing. Placing the current sensor after the load is low side as shown below:

Determine if you need to sense current going in both directions through the resistor, if you do, then a dual supply will be advantageous.

The next thing is to size the resistor, lower resistor values are better because they consume less power but lower resistor values have lower voltages with the same ammount of current. This makes current sensing more prone to noise.

The max voltage can be determined by finding the max current and the sense resistor:

$$\ V_{max sense voltage} = I_{max current}*R_{sense}\$$

Then find voltage rail of the op amp to find gain needed of the op amp:

$$\ G = V_{opamp rail}/V_{max sense voltage}\$$