How can the Propeller adjust the voltage of an LM317 adjustable voltage regulator?
ElectricAye
Posts: 4,561
I once had fantasies of using a digital pot to act as R2 on the usual R1 + R2 scheme for operating an LM317 adjustable voltage regulator, but that doesn't seem to work very well considering the input voltages and current limitations of digital pots. So now I'm looking at using the "Digitally Selected Output" scheme as shown on page 22 of this data sheet:
http://cache.national.com/ds/LM/LM117.pdf
But I don't know what sort of transistor or whatever could be used by the Propeller to perform this task. Would a simple mosfet like the BS170 be able to do this? It will be switching slowly, so there's nothing dynamic needed here.
http://www.fairchildsemi.com/ds/BS/BS170.pdf
I would like the input on the LM317 to be 12 volts, and the output to range from about 8.6 volts at the high end to about 5 volts near the low end.
Also, I notice a lot of data sheets for the LM317 have R1 set at 240 ohms but I've seen debates on the internet saying it should be 120 ohms. Why can't it be, say, 500 ohms or 1000 ohms? What's so magical about 120 or 240 ???
Suggestions much appreciated,
Mark
http://cache.national.com/ds/LM/LM117.pdf
But I don't know what sort of transistor or whatever could be used by the Propeller to perform this task. Would a simple mosfet like the BS170 be able to do this? It will be switching slowly, so there's nothing dynamic needed here.
http://www.fairchildsemi.com/ds/BS/BS170.pdf
I would like the input on the LM317 to be 12 volts, and the output to range from about 8.6 volts at the high end to about 5 volts near the low end.
Also, I notice a lot of data sheets for the LM317 have R1 set at 240 ohms but I've seen debates on the internet saying it should be 120 ohms. Why can't it be, say, 500 ohms or 1000 ohms? What's so magical about 120 or 240 ???
Suggestions much appreciated,
Mark
Comments
Digitally adjusting the voltage is pretty simple and can be done in several ways. The difficulty is that most designs will have the output voltage set to maximum on startup which is not always good for the circuit being powered.
The most direct method is to use an adc and op amp to control the voltage on the ground pin of the regulator.
Another option is to put a constant current circuit in parallel with R2 and use PWM and a filter to control the current.
My favorite is to use an optoisolator with a filter on the output and PWM the led so the output voltage is at minimum on startup.
R1 determines the current flowing through R2 to ground. There is a very small current from the ground pin that varies with temperature so a lower R1 value increases the stability of the circuit by “swamping” that current fluctuation. You can use 500 or 1000 ohms but stability will suffer.
Nothing really magical about 120 ohms, but with 1.2V between the output and ground pin it provides 10mA into R2 which makes calculating R2 for any desired voltage dead easy. I use a 120 ohm resistor most of the time with good results.
Oh. Uh, yes, I see what you mean. That might be a weakness in the scheme I originally posted. But since this is a research device and not something for public consumption, I suppose I might be able to work around that problem by instructing "Power up the Propeller before powering up the voltage source..." or something like that???. I'm glad you brought it up. But besides that, can you see anything else inherently wrong with that somewhat clunky "digitally selected" scheme I originally posted?
My ignorance is showing. I am not worthy. I'm having a hard time envisioning some of these fancy circuits you're describing. And I cower, trembling upon the wasteland of my Mech E degree, as I wonder how the schematic of those aforementioned devices might appear. Would it be cowardice or folly to go with my original plan?
kwinn,
OMG, you are just a gold mine of information this week! You have saved me from unspeakable torments these past few days.
many thanks again! :-)
The Voltage between the output and the "GND" pin of the regulator is always 5V. The Prop can lift the "GND" pin up to 3.3V with a PWM output so you get 8.3V max.
Be aware: This is only an untested idea.
Andy
Andy,
that's very clever. And your diagram now sheds light on what (I think) kwinn said about using PWM on the adjustment pin. Hmmmm, I think I will really need the 8.6 volts, though. But, in any case, I think I'll give this PWM approach a good look in the morning after I've had some sleep.
thank you! :-)
No, nothing wrong with either the op amp or PWM scheme other than power coming on at the highest voltage when turned on. As you say that can be avoided by turning on the propeller first or having the propeller turn on power to the supply (only 2 transistors required). If you only needed a few discrete voltage levels you could even use individual resistors and transistors to select different values of R2. Many ways to approach this. How about 8 steps between 5 and 8.6V using a '595 and ULN2803 or TPIC6595
Having read your posts I can only say you are laying it on pretty thick here. Nothing wrong with your original plan but there may be simpler ways to do it depending on how small a step you want from 5 - 8.6V. How about 16 steps of 0.25V and having it start at the low voltage automatically?
PS - I will dig up the schematic for the optical isolator circuit and post it tomorrow evening. I used that to switch voltages on an old eprom programmer I built.
http://www.edn.com/article/512537-Control_an_LM317T_with_a_PWM_signal.php
Basically it makes sense to me, but because I'm in the fog when it comes to op amp operation, I'm always worried about such circuits going into oscillation and causing me more problems than they are worth.
Most opamps these days are internally frequency compensated and unconditionally stable in negative feedback circuits - don't be too worried by that - its making sure you have a low voltage rail-to-rail device that's more important these days.
The down side is that the resistors are connected in parallel when switched in so it is difficult to get even steps in voltage. Using an R2R network might be better.
Mark,
that's comforting to hear. I'll have to try one of these someday but I think I'll go with the resistor network for starters.
Thanks!
kwinn,
you've been reading my mind. This looks like the last piece of what I've been puzzling over all day long. I didn't know if such a resistor thing existed or what it was called and had no idea even what to search for.
I'm now changing this thread to SOLVED.
thanks a million for helping me out with this! :-)
You're more than welcome, but fyi, I have no psychic powers. It's just a problem I have encountered and solved before along with a preference for simple reliable designs.
Hi Folks, I found this thread using the search engine here and I'm interested in doing the same thing. I hope you don't mind me bringing up this thread again.
@Kwinn, Your post above references a circuit you posted, but I don't see the circuit in your post. Any chance you can re-post the example circuit?
@ElectricAye, Which solutions did you implement and how did they work out?
I think I used the R2R network to start with. But then I realized the IR emitters I was working with were controlled better by varying the current rather than the voltage, so I had to change my strategy. It was one of those lessons I learned the hard way.
I think I just realized the same thing for my project, however, I don't want to hijack your thread. I was hoping to use this solution to vary the current when using the LM317 as a current regulator. I just learned the resistor in datasheet on how to do this accomplishes this by limiting the current and not the voltage. I'm back to square one now.
Any suggestions on how to interface the Prop to a device that requires current limiting rather than voltage limiting? I still need to run the numbers on the parameters I need for power.
I hate to admit it, but I had a total brain fart when working on that project and, had it not been for Phil Pilgrim, Tracy Allen, Heater, bsnut, et al, I would have continued to drive off a cliff on that one. The follow up to the aforementioned thread is shown below. I don't know if the advice given there will be of any help to you or not. For me, many things depended on how fast the current pulse had to be so I ended up using discrete components (resistors) that had to be swapped out by hand, but if your pulses don't have to be very short and current levels do not have to be very high, I think there are op amp solutions to this sort of problem.
http://forums.parallax.com/showthread.php?134091-Is-it-okay-to-use-two-power-supplies-channeled-through-a-single-mosfet&
Maybe you could start a fresh thread and state your exact problem.
No problem. I accidentally deleted all my uploads a while back when I could not upload anything new. I thought I might have reached a limit of the number of uploads I could make so I tried to delete a few and ended up deleting them all.
Here is the circuit. Just take note that Vout will be very close to Vin until the control circuit turns one or more of the transistors on. Sorry, I forgot I had modified it so it came on at the lowest possible voltage setting. That will teach me to look at a circuit before posting it.... at least for a couple of days.
Interesting coincidence here. The R2R network is typically used as a digitally controlled current source for the comparator in successive approximation ADC's.