Guys please help.
At this point I'm not sure what you want help with. The glaring problem: not driving that High-Side P-MOS correctly, has already been dealt with, right?
I can offer this:
I would add an over-voltage protection diode on the A0 and A1 inputs. Something like a 1N5817, with the Cathode to the Nano's +5V pin, and the Anode on the Analog Input. That way, if the voltage ventures above the Nano's +5 voltage, the diode will clamp it below the VCC+0.3V MAX input requirement.
Also, I would adjust the voltage divider values to get a full conversion range (i.e. 0-VCC, instead of the 0-1.8V, for the PV input, and 0~1.4V on the BAT input). That way, you'll get better conversion resolution. For instance:
In both cases, the lowest "+5V" voltage, on a Nano, is 4.95V
Also, in both cases, the divider current, when there is 4.95V on the Analog Input, is:
** **I[sub]D[/sub] = 4.95V/10k = [u]495µA[/u]** **
The PV can go to 20V open circuit, so, instead of 100k, I would use:
[b]R[sub]HI[/sub] = (20-4.95)/495µA = [u]30.4k[/u][/b]
The next available 1% value up from 30.4k, is 30.9k
For the BAT R3 value, assuming the Battery voltage will never go above, say 15V, instead of 100k, I would use:
[b]R3 = (15-4.95)/495µA = 20.3k[/b]
And, the next available 1% value up from 20.3k, is 20.5k
Now, all of that, of course, assumes you will be using that input over-voltage protection diode.
But, looking at your schematic hurts my eyes , so either post a better resolution image, or ask specific questions. [or, maybe someone else, with better eyes, will fill in ;)[/i]
Also, the BAT voltage divider will be consistently drawing half a milliamp from the battery(ies). I don't think you've divulged the capacity of the batteries you plan to use, so I can't be sure, but if half a milliamp is an excessive drain, consider bumping up the resistances. BUT, if you do that, add a 100nF ceramic capacitor across the Analog Input, so the MCU's internal Sample-Hold can still get a good sample. This applies to any resistance greater than 10k, on an Analog Input.
I know that last suggestion might sound silly. I mean, if your Solar Panel is 100W, that's potentially 8As of current to the battery, and even if you're only storing an hour's worth of energy, at 0.5mA, it would take 2 months to draw those batteries down by 10%, and the battery's internal leakage will probably do worse than that, anyway--unless we're talking a lithium battery, in which case the charge will hold up pretty good. I merely added that last bit as an exercise in considering all possible "use cases".