I really like the little solar charging circuit I built. You can see that blog here. It’s a simple little circuit, by Mike Davis, that turns on a relay switch that kills the solar output to the battery. It works just great, but it needs a little something.
The problem I was having, was that when I wouldn’t use the van for a few days, the battery would charge up and turn off. Then without any drain on the battery, it would never go back into charging mode. So by the time I used the van again, the battery wasn’t low, but it also didn’t have a fresh charge. A good drain on the battery and it would be low, and this usually happens at night when it can’t charge. So what it needed was a way to go into charge mode when it’s nighttime. That way it’s sure to get a charge every day and it will start in the morning.
I figured how hard could that be to add? I just need a photo sensor to signal it to go into charge mode. I looked in my electronic book that I have had since I was a child, that I bought at Radio Shack, and I found a circuit that would work. What a great book, and it’s still in print today. If you want to learn basic electronics, this is the book to buy.
There were actually two circuits in the book that work. The one I liked used a phototransistor and it would have worked, but I got to thinking. Why am I putting a sensor outside to detect the sun when I already have solar panels that are doing the same thing? So duh, I decided to detect if there was an output to the solar panels. Seems easy, but of course, I need to detect on the other side of the diodes, which are on the roof. So I would still need to run another wire outside. I can’t test on this side of the diode because this side is connected to the battery. That’s when I realized I could detect it when it disconnects from the battery, on the relay. I could monitor the normally open side of the relay. If it doesn’t have any voltage to it, that would mean it is either dark, or in charging mode already. Now if I could tell if it’s in charging mode or not, I could know that it was dark outside.
So any way, here is what I did to upgrade my solar charger…
I used a Picaxe 08m2 microprocessor to monitor everything and to turn the charge on. This is one of my favorite chips to play with. You can’t beat these guys for the price. They are not the fastest things in the world, but I’m not building a supercomputer.
Other than the picaxe chip, I used a few resistors, a potentiometer, and a NPN transistor. Basically you need a really big resistor and/or a potentiometer to protect the chip when detecting the solar panel. A 10k ohms resistor to protect the chip from the input to test for charging. Then the output goes through a 1k resistor to the NPN transistor, which is grounded.
Here is the code I used for the chip…
if pinC.1=0 and pinC.3=0 then startCharge
What it does, is it makes pin one and pin three input pins. It makes pin two go low, or in other words, it has no voltage or a negative voltage.
Then there is my main loop. The first thing it does is sleep. The sleep command shuts down everything except for the timer. This will use less electricity. The number you give it, is how many seconds it will wait times twenty three. Why twenty three? I have no idea. But basically, “sleep 500” makes it sleep for about three hours and nineteen mintues.
Then it checks pin one and three to see if they have either no voltage or a negative voltage. If both of them do, and it has to be both, it will start the charging process. If it’s already in charge mode, or if there is a charge coming from the solar panels, it won’t do anything. So then it “GO TO”s back up to the main loop start.
To start the charging process, it just mimics the pressing of the button. It turns pin two high, giving it a positive charge. That positive charge turns on the NPN transistor. When that gate is open, it drops the line to ground, which is the same thing that happens when you push the button for it to go into charge mode. And just like letting up on your finger from the button, there is a pause of a one hundredth of a second and then it makes pin two go back low. Then it is back to the main loop to sleep and detect again.
It works. I don’t have to worry about my battery not getting a fresh charge. Whenever it gets dark, it will put it in charge mode ready for the morning sun. I like it, but really, I could have just had the chip put it in charge mode every six hours and that would have worked too. But what fun is that?