Maker Pro
Maker Pro

lm317 set up

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

Conntaxman,

Let's throw out the schematic for a minute. I want an extremely detailed description of what you want to accomplish with this circuit. How many hours a day is the solar panel going to be in the sun? What is the maximum current available from the solar panel? What is the average current that is going to be available during normal operation? When do you want the LEDS to be on? Only during the night? Let's say you want 24 hours of light from the LEDs. 24 hours x 2 LEDs x 20mA each gives us 960mAh. This means that you could run your batteries in series and still have enough capacity. What is the Vf of your LEDs? Is it less than 3.2V? Are you only going to want two LEDs? Or will you want more? Depending on the problem, sometimes it's better to start from scratch than to try to modify a design you're only going to use a small part of.

Let's say you want to charge the batteries at 4 volts and 200mA. This means the cells will be charged in approximately 10 hours.

Here's what I came up with. It may be right, or it could be wrong. I'll let someone more knowledgeable than myself chime in.

12 volts comes in from the solar cell. It passes through D1, then the LM317, where it's regulated to about 4.7 volts. At this point, an LDR (light-dependent resistor) and NPN transistor ground out the ADJ pin of the LM317 when it is dark outside, cutting off charging. Diode D2 prevents the batteries from discharging into anything except the LEDs. A second LDR and NPN transistor turn on the LEDs when there is insufficient light shining on the LDR. You'll need to figure out the value of R8 and R9 according to the Vf of your LEDs.

I chose R4 and R5 like this: Approximate charging voltage is 4 volts. Battery voltage is approximately 3.2 volts. 4-3.2 = 0.8 volts. Charging current of 200 mA = 0.2 A. V = I*R. 0.8 / 0.2 = 4. Round up to the E12 value of 4.7 ohms.

Let me know what you think.

TB. you made me smile, thats what I need,isnt that about the same as the last pic i put up? ok let me explain what I want to do.
I put a flag up and at night you are suppose to have a light shine on the flag,[respect to the flag]or you should take the flag down.
I make the solar panels,out of 3x6 solar cells which give off 1/2 volt dc and max 3amp.So ill make a 6 volt panel useing 12 cells that will give 6volts x 3 amps.
I figure that i would use 2 of those 3.2 volt x 1000mah batteries. Just in case I want to add more leds. Now the leds are the reg 10mm whith in volt 3 ,current draw is 20ma .Now the amount of light per day im going to say about 7 hr.So i know their will be enough of sun to charge the batteries,I know on cloudy day you dont get much light. Want to LEDs to turn on at dark and trun off in the morring. so we have about 15 hr of draw on the batteries.I looking in the winter when it gets dark around 4am ,light about 7am.
So your drawing is what I want,or trying to make. Oh, the Solar cells don't produce any electricity at dark. So on your drawing i wouldnt need Q1 R3 R2 would i.You have those to turn off the solar cells, or is that used for the current to the batteries.
I thought to charge a battery you have to have the voltage a little Above the battery voltage to charge it fully.Like a car battery its 12, but you need about 18 volts to fully charge it up.
oh the current from the solar panel will most likely fluxuate a bit.
Is the last drawing i made right? I just need to know the val or R6 ,to me thats confuseing to figure out.
tks
John
 

davenn

Moderator
Sep 5, 2009
14,254
Joined
Sep 5, 2009
Messages
14,254
TB. you made me smile, thats what I need,isnt that about the same as the last pic i put up? ok let me explain what I want to do.
I put a flag up and at night you are suppose to have a light shine on the flag,[respect to the flag]or you should take the flag down.
I make the solar panels,out of 3x6 solar cells which give off 1/2 volt dc and max 3amp.So ill make a 6 volt panel useing 12 cells that will give 6volts x 3 amps.
I figure that i would use 2 of those 3.2 volt x 1000mah batteries. Just in case I want to add more leds. Now the leds are the reg 10mm whith in volt 3 ,current draw is 20ma .Now the amount of light per day im going to say about 7 hr.So i know their will be enough of sun to charge the batteries,I know on cloudy day you dont get much light. Want to LEDs to turn on at dark and trun off in the morring. so we have about 15 hr of draw on the batteries.I looking in the winter when it gets dark around 4am ,light about 7am.
So your drawing is what I want,or trying to make. Oh, the Solar cells don't produce any electricity at dark. So on your drawing i wouldnt need Q1 R3 R2 would i.You have those to turn off the solar cells, or is that used for the current to the batteries.
I thought to charge a battery you have to have the voltage a little Above the battery voltage to charge it fully.Like a car battery its 12, but you need about 18 volts to fully charge it up.
oh the current from the solar panel will most likely fluxuate a bit.
Is the last drawing i made right? I just need to know the val or R6 ,to me thats confuseing to figure out.
tks
John

