Multiple Volt/Amp Sensors on common + rail

I have a need for a circuit for an Arduino project. I need to monitor amps/volts for three sources. They are all "12V" but that's only theory. A solar panel array of about 220 watts peak can go as high as 19V without load. The charger and "12V" battery can go as high as 14.8.

I want to read the Volts on the solar panel and the amps currently being used. This can be up to 19V and 20 Amps. Amps should never be negative.

I want to read the volts at the battery, and the amps going into the battery (+) or coming out of the battery (- amps when discharging).

Not required, but nice to have, would be voltage and amps going into the load. The voltage really can't be different than the battery voltage. Amps may be higher than what's being pulled from the battery because it could be getting at least part of the power directly from the solar panel.

I would like to connect this sensor module(s) using I2C for simplicity. Because everything is powered from a battery, I would also like to be energy efficient. Low quiescent and/or shutdown ability.

My design used three Adafruit INA 219 breakout modules. That failed and I realised that the (explitiv deleted) charger module had a common positive rail (solar panel, battery and load). Connecting the INA219s to a common ground resulted in smoke signals of course.

I would prefer a design that I can build myself and to do that the design requires none or very limited use of SMD chips.

The first thing you should do is draw a diagram your circuit showing the various supplies, battery, and load and indicate what points you want to monitor. Right now I'm guessing at what it looks like and odds are, my guess is wrong.

I have a solar "battery charger".

It has two terminals to attach solar panels. Two terminals to attach the battery. Two terminals to attach the load. The software within the charger will automatically turn the load off to prevent extreme discharging of the battery.

I will attach two "100 Watt" solar Panels. No load voltage up to 18 Volts. I also attach two 45AH 12 volt batteries. The load is attached to a heating element and is approximately 80 watts.

The Arduino should monitor the temperature of a 200 liter drum which is to be heated. The drum should be kept within a certain temperature range. The Arduino should also monitor the solar panel and battery state.

The idea is that the solar panels charge the battery through the charger. The Arduino can detect that power is available from the solar panels which is not being used to charge the battery. When this excess power is available and the barrel is not at its maximum temperature, the heat will be on. If the temperature goes below the minimum temperature, the heater will go on and draw power from the battery.

So, the circuit I Need allows the solar charger to do ist Job and diverts Surplus power to Keep the Barrel warm

This looks like a simple solar charger, that does not use MPPT & step down voltage converter.
That means when it is charging the panel voltage drops to battery voltage level.

You can compare voltages to know if the charger switches on or off the battery charging.

also is possible to control the heater with PWM, in a way that does not drop PV output voltage to lower than say 16V, so whenever battery charger draws large current from PV (and voltage drops below 16V) you stop the heater.

When the heater is switched to battery also is sufficient to monitor battery voltage in order to avoid excessive discharge.

Direct water heating panels are much more efficient/cost effective than PV:

  • One kwh will raise 200l water temperature with only 4-4.5 centigrades.
  • There are not many days in which 200watt of PV will collect 1kwh.
  • Battery life is seriously affected by deep discharges, 1kwh out of 2x12Vx45Ah batteries is >90% discharge.

You are correct. MPPT is not implemented. You are also correct, if the voltage on the Panel remains high, that means the charger is not using the available energy. That is exactly what I want to detect and reroute that energy to the heater. I have kept the Option of PWM for the heater open so that I can match the heaters consumption to the available energy (in a future Phase of the Project).

I cannot use direct solar water heating. On a small scale, pumps that can withstand the heat aren't cheap either. I Need the electricity because the battery also drives the Arduino, sensors, etc. as well as a pump for a few minutes per day. There is no heat extracted from the Barrel (except what escapes through 12cm of styrofoam insulation). If you are curious, the Barrel is a small Biogas digester. The bacteria provide some heat themselves but not nearly enough. They Need help (from the heater) to remain at a temperature to function well.

