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