Introduction: Battery Powered LED Light(s) With Solar Charging
My wife teaches people how to make soap, most of her classes were in the evening and here in the winter it gets dark around 4:30pm, some of her students were having trouble finding our house. We had a sign out front but even with a street light right there the sign was hard to see. To run power out to where the sign is would have been a lot of trouble, during this time I watched a bunch of YouTube videos on how to make a street light using an LED, solar panel, and a battery. While this worked it didn't fill all the requirements I wanted in the backlight for her sign. Basically, the circuit needed to do the following
- Charge the battery during the day with a solar panel
- Automatically turn on at night
- She had to be able to turn it off once the class was finished yet it turn itself back on the next night
- We had to be able to turn it off for the weekends, holidays, and vacations without it turning itself back on.
In these pictures you can just see the LED strings in behind the sign to light it up, it actually needs maybe another 3 rows, I just haven't gotten around to installing them. The back of the sign shows the rocker switch, push-button switch and an LED to show that the sign is on in case it gets forgotten and left on, we can see it from our living room window and go turn the lights off. There's actually a piece of plexiglass that slides over the buttons and LED to keep the rain off of them.
- Soldering Iron
- Breadboard jumper wires of assorted sizes
- 18650 battery (x1) Amazon.ca / Banggood / AliExpress
- 5V 500mAh solar panel (x2) Amazon.ca
- 220 ohm resistor (x1) Amazon.ca / Banggood / AliExpress
- 10k resister (x2) see above for purchase links
- 5V Coil Bistable Latching Relay Amazon.ca / AliExpress
- JST connectors Amazon.ca / Banggood / AliExpress
- Momentary Toggle Switch 2 pin Amazon.ca / Banggood / AliExpress
- Rocker Switch 2pin Amazon.ca / Banggood / AliExpress
- 5V LED [single or string]
- 22awg wire for LED strips Amazon.ca / Banggood / AliExpress
- 1N5819 Schottky Barrier Rectifier Diode (x1) Amazon.ca / Banggood / AliExpress
- S9012 PNP Transistor (x1) Amazon.ca / Banggood / AliExpress
- BC547 NPN Transistor (x1) Amazon.ca / Banggood / AliExpress
- 2.54mm Breakable Pin Male Pin Header Connectors Amazon.ca / Banggood
- A TP4056 5V 1A Micro USB 18650 Lithium Battery Charging + Protection Circuit Board Charger Module Amazon.ca / Banggood / AliExpress
- 2.54mm Straight Female Round PCB Pins Amazon.ca / Banggood / AliExpress
- Terminal Connectors (alternate to JST Connectors) Amazon.ca / Banggood / AliExpress
- prototype circuit board Amazon.ca / Banggood / AliExpress
The 18650 batteries are cheapest on AliExpress but really pay attention to the shipping costs, some are horrendously high. Banggood seems to be middle of the road, batteries are more expensive but shipping is reasonable. On Amazon, the shipping is free but the battery cost is really high. The best way to get these batteries is a laptop battery pack headed for recycling, you can get up to 6 individual cells, at least 1 of which will still be good. Just be very careful taking the pack apart, avoid short-circuiting them.
Step 1: Solder Pins to the TP4056 Module
Here to make it easier to identify which pins were positive and negative I used red and black. Break off 2 pins of black and 2 pins of red and leave them connected by the plastic, these get soldered to the 2 pin holes for the B+/Out+ and B-/Out-. You will also need a single pin of each colour to connect to the power in.
So the easiest way to do this is to place one of the pins, longest part of the leg after the plastic piece down into the breadboard, place the negative power-in pinhole of the charging module on the pin, see where the other pins need to be on the breadboard and place them in their appropriate spots so that all pins are on the breadboard and they sit in the holes on the charging module. Now with the pins held firmly in place on the breadboard and the charging module sitting on top of them you can solder all the pins in place.
Step 2: Solder Wires to Solar Panels
If you want to do as I did and connect the 2 panels in parallel so that you keep the same voltage but higher amps then solder wires onto the positive and negative pads on one panel and solder the positive from that panel to the positive of the second panel, do the same with the negative wire. Then solder the wires with a JST connector to the positive/negative of one of the panels
If using a JST connector then place the piece with the pins on the breadboard as pictured, make sure the positive from the solar panels is connected to the positive rail on the breadboard.
Step 3: Readying the Battery
Attach another JST connector to your battery holder, place the piece with the pins on the opposite end of the breadboard but still on the power rails. As with the solar panels make sure the positive and negative are on the proper rails on the breadboard.
Step 4: Connecting Up the Charge Module
Place the charging module, with the pins soldered on, onto the board but do not press it into the board as we will need to place wires underneath it still. Leave two pin holes from the top power rail, see 2nd picture.
Place a jumper wire from the negative rail to the 1st hole above the negative power-in pin
Place the Schottky diode, 1N5819, from the positive rail connecting to the positive power-in pin, silver band should be closest to the power-in pin as that is the direction you want the power to flow, if it faces the other way then no power will flow into the charging module. The Schottky diode was chosen for its "Low Power Loss/High Efficiency Mechanical Characteristics" which is about half a normal diode. The diode is added to prevent reverse voltage flow at night back into the solar panels which is then wasted power.
Step 5: Connecting the Charger to Battery
Step 6: Setting Up the First Transistor Switch
Now we add the PNP S9012 Transistor
This transistor will act as a switch, if the solar panels are producing power (ie. it's daytime) then no power will be allowed to flow through the transistor, effectively turning the lights off and allowing the battery to charge up.
Connect 1 short jumper wire from the power-in pin on the charging module to an empty spot on the breadboard [image 1]
connect a 10k resistor [image 2] to that jumper wire
connect the Base of the transistor to the resistor [image 3]
connect the Collector of the transistor to the Out+ pin on the charging module [image 4]
connect the Emitter of the transistor to the lower positive rail on the breadboard [image 5]
Step 7: Simply Extending the Ground
Connect the Out- to the lower negative power rail.
That's the charging module done and the first transistor switch finished.
All you need to do now is fully seat the charging module into the breadboard.
If all you wanted was a battery-powered LED that turns on a night, off during the day and a battery that gets charged up during the day then this is as far as you need to go. You just need to solder the components onto a circuit board making sure to keep the traces the same as the wiring and that's it. The LED would be connected to the positive from the Emitter of the transistor and the negative from the Out-
To add a push button and rocker switch then follow along with the rest of the steps.
Step 8: The 2nd Transistor Switch
So this is the switch that trips the relay to allow the LEDs to turn on at night.
connect a jumper wire from the positive rail on the Solar Panel side, not the battery side and definitely not after the Diode. For some reason I have not figured out yet the circuit will NOT work if the connection to the Base of the transistor is made after the diode. Orange wire in image 1, coming from the positive to column 37 on the breadboard.
connect a 10k resistor to the end of the jumper wire you just placed [image 2]
place the Base of the transistor so that it connects to the resistor
connect the Collector of the transistor to the positive rail of the battery.
We'll connect the Emitter of the transistor in the next part
Step 9: Adding the Relay
So this is a double throw, double pole, latching relay. The latching part is what makes this a perfect relay for this project, "Most relays require a small continuous voltage to stay on. A latching relay is different. It uses a pulse to move the switch, then stays in position, slightly reducing the electric power requirement." What I have done here and what I recommend is to mark the sides of the relay to indicate where the pins are because once placed on the board you can no longer see them.
first let's place the connectors for the relay, due to its small pins you will have a hard time keeping the relay in the breadboard so using the female breakaway round header pins works very well [image 2]. You will need 8 pins per side. I tried an IC socket but it was actually worse than the breadboard for holding the relay.
connect the Emitter of the BC547 transistor to pin 2 on the side nearest the battery terminal. The relay can be connected with positive one side or the other, so which side the positive is on doesn't really matter, it just simplifies things for the moment.
connect pins 1 and 2 on the other side of the relay to the negative rail [image 2, the 2 blue wires]
while still on the side where we just connected the negative wires connect the 3rd pin to the lower positive rail
connect a jumper wire to the 1st pin on the opposite side of the negative wires, leave it loose for now
the 4th pin on the relay can be left unconnected or for testing purposes, you can connect a resistor and LED from it to the negative rail. This one is only turned on when you want to turn the main light off.
Step 10: Adding the Temporary and Long Term Off Buttons
I used a 2nd smaller breadboard for this part to try and eliminate some of the wire clutter, not sure it worked but anyway.
place a momentary button straddling the centre of the breadboard somewhere you have space.
connect the wire from the 1st pin on the relay to one of the pins on your button. In my case, the top left pin (red wire)
from the positive power rail of the battery connect a wire to the button. In my case the lower right pin. Yes, it does matter on this button which pin you connect to. (orange wire)
place a 220 ohm resistor from the positive power rail to any unused column
place an LED, this will be the LED or LED strip you want to power, connect the anode (long leg) to the resistor
connect the LED cathode (shorter leg) to the lower negative rail of the main breadboard (purple wire)
connect 2 wires to your latching or rocker button
connect one of the wires from the latching button to the 5th pin of the relay
connect the other wire from the latching button to the positive rail that the last resistor is in that you just placed
Image 1: solar panels are working and the battery is charging, all lights are off
Image 2: solar panels are no longer producing power so the LED is powered by the battery
Image 3: press the momentary button, relay is triggered, power no longer flows to the LED and the lights are off for the night, when it becomes daylight and the solar cells again produce power and the relay will be triggered back to the "on" position again.
Image 4: latching button has been pressed and no LEDs are powered until this button is pressed again.
Step 11: EasyEDA Schematic and PCB Diagram
Image one is the schematic wiring diagram
The board you see here is the PCB prototyping board, I used wires where possible to make the trace connections as soldering each hole to the one beside is a long and arduous process. I've included the circuit board traces as PDFs, one is a top-down view and the other as you can see reversed as if you were looking at it from the bottom.
Participated in the
Battery Powered Contest