- It can be done easily and cheaply if desired.
The "best" way, no expense spared, is to use electronics to convert what you have to what you want. Either a boost converter tp step up low voltage panels when desired or a buck converter to step down series connected panels when required.
What you describe can be achieved cheaply and simply using relays. You can also do it with electronics, but using a pair of relays is so simple and cheap that they are hard to beat.
Consider this solution with 2 panels. This can be readily extended to 2N panels as required.
See circuit diagram at end.
Note that relay can be SPDT rather than 2 x relays as described here.
Panel B = Upper panel = PVB. .
Panel A = lower panel = PVA
PVB+ connects to B+
PVA- connects to ground.
Provide two relays.
Relay 1 = single pole changeover.
Contacts are NO, NC an common.
NO = normally open
NC = Normally closed = connected to common when depowerd.
Relay 2 = normally open single pole.
Use same NO, common terminology as relay 1.
PVB- to Relay1-common
PVA+ to Relay1-NC
Relay-1_NO to ground
PVA+ also to Relay 2 common
Relay2-NO to Battery +
Provide magic circuit to operate both relays when Vpanel rises to high enough to allow parallel operation and to deoperate them when Vpanel falls too low. You could use relays themselves with hysteresis due to relay characteristics but a simple window comparator or comparator with hysteresis will do this easily.
When PV voltages are low relays are unoperated and panels are in series.
Whe PV panel voltage is high enough relays operate and panels switch to parallel.
Switching could occur due to clouds etc but with enough hysteresis this should not be too bad.
You could also use an LDR or photocell sensor to control this.
You could add a delay of seconds to minutes to minimise chatter.
ENSURE relays are break before make.
If R2 operates while R1 is not operated contacts on both relays will be entertained by current from PVB under short circuit. Adding a diode between R2-NO and battery stops this happening. HIGHLY recommended :-).
Quck sketch suggests this would work OK with 3 x MOSFETS and some head scratching. They probably need to be operated "upside down" in second quadrant due to body diodes but doable. Later.
FET1 ground PVB- when desired.
FET2 connects PVA+ to PVb- WHEN DESIRED.
FET3 connects PVA+ to battery when required.
FET 2 is mid supply referenced but should be no problem.
Check my NC NO common etc :-)
Here we go, then.
Forrest mims style cct:
Relay can probably be a single DPDT or a SPDT and SPST or whatever.
As shown relay(s) is/are unactivated and PV panels are in series
When relay(s) activate(s) PV panels are in parallel.
Diode in RH NO contact lead to battery stops PVB (upper) shorting through two contacts if RH contact closes before LH contact is open.
If contacts are on a DPDT relay and contacts are break before make then diode is not needed.
R1/R2 set changeover voltage.
R3 adds hysteresis as desired.
0515 - bedtime.