I have a device which is powered by a lead-acid battery that is charged by a solar panel.
I want to use that device's Atmega328 to turn the panel off when the battery is fully charged and on when the voltage drops below some threshold. I also want to disconnect the charger to measure the battery voltage periodically.
A relay is possible, but consumes power continuously - not good for a solar project. A normally-on relay is better, as it only consumes power when pulling the solar panel OFF - a time when, by definition, the battery has plenty of charge, but it's hokey.
I wanted to use an N channel power MOSFET, but it gets tricky.
I tried a low-side switch, wiring the solar panel positive to the battery positive, and the MOSFET (IRF540A) between the panel ground and the battery ground.
Because the panel has a higher voltage than the battery and the positives are connected, the panel's ground is 6V lower than the battery, so I flip the MOSFET source/drain - the source goes to the panel ground, and the drain goes to the battery ground.
Not home yet, because the Atmega can only source 5V (actually it's running on 3.7 - so 3.7volts) or Battery ground, which is also drain voltage.
However, I can use a large resistor between the gate and source to pull it low, turning the panel off, then I can use an Atmega digital output to write a HIGH, which pulls the gate on, thereby turning the panel ON. When I make the digital pin an INPUT, it goes high impedance, and so the pull-down is allowed to turn the panel OFF. So now I have control, right?
Well, yes - it worked. For a few minutes. Then it stopped. I think it's because I inadvertently created a path from the digital pin to - 6 Volts, and I think that fried the driver for that pin.
I wondered about using a diode to prevent this current/voltage path, but I realise I don't know how to analyse this circuit.
So my first question is - is it current or voltage that matters, and whatever the answer - how can I prevent it?
And my second is - assuming I get it working, is this a sensible way to control a panel? It's far less complex than any other charge regulator I've seen, which I suppose should be telling me something.
Any insights would be very welcome.
The image I inserted isn't visible for some reason - it's here: http://chriswesley.org/c.jpg