Hey John :)

Similar to that cct but you will notice how the transistor is supposed to be wired, unlike the way you have done so in your circuits. As you have wired your circuits you will short circuit the power to ground via the transistor when it is switched on. A bad thing for the power supply and will probably instantly kill the transistor.

Follow Timothy's cct noting that the LED's and their resistors are in SERIES with the supply and the collector of the transistor :)

cheers
Dave
 

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

Hey John :)

Similar to that cct but you will notice how the transistor is supposed to be wired, unlike the way you have done so in your circuits. As you have wired your circuits you will short circuit the power to ground via the transistor when it is switched on. A bad thing for the power supply and will probably instantly kill the transistor.

Follow Timothy's cct noting that the LED's and their resistors are in SERIES with the supply and the collector of the transistor :)

cheers
Dave
Dave, tks, now I see it. guess i wasn't even really looking at the flow that much but just wanted to get this done and build it. You saved me Q1. Tks. I will follow Timothy's cir. but I dont think that if need his Q1-R2-R3 i think he put those in their to shut off the solar cells at night. They don't make any ele. at night.But the diode is their so nothing will back feed.
Im glad that you told me about the Grounding / short to the transistor.Im just learning, I use to use relays all the time if i built something, never transistors, these were the new things, ha ha ha Im 63 and haven't played with this stuff for a llllooooonnnngggg time. LOL.
You guys are really great on this forum. and alot of help, I know to you that this is one of the most simplish things to make. And I always followed a schematic, never made my own cir.
again tks
John
I think that i still have to find 1 value for a resistor for his Q2. I watched a vid on that and couldn't understand the guy doing it,well how he got to the val of the resistor for the VH or VF. i know it was small amount . LO.L
 

jackorocko

Apr 4, 2010
1,284
Joined
Apr 4, 2010
Messages
1,284
I am just gonna say this again. you are using lithium ion battery cells. these are VERY picky about how they are recharged. I don't think TCB's design takes into account a lithium-ion cell. Too much heat and you won't have much left of your project.
 

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

I am just gonna say this again. you are using lithium ion battery cells. these are VERY picky about how they are recharged. I don't think TCB's design takes into account a lithium-ion cell. Too much heat and you won't have much left of your project.
Hello Jack. I think and everything sounds good about the charging for the batteries.If you read he said that it would take about 10 hrs to charge.Thats a long time.Any ways ,when I build the cir, and put it to use I will see/feel the batteries.I have a charger for my ele. helicopter and that battery gets warm when in that charger.
Do you have a schematic for what I need?
tks
John
I think they know what they are doing.
 

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

http://en.wikipedia.org/wiki/Lithium-ion_battery#Charging_procedure

Most lithium ion battery chargers have protection circuits to make sure the temp stays in check. Plus, you can really ruin a lithium-ion battery as the wiki states by discharging it past a certain point. There is no advantage in this project that I can see where you would require lithium-ion batteries. Just an opinion
Thanks Jack for your concern. I'll keep a check on them reason Im using them is because I had them just laying around doing nothing.Might as well put them to work.
John
 

TBennettcc

Dec 4, 2010
292
Joined
Dec 4, 2010
Messages
292
Q1-R2-R3 grounds the ADJ pin of the LM317 at night, "which programs the output to 1.2V where most loads draw little current." - From the National LM317 datasheet:

http://www.national.com/mpf/LM/LM317.html#Overview

I included it just because I could. An extra level of safety maybe. Include it or don't include it. It's totally up to you.

I am not going to pretend that I know ANYTHING about charging batteries. That circuit seems simple enough to me, especially after reading:

http://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery

