DIP Switch Adjusted Voltage Regulator


It couldn’t be simpler but you have to admit that a small adjustable portable power supply like this one will be really handy.

The main part of the PSU is an LM317 linear voltage regulator which we’re already familiar with. The output voltage is adjustable based on a voltage divider between two of the pins. The set of eight DIP switches allows you to tweak that voltage divider. Switch number one connects the 9-volt battery connector to the regulator, serving as a power switch. Each of the other seven switches adjusts the output voltage by 1.5 volts. The output of the regulator connects to your target device using alligator clips which are not in frame above.

[Jason] says he takes this with him when thrift store hunting for cheap electronics. It can mimic most combinations of Alkaline cells letting you power up electronic toys to ensure they work. But we would find it equally useful for getting that early prototype away from the bench supply for testing before finalizing a dedicated portable supply.

55 thoughts on “DIP Switch Adjusted Voltage Regulator

      1. Nah… Why don’t you just buy a couple of power sources with varied voltages? Radio Shack already sells things like that…

        Now serious: I liked the idea. I think you could hook up this setup to a 12V, 2A power source, a heat sync and get a very good adjustable power supply.

  1. “Turing on switch 1 turns on the circuit and brings the output up to 1.25V” and not “Each of the other seven switches adjusts the output voltage by 1.5 volts.”

    1. It’s both. Switch 1 is the power switch. With all of the dip switches closed, the adjust pin is tied to ground, so it’s at 1.25v. Each switch opened at that point will increase the voltage by 1.5v. (1m36s in the video)

      1. can i tell you a secret……..most common rechargeable batteries(AAA,AA,C,D) are actually 1.25v, and not the ‘standard’ 1.5v……yet they have no problem running standard electronics.

        99% of consumer electronics actually fairly electrically ‘imprecise’…….because honestly, they dont need to be.

        if something will run at 3v….there is a good chance its also going to run fine anywhere from 2.75-3.25V

  2. You can also solder the resistors laying flat and use a slide switch to make it even thinner. And while using a slide switch, the resistor array must have incrementing resistance as well to accommodate the slider switch. I’m making one later on.

  3. I’ve done something similar using a potentiometer instead of the dip switches/resistors. However, this is elegant, simple, effective, and you don’t need a meter to tell you what the output voltage is.
    I like it.

      1. If you didn’t asked to change your name on the comment, nobody would notice. As you stated this, now everybody knows you don’t want to be known, and we just told NSA to watch you.
        And have a nice day!

          1. Yeah on second thoughts I could probably have just lived with the world knowing that I know about something on eBay. I guess this is a good indicator of how good the moderation is on here!

  4. I have always implemented small variable voltage supplies like this by simply using a multiturn variable resistor….. Remember kids: You must put a load on the LM317 series in order to read the “operating voltage” …. If you leave the outputs floating, then the output voltage can vary wildly. This caused me all kinds of headache trying to figure out why my 317 supplies produced wildly different voltages from what I expected to see…..

      1. Thanks for the comment Caleb!
        I did realize the fact and made a version with a thumb-pot too;which was apparently easier to operate but, i usually use it to experiment with OPAMP`s where i require very precise control of voltage level.
        Will surely post the pics of the thumb-pot version too. :D

  5. Could you wire in another 9v battery to get an adjustable voltage up to 18v?

    How would you wire in a switch to have two banks of batteries? (I.e. When the first 9v is depleted you could flip switch to second 9v). I’m asking because this could come in handy in so many ways.

    1. You can put a second 9v in series and the switches will give you 10.25, 11.75, 13.25, etc. The LM317 will actually go up to 30v this way. You can do higher voltages as well as long as the *difference* between input and output is not over 30v.

      A simple DPDT switch can swap two banks of batteries.

  6. Meant to comment on this yesterday but forgot to hit submit, the most important part lol. Love this! It is a simple circuit, can be used for a variety of applications, and is a good one for teaching soldering, troubleshooting, and board layout skills. Nice :) Already built a couple (Thanks to Jameco sending me 8000 dip switches in a grab bag order lol). I added a simple multi-barrel tip from an old wall wart multiadapter and can accommodate a variety of sizes and polarity swap on the fly :) Fun project!

    1. Can you be more specific?
      Do you want to control the voltage output from a simple linear voltage drop regulator like the LM317 using the PWM from an arduino?
      Do you want to build a boost/buck power supply from scratch using only discreet chips?

        1. If your looking for efficiency go with a buck power supply. Or better yet a boost power supply and less batteries. Check out the minty boost for a simple example.

          That circuit doesn’t directly control the LM317 using a PWM signal. It uses the 47K resistor and 0.1uF C1 to convert the PWM into a voltage, like a simple DAC. The Opamp buffers and scales that voltage to set the reference voltage of the LM317.

  7. I have to admit. I suck at electronics.

    Now can someone tell me if a voltage regulator above save energy or not? If a 9V battery has 500mAh rating. And it is using the voltage regulator to output at 3V, what would the power rating be?

    1. A simple formula to find efficiency of a LM317 is Efficiency = 100%-(Vin-Vout)/Vin. This ignores the power being used by the LM317.

      So your example of a 9V in and 3V out gives 33.3% effiency because 1-(9-3)/9=.333

      Your 9V battery with a 500mAh capacity would give 3V with 500mAh using this circuit with no losses in an ideal world ignoring all current going through the resistors and at a perfect discharge of your 9V.

    2. The difference in voltage is wasted. If you put 9 Volt in, and get 3 Volt out, the LM317 drops 6 Volt. If the current is 1 Ampere, that means that 6 Watt is turned into heat (power = voltage * current).
      This means that the total power use is always the same, it is the voltage going in * the current. If you turn down the output voltage, it just means that a bigger part of it ends up in the heat sink.
      To get the power rating at 3V, you need to look up the data sheet. There you will read “Output-Current In Excess of 1.5 A”. Let’s take the 1.5A. Then the power supply can deliver 3V*1.5A = 4.5W. However, at the input, there will be 9V*1.5A = 13.5W. The LM317 will be consuming 9W itself.

    3. I found out the hard way thees type of regulators are not useable for battery applications unless you use a real power switch (ie no soft power) because the draw 7ma just sitting there doing nothing. A cmos low quiescent current (in the nano amp range) regulator is a better choice..

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.