DIY Hacks & How To’s: Convert From Battery Power to AC

DIY Hacks & How To’s: Convert From Battery Power to AC

Screen Shot 2013-06-03 at 1.53.47 PM

We use battery power to drive a lot of our electronics. But if an electrical device doesn’t need to be portable all the time it would be nice to be able to power it with AC and not waste the batteries. So in this project, I show you how to modify an old AC power adapter so that it can power your electronics instead of batteries. Here is the Instructables link to the project.

YouTube player

See the full series here.

28 thoughts on “DIY Hacks & How To’s: Convert From Battery Power to AC

  1. Charles Haase says:

    Very nice instructions! But I am curious about two things that I think might be useful to your readers. Can you cover: 1) How to choose the wall wart based on the amperage needed? and 2) How to choose the wall wart based on the wattage needed?

    1. David Adams says:

      You need to choose a transformer with the same volts required by your circuit. So if it runs on 6V batteries, get a 6V transformer (wall wart). Then you just need to make sure that the transformer can provide as much or more current than is drawn by the circuit. You can do this by hooking an amp meter (most multimeters can measure amps as well as volts) up between your battery and circuit IN SERIES (don’t do it in parallel or you can blow the fuse on the meter or damage it). Whatever the measurement is, your transformer should list that much or more somewhere on it. Example: if you read 350 mA drawn by your circuit, you could use a 500 mA transformer with no worries.

      As for watts, watts is just a measure of Voltage * Current.

      1. Christian Restifo (@restifo) says:

        One thing to add to this:

        Keep in mind that your device may have a much higher starting current than what you’d measure while running, particularly if motors are involved. It’s easy for a battery to provide that short burst of high current whereas a wall wart may be taxed (particularly if it’s a cheap one).

        I had a project that gave me this very problem. When I ran it on batteries, everything worked great. As soon as I plugged it into a cheap power supply, things started going goofy. I traced it back to a temporary high current draw that the PS could not handle.

        If your item starts resetting or behaving oddly, try a wall wart with more capacity; also check your regulator. It will need to have enough capacity, too.

    2. Jason Poel Smith says:

      The method that David Adams describes works great for this application. If you don’t have a way of easily checking the current used by the device then you can also use battery life as a rough estimate. Take the capacity of the batteries (in mAh), tthen divide that by the number of hours that it will run. This will give you a rough estimate of the current requirements. When in doubt use a bigger adapter. The regulator will bring it down to the appropriate level.

      1. James Bryant says:

        A simple multimeter can be had from China on eBay for about $4 (example item #320573347678 but there are many more) and no maker should be without one. Visit my page at for details on how to use it.

    3. Never make voltage assumptions based on # of batteries says:

      I’ve opened some cases and been surprised to see that 4 AAA batteries were connected as two cells in parallel, with each cell consisting of two AAA’s in series. Be sure to check your wiring before modding!

  2. Bryan says:

    I do not understand the purpose of the small circuit created. What is to stop you from just using the + and – output of the transformer if it is the right volts and amps?

    1. asciimation says:

      Often those wall supplies are unregulated. They will state an actual voltage on the label but the real voltage they output can be much higher (you can try putting a voltmeter across some and see this). The circuit shown will regulate the voltage exactly. As well as the LM317 regulator (a variable voltage one) another route is to use the fixed voltage ones (7805, 7809, 7812, etc). Those regulators do need an input voltage a few volts above (around 2v from memory?) the regulated output voltage to work properly. If your power supply voltage is closer to the regulated voltage you need there are also what are called LDO (low drop out) regulators such as the LM2940 where the overhead needed is only about 0.5v.


      1. Daniel Kim says:

        This is a really important point that you bring up. Many transformers list their output voltage that applies only when they are being used in their assigned device. On the other hand, chargers for cellphones are regulated, and so will always output the listed 5V. Since battery-operated devices that use six 1.5V batteries must work even when these batteries have been partially depleted, many will function quite well on a 5V supply. A four-cell device, expecting 6V from alkaline batteries, will also work with the 4.8V provided by NiMH rechargeables, after all.

    2. Jason Poel Smith says:

      If you have a power supply that is rated for the right voltage and current, then you can just hook it up directly. This circuit is used to adjust the output of a power supply with a different rating. It also lets you use a power supply if you aren’t quite sure if it has the right power output.

  3. James Bryant says:

    Omitting the capacitors is not a good idea, they are neither expensive nor physically large and without them there is quite a large risk of noise, and even oscillation, on the regulator output, which will degrade the performance of the things you are powering. Also they may help supply turn-on transient current if the wall-wart is powered up before the device is switched on.

    “Capacitance free” on a regulator datasheet does not mean that it will work without a capacitor in all circumstances, but that in the simplest case (resistive, non-reactive, load and reasonable noise tolerance) you can usually get away with it. Best not to take the risk.

  4. Wilson! says:

    How timely! I’m currently gathering “stuff” to make an external power supply for my Pentax K-X, since Pentax’s OEM version is rare/discontinued and expensive. It’s just a 6v power supply and two fake AA batteries. So I’m going to make my own, that will run off of either a 6v wall wart, or a larger 6v battery. The regulator circuit is most appreciated!

  5. James Bryant says:

    There are two common types of “wall-wart”. The older one uses a mains transformer and rectifier (and usually a smoothing capacitor) and works on a single supply voltage (110 V or 230 V), the more modern type rectifies the incoming line voltage (which can have any value from 85 to 250 V) and then uses a high frequency switching regulator to give an accurate output voltage irrespective of the input voltage or, within a reasonable range, the load current.

    You can tell the difference in two ways – the mains transformer is much heavier and only works with a small range (perhaps +/- 10%) of input voltages, while the switching regulator is lighter (and often smaller) and usually works with a very wide range of inputs.

    If you are even slightly experienced in electronics it is often possible to open a switching-type wall-wart and change one resistor to change the output voltage without the need for the series regulator described in the article. (If you are willing to add a little more complex circuitry you can change it from a constant voltage device to a constant output current one (within certain voltage limits) and use it to drive constant current devices like LEDs.)

  6. John Horton says:

    I didn’t see any warnings to go along with this – Is there any major risk involved with this since you are ultimately connected to the mains? Does the internal circuitry of the wall-wart take care of most of that danger?

    1. Jason Poel Smith says:

      If your power supply is functioning properly, it should take care of most safety concerns. The only thing to watch out for is over loading the adapter or the regulator. Be sure to use an AC adapter that is rated for a high enough load. Also make sure that the regulator doesn’t have too much current going through it and use a heat sink if it gets hot.

      1. John Horton says:


    2. James Bryant says:

      The reason that so much equipment uses external supplies (wall-warts) is that it then does not need a separate safety certificate (of various sorts) in every country where it is sold – the wall-wart is what must meet the safety checks. And it is much easier to determine that a power supply is safe than a complex equipment which contains a power supply, since, although it is illogical, in many countries laws are written so that the power supply safety must be checked for all the different operations, even though the power supply is doing the same thing during every operation. This costs a bomb.

      Wall-warts must meet seriously demanding safety standards and are very rarely a source of danger.

  7. timmay says:

    Why would you use a homemade hacked power supply to save a few cents on batteries and risk burning your child to death. Projects are fun and all, but this is stupid. That thing is plastic and polyester. Your kid is strapped in and has no chance of escape once it starts to burn. There are reasons it don’t come with a cord. Chances are you will trip on the cord and knock the kid over. What the hell do you need an automatic swing for anyways? Are you too busy with projects to consider rocking your kid? Why would anyone do this?

    1. Timmy? says:

      Consider other experiences than your own. Not everyone leaves a child unattended.

  8. says:

    What a information of un-ambiguity and preserveness of valuable experience concerning unpredicted emotions.

  9. Chad W says:

    I’d like to do this same thing for battery operated LED lights. They run off of 3 AAA batteries. What size wall mount would I need and what would be the Ohm’s range that I would need to use with the LM317T Adjustable voltage Regulator? Thanks for your reply as I’m new to all this!

  10. Raypairman says:

    I nned to do the same thing but I have a series of 3 LED light (3 AAA batts per light) equals to 13.5V

  11. Sharon Jensen says:

    I want to change minecraft torches from battery to electric. They will be on the wall in my child’s bedroom and probably turned on a lot of the time. Should I do each one separately? If so, is it safe to plug them into a power strip? Thanks

    1. Caleb Kraft says:

      With the proper math you could figure out how many you could power off of a single “brick”. However, I would be tempted to just do each one separately for ease of relocation. Yes, you should be able to power several minecraft lamps on a single power strip.

      1. Sharon Jensen says:

        Should I use a voltage regulator circuit or dummy batteries? I want to “electrify” 4 torches that each use 3 AAA batteries. Wikipedia tells me each AAA battery is 1.5V. So does that mean each torch needs 4.5V ? (PS I have never even changed a light switch)

      2. Sharon Jensen says:

        Ok I reread the directions and I think I need both dummy batteries AND the voltage regulator circuit. Can I purchase dummy batteries? How do I know which of my old AC adapters to use?

  12. damon says:

    Is it possible to use the batteries as backup?

  13. John says:

    Would I do the same for 4 D size battery for my security siren? And how do I do battery backup in case of power outage?

Comments are closed.

Discuss this article with the rest of the community on our Discord server!

My name is Jason Poel Smith. I have an undergraduate degree in Engineering that is 50% Mechanical Engineering and 50% Electrical Engineering. I have worked in a variety of industries from hydraulic aerial lifts to aircraft tooling. I currently spend most of my time chasing around my new baby. In my spare time I make the how-to series "DIY Hacks and How Tos."

View more articles by Jason Poel Smith
Maker Faire Bay Area 2023 - Mare Island, CA

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 15th iteration!

Buy Tickets today! SAVE 15% and lock-in your preferred date(s).