...which I took to be the type the OP was using, as described on the Home Depot site, and putting together whatever I could find. I could not find any references to "Lithium Phosphate" batteries, only "Lithium Iron Phosphate" batteries, which I take to be the same thing.

The Wikipedia page I linked to states that the LiFePO4 batteries are much safer and more stable than other Li+ batteries, so I didn't think too much about charging one. I AM BY NO MEANS AN EXPERT in any of this. The circuit I drew for the OP is pretty much my first circuit using transistors. I do this as a hobby, because I enjoy electronics, and solving problems. I would LOVE to have some formal training in electronics; unfortunately, that is not in the cards right now, although I will definitely be pursuing it later in life. So far, I am self-taught, with a little help from my ham radio friends. I am doing the best I can to absorb all of this theory, process it, and use the resulting understanding to help other people who understand less than I (a small number of people, I assure you.) Believe me, I have learned a lot in the last year.

Vf is the forward voltage drop of your LED. All diodes have a forward voltage drop (LED = Light Emitting DIODE). If you bought the LEDs from a store, the packaging should indicate all of the metrics for the LED, including Vf. If not, you can always put the LED across a battery with a known resistor, and use Ohm's Law to extrapolate the calculations from there.

As far as the values of R8 and R9 go, here's what you need to do: Get the voltage of your circuit running off the batteries. Subtract the Vf of your LEDs from the overall voltage from the batteries. In order to produce light, the Vf of the LED MUST be less than the voltage applied across the LED (and in the correct direction!). Now you have your overall voltage in the circuit, the Vf of the LED, and the difference between the two. Vtotal -Vf = Vremaining. According to Ohm's Law, V=I*R. You want 20mA flowing through each LED. Vremaining = 20mA * R. Re-arranging algebraically, Vremaining / 0.020 amps = Resistance in ohms needed to achieve the specified current through the LED and resistor. ALWAYS REMEMBER to use BASE UNITS in Ohm's Law (Volts, Amps, and Ohms; NEVER milliamps) (Yes, I am aware there are "shortcuts", but I figured this would be less confusing for the OP and any other newcomers who happen to stumble across the site.)

Also, John, in the last schematic you posted, your R3 and R6 are supposed to be swapped, if you want the transistor to turn on during the day (in addition to having the LEDs in series with the transistor collector). The LDR resistance decreases with increasing incident light. This would allow current to flow to the base of the transistor during the day, turning it on. With those two reversed, the LDR resistance is low during the day (light), lowering the resistance and allowing current to pass through it. When it gets dark out, the resistance of the LDR rises, diverting current to the base of the transistor, where it flows from base to emitter, and enables the flow of current from collector to emitter, through your LEDs, lighting them.

I enjoy teaching. I hope I have helped you learn something. Good luck with your project.
 

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

Q1-R2-R3 grounds the ADJ pin of the LM317 at night, "which programs the output to 1.2V where most loads draw little current." - From the National LM317 datasheet:

http://www.national.com/mpf/LM/LM317.html#Overview

I included it just because I could. An extra level of safety maybe. Include it or don't include it. It's totally up to you.

I am not going to pretend that I know ANYTHING about charging batteries. That circuit seems simple enough to me, especially after reading:

http://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery

...which I took to be the type the OP was using, as described on the Home Depot site, and putting together whatever I could find. I could not find any references to "Lithium Phosphate" batteries, only "Lithium Iron Phosphate" batteries, which I take to be the same thing.

The Wikipedia page I linked to states that the LiFePO4 batteries are much safer and more stable than other Li+ batteries, so I didn't think too much about charging one. I AM BY NO MEANS AN EXPERT in any of this. The circuit I drew for the OP is pretty much my first circuit using transistors. I do this as a hobby, because I enjoy electronics, and solving problems. I would LOVE to have some formal training in electronics; unfortunately, that is not in the cards right now, although I will definitely be pursuing it later in life. So far, I am self-taught, with a little help from my ham radio friends. I am doing the best I can to absorb all of this theory, process it, and use the resulting understanding to help other people who understand less than I (a small number of people, I assure you.) Believe me, I have learned a lot in the last year.