You are correct that I Need to Monitor the battery to prevent excessive discharge. Exactly at this Point the Problem Comes in. The Volt/amp sensors I have seen thus far (keeping in mind that I want to use I2C) require the sensors to be attached to the Arduino ground and the negative of the circuit whose Volt/amp is being monitored. Because the charger already has all the positives connected together, connecting the negatives of two or more such sensors causes a short circuit. Both positive and negative of solar Panel, battery, and load are thereby direct connected. Excellent for sending smoke signals but bad for power Management.

I would like to connect this sensor module(s) using I2C for simplicity.

I think this is a wrong perception problem.

All you need - for the problem you described - is to measure two voltages: The voltage between PV positive lead and ground and the voltage between battery positive and ground.

For that you need only two voltage dividers, == 4 resistors to feed two analog inputs in arduino and no other sensors. No short circuit whatsoever.

But still...even if that is well insulated barrel, 200l with 10cm insulation would need at least 700wh/day to keep its interior at 40degrees over ambient. In long winter days without sun, you will not have enough sun to keep its temperature, 200watts of PV will barely give 100wh in a cloudy day.

So you will need to have a small hot water pipe passing through the barrel to provide that needed heat with fire, either using wood or part of the biogas you collect. Not much needed, burning 300g of biomass or 100l of methane/day will give sufficient heat to keep the digester from dropping its temperature.

You say DC circulation pumps are expensive, which is generally true, but you don't have to mount it at the outflow of the hot water panel (hot water that goes into barrel) you can put it as well on the inflow pipe of the panel - and there you will be water coming out of the barrel which will not have more than 60centigrades, otherwise your bacteria will be dead.

There are cheap 12V plastic pumps with brushless motor (which means long life, no brushes to wear) that can easily survive up to 80-90centigrades. Nothing powerful is needed, 3l/min of water at 10 centigrades difference will put 2kwatt of heat into the barrel. More than sufficient, a 2sqm flat panel will do, and with an temperature-aware arduino controlled valve you can redirect its excess heat into a domestic hot water barrel to save a lot of biogas for water heating.

Here-s a crappiest pump I quickly found at 9 euro, that will do the job.

Price isn't that prohibitive

Here-s one at 18euro, rated for 100centigrades and 6.5l/min. .

While I truly appreciate your zealousness in helping me with the design, I have been working on this device for almost two years. In the beginning, I planned on doing the heat directly from solar. I pitched that idea for several reasons. The ultimate Goal is to have this device run more or less autark and the total device also has other components. The Arduino and sensors as well as a small pump to move extra gas to a high pressure storage tank all require electricity. I can't get around the solar Panel, battery, charger, etc. If I use direct solar heat, I have to run additional lines and they will Need to be insulated and the holes through the walls larger, etc. I also Need to provide for a drain-back (the best way to protect against freezing) which also means an additional tank for the fluid to drain into. I also start having Problems with Placement. Electric lines are pretty uncaring about Placement, length, etc. (assuming proper sized). If the Biogas digester is in the Basement of a two Story house (plus attic), I have around 8 meters to overcome. No Problem for electricity, but for example the pump you suggested only handles 3M static head. For These, and other reasons as well, I dumped the idea of direct solar heat. A backup System for electricity could be easily done using the AC power of the house (though violating my own desire of it being autark). If I find that the solar Panels and/or battery are insufficient, I can scale it pretty much at will.

I don't think using 4 resistors will work. The analog pin of the Arduino will measure voltage between the Center Connection of two resistors and ground. The Arduino ground has to be connected to the negative pole of the voltage being measured. Do that twice and the two circuits being measured have a common negative ground. Since in this case they already have a common positive Connection, I get unregulated voltage from the solar Panel straight to the battery through my measuring circuit. I couldn't measure the 18V of the solar Panel because the battery would pull it down and the solar Panel will eventually fry the battery by overcharging it. Or, have I got something totally wrong here?

