This is one of those problems that seemed super simple at first but, after simulating, appears to be tricker than I expected, at least for my wannabe-EE brain.
The circuit I'm working with looks something like this:
As you can see, we have a very simple solar-powered microcontroller with a battery backup. A buck/boost converter generates the 3.3V needed for the microcontroller. This circuit works pretty well, but on particularly sunny days we can overcharge the battery.
To address this, I wanted to add a way for the microcontroller to disconnect the solar panel. In order for this to work, the mechanism would need the following requirements:
- Low impedance when "on", so that we don't waste energy.
- Needs to default to "on" if the microcontroller GPIO is high-z (to allow for cold-starts when the battery is depleted)
That's it. I don't care if it is a high or low signal from the microcontroller, or what side of the solar connection gets interrupted. As long as it is low impedance when on. Seemed so simple.
At first I thought I could just use a MOSFET to interrupt the low or high side of the circuit, but I immediately ran into problems getting the MOSFET to always turn completely on or completely off in the simulations.
One of the tricky problems is that the voltage from the solar panel is variable: it can be anywhere between 2.5V and 3.5V when under load, or as high as 6V when unloaded (like when turned off). The microcontroller GPIO can only source 3.3v, which might be higher or significantly lower than the solar panel voltage.
I could use a bipolar transistor, but I'd rather avoid the voltage drop. At these scales, every 10th of a volt counts.
This was the closest solution I could come up with:
At first this seemed like it was working well enough. It defaulted to being on, but problems arise when the voltage of the solar panel increases. For example, in the case above only 2.6V is making it to the load, which way too large of a voltage drop.
I'm sure there is some easy way to do this that I'm just not seeing. I could use a small relay, but those are expensive. It seems like there must be a better way using solid-state electronics.
If I find a good enough mechanism, then perhaps it might even make sense to use it instead of the diode... But I digress.