## Introduction: Convert Battery Powered Electronics to Run on AC

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.

Example:
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.

Participated in the
Pocket Sized Electronics

Participated in the
Instructables Green Design Contest