I have a solar panel and battery connected to a charge controller (Powertech MP3750), and this provides 5V USB output which powers the ‘load’ - my own board with ATMega328p. I wanted to use the onboard ADC to measure both the voltage and current of the solar panel so that I could calculate and record power output. I have a Hall effect current sensor for the current measurement which should (in theory) be straightforward. For voltage, the solar panel is rated 20V open circuit, so the plan was to use a simple voltage divider to reduce it to max 5V input to the ADC. However this is not as simple as it sounds.
On a sunny day I measured the voltage on the solar panel at the input of the charge controller. This was fine - it ranged from a few volts to around 13V, same as the battery. But the issue was that it wasn’t referenced to the same earth as the load (which the ADC uses as a reference). If the voltage across the solar panel is less than the battery voltage (~12V) then the negative of the solar panel is increased so the positives match. So then I thought i would use two voltage dividers and measure both the pos and the neg of the solar panel separately, via the ADC.
However, when the load is switched off, the earth of the ATMega goes to the battery/solar panel pos, so the neg is -12.8V or so. This would mean the ATMega328p, although switched off, would see a negative voltage on the ADC pin. This is outside the allowable range according to the data sheet.
Does anyone know if this is normal for a PWM charge controller? Any ideas on how I can get around this to ultimately measure power?
Thanks!