Vf is the forward voltage drop of your LED. All diodes have a forward voltage drop (LED = Light Emitting DIODE). If you bought the LEDs from a store, the packaging should indicate all of the metrics for the LED, including Vf. If not, you can always put the LED across a battery with a known resistor, and use Ohm's Law to extrapolate the calculations from there.

As far as the values of R8 and R9 go, here's what you need to do: Get the voltage of your circuit running off the batteries. Subtract the Vf of your LEDs from the overall voltage from the batteries. In order to produce light, the Vf of the LED MUST be less than the voltage applied across the LED (and in the correct direction!). Now you have your overall voltage in the circuit, the Vf of the LED, and the difference between the two. Vtotal -Vf = Vremaining. According to Ohm's Law, V=I*R. You want 20mA flowing through each LED. Vremaining = 20mA * R. Re-arranging algebraically, Vremaining / 0.020 amps = Resistance in ohms needed to achieve the specified current through the LED and resistor. ALWAYS REMEMBER to use BASE UNITS in Ohm's Law (Volts, Amps, and Ohms; NEVER milliamps) (Yes, I am aware there are "shortcuts", but I figured this would be less confusing for the OP and any other newcomers who happen to stumble across the site.)

Also, John, in the last schematic you posted, your R3 and R6 are supposed to be swapped, if you want the transistor to turn on during the day (in addition to having the LEDs in series with the transistor collector). The LDR resistance decreases with increasing incident light. This would allow current to flow to the base of the transistor during the day, turning it on. With those two reversed, the LDR resistance is low during the day (light), lowering the resistance and allowing current to pass through it. When it gets dark out, the resistance of the LDR rises, diverting current to the base of the transistor, where it flows from base to emitter, and enables the flow of current from collector to emitter, through your LEDs, lighting them.

I enjoy teaching. I hope I have helped you learn something. Good luck with your project.
TB hello again, and Thank you very much for your patiance. I know it's some times hard to tell someone something over and over again.Like i said I use to teach guys plumbing ,heating, remodeling, in my business.And I always told them to ask questions, even if they thought they were stupid,other wise how would you get the answer.
So thank you and everyone else that helped or tried their best, and this might help someone else that finds this on the web. I will be using your cir, mine is just a bit different, You said that i had to swap R3 and R6 ,dose that change the direction of flow? seeing that the arrow is now on the bottom facing ground. one person said that I would burn out the Q1 my way, and i can see his point.Its now a Short. I wasn't really looking at it ,i was in a hurry to get it done. LOL. poof, smoke, oops, try it again, close your eyes and turn on the switch.LOL.
Atleast one thing went right yesterday. I connected all my solar panels that I made,to my controller and them to a battery, and every thing is working fine. and they charged the 12 deep c. battery really fast. I have 560 watts of panels so far , will have 1000 watts soon.
Tks again
John
 

TBennettcc

Dec 4, 2010
292
Joined
Dec 4, 2010
Messages
292
By swapping R3 and R6 in YOUR circuit (the most recent schematic YOU posted), you would simply change whether the LEDs were on during the day or at night. As you have it wired (besides the LEDs and their resistors being in the wrong place), the LEDs would turn on during the day, not at night (if the LEDs were in the correct place, between the transistor collector and V+). The resistance of an LDR decreases as light shines on it. This would allow current to flow from V+ to the base of the transistor, which would open the path from the transistor collector to the transistor emitter. Because you don't have any resistance in that pathway, it would indeed cause a short-circuit and most likely fry something. I'm not quite sure which arrow you are referring to.

Sounds like you are on your way to a successful project.
 

conntaxman

Jun 17, 2011
89
Joined
Jun 17, 2011
Messages
89
lm317

By swapping R3 and R6 in YOUR circuit (the most recent schematic YOU posted), you would simply change whether the LEDs were on during the day or at night. As you have it wired (besides the LEDs and their resistors being in the wrong place), the LEDs would turn on during the day, not at night (if the LEDs were in the correct place, between the transistor collector and V+). The resistance of an LDR decreases as light shines on it. This would allow current to flow from V+ to the base of the transistor, which would open the path from the transistor collector to the transistor emitter. Because you don't have any resistance in that pathway, it would indeed cause a short-circuit and most likely fry something. I'm not quite sure which arrow you are referring to.

Sounds like you are on your way to a successful project.
>>>> Thank you TB.
John
 
Top