Convert Battery Powered Electronics to Run on AC





Introduction: Convert Battery Powered Electronics to Run on AC

About: My name is Jason Poel Smith I am a Community Manager here at Instructables. In my free time, I am an Inventor, Maker, Hacker, Tinker, and all around Mad Genius

We use batteries to power a lot of our electronics. But there are some battery powered devices that don't necessarily need to be portable all the time. One example is my son's battery powered swing. It can be moved around but it usually stays in the same general area. In cases like these it might be nice to power these devices with an AC adapter and save the batteries. So in this project, I am going to show you how you can use an old power adapter to power your electronics in place of batteries. I will share how to modify the adapter and two different ways to connect it to your electronic devices.

Step 1: Use a Voltage Regulator Circuit to Set the Output of the Power Supply to the Appropriate Voltage

It is very rare to find a power supply that will perfectly match an electrical appliance unless they are sold together as a pair. So we are going to have to modify our power adapter to match the circuit that we want to power. The easiest way to do this is to use a variable voltage regulator such as a LM317. The typical configuration for this kind of circuit is shown in the picture above. This regulator uses two resistors to set the output according to the formula: Vout=1.25*(1+R2/R1).

For most applications this circuit can be simplified a little bit. The capacitors are only needed if your load circuit is sensitive to small power fluctuations. So in many cases, these can be eliminated. The variable resistor R2 is useful if you want to be able to power multiple different devices. But if you are going to use the power supply exclusively on one device you can replace it with a fixed value resistor. Wire the circuit as shown with Vin connected to the power supply and Vout connected to the circuit that you want to power. The regulator will bring down the output of the power supply down to the value that you set.

Depending on the power rating of your circuit, you may need to add a heat sink. 

My son's swing normally runs on four C size batteries. So I found an old power supply with a 9V 1000mA output. I figured that would be enough to replace the battery pack. Then I soldered together the LM317 regulator circuit with a 220 ohm resistor for R1 and a 820 ohm resistor for R2. These resistor values give an output voltage of 5.9V. (It would have been ideal to use a 240 ohm for R1 and a 910 ohm for R2 but I didn't have those values on hand) This output is still well within the operating range for a four cell battery pack. Anything between 1.25V and 1.5V per battery will usually work. Since the electronics on the swing just consists of a motor and a speed controller, I decided that the filtering capacitors weren't necessary and I left them off. See the following steps for the best methods for connecting everything together. 

Step 2: Connect the Power Supply Using a Power Jack With a Built-in Switch

The first way to connect the power adapter to your electrical device is to use a DC power jack with a built-in switch. On this connector, pin 1 is normally connected to pin 2. But when the plug is inserted into the jack, this connection is broken and pin 1 is instead connected to the wall of the plug. This kind of connector can be used to switch the device from running on the battery pack to running on the power supply whenever the it is plugged in.

To wire up this jack to the rest of the circuit, cut the wire coming from the positive terminal of the battery pack in half. Connect the wire coming from positive terminal of the battery pack to pin 2 on the power jack. Then connect the other part of the cut wire that goes to the circuit to pin 1 on the power jack. Lastly connect the negative wire from the battery pack and the circuit to pin 3 on the power jack. This will create a common ground line.

To use this connector in this project you will need to connect the regulator circuit between the power supply and the plug. You can't put the regulator circuit inside the housing because the jack has a single output terminal and you would have to regulate the power coming from the battery pack as well as the adapter. This would waste a fair amount of electricity and saving batteries is the point of this project.

Step 3: Connect the Power Supply Using a Dummy Battery

Another option for connecting the power supply to the electrical device is to use a substitute or dummy battery. This is anything that takes the shape of the battery and fits in the battery housing, but is used to connect the power supply to the terminals of the battery connectors on the device.

Here is one quick example of how to make a dummy battery. Take a wooden dowel and cut it into section that are a little shorter than the battery. Then select some screws that will make the connections on each end. Using a drill bit that is a little smaller than the shaft of the screws drill a hole in the center of each end of the cut pieces. This will help prevent the wood from splitting. Screw the screws into each hole leaving a little room to wrap wires around the screws. Cut several pieces of wire and strip the insulation off each end. Then wrap the bare wire around the screws and tighten the screws down on top of the wires to hold them in place.  

One of the wooden pieces has an extra section of wood cut out to make room for the regulator circuit. The positive output of the regulator is connected to one screw and the negative output of the regulator circuit is connected to the other screw. Be sure to mark which end is positive and which end is negative to avoid confusion when inserting the dummy batteries into the battery pack. 

