LM317 Higher output than calculated

Discussion in 'The Projects Forum' started by Artfldgr, Oct 5, 2010.

  1. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    I just made a small power circuit using the LM317. this time i am using surface mount parts on Manhattan style. I made two of the boards and rather than use a 240 ohm for R1 i used other values. the board in question uses 1300 for R1 and 3900 for R2, which given the formula would give 5 volts.
    i am using a 9 volt battery for testing (will move to a wart eventually). i even omitted the diodes since i am using small value caps, and not going near 27 volts as the datasheet mentions.

    with all that said, I dont understand why the output is 6.5 not 5...
    [or near 5 given that parts are not perfect]

    i put on a resister to give it a load, and it maintained its 6.5

    [here i sit and ponder if my life will be easier when the 7805s arrive from asia]
  2. SgtWookie


    Jul 17, 2007
    Use 120 for R1 and 360 for R2.

    You didn't pay attention to the minimum 10mA load requirement, and you ignored Iadj.

    If you change to the values I specified and your Vref is 1.25v, you should get about 5.032V out.

    Also, do you have the recommended caps from IN to GND and OUT to GND? Without them, the regulator may be unstable, and oscillate at high frequencies.
    Last edited: Oct 5, 2010
  3. tom66

    Senior Member

    May 9, 2009
    Also, avoid my stupid mistake of connecting the resistive divider to Vin. This gave me 3.7V (5.16Vin - 1.4Vdrop) instead of 3.35V for a circuit which almost toasted a microcontroller.
  4. SgtWookie


    Jul 17, 2007
    Note that the 317 regulator terminal configuration is not compatible with the 7805 terminal configuration.

    From left to right, pins down and the lettering facing you, the TO220 317 is:
    ADJ, OUT, IN
    Note that the tab of the 317 is connected to OUT.

    The TO220 7805 pin configuration is:
    IN, GND, OUT
    The tab is connected to GND.

    These differences can really "bite" you if you try to swap a 317 for a 7805 or vice versa, and don't pay close attention to the terminal configurations.
  5. eblc1388

    AAC Fanatic!

    Nov 28, 2008
    Similarly, the pinout of negative regulator, e.g. 7905 is not the same as their positive counterpart.

    As always, confirm pinout from data sheet.
  6. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    Hi guys,
    I took some time tonight to make an image and put it all together.
    [and thanks for the help]


    As i hope is evident, its pretty easy (but not pretty looking :)), which is why I wondered why it wasn't working right.

    Is the information that one can use other values for the resistors not completely true? [and thanks for the tip to use 120/360]

    By the way, battery was new testing higher than 9v

  7. wayneh


    Sep 9, 2010
    Aren't those resistors off by 10X, ie. 1300 and 3900 instead of 130 and 390? Hard to tell from the picture. Are the diodes not in there yet? I don't see 'em. Otherwise nothing wrong jumps out.
  8. Audioguru


    Dec 20, 2007
    Did you notice that the schematics in the datasheet use a 240 ohm resistor because they use the more expensive LM117 instead of the LM317 that uses 120 ohms?
    Millions of circuits on the internet make that mistake.
  9. SgtWookie


    Jul 17, 2007
    Actually, the LM117 has the same minimum 10mA Iout requirement for guaranteed regulation as the LM317 does.

    If you know that your load will always require at least 10mA current from OUT, you can use higher-value resistors for R1 & R2; but Iadj will become quite significant.

    I've seen a number of schematics that use 330 Ohms for R1 and a 5k pot for R2. That works out fine for a 1.25v-20v adjustable supply, IF you realize that you will need to have at least another ~6.21mA load on the output in order to get guaranteed regulation. 1.25/330 = ~3.79mA; 10mA - 3.79mA = 6.21mA left.

    It looks like the ground side of C2 and R2 are not soldered correctly. If R2 is disconnected, then you'd get the battery voltage out less the voltage drop of the regulator; roughly 1.7v.

    Your soldering in general does look quite iffy. It takes awhile to get really good at it. Rest assured, my first couple of projects looked a good bit worse; more like leftover slag from a volcano. :rolleyes: I'll bet that you either used a low-wattage iron, or the iron had a dirty or loose tip.

    Use 63/37 tin/lead solder. If you can't find that, use 60/40. Don't use 50/50 unless you want lousy results. NEVER use acid core solder or acid flux; use rosin flux only - but if everything is really clean beforehand, you really don't need flux to make a good solder joint.

    If you're using 63/37 or 60/40 solder, the resulting joint or tinning should look bright and shiny. If it doesn't, you're doing something wrong.

    You didn't prep the circuit board before you started soldering. I like to use a green Scotchbrite (tm) pad with some isopropyl alcohol on it to get any contaminants off of it, and scratch up the copper a bit. If you pre-tin the copper areas with 63/37 or 60/40 solder before you start placing components,
    you'll have a much easier time soldering.

    Clean your components and the board with 90% or better isopropyl alcohol (Ace Hardware, Wal-Mart) and an acid brush (Ace Hardware, auto supply stores) prior to soldering to remove contaminants. Avoid handling the areas to be soldered with your hands, as finger oils will make soldering very difficult. It's best to use a soldering iron with a temperature-controlled tip.

    Note that if you hold the solder with your fingers, you're contaminating everything you're trying to solder with your finger oils, which makes it a bear to get a good-looking solder joint.

    http://www.mpja.com has an adjustable-temp iron for $15; not temp controlled tip, but it beats a pencil iron. If you want a temp-controlled tip, prices start at around $60 and go into the stratosphere for a really good one.

    Radio Shack carries a 15w/30w switchable iron that's not too horrible. They also carry 60/40 solder. They used to carry bottles of liquid rosin flux with a brush in the cap, too - haven't seen it in my local RS stores lately.
    Last edited: Oct 6, 2010
  10. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    Thanks for the advice sarge!! :)

    before i came back and saw your great answer I did a whole new board.
    this one has everything. da woiks...

    thanks for the help!!!!! (specially sarge)

    [its been a long evening, please forgive the font abuse]

  11. wayneh


    Sep 9, 2010
    Better work AND a better picture. But does it work as you'd hoped??
  12. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    wayneh: Better work AND a better picture. But does it work as you'd hoped??

    Its actually not better work...
    I just didn't wait 24 hours before taking the photo
    take a look at the board today and it will look a lot like the other one!!!

    I DO clean the boards and things before i start.
    generally if they are REALLY freaking bad (rare)
    i hit them with metal polish to get the top junk off fast.
    and depending on how much is left, i either use a pencil eraser
    or i use 1200 grit sand paper...

    they are nice and shiny when i start
    they are nasty looking but work fine when i end

    Its probably because of what i use as a flux... :eek:
    [there wasn't any on that section sarge pointed out so the solder didn't run]

    i will tell you what i use, but please please don't give me a lecture on how bad it is. Chemically its not as bad as it sounds as the material that is most active in it gets replaced by oxygen when on the surface, which is why it gives a natty look if you don't clean it when your done.

    Zinc Chloride solution... :D

    nothing beats it when you want to solder fast and not put much heat on parts. its VERY cheap... and a pretty color (being silly, sorry)

    its what stained glass makers use (i do a lot of different things)

    basically when it heats up, it makes a great flux
    as the chlorine dissociates and your left with a Zn ion

    the solder i use is also old... and when i say old, i mean OLD...
    i have some other solders (including some goop in the fridge for surface mount parts on a pre-made board).

    Zn and Copper get along wonderfully... (see modern pennies)

    any chlorine gets replaced by Oxygen in a very short while.

    a while back there was a DIY on making your own solar cells using copper. i noted that they said to heat up the copper to make copper oxide and it turns black... i was too lazy, so i put the plates in a chamber with HCL and the vapors of chlorine bonded to the copper, oxidizing it... you take it out, and in a short time, the chlorine is replaced by oxygen, and it turns black.

    if i take another picture and put it up tonight, i will bet it will look not as good as the one i put up last night...

    it doesn't affect the circuit, its an EXCELLENT flux as it makes the solder instantly run and spread out very very well.

    however the hcl gas will eat away your solder tip a bit faster

    as to your question as to the way it works.

    it worked PERFECTLY... as other circuits i built did...
    [it wasnt the first one, it was the first one that didn't work right
    and as any knowledgeable person can tell you, success doesn't teach much]

    as Sarge pointed out, its not perfectly 5...
    to get that i would have to use a varable resistor to tune it

    but given how circuits work, this is just a waste most of the time.
    i can be like a beginner and try to get every section of my circuits to perfectly work out to the numbers i want... or i can accept a certain amount of 'looseness' and plan and implement accordingly. which is more realistic if things are not one offs (and your paying for labor)

    its a tiny amount above 5volts..
    i didn't hook it up to a digital multimeter, but an analog one
    so you can see that the needle isn't perfectly on the line...

    Its a VERY old meter but a VERY good cheap one that is accurate

    if i put it on the old fluke i have, or the cheapy radio shack one i got as a gift, it will show the slight skew.

    ultimately i am getting back to this because i cant find an EE to help me with my projects.

    I work for a place of research and education, and i am very good friends with a researcher and we do projects together.

    we have gotten to the point where we have new IP, and want to bring it to market, but alas, we have the same problems others have.

    i dont have capital... but in this case i have something special, and that is that the entity i work for has a department which is in charge of IP and all that kind of thing. AND since my work assists the researchers (i do other things than EE of course), i am allowed to avail myself of these departments and their services with such applying to me too.

    that is, i dont have capital to pay for R&D i do by myself or with others that we would work with, but i DO have a place for the results to go!!!

    so the doc and i are and have been trying to finish up the proof of concepts and have figured for moving forward. we need an EE to be a part of the team and compliment what we have, but we don't have one, nor the capital.

    however if we DO get past this point, the resources kick in and something is done with the results, with the splits being formulaic and contractual across the whole of the entity.

    so once again, i am digging into my childhood hobby and ramping up to make the devices we need to then move the stuff we have in the pipeline along, and keep going with other stuff too.

    so there you have it....

    why my boards are nasty looking, despite cleaning...
    what the results of the effort and the forum posts were
    and the reason behind why i am bothering and annoying you guys. :D
  13. SgtWookie


    Jul 17, 2007
    Glad you got it working decently. :)

    As I said earlier on, your Vref will nominally be 1.25v, but it can be as low as 1.2v or high as 1.3v and still be within manufacturer's specs.

    Also, Iadj will be anywhere between 50uA and 100uA; nominally around 70uA.

    Keeping R1/R2 values in the range of 10mA current will minimize the impact of Iadj, but if Vref is off from 1.25v, it goofs up the current through R2.

    Since you're above 5v, you could put a large-value resistor in parallel with R2 to get the voltage down a bit. In a perfect world, 43k in parallel with 360 Ohms should get you right on the money. However, that's if the 120 Ohm and 360 Ohm resistors were 0.1% tolerance and the Vref was right on the money at 1.25v.

    I don't know what kind of load you're planning on powering with this circuit, but keep in mind that you don't have much copper around the regulator for cooling, and a good bit of that is behind the regulator itself. I'd increase the copper area around the regulator, and possibly add some "L" shaped copper fins to it, too. You don't want the regulator shutting down due to overtemp.

    Positioning the circuit board vertically will help a good deal with air convection currents.
  14. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    thanks again!!!!!!!!!!!!!!!!!!

    not going to have a large load on this one.
    its a simple project with similar chips to what i have to get to.

    basically its a variation on a led race circuit...

    i am half deaf... and my wife can do something that i cant (well actually more than one thing, but it balances with what i can do she cant).

    that is, she will hear the rain and she will be able to judge how bad it is.
    i cant do that unless we leave the apt, and i can hear the rain off the skylight.

    since the project for the medical stuff will use a 74hc164 and other such chips, finding a good end use for a race circuit you would throw out otherwise is nice for me. :)

    its pretty easy... i designed it myself given i don't like the version that is now a net classic... that one requires a couple of things i think are necessary to be so critical. specifically i didn't like that you had to change the capacitor and such if the clock speed rises, and had to have two delays, one to clear the unit before you start, and the other to put the first light on the series.

    so here is the plan, i tested it on workbench, and i will put it up. its the very least i can do since i got so much help.

    the lm317 only has to power one 74hc164 and one 74hc14
    (and not the LEDs)

    one line out from the 164 to each led using either a 2n2222 or a 2n3904 (or is it 6? i always check, but i am at work, so memory is not good enough)

    each led will have their own resistor... (for a reason)

    all the lines AFTER the transistors converge and feed into one inverter, before going down the tube to ground...

    so when all pins are low, there is no out, and the inverter goes high, this puts the high signal on the pin when the clock signal goes high.

    once that cycles, there is a high output, and so the inverter goes low till all the pins are cleared again.

    i like this a lot better than the timer race capaciter circuit since the inverter has the down cycle of the clock to determine no signal and then go high before the clock moves the current state to the first flip flop.

    it doesnt matter if the clock speeds up, or slows down, or the time as there is always a half cycle for the inverter to change and meet the uptick of the clock.

    whats nice is that you can get it to do three patterns if you use this set up with another inverter. :) that is, if you use all the lines to sense, then you get one lit led moving across the series. if you connect a inverter to the last line only, then you get it to cycle all on then all off... (which by the way can be used to make a kind of digital sine wave generator...)

    if you turn both on. then things get weird, and i will use this circuit to test it before i continue onward to the project point. :cool: [the simulation says i get two cycles of one led followed by one cycle of full up then full off. i had not taken the time yet to figure out what the logic is to make the pattern...]

    so the 164 will only be used to make a 8 led race bar

    the 74hc14 is to be used to make a clock circuit... which will be used to test the two patterns, then later to be used as a test of the system over the rain... (press button with power button enable clock, lights cycle, it works)

    one inverter will be set to test all lines and put a bit on the input if they are blank, and another one will be used to test the last line...

    [trying to use em up if i can... :rolleyes:]

    in its final version it will have two modes,
    single led race and bar/blank cycle...
    (the odd cycle is not worth making a triple choice over)

    the rain will become the progenitor of the clock ticks.

    how? well i hated the large infrared ones and wanted something simple.

    so the input is going to be a large piezoelectric element with a twisted pair from it. it will be connected to a magnet so you can just put it on some metal surface with the flat up... [and just accept that its small and made for the weather rather than doubling this post with a description]

    given that a piezo when struck can give one a pretty high voltage...
    the line will feed into a rectification circuit, and past a voltage limiting shunt.

    the results of this conditioning will run between two resistors, the top resistor being from power, the bottom being a potentiometer.

    in this way, you can dial an offset and so control the sensitivity of the detector... (move it up near the inverter voltage, or move it down so only the hardest hits go high enough).

    the description sounds a hell of a lot more complicated than the circuit and assembly...

    as far as LED power, the 164 will drive the transistors, which will take its power from the main source, not the lm317.

    i dont expect heat to be that much of a problem.

    the idea is to hit a button, and see what the rain intensity is by seeing how fast the lights cycle.. as the rain becomes the clock..

    faster higher rain, the faster the cycles..

    i wanted an A for originality... :p
  15. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    PS. it took me longer to find a reason for using the device than it took to design it. but i hate to waste effort if i can avoid it, and combine learning with usefulness...
  16. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008
    Hi all,
    i tried to sketch this out as fast as i could tonight... didnt have as much time as i would like (who does?)


    Upper chip is the 74hc164 the lower one is the 74hc14

    on the 164:
    A&B key into AND logic, so tying them together is what i decided both are up when up, both are down when down. one can also tie one to the 5v in. i prefer to tie them together as the pins are more immune to a false trigger. (at least in theory in my head)
    [can also tie one to the 5V in]
    CLR is disabled by tying it high
    Each out QA-QH is connected to NPN transistors (2n2222/2n3904)
    The LEDs get their current from the 9V supply, not the 5V logic
    each has their own resistor so that all can be on at once or just one.
    all power has capacitors

    the 74hc14 as of the drawing has three functions

    one of the last two will be used to convert pulses from strikes to the piezo to a square wave for the clock. that circuit is not finished yet. the piezo will not be directly connected to the chip, they can put out a surprisingly high spike with not much effort.

    there is a relaxation oscillator (is that the right name?) using two inverters, capacitor C1,and R3... clkout will be used to get it working and will be replaced by the output from the piezo pulse circuit, however i plan to have a switch that can be used to test the unit by allowing a clock signal to connect and the circuit should cycle.

    SW1 i am using to indicate the one LED cycle
    SW2 is the bar cycle, or all on all off (anyone with a better name?)

    if both are on, it generates a mixed pattern... (i think two cycles of one led followed by a bar cycle, then repeats).

    I saw no reason for a delay keeping CLR low as it powers up..
    but that wouldnt be hard with a resistor and a cap (Rather than the circuit online that uses one of the 74hc14 inverters)

    and i saw no reason to have a complicated circuit to time being on as i power up to get the thing to cycle, i figure why not test out and let the inverter handle it... trick is making sure that i dont zap the chip. so i may just use the 9v to turn on 5v using a transistor as a buffer rather than worry about the span between one led and a full bar of them.

    if this was to be a race only circuit one can connect the last pin to AB, and the 74hc14 would only be a starter...

    [and if one wires things right, one can make a sine wave generator with the 164 or a few of them]

    have to go
    thats it for now :)
  17. marshallf3

    Well-Known Member

    Jul 26, 2010
    Now this has to be one of the more innovative projects I've seen on here in a long time, I hope you've gone through some of the basic methods of trying to protect your idea before you can get through all the patent process.
  18. SgtWookie


    Jul 17, 2007
    Pretty neat idea, Art.

    Had you considered using 4000-series CMOS instead? That way you wouldn't need the regulator; and you'd save the static ~10.4mA draw from R1/R2.

    You could use a 4015 dual 4-bit static shift register; just feed A-Q3 to the B-side data in, tie the clock and reset pins together and you've basically duplicated the 74HC164 functionality in 4000-series CMOS.

    You could use a 40106/4106 hex Schmitt-trigger inverter instead of the 74HC14.

    Instead of all the discrete transistors, you could simplify things by using a ULN2803A or ULN2804A; an 8-channel Darlington driver. They have built-in base resistors (you've omitted base resistors from your schematic; that'll fry your shift register's outputs :eek:)
  19. wayneh


    Sep 9, 2010
    Well, you nailed it. Necessity truly is the mother of invention, isn't it?
    Sounds good, but you didn't mention - or I missed - any testing of the concept that rain drops will give you enough signal from your piezo. I've never used one, so excuse me if it's a silly concern.

    Around here rain comes down in lots of different ways; anything from a light drizzle (lots of small drops) to a goose-drowner (wind blown sheets). I'm wondering if your sensor will give you reliable results in varied situations.

    One way I gauge rainfall rate is by hearing how much is cascading down the downspouts. If I was starting your project, I probably would have started thinking about a sending wheel - a rotating magnet - like they use on boat speedometers, mounted in a downspout. Sort of a poor man's flowmeter. The piezo approach is far more clever, if it actually works.
  20. Artfldgr

    Thread Starter Active Member

    Aug 15, 2008

    THANKS so much marshallF3, wayneh, and SgtWookie!!!

    to address the point MarshallF3 makes is that i would love to patent or protect what i work on, but i cant.

    If i could i would have done so with a lot of other much better much more profitable and market driven solutions using new materials, or exploiting other things.

    in fact i have a few items and the research place i work for only needs me to prove that the concept works... then THEY will patent things, and find licensing or start a company. its a GREAT deal if i can pull i off as the results are split three ways between my department, the whole institution, and myself/team...

    i have a genetics/genomics researcher that is key (with 30 years experience in biology)... i am a bronx science technologist and information science, math and physics kind of guy (who is VERY inventive, driven, risk taking, etc)..

    what we don't have is a EE who can implement and round off what i know is possible to make and design (but i cant implement as the faster you go, the more esoteric and weird things get), and add to the team.

    I have made many other people wealthy providing them my skills, but cant enable myself since i have no captial and the cards are stacked against me

    like the 8A program completely making it impossible for me when i was trying to do things through SBA. no bank or other woudl come near as i am not allowed to get the same boosts, i cant get power cost reductions, i cant get extra cash, my loans are not guaranteed like the others, no mentorship for me, and no free equipment and other perks.

    so i have 30 years of notebooks and things that encompass many solutions... many of them now are products done by others who were in a better place.

    i am usually 2 years ahead... sometimes 5..
    and once in a while, longer than that if the issue is hard and they are not looking in the right places...

    power co-generation
    new calibration system
    means of studying convection
    multicellular digital life (morphological)

    the reason i am doing this with this is that i am ramping up my skill to use these chips and a pick to make a very slow proof of concept so that the IP that was stolen (and is now in another country not as a product but as a resource), can be used here.

    its the fruit of more than 20 years work combining information science and electronics to solve some really pressing data problems so that we can work on that data.

    when it came time to get it going, the only people in the room that realized what it is and is worth was the person stealing it, and me. the doc, didn't understand the value, and the dip running the meeting didn't. so an associate of the other guy took the idea, closed his company (since he was a competitor and we slammed his whole business), and proceeded to go to his R&D center in another country with it.

    all because we dont have that third person,
    and because i have no control over any capital...

    so no.. its not protected.
    nothing is... i have no hope of doing so either.

    i actually wasted my life on this as a thing to do and because i cant get capital, cant get a team together, i cant succeed.

    but imagine where Myrvold would be without gates..
    or Wozniak without Jobs.

    the skills and things i have which allows me to see clearly and solve really complicated problems are antithetical to what you need to sell bull patties to a cow farmer.

    i would be luck to be hit by a bus on the way home given the things taken... even ny times took technology we presented!!!! i put together this software thing and some 'partners' teamed up, and what they did was not patent it, waste the money paying family salaries, drained a person of capital to pay them back for some prior thing i didnt know about. attempt to steal the whole project with blackmail after taking mhy savings.

    so no... i dont have it patented
    its not protected it will never be protected.
    and most likely the stuff i have worked on and solved and done will be in the trash in a few years anyway.

    being skilled and smart in a society that doesn't want that any more, has made my life a misery as the social designers have decided i have no place.

    sorry about that answer, but you hit a sensitive subject for me now that its 30 years of trying and being cheated, slammed, robbed and now have nothing for my future... (so far)...

    i would have been much better off being stupid and not bothering learning as a life project in autodidactism...

    my system right now has crap ped out, i will upload after i reboot...