• EEVblog #158 – AVR ISP MK2 + LM317 Regulator Tutorial

    Who else but Dave can turn what was supposed to be a simple 2 minute AVR ISP hack video into a 30 minute episode on designing and measuring the performance of an LM317 voltage regulator circuit, with a bonus shootout between the Fluke 87V and the Gossen Metrahit XTRA multimeters?

    Be Sociable, Share!

      About EEVblog

      Check Also

      EEVblog #1054 – How an Analog PC Joystick Works

      How does a PC read an old school analog joystick? It might be more interesting ...

      • firewalker

        So, what does the little board is for? 😛 😛 😛

        Is there any chance that MK-II has already a 3.3 volt pin for it own use?

        • Ah, I meant to mention that.
          No, I could not find any existing 3.3V reg in the Mk2 board.

      • Mio Taalas

        That’s great stuff you made there Dave. I really like how you take something as trivial as LM317 and shwt what when incorporating it into a design there’s much more to it than just putting it there and be done with it. A great lesson for beginners and more involved designers alike.

        Hopefully you continue making a great contents like this from all the topics you run across 🙂

      • George Graves

        Love it – I’m glad you went over board. Great video.

        And the next time you find yourself prefacing things with “well, it’s only for a dev tool, and it’s not going to get cold, and…”, just look into the camera and say “This is what I had on hand, so suck it!” – then smile. 😉

      • Rubi

        Nice, thank you

      • ac

        I don’t think the USB spec allows for pulling the 500ma @ 5v (?). Maybe it’s allowed in practise (after all the simple gadgets doing that) but I believe there was something supposed to be done first. Atleast this is how it’s with Firewire.

      • sinuscosinus

        Great video, thank you!
        Very informative. Would like to see more such “getting carried away” videos -> best stuff without being too much tutorial like 🙂

        Greetings from Germany!

      • Napalm

        Great video Dave thanks for the info and tips on the LM317.

        I wanted to mention this as its not in the video. USB will only support 100mA per root port. To get higher the USB device needs to software negotiate with the USB host to get up to the maximum 500mA.

        I am unsure if the AVR ISP MK2 does this. Perhaps you could monitor the current on the USB port when using the AVR normally.

        Either way, I think its best to note this as you don’t want people to be damaging their devices.

        For more info check out http://en.wikipedia.org/wiki/Universal_Serial_Bus#Power


        • I believe that’s essentially a myth, yet people love to keep repeating it.
          No one implements it like that on the host side as far as I am aware. The 500mA is always available, no negotiation required.
          Every single USB port I have ever tried has delivered 500mA without negotiation.
          I believe the deal is that devices are supposed to “play nice” and only draw 100mA at start up to be strictly USB compliant, as the USB port is supposed to be able to support 5 “unit loads” of 100mA each. But if the devices does try and draw more, oh well, the host will deliver it, up to 500mA.
          The “negotiation” part is only for the device to “ask” if it can draw more than 100mA (as other devices may be connected).
          You can connect 5 x 100mA USB devices without any negotiation, so it naturally follows that you can draw 500mA with one device with no negotiation.
          I believe a bus powered hub is the only exception to this.
          USB ports are usually fully protected, you can’t damage them by trying to draw 500mA.

          • Alex

            Voltage drop.

            I have measured an output of 3.68V at 440mA and 3.94V at 386mA on another port. Both on workstations with no other USB devices on. And less than a meter cable from the port.

            You mention a +/-5% in the blog, surely that is for very small loads, if not for no load.

            Measurements with various devices here:
            also show that tight margins with USB ports are not to be relied on.


      • Strube09

        I can tell you for sure that in the battery industry almost all devices that can charge on the USB line (Phones, GPS, other small devices) do not negotiate current with a host. They are usually dumb devices designed to work at 5V in and just draw what they need up to the 500mA.

        • f4eru

          Shure, it’s a general consensus, and it’s out of spec. And it makes problems like, solved by “try a powered usb hub between”.

          manufacturers don’t care such consumer grade equipment failure…

      • Richard

        One subtlety — The output current as specified on the data sheet dropout voltage graph is, I believe, the total current sent out through the output terminal, including both the current for the resistors and the current for the load. But I believe the current you were measuring (or setting) via the constant current load did not include the current through the resistors. The difference should be 1.25V/220ohm, or a bit less than 6mA. Not significant at all for the higher load currents, but perhaps worth mentioning at the lowest load current. Then again, the effect of 20mA vs 26mA current difference on the dropout voltage is small, no doubt.

        Another related point: The data sheet says the minimum load current can be as high as 10mA, though the typical value is 3.5mA. Your 220 ohm resistor is only pulling 6mA, which is well above the typical requirement, but not up to the max value on the data sheet. I’m guessing the higher minimum output current is probably only required for high values of (Vin – Vout) (It’s only specified for 40V), so it’s almost certainly not an issue when you’re pushing up against the dropout margin as in this case. It’ll probably work fine, but if you were doing a production design with a higher value of (Vout – Vin), and if you wanted really robust regulation all the way down to 0mA drawn by your output load, you might need to use a 125 ohm resistor for R1, and of course recalculate an appropriate R2. Something to consider for other designs.

      • VanLarry

        I sure appreciate Dave’s honesty. Shows us the goof, eh shift the switch over and put a label over it. No problems. FIXED.


        • Jon Chandler

          An engineering solution at its finest!

      • Dan

        Dave, I’ve been told that it’s possible to run the lm317 in a constant current mode too. Would you blog about this?

      • Alex

        I’m glad you got carried away and boosted 3 into 30 min 🙂 Thanks!
        I’m sure people noticed that in your post-it note schematic the input cap should be marked .1u instead of 1u.

        Até breve (from Portugal)

      • kodon


        That stuff is certainly useful, but I’d like to see a blog about wireless embedded applications. For example what is the best way to communicate with GPS, GSM/GPRS or any short range radio (for ISM frequencies). That would be a BLAST!

        Hey Dave, what do you think do I really need to get the manufacturers dev board to get started. Also I’d like to learn something about Integrated Development Enviromets (such as AVR studio). And if I want to start from scratch with the radios I mentioned, wich is the best way to go on?


        • Karl (not that Karl, the other Karl)

          Another armchair engineer, not knowing what he is talking about. Just randomly mentioning acronyms doesn’t mean you have a clue.

      • danfishman44

        I think it is a board that keeps time for a pc or mac.

      • danfishman44

        of course this is my 1st time watching your videos so Im probably ten years too late, story of me life mate.

      • Ovidiu M

        Excelent tip,
        Sometimes I find it usefull to scrape some LDO’s from old PC video cards, specially the 1117 series. Excelent tip once again

        Regards from RO

      • huh

        Thanks Dave, I was about to write why not a 3.3 low dropout dedicated regulator or a zener + bjt solution, then I watched the video and got enlightened: the voyage matters more than the destination.

      • PedroV

        Why do most chips put output voltage or Vcc or -Vee on the metal on it’s back? I understand when one wants to use several regulators or chips and bolt them to a Aluminum dissipator or to chassis they need to have a mica isolation. But my question is why is this like this??


      • Joker
      • Joker

        Any ideas ?

      • Dave,
        Loved it! For a noob to electronics, datasheets can be exceedingly confusing.

        Between this video and your battery video I learned a ton of information about volt, batt, and especially datasheets.

        I bow to the master!

        Greetings from New Jersey!

      • MidnighToker

        Another great video, but a quick clarification if you don’t mind.

        You measured the idle of the programmer at about 100ma and are therefore assuming we have approx 400ma to power our circuit with.

        Isn’t the programmer liable to draw way more current when its actually programming rather than idling?

        eg. if our circuit is drawing 350ma and the programmer spikes to (say 200ma) when actually programming, isn’t this going to push you over the limit?

        -I should probably point out that I’m a total electronics noob (except for a tonne of your videos, so I’m learning) and have almost certainly missed the point.

      • Pingback: joesacher.com » Blog Archive » Enhancing the AVR ISP II()

      • I just made your suggested modification to my own AVRISP MKII – to connect the 5V USB pin directly to pin 2 of the ribbon cable. For my simple hobby projects this is a really useful and neat hack which saves a lot of fussing around with batteries.

        Nice one 🙂

      • Your posting, “EEVblog #158 – AVR ISP MK2 + LM317 Regulator Tutorial | EEVblog – The Electronics Engineering Video Blog” ended up being worthy of commenting on!
        Basically desired to mention you did a tremendous job.

        Thanks for your time ,Kendall

      • I just desire to introduce myself real quick
        – Mardell Rough1

        I see that you have a very strategic composing method.
        Do you have any ideas on exactly what I could do for my short article about

        I acquired 1 concern about EEVblog #158 – AVR ISP MK2 + LM317 Regulator Tutorial | EEVblog,
        where do you discover all your information to create this blog post?

        Feel free to surf to my web blog … cognitive seo link management tool

      • Neil Armstrong

        Simpler method (click image for full size):

      • Pingback: Crafts Supplies()

      The EEVblog Store generally ships twice a week, on Tuesdays & Fridays, Sydney time. Dismiss