There are any number of other designs that could also work to make the connections in the battery housing. You could use bar stock, washers, pipe, quarters, etc. You could also skip the dummy batteries and just connect the output wires of the regulator circuit directly to the end terminals of the battery pack. The choice is up to you.

Lastly this method require you to cut a small slot in the wall of the battery housing or cover to accommodate the wires of the power supply. 

Step 4: Finished Battery to AC Power Adapter Conversion

Now just plug in the power adapter and you are ready to try it out. This mod give you a choice in how to power your electronics. You can have the convenience and portability of batteries, or you can save batteries and money by using AC power. 

4 People Made This Project!


  • Clocks Contest

    Clocks Contest
  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest

133 Discussions

Would/could this hack be applied to a device with a provided A/C adapter meant to charge the device's battery? I'm asking specifically for the purpose of converting a Swiffer Sweep Vac (because 16 hours of charging for 12 minutes of use--on a new battery, is bananas). Thanks! :)

Could you tell me why the dummy batteries were necessary? Was it just for cosmetic reason or was there a purpose?

2 more answers

They aren't 100% necessary. You could just connect the wires directly to the terminals on your device. I just did it as a way to make it quick and easy to connect and disconnect.

I think they put the full 6v across 1 dummy battery. The 3 orange batteries are just short circuits. Maybe.

Would like to add LED to circuit. Can you please validate that I've picked the right resistor values for 6V output and LED?

Thank you.

1 more answer

The resistor that you need for an led depends on the operating voltage of that LED.

Thanks for the Instructable. I would like to power a door lock this way but I still want to keep batteries for power outage backup. If I replace the alkaline batteries with NiCad or Li, can this circuit charge the batteries as well?

6 replies

@RomanW9, did you find a solution? I too am attempting the same thing. I have Schlage Connect locks I want to power on A/C but want to trickle charge batteries as backup.

"@DIY Hacks and How Tos" how might your how-to differ to be able to trickle charge the batteries? My lock specifically has 4 AA batteries. I am thinking of just buying a 6V 1000 mAh adapter. My batteries sit in a battery tray that is connected to the device by a 9-volt connector (simply used as a way to connect/disconnect and allow for removal of the battery tray).

Thanks for the tutorial, really great.

Here is a picture of what the battery pack and connector looks like.


I did finally find a solution after some research and discussion on the forums at All About Circuits. I am using a NiHM battery pack (just slightly too large to completely close the cover) and an a/c adapter to trickle charge. I will try to write up the details in a couple of weeks when I need to make some adjustments to it.

I should clarify, it isn't just an a/c adapter, the adapter has a time-out to trickle charge automatically.

Nope, have not given it much thought. The charging circuit should be easy enough but wiring the lock through the door is the biggest challenge

I would not recommend charging lithium batteries because they need a special kind of charging to make sure that everything is safe. NiCd are a little safer to trickle charge.


6 months ago

I have a battery holder with four 1.5v C batteries for my exercise bike. The batteries are connected in series.

There are two connection points from the battery holder to the printed circuit board.

There is one between batteries 2 and 3 which generates +3 volts and there is one at the end of battery 4 which generates +6 volts.

Should I use 1 or 2 regulator circuits? At what voltages? How should they be connected to the battery holder?

Thank you,


2 replies

If you use 2 voltage regulators it will definitely work. But that might not be necessary. It depends on how much current the 3V circuit uses. If the 3V circuit is a lot current application, you might be able to get by using a couple of resistors to make a voltage divider.

Thank you. I think I'll play it safe and go with the two voltage regulators.

hi i have a wall clock having a 1.5v battery whom i have to replace daily,quit an expense,so i decided to convert it to Ac supplied from the wall switch.Could some body tell me how to do it or if it exist a converter to convert from Ac 240V to Dc 1.5V

2 replies

This will do exactly what you need, no soldering needed. Some reviews claim their clock ran slow afterwards. I had no issues with mine.

"Battery to Electric AA Converter - Convert Any AA Battery Clock/Device to Electric - NiMH Battery Will Keep Your Clock/Device Running In Case of Power Failure"

look for a variable power adapter that has a 1.5V output.;=variable+power+adapter&rh;=i%3Aaps%2Ck%3Avariable+power+adapter

Must add a warning; when I tried to apply this to a TENS machine who was consuming lots of batteries, the item went dead, broken. I used a 6 v. adapter with four dummy batteries. It seems as if not all appliances have a serial connection(?).