Noob LM317 help!

Discussion in 'General Electronics Chat' started by dextorslabs, Jul 7, 2011.

  1. dextorslabs

    Thread Starter New Member

    Jul 6, 2011
    2
    0
    Hi All,

    I want to build a digitally controlled constant current power supply for a laser diode using a regulator like the LM317. After searching the internet I found several articles about digitally controlling the LM317 in voltage mode but I couldn't find anything about controlling it in current mode.

    I hope someone can help answer my questions:

    1) Can I put a DAC directly on the Adj pin of the LM317 to control it in constant current mode?
    2) And also is the Adj pin sensitive to voltage or current when in CC mode?

    Thanks a lot! new to this forum but looking forward to being part of the community! :)
     
  2. #12

    Expert

    Nov 30, 2010
    16,268
    6,780
    The adj pin is voltage controlled.

    If you use a positive supply connected to the laser, the current goes through the laser then is attached to the input pin of the 317. Now, ground the adj pin and put a (load) resistor from the output pin to ground. There you have 1.25 volts across the resistor, thus a constant current.

    Now you disconnect the adj pin from ground and connect it to a digitally controlled voltage. You will now have 1.25V + (the applied voltage on the adj pin) across the load resistor.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    The LM317 attempts to maintain a constant 1.25v from OUT to ADJ by sourcing current from the OUT terminal. There is a nominal voltage "dropout" of 1.7v from the IN to OUT terminals, depending on actual current and the temp of the regulator. Add the 1.25v to the 1.7v dropout, and you're losing nearly 3v across the regulator.

    In order to obtain the guaranteed regulation specifications, the output current needs to be from 10mA to 1.5A inclusive.

    No. You can only increase the OUT to ground reference voltage potential; 1.25v being the minimum. The ADJ terminal sources a minor amount of current; on the order of 50uA to 80uA, which is usually of little consequence.

    The ADJ pin is the regulators' 'zero volt' reference internally; it attempts to keep the OUT terminal 1.25v (nominally) higher than the ADJ terminal by sourcing current from the OUT terminal.
     
  4. dextorslabs

    Thread Starter New Member

    Jul 6, 2011
    2
    0
    Hi guys,

    Thanks a lot for your detailed explainations... very interesting! I think i'm beggining to understand the LM317 and its workings.

    I think I'll go and tinker with an lm317 and see if I can put the above knowledge into practice. See if I really do understand it - This electronics thing is hard!:(

    Thanks guys - I really appreciate your help! No doubt I'll have more questions when I've burned up an LM317.:)
     
  5. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    [​IMG]

    Something from my albums.
     
  6. #12

    Expert

    Nov 30, 2010
    16,268
    6,780
    You aren't really a member until you can recognize the smell of transistor smoke and the crackling sound of exploding thermoplastic.
     
  7. Jaguarjoe

    Active Member

    Apr 7, 2010
    770
    90
    Or the sight of a Campbell's soup can size electrolytic capacitor blowing out because it was in backwards. They're like time bombs.
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    The LM317 makes a horrible adjustable current source as you have to change the resistor's resistance.

    Better to take your digitally controlled 317 (and leave out the 317 itself, you just want the control) and use it to drive something like this.
     
  9. #12

    Expert

    Nov 30, 2010
    16,268
    6,780
    Have you read post #2 where I told how to adjust the current with a variable voltage source? Much like the circuit you posted, but uses fewer parts.
     
  10. Wendy

    Moderator

    Mar 24, 2008
    20,765
    2,536
    In the real world you want simple adjustable you have to change resistance somewhere. With this circuit it is just straightforward. Of course, I guess you could do it with a µC and digital pot at about X100 the cost.

    Even when your changing the voltage it works down to a resistor as the simplest case.

    Sometimes people get so enamored with the latest tech they forget the basics. Tech generally costs more money, when all you need is simplicity.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No, a digital pot can't really be used for that. They have very limited current source/sink capability, and are generally limited to 5v or less difference across the supply, and they'd pretty much have to share a common ground with the uC that's driving them. Optocouplers might be used, but now it's getting a bit silly.
     
  12. #12

    Expert

    Nov 30, 2010
    16,268
    6,780
    Just in case you can't read my mind, I was thinking of using the Microprocessor or DAC (whatever you are using for the brain) to drive transistors that connect resistors from the adjust pin to ground.

    4 instance, a 12 volt supply voltage through a 1200 ohm resistor to the adjust pin (10 ma or so). Connect one resistor from Adj to ground to set the highest current you want available. Connect several resistors to the adj pin. Connect each of those resistors to the collector of an npn transistor with its emitter grounded, and drive the bases with the brain.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Hmm, OK.... you COULD use the LM317 for a current sink that way.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Refer to the attached schematic & simulation.

    I used a couple of 4-bit binary synchronous counters to have 8 bits of resolution. With the choice of resistors I used, were the LM317 model have the "ideal" Vref of 1.25v, the current sink would have a range of 0mA to 1.26A in steps of 5mA. The 5mA sink itself would not be very accurate due to the lack of accuracy at currents less than 10mA. Were R1 changed to 1,250 Ohms, and the rest of R2 thru R8 1/2 of the proceeding resistors' value, then you'd have 1mA steps for a maximum 255mA sink current; although 1mA thru 9mA would not be accurate.

    I didn't calculate in the Rds(on) of the MOSFETs, which would probably be around 9.5m Ohms. That wouldn't be very significant on the least significant bits, but more so on the MSB's.
     
Loading...