I am off work right now (3 days sick leave) and have been doing further Research. I have found what are called I2C Isolators (ADUM1250 I2C Isolator) and also a Volt/amp sensor with build in I2C with split SDA which means optical Isolators can be used. There are Problems with Speed but it seems the 6N137 is fast enough. I'm not sure I can put the two schematics together into one. Maybe I will post separate threads on those Topics and see if anyone has any experience that way.

The reason I suggested you draw a diagram is because without it, anyone without experience in that particular configuration is guessing at how it is wired. Your description doesn't add further information.

Right now, without any other information, I would have suggested using instrumentation amplifiers like the INA219 because with a common V+ rail and separate returns (that sounds like what you're describing), you could use separate voltage dividers floating above ground (the in-amps would have a ground common to the Arduino) to take advantage of the in-amp's common mode measuring ability. But you said that resulted in smoke, so...

Make as you wish, I know it's hard to draw pipes instead of electric lines, and 200watt worth of panels and 90Ah of 12V battery wont keep that barrel hot at all times, insulation included. Do the math, or.. I did it for you, just check it,

No Problem for electricity, but for example the pump you suggested only handles 3M static head

Among others uou make a confusion between system static pressure and circulating pressure. Look at specs for typical circulation pumps which, like the second one I suggested, can handle 10bars system pressure, have 4m head and circulate water in 4 level buildings. How do you think they can do that?

Ok, here are two diagrams. The first (WithoutArduino) is the standard connection between the solar panel, the charger, and the battery. The battery read 12.5 Volts before it was connected and 13.1 after all connections were made. The solar panel read 20V before and 13.2 after. The solar panel was pulled down to just over the battery voltage and the battery voltage was increased. The display on the charger indicated that the battery was charging. The interesting point though is that before the charger was connected, there are no readings (conductance) between any given plus and any given negative. So, it's not really a common bus on either side. With the system running, I can read battery voltage between the negative battery terminal and any given positive terminal. I can read the solar panel voltage between the negative solar panel terminal and any given positive. That lead me to believe that, at least when running, there is a common positive.

The second diagram (WithArduino) shows that an Adafruit INA219 breakout was put between the positive terminal of the solar panel and the charger and that a second INA219 was put between the positive terminal of the battery and the charger. All INA219 are connected to the Arduino SDA, SCL and VCC to +5V. The INA219 ground must be connected to the Arduino ground for I2C to work. The INA219 ground must also be connected to the negative terminal of the voltage it is to read (solar panel or battery). Assuming that the charger (while operating) has a common connection between the positive terminals, the Arduino ground is also connecting all the negative terminals together. In any event, it lasted about 3 seconds and one INA219 breakout went up in smoke.

Complicating matters even further, the Arduino is to be powered from the same 12V battery that one of the INA219s is monitoring.

I hate it when I do that!

Here are the attachments talked about in the prior post.


OK. I see the problem.

When you mentioned INA219 I erroneously thought it was an instrumentation amplifier, since there's a series of in-amps that start with "INA."
But all is not lost. First, the INA219 is a differential input amplifier so it does not need a ground common to what it's measuring. That means you can get current measurements without a common ground. But the voltage measurements aren't differential, so you probably won't get an accurate voltage measurement.

For a voltage measurement you'd need to drive the Arduino analog input with an instrumentation amplifier. Using an instrumentation amplifier means you can get accurate voltage measurements even if you do not have a common ground between the thing you're measuring and the Arduino.

A suitable instrumentation amplifier I'd try would be the INA217.

Thanks for the info. If I read the datasheet correctly though, the INA217, which is designed as an amplifier, has a way too small range for the voltage I am using.

" Signal input terminals Voltage(2) (Vā€“) ā€“ 0.5 (V+) + 0.5 V
Current(2) 10 mA "

That would make sense for an amplifier, but I don't see how it can be used as a voltage sensor for up to 18V.

What am I missing? A search for Arduino and INA217 only gets amplifier circuits. INA217 and voltage measurement gets nothing.

It measures both current and voltage to ground up to 26V or something, so ina219 should work.

JaBa: The INA217 can be set to a gain of 1, so it acts as a buffer and then you can use a voltage divider at the + & - differential input terminals to bring the voltage you're measuring into range.

@Blimpyway: it sounds like his grounds aren't common, so that may be a problem. Although, if the offsets from one ground to another are constant, then the problem can be fixed by math! If that's so, then it would be a simpler solution than introducing another buffer/amplifier.

From the pdf it has the same ground with arduino, and has library call to read the voltage between the current shunt lower voltage to ground.

It's simpler but since voltage readings are sufficient for specified application, it's not as simple or cheap as a couple voltage dividers one for battery and one for panel.

And, unfortunately, I now noticed it is rated for 3.5A, well below the 200watt solar panel output.

The INA219 will not work. At least not the way I wired them. ONE works fine. TWO or more does NOT work because EACH of them has to be connected to the Arduino ground and therefore they all have a common negative and the charger already has a common positive. The Adafruit breakout is rated at 3.5A but that Problem was easily overcome. I provided a second shunt resistor of 0.01 Ohm (off the breaker board) so that theoretically the thing can now measure ten times the current.

The way I have seen voltage dividers connected to Arduinos to measure voltage, that solution has the same Problem. ONE would work fine, TWO or more would not work because they also have a common ground to the Arduino.

Again, I may be missing something here. My electronics training is 35 years old. These days I am more of a keyboard dancer and spend all my time programming.

Did you measured the charger 6 pins (PV, load, battery) ?
They should have common GND

Yes, I measured all the pins. (Post #9).
With nothing connected, there is no connectivity between any Pins at all so there is no true common ground (as one would have expected) and also no common plus.
When the charger is connected to the battery only, I can read battery voltage directly across the battery, or across the battery terminal of the charger. No surprise there. I didn't test between battery negative and any other plus Pins, probably should have. If I connect the solar Panel as well, the battery starts charging. No surprise. I measure slightly higher voltage across the solar Panel terminals compared to across the battery terminals. That also is to be expected as the battery loads the solar panel and pulls it down. However, I get the exact same voltages (slightly lower battery voltage) between battery negative and battery positive compared to battery negative and solar plus. I also get the solar Panel voltage (slightly higher than battery voltage) across solar plus and solar negative and also solar plus and battery negative. Ergo, my conclusion that at least while charging, the plus terminals (all three of them) are common.

After I scratched my head over this phenomon for a while, I (maybe?) figured out what was going on. Just like on Arduinos, it is easier/cheaper to have the MOSFET on the negative side of the switching circuit. I think that is what they did with this charger. I own other chargers as well. I measured those and they have a true common positive, even when powered off. I opened them and sure enough, there is a fat copper/solder trace connecting all three terminals. On the one I am now using, that is not the case but nonetheless, when opeating the plus all seem to be common. (More head Scratching required)


Just wondering if you have any updates on reading multiple V+I sensors off your charge controller? I am facing the exact same problem (with a positive common ground on charge controller) - trying to deploy some remote monitoring Arduino boxes on off-grid solar home systems but can only accurately get 1/3 readings of (panel, battery, load).

The way I see it, if we want to measure multiple voltage values going straight into Arduino analog input:

a) Arduino needs to measure POSITIVE voltages at analog inputs (w/ regards to arduino reference voltage) otherwise pins will get fried.

b) Arduino needs to have the charge controller + rail voltage go into GND (to set the common reference voltage).

c) Arduino needs to have +5V -> +12V differential between Vcc -> GND. So if we're going to power the arduino with the battery itself, and use battery + as GND too, we need to boos battery by +5V to go into Vcc.

I'm really scratching my head here. Not that experienced in electronics so don't want to fry my Arduino. Any way we can use inverting OP amps to solve a). does b) sound right, and then use a buck converter to boost c) for Vcc input?