Voltage regulators, what am I doing wrong? - Page 1
Forum section: electronics / beginners

author: matts-uk
author_rank: Contributor
timestamp: March 19, 2014, 02:24:44 pm
content: The project I am working on at the mo, is using a transducer which is powered by a 24 Volt, 1200 mA AC output, wall wart. I need ~ 250mA at 5V to power my MCU, Wi-Fi adaptor and sensors. I also need to drive a small, CPU style, fan rated at 12V but fast enough for my purposes at 4V to 6V.Rather than follow the easy route of having a bunch of separate plug in PSUs. I thought I might have a go at producing the various DC Voltage levels myself. I found a 28V AC/DC step down converter on e-bay, way cheaper than I could try to build one. To make up the postage, I added a few LM317s in spite of being wary at what I might get at 5 for 50p.I have since been learning the intricacies of Voltage regulation, with a sometimes disastrous result!I am currently using a fixed 500Ohm for R1 and a 10K preset for R2, to produce ~5V. I am using a Beagle Bone Black as a test load, which peaks at a little over 400mA during boot up and settles around 160mA to 250mA. I started with an input Voltage of 12V but quickly learnt (ouch) to back it off to ~8V, as I can't fit a decent sized heat sink on my bread board. I would appreciate knowing whether 500Ohm's and a 10K preset, are at all sensible values?The first thing I am slightly confused about it is the LM317 'current regulation.' I found a calculation on a data sheetIout = Vref / R1With the LM317 given a Vref value of 1.25Would someone be kind enough to explain what it means?1.25 / 500 is 2.5mA and clearly my BBB is pulling at least 100 times that.Second. My first attempt used 220Ohms for R1 and a 1K pot. While probing around with my DMM, I somehow managed to blow two of my LM317s, both ending up with an internal short. The first one, was on my very first power up and I have few clues as to what I might have done wrong. The second, had been run-in for days at > 500mA. I was stupid enough to be poking around with an LCD connected...And I now have a few quids worth of dis-functional LCD to put in the bin with my two blown up 10p regulators. I guess I have learnt the lesson there but still don't know what I was doing wrong.1. What might I have done upstream, which would cause the regulators to short circuit internally?2. Is this just what happens when you buy ridiculously cheap voltage regulators from China?Finally, for now. I was interested in finding a peak current measurement and it's clear my ageing DMM is not able to keep up with my MCU boards. So I was thinking (dangerously), my DMM must have a shunt resistor, so I should be able to stick the meter in Amps mode, measure the Voltage over the shunt with my scope and derive the current using Ohms law. So I put the DMM in series on the positive supply, connect the ground of my probe to the Negative side of the meter but at the moment I touch the positive side with the scope probe, the MCU powers down. Clearly I am not understanding something here. If someone is able to enlighten me, I would much appreciate it.

