Connect with us

lm317 set up

Discussion in 'General Electronics Discussion' started by conntaxman, Oct 1, 2011.

Scroll to continue with content
  1. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    On a lm317 I need someone to explain R1 and R2 . on the 317 i will have to set the voltage out and the current out.They have calculators on line but Im missing were the current part comes in. Im going to make a solar battery charger and led light to only shine at night.Like a garden light.I will have to add the led light part later.I will be useing Two 3.2 volt x 1000mah in series. so 6.4 volt. I read some were to charge these battery you go 10 percent of the battery current. So i will need about 200 ma. at about / i think 7 volts.here is the link
    http://electroschematics.com/4746/solar-charger-circuit/
    So setting up the 317 for about 7 volts would be by this page
    http://www.reuk.co.uk/LM317-Voltage-Calculator.htm
    R1:390 and R2:1800
    Now that is the voltage. But how do I calculate for the amp"s or current.That is on this page
    http://www.reuk.co.uk/LM317-Current-Calculator.htm
    But isn't that the same resistor as R1
    Thanks John
    Sorry but im just trying to learn.
     
  2. TBennettcc

    TBennettcc

    292
    2
    Dec 4, 2010
    An LM317T can be used EITHER as a constant-voltage regulator, OR a constant-current source, but not both at the same time.

    If you're talking about current for charging, you need to make sure your solar panels can supply that current. If you're talking about current for running your LEDs, you need to do the calculations for how many LEDs you want to run, in what configuration (series, parallel, or hybrid), and how long you want them to run. Then, you can determine the total amount of power drawn in mAh, and adjust the circuit accordingly.

    From the circuit you linked to, why not just use the 390 ohm resistor for R1m and use a 1k pot for R2? You're going to have a little variance in the actual resistance of single-value store-bought resistors. It's called the tolerance value. Most resistors will be within +/- 10% of their specified value.
     
  3. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    ..........
    Thanks for the reply.I though you only can do one at a time.Another question.Seeing that I will be looking for the resistor val. for the current of about 100ma for the batteries, that resistor will be off the out put pin, Now after i find the value for a resistor for the leds, could I connect that also to the out put pin and run that to the leds. So that would be two different resistors.I'll be running about 3 led I think the volts are 3volts each x 20 ma.Just the nor. led.
    tks
    John
     
  4. TBennettcc

    TBennettcc

    292
    2
    Dec 4, 2010
    Keep in mind that the Vf specified for an LED is actually the forward voltage drop (i.e., how many volts will be dropped across this LED in a circuit.) So if you have a 12 VDC power supply, and you put an LED with a Vf of 2 V in series with the battery, you will have a potential of only 10 volts after the LED. Add another LED, drops to 8 volts. Add 3 more, and the potential difference is now only 2 volts. It unlikely for you to be able to add another, because then there won't be enough potential to get back to the battery.

    Also, when the LEDs are in series, the same amopunt of current is flowing through each LED. So, to calculate the resistor for your three LEDs on the output, you need to know #1) What is the total potential difference going to be across the output leads? #2) What is the Vf of the LEDs you plan to use? Take the total potential difference (for example, 12 volts), subtract the Vf of every LED you are planning to use (say you have 4 LEDs, each with a Vf of 2 volts. Your total voltage drop will be 8 volts.) For this example, you would take 12 volts - 8 volts = 4 volts. Now, use Ohm's Law to calculate the resistor needed to pass only 20mA at a voltage drop of 4 volts. E=IR. 4 = .020 A * x R. 4 / 0.020 = 200 ohm resistor.

    Substitute your LED Vf and total potential difference.

    Keep in mind that just because a power supply CAN supply 20 amps, it is not ALWAYS supplying 20 amps. It depends on how much current the load is drawing. If the load resistance is small, the current drawn will be large. Likewise, if the load resistance is high, the current drawn will be small.
     
  5. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    /
    Thanks Tim
     
  6. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    TB. how dose this look to you.I'll be feeding the 317 with a solar panel about 6 vdc.
    I want to charge the two 3.2volt 1000ma batteries in the day and at night the leds will come on and go off in the day.It looks like the 2n3904 will pass enough current for the 2 leds easy. let me try to up load the pic. P1010078.jpg
     
  7. TBennettcc

    TBennettcc

    292
    2
    Dec 4, 2010
    My web browser hates me. It has now cleared my post to you twice. So I will summarize. Again. :-/

    Go download ExpressSCH (part of ExpressPCB).

    Use this to create a proper schematic. Learn the proper symbols for a battery, NPN transistor, and PNP transistor. I can't tell which leg of your transistor is which. It really doesn't matter that it's in a TO-92 package. I can't tell which leg is which of your LM317. It looks like you have the input connected to ground, and output connected to the solar charger. Your LEDs are backwards. Think of the bar as 'current cannot flow in from this direction'.

    I have no idea what the circle with the two lines is between 'Diode IN4004' and 'LED 3V x 20mA'.

    Make sure to label every part. For example, if you have three diodes, label them 'D1', 'D2', and 'D3'. If you have two transistors, label them 'Q1' and 'Q2'. This avoids confusion and facilitates easy communication of the circuit. Talking about 'D2' is easier than saying 'that diode between those two resistors over there'.

    Download and install ExpressSCH and draw me a proper schematic. Then we can talk.

    I think that was everything. I'm going to post this before my browser decides to erase it again.
     
  8. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    You have the +6V connected to the output of the LM317, how do you expect it to be regulated in this configuration? Take a closer look at the datasheet. It also seems like the photoresistor should be attached to ground as well. This would then make a voltage dividing network at the base of the transistor to turn it on and off. I don't see what the diode is doing exactly. I better stop before I confuse you, if I am confused. Someone else will chime in
     
    Last edited: Oct 2, 2011
  9. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    hello.back again.and I went and made another pic.with the parts marked.haha sorry.
    The solar panel is going to charge the Two 3.2 vdc x 1000ma batteries in the day time, then at night I want the cds cell [photo resistor] to humm Open the transistor 2n3904 to let current flow to the Two led's. which are reg. leds 3 some thing volts and 20 ma. Thats it.I think i have the leds going in the right direction.+ long goes to pos.
    tks John
    P1010077.jpg
     
  10. TedA

    TedA

    156
    16
    Sep 26, 2011
    conntaxman,

    I agree that your circuit still needs work, in order to function at all. But I'm curious about some of your key components, beyond the LM317 circuit.

    Can you tell us more about the solar panel, and about the batteries you plan to use? Are there data sheets for these online we might look at?

    What is the maximum current the panel will produce in full sunlight? Is it actually enough to harm the battery?

    And what is the maximum power voltage when the illumination is at the minimum that must still charge the battery?

    What battery chemistry produces a nominal 3.2V ?

    Good luck finding a good solution.

    Ted
     
  11. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    Ted, the batteries you can get in Home depot now in the lighting section for solar lights.looks like their made/sold by Hampton Bay. [solar] the voltage is 3.2 volts and 1000mah.[Lithium rechargeable] The solar panel im making is going to put out about 9 to 12 volts with about 1 and 1/2 amps. I could make the panel bigger if i want.
    here is the link for the batteries.http://reviews.homedepot.com/1999/2...lacement-batteries-2-pack-reviews/reviews.htm
    tks
    John
    after i get this going i would like to know if I can turn on a STCS2SPR link http://html.alldatasheet.com/html-pdf/230546/STMICROELECTRONICS/STCS2SPR/5847/3/STCS2SPR.html
    using the voltage from Q1 to feed the Vin on the stcs2spr so that I can feed more amp's to some leds. I dont know but would I use the "drain" as the feed to the leds? im pretty sure it would work but I dont know what the other pins do,or how they switch.
    But first is this one.
     
  12. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    Right now the transistor is not doing anything "useful" in this circuit. It is not acting as a switch, which is what I was thinking you had in mind.

    Right now, the photoresistor will take the full load of the current for both led's. You need to put the LED's in series with the collector.
     
  13. TBennettcc

    TBennettcc

    292
    2
    Dec 4, 2010
    Conntaxman,

    This last schematic is much better, at least in terms of readability. Please take a look at the circuit you referenced. Pay special attention to the description below the schematic. They describe how their circuit works. Look at how they have things set up versus how you have things set up. You have two 3.2V 1000mAh batteries in parallel, which is effectively one 3.2V 2000mAh cell, not one 6.4V 1000mAh cell. Batteries in series combine voltage. Batteries in parallel combine capacity. They have a blocking diode (D1) between the solar panel and the LM317, you do not. They have a resistor (R3, 10 ohms) to limit the battery charging current to 900mA. They have another blocking diode (D2) to prevent the battery discharging back into the solar panel when there is no light. Your single diode seems to do absolutely nothing. The values of resistors you have chosen for R1 and R2 set the LM317 to output about 3.47 volts (don't forget tolerances. That's why most people use a pot for R2, so you can continuously adjust to get the exact voltage you want.) You don't have a resistor to limit the charging current to the batteries. LEDs are typically attached to the positive power rail and the ground connection is switched to form a circuit. Unfortunately, the solar charger circuit you linked to does not show where you should attach the load. I would assume across the battery, but I'm not sure.

    Something I don't understand about the solar charger circuit: they claim the Vout of the LM317 is 9 volts. Won't that just turn on the Zener diode? Why would the Zener only respond to the battery voltage, and not the initial 9 volts in?
     
  14. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    .,
    I could see that i need a diode on the Vo after the first tie with the resistor, so that the 2 batteries won't feed back .Right.And the someone mentioned that i have the Q1 wired wrong.Is it just the Emmitor and collector wired wrong? I cant put the leds in series because the two small batteries are wired in parallel so that it will have more mah.So each battery is 3.2 volts and that is why I have the leds wired in parallel. I just want to use the photo resistor just to turn on Q1, and have Q1 feed the leds the 3.2 volts.
    John
     
  15. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    .
    Hi TB. you are right, I should move D1 and put it after the resistor on the Vout before the batteries. This would keep any back feed from the batteries.Also you are correct,i ment the two batteries would supply 3.2 volts. Now i want to use the photo cell resistor, to turn on Q1, and Q1 to feed the two leds, that is why i have the leds in parallel.
    I though when useing the 317 I would need to get the Voltage down to charge the batteries. and then the batteries would take what current then needed. So do I also need a resistor, and were would it go to adjust the current for the batteries?
    tks again
    John
    I feel sooooooo STUPID learning this stuff.Now i know how the guys felt when I was teaching them plumbing / heating / remodeling/. see all that is EASY to me
     
  16. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    This is what I had in mind... I didn't say you couldn't have your photocells in parallel, I just said to put them in series with the collector. My fault, but this is what I meant R1 ideally will be a variable resistor, but since my cad app don't have photocells I replaced that with a variable resistor for now and didn't want to confuse you. tweak R1 to set the light level that triggers the circuit
     

    Attached Files:

    Last edited: Oct 3, 2011
  17. conntaxman

    conntaxman

    89
    0
    Jun 17, 2011
    lm317

    .
    Hello jackorocko. thank you. I looked at your pic.and see what you mean. I also read about the Q1 NPN and found my mistake. so i have another pic of it, and i ""think"" its right.well except for the amount of current to the batteries. and I don't know how to figure out the val for the resistor R6. I know that I have to have the right voltage just a little above the battery voltage to charge fully.But i though that the battery would only draw a set amount of current that it needed.Like charging a car battery.Ill att. the drawing.I hope its right this time.Well atleast im learning. ha ha ha.
    How do we Remove attachments, like pic? battery c.jpg
    tks
    John
     
  18. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    go to advanced edit and then down on manage attachments, click on remove button

    That picture up above, unless you have figured it out is still wrong. But is that why you want to remove the picture? The transistor in the above schematic is gonna create a short between vcc and ground when the transistor turns on, this is why you need the led's in series with the collector.
     
    Last edited: Oct 3, 2011
  19. jackorocko

    jackorocko

    1,284
    1
    Apr 4, 2010
    oh and I would listen to TedA about the batteries. I don't really know a lot about battery charging, you certainly don't want them to blow up, so you will have to find out how much current they can handle and how much your solar panels provide as Ted has already hinted at. Sorry I can't be of more help

    edit: now that I look back, you are using lithium batteries, which are the pickiest batteries to recharge and require additional circuitry. I would find a better solution myself.
     
    Last edited: Oct 3, 2011
  20. TBennettcc

    TBennettcc

    292
    2
    Dec 4, 2010
    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.
     

    Attached Files:

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-