Announcement

Collapse
No announcement yet.

LM317 constant current question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    LM317 constant current question

    Good day folks. Messing around the shop and sometimes not having stuff to actually do, I thought might as well learn something, so: constant current source using an LM317....I know the general principle of operation and even built one a while back, but can't figure out a couple of things and there don't seem to be any clear-cut tutorials. I don't just want it to work without knowing HOW it works. I can't sleep well at night if something's puzzling me, so let's work this out

    1) what exactly are those 1.25v we divide by the resistance and why that number ?
    2) what happens if the load is disconnected ?
    3) what's going on with the power dissipation in the resistor ?

    Have a look HERE at the very first diagram.

    1) I understand that 1.25v divided by R equals the current we try to achieve, which leads us to my first question: what exactly is 1.25v ? Why that number ? Of course, I had a look at the datasheet and saw it's the reference voltage on the non-inverting input of the op-amp, but the anode of that internal diode doesn't go to ground like in a traditional zener regulator, but to the ADJ pin....how does this work and what's the mechanism that keeps the current constant anyway ? Indeed, drawing 125mA through that 10ohm resistor in the example DOES equal 1.25v and I don't have to take their word for it: the math doesn't lie.

    2) this one is easier and makes more sense: I reckon if the load is disconnected, the voltage goes all the way up to VCC, or really close, since the non-inverting input is driven high straight off the input pin and opens the transistor. Correct ?

    3) nobody seems to mention that resistor: take the first example again: 125mA...ok, but what about the voltage drop on that resistor ? How do you calculate its power dissipation ? I KNOW the formula of course, V x I = P, I don't mean that, I mean where do I get my numbers. Going back to 1) again: 125mA through a 10ohm resistor gives us that elusive 1.25 again. Solving for the formula above, would this be 1.25V x 0.125A = 0.156W ? Let's say 0.15w to round it out...is this correct ?

    The thing that's really confusing is the absence of GND in the LM317....it just floats there...

    Cheers and thanks.
    Wattevah...

    #2
    Re: LM317 constant current question

    There's a voltage reference inside the chip, like the classic TL431 , but a more basic one. It produces 1.2v .. 1.3v depending on temperature, amount of current flowing through (which depends on your resistor choice, that's why they recommend picking resistors in the 100-300 ohm range, to have some minimum current going into the adjust pin)

    1.25v references are easy to manufacture.. there are voltage references as low as 0.2v ... for example https://www.digikey.com/product-deta...FTR-ND/1212555
    more common - and cheaper - are 0.5v and 0.6v references.

    In current limit mode, the chip basically measures the voltage drop across the resistor and constantly adjusts voltage up and down trying to keep the voltage drop at 1.25v (or same value as the reference voltage inside).

    Value won't be 1.25v always, it will drift as the linear regulator warms up or depending on ambient temperature, the resistor you use will also drift as it gets hot unless you get some fancy one ... so it's not a super accurate current limit regulator.


    power in resistor... P = I x I x R ... it's derived from V = I x R formula.

    For 10 ohm and 0.125A you have P = 0.125x0.125x10 = 0.15625w wasted in the resistor.
    Last edited by mariushm; 04-13-2018, 08:39 AM.

    Comment


      #3
      Re: LM317 constant current question

      Originally posted by mariushm View Post
      In current limit mode, the chip basically measures the voltage drop across the resistor and constantly adjusts voltage up and down trying to keep the voltage drop at 1.25v (or same value as the reference voltage inside).
      Yeah I know this principle very well - I'm familiar with how it operates in TVs to drive the LEDs. PSU doesn't care about voltage - it does whatever it can to maintain X amps across the load. I could short a single LED with the ammeter and get X amps, then an entire row of LEDs and still get the same X amps because the PSU lowered the output to read the same amps. I even explained this myself to someone else in a post of mine about caps going bad in the driver of a particular model of Samsungs, so I don't know why I'm having so much trouble with an LM317...simple stuff is complicated and complicated stuff is easy...go figure...

      Originally posted by mariushm View Post
      power in resistor... P = I x I x R ... it's derived from V = I x R formula.

      For 10 ohm and 0.125A you have P = 0.125x0.125x10 = 0.15625w wasted in the resistor.
      So I was correct: the drop WAS 1.25v times the current I got that same number just didn't write it all down
      Wattevah...

      Comment


        #4
        Re: LM317 constant current question

        The 1.25 V is fairly stable for a particular LM317, it's indeed from within the IC and it's the characteristic bandgap voltage. The IC has some temperature compensation.

        If you want to see this voltage, ground the ADJ pin and use it like a 3-terminal regulator like a LM7805.

        In theoretical electrical circuits the "unicorn" constant current source doesn't exist. This is because it needs to follow V=I*R and an open circuit, R= infinity. So (constant)*infinity =infinity too, so voltage = infinity. But the best we can get with real circuits is the voltage source minus any drop across our fake constant current source, which is the voltage source voltage minus the dropout voltage minus the 1.25 volts.

        Now power dissipation, while P=V^2/R works here: That V is always 1.25V so power is always 1.25^2/R no matter what load is. However, this is not considering the power dissipated in the LM317 or the load. Also if the circuit is open or your circuit is drawing less than the current you designed your CC circuit to do, the dissipation is also lower because the LM317 can't get the 1.25V across it anymore.
        Last edited by eccerr0r; 04-13-2018, 09:54 AM.

        Comment


          #5
          Re: LM317 constant current question

          Originally posted by eccerr0r View Post
          That V is always 1.25V
          Another thing that confused me, which I was gonna ask in the first post but I thought I'd wait and see how people respond: if you look at the page I linked to, further down there's some examples of this thing driving LEDs and there's values like 9.6v and 6.4v there....where do those numbers come from considering Ohm's law pretty much dictates that 125mA flowing through that 10 ohm resistor MUST equal 1.25v (also confirmed by the fact that that's the number the ADJ pin must stay at to reach equilibrium)...
          Wattevah...

          Comment


            #6
            Re: LM317 constant current question

            Those 9.6V and 6.4V have nothing to do with the LM317 - those are the characteristic forward bias voltages of the LED strings in series (3 LEDs x 3.2V = 9.6V, 2 LEDs x 3.2V = 6.4V).

            Comment


              #7
              Re: LM317 constant current question

              I figured. Like, practically, if I put my meter probe on that output, I'd read 1.25v, right ? Regardless of the current the thing's pushing out. Let's get this out of the way - that number's been burned in my retinas
              Wattevah...

              Comment


                #8
                Re: LM317 constant current question

                If you put a meter from the LM317's OUT pin and the LM317's ADJ pin (i.e., across the resistor) you will always read 1.25V as long as the dropout voltage plus 1.25V of the LM317 is met (voltage from LM317 IN and LM317's ADJ)

                Comment


                  #9
                  Re: LM317 constant current question

                  What about with respect to GND though ? That varies up/down to keep the current constant ? What do you call "dropout" exactly ?
                  Wattevah...

                  Comment


                    #10
                    Re: LM317 constant current question

                    Again in circuit theory, constant current has no defined voltage. Also you can't compute the voltage directly, you have to use KVL/KCL to compute the voltage.

                    Dropout voltage is the voltage over the output voltage that is needed for the particular regulator to actually work properly. That's where the term LDO come from - where the regulator has a lower than typical dropout voltage. An ideal voltage regulator has zero dropout voltage. The LM317, being an old regulator, dropout is fairly high - at around 2.5 volts IIRC.
                    Last edited by eccerr0r; 04-13-2018, 10:23 AM.

                    Comment


                      #11
                      Re: LM317 constant current question

                      Still on the subject of amps and ohms, let's digress a little: today I had a little playful argument with my work mate about a cable: we were hooking up a POS/terminal PC (the one which I said its PSU died in another post of mine I made earlier today) to a regular, external supply to verify that it still works before going through the trouble of repairing its supply. The cable I chose was 0.75mm speaker cable and I unreeled a fairly good amount - 3 meters or so. He insisted that's too long and will have a "huge" drop and will get hot, resulting in the PC not getting the full 24v...I however disagree and stated that, although any conductor has losses, here they're negligible because the cable is thick enough and the current is not that high.

                      Saying this, I explained that ohm's law would apply here: assuming the PC is the load and the cable is a resistor, a very low value one, would the "dropout" (I like the way it sounds) / loss be calculated as follows ? Load current times resistance equals voltage drop across our "resistor". We then subtract this voltage drop from the supply to determine how much it actually lost on the way. The resistance being very low, so is the drop across the cable. In reality it's almost unmeasurable and sure enough when I measured the end of the cable, there was almost no drop from the original 24v supplied at the other end. That shut him up for a while but I want to check my facts to know whether I indeed blinded him with knowledge or he stopped arguing because I was wrong
                      Wattevah...

                      Comment


                        #12
                        Re: LM317 constant current question

                        https://en.wikipedia.org/wiki/Americ...AWG_wire_sizes

                        0.75mm is ~awg 21 with 42mohm per meter.. round it to 45 mohm... so 6m (3m x 2) would be 0.27 ohm... you're losing 0.27v per amp more or less.

                        Comment


                          #13
                          Re: LM317 constant current question

                          All you need to do is measure the voltage with the load at the computer to make sure it's still sufficient... then again just how much current are we talking about here.

                          A typical PC will draw 50W or so, so we're talking 2A @ 24V at least. 0.75mm cross is around 20 AWG, it's probably sufficient though you may start to get a little drop at 3 meters.

                          Dropout is a characteristic of regulators, simply use "voltage drop" for wires.

                          Comment


                            #14
                            Re: LM317 constant current question

                            So how much current was flowing through that speaker cables?
                            Never stop learning
                            Basic LCD TV and Monitor troubleshooting guides.
                            http://www.badcaps.net/forum/showthr...956#post305956

                            Voltage Regulator (LDO) testing:
                            http://www.badcaps.net/forum/showthr...999#post300999

                            Inverter testing using old CFL:
                            http://www.badcaps.net/forum/showthr...er+testing+cfl

                            Tear down pictures : Hit the ">" Show Albums and stories" on the left side
                            http://s807.photobucket.com/user/budm/library/

                            TV Factory reset codes listing:
                            http://www.badcaps.net/forum/showthread.php?t=24809

                            Comment


                              #15
                              Re: LM317 constant current question

                              Didn't measure, but worst case scenario is 10a, since that's what the original supply was rated at, though the PC never reaches that in reality, which would result in a loss of 2.7v, so 24v - 2.7v = 21.3...I'd say it's within spec with no worries. The dissipation of the cable would then be 27w ?

                              At first I couldn't figure why you said 3m x 2, but then I got it: there's two conductors, hence two "resistors"
                              Wattevah...

                              Comment


                                #16
                                Re: LM317 constant current question

                                For 10A, 20-gauge is insufficient, you'll need at least 16 gauge I'd think. 2A is marginal.
                                Sorry about AWG measurements, unfortunately that's what I'm accustomed to...

                                Comment


                                  #17
                                  Re: LM317 constant current question

                                  On a related note, you can also use 7805, 7812, etc, and their negative voltage counterparts as current regulators in the same fashion. Just need the appropriate resistor.

                                  Boosting the current capability of a regulator with an external high-powered pass transistor is also possible with the current regulator circuit topology, though your series resistor by this stage is going to be dissipating a fair few watts

                                  Comment


                                    #18
                                    Re: LM317 constant current question

                                    Originally posted by Dannyx View Post
                                    I thought might as well learn something.
                                    Commendable
                                    It is typical to find most technical literature devoted to looking at the world from a voltage perspective. For some reason people have no problem with the idea that the ideal voltage source can deliver an infinite amount of current to maintain a given voltage. But, the idea that an ideal current source can provide an infinite voltage to maintain a constant current is somehow unacceptable.

                                    As mentioned, the LM317 has an internal band-gap reference of 1.2 volts. That is a special physical thing that is very stable at that particular voltage over a given temperature and current range. To get various currents out of the device, a simple voltage divider is used to tell the amplifier in the device what value of resistor it should be. You don't have direct access to the 1.2 volt reference on this device.

                                    It might be simpler to look at its little brother, the LM385 which is just the 1.2 volt reference without the adjustment feature. Essentially you can use it exactly like a 1.2 volt zener diode - except that the LM385 is much more stable than a zener.

                                    Both of these devices are essentially voltage regulators. So, as mentioned you can use any type of voltage regulator to develop a constant current in the load if the connections are re-arranged.
                                    Last edited by Longbow; 04-21-2018, 09:38 AM.
                                    Is it plugged in?

                                    Comment

                                    Working...
                                    X