author: mariush
author_rank: Super Contributor
timestamp: March 19, 2014, 02:50:34 pm
content: LM317 outputs a proper smooth stable voltage as long as about 4-5 mA of power is consumed on the output.The feedback pin also needs a minimum amount of current to get into it, and that's the reason why it's recommended to use something around 100-120 ohm resistor along with a potentiometer to adjust the voltage.The output voltage is determined by the formula 1.25 ( 1 + R2/R1) where 1.25 is the internal voltage reference value and r2, r1 are the two resistors. So for 5v out, the ratio between resistor needs to be around 3 , so with 100 ohm resistor for R1, you can use a 1k potentiometer set to about 300 ohm.I don't know what you mean by 500 ohm and 10k preset, if you mean to use those to adjust the output voltage then no, really you should choose a resistor around 100 ohm and a suitable potentiometer.Linear regulators dissipate the difference between input and output voltage as heat, hence why you need a good heatsink. LM317 needs at least 2v above the output voltage to give you a good output, so at 500mA output, you're looking at at least (7v - 5v) x 0.5 = 1 watt wasted as heat. Without a heatsink, a LM317 can probably dissipate about 0.3-0.5 watts for long periods of time without problems, but it will be VERY HOT.As to why those died, you probably shorted the input with the output. if you check datasheets for LM317, there are lots of circuits there and the datasheet has paragraphs explaining how to use diodes to protect the regulator a bit. Read the datasheets.Multimeters can measure current and also should have a peak current function. No need to complicate yourself with oscilloscopes. Yes, multimeters use a current shunt and measure the voltage drop on it and that's how to measure the current. But the current shunt drops a voltage on it, so in your circuit it's possible that the voltage drops so much that the MCU will power down (or maybe it has brown-out detection active or some other feature ... disable that, make sure you have a 0.1uF capacitor close to mcu's input voltage and maybe also a 47-220uF capacitor near it)As for multimeter ... multimeters have a burden voltage, which can affect the output voltage. IWhat you did with the probes I don't understand, you probably shorted something.The easiest way to do a current measurement that doesn't affect the circuit a lot is to get a bunch of resistors and put them in parallel to decrease the resistance. For example, you can get 10 1 ohm resistors and connect them in parallel and you'll have a 0.1 ohm resistor. Now if you put this resistor in series with your MCU, for each 1 mA of current, you'll see 10mV between the leads of your resistor if you measure with your multimeter or oscilloscope.Martin (mjlorton) on Youtube actually posted a video a few hours ago on this current measuring issue:

author: cellularmitosis
author_rank: Unknown
timestamp: March 19, 2014, 07:57:32 pm
content: Maurish, I thought the reason the datasheet uses the 240 ohm / 5k ohm setup is that 240 provides a minimum load of just over 5ma, which is the max value for minimum load required for stability in the datasheet.I'm working on an lm317 project at the moment, so now you have raised my curiosity about the current into the feedback pin. I thought that was micro amps, and that the current flowed out of it?

author: Nerull
author_rank: Frequent Contributor
timestamp: March 19, 2014, 10:05:17 pm
content: An LM317 can be configured as a voltage regulatorora current regulator. It cannot do both at the same time. The calculations for the current regulator do not apply when used as a voltage regulator.

author: David Hess
author_rank: Super Contributor
timestamp: March 20, 2014, 06:35:34 am
content: If the resistor between the output and adjustment pin is used to provide the minimum load which could be as high as 10 milliamps, then the error from the maximum adjustment pin current of 100 microamps becomes insignificant only contributing up to 1% error in the output voltage compared to the 4% error in the reference itself. 1.25 volts / 0.010 amps = 125 ohms. In practice that means that the resistor between the output and adjustment pin should be between 125 and 500 ohms depending on the accuracy and preload requirements.I usually use 249 ohms when I know that the minimum load requirements will be met and 124 ohms otherwise.I often build high performance regulators using an LM317 as a fault protected pass element with the adjustment pin driven by an external error amplifier.

author: matts-uk
author_rank: Contributor
timestamp: March 21, 2014, 01:45:48 pm
content: Thank you so much for the comprehensive response. Apologies for the delay but I was in the hospital yesterday.Yes, I was using a 500 Ohm fixed (R1) and a 10K (R2) preset on VAdj, producing an output voltage, adjustable between ~2V to ~25v. I had not really thought about the current. I have now ordered some lower value resistors, including 100 Ohms. Thanks.I am reading data sheets pretty thoroughly but I am still learning what all the numbers, formulas and terminology mean. I even worked out how many Watts of heat was going to be produced but had no idea how hot .5 Watts is, until I switched on the power. I dd think to fit a heatsink but it is not big enough. I have since rescued a lump of Aluminum out of an old amplifier and will be taking a hacksaw to it, once I am back on my feet.The first LM317 I may have shorted the input to the output but definitely not the second one. I had a recitifier diode on the output and am pretty sure the 317 shorted internally when I put a Volt meter over the diode. Along with some low value resistors, I have ordered a couple LM317s from Farnell, as I am not trusting the cheap Chinese ones.My multimeter is a 20 year old 2 + 1/2 digit Mastech and does not have a peak current hold. I think you might be right about the voltage drop causing the reboot.I will try to watch the video but I am a bit old school and prefer to learn by reading.Thanks, once again.

author: David Hess
author_rank: Super Contributor
timestamp: March 21, 2014, 09:04:30 pm
content: The On semiconductor LM317 datasheet discusses the various ways the regulator can be damaged and under what conditions protection diodes should be used:http://www.onsemi.com/pub/Collateral/LM317-D.PDFSome LM317s use an improved design that does not require the adjustment pin to be protected.