When I first started playing with an Arduino, I relied on USB power. Once I got into those roaming robots, I started using a battery holder I bought with the rest of the parts. In my recent projects, I’ve used power adapters that plug into the wall. With my experiences using different ways of powering my projects, I thought I’d write a tutorial that may help someone chose a supply for their projects.
Power supplies can come in different forms that give you choice based on what’s best for your project. Making a roaming robot? Go with a 4-cell AA battery holder. How about a scarf with LEDs? The lithium ion polymer (“lipo”) battery is great for wearables because it’s light and small. Sticking up strip lights above your kitchen counter? You’ll need a power outlet adapter to drive all of those LEDs. Of course, you can stray away from what a certain power supply is typically used for, as long as it can handle whatever your project is asking for.
Every maker probably has a handful of battery holders lying around at any time because they’re so easy to come by. Most of the holders I have were stripped off of old toys and electronics.
The voltage that is supplied by the pack is easily calculated by adding the voltage put out by each cell. On most batteries, a mAh, or milliamp-hour, rating will be given. This is telling you how many milliamps you can draw from the battery for an hour. For example, if you have a 3000mAh battery, you can draw 3000mA for an hour, 1500mA for two hours, etc. The higher the mAh rating, the larger the capacity of the battery and the longer your project will be powered.
You also probably have a power adapter lying around from an obsolete device. Inside of the “black box” is a transformer to step down the voltage, and then a rectifier circuit to make the output DC (if the output is DC). I’ll probably try writing tutorials for transformers and rectifiers once I brush up on the material. For now, all you need to know is that the adapter is converting your outlet power into power suitable for your project or device.
Look for the specifications printed on the adapter. The input is always the same but you need to make sure it’s an input that works for your location. In North America, we’re looking for adapters that want 120v 60Hz power, while people in other places around the world may want to look for adapters that want 230V 50Hz power. If you’re reading this, you should know what comes out of the plug next to you.
As for the output, that will vary between project and device. It is always important to know the power your project requires. For most projects, you’ll be looking for a DC supply. It’ll need to have a voltage rating appropriate for the components in your project. It is always possible to change the voltage for parts of your project using voltage dividers or regulators (to be discussed shortly) so go with the highest voltage that is required by any of your components. It is important to consider the current draw of your project as you can cause your adapter to overheat and fail if your project begins to draw more current than the adapter is rated for.This was a good reminder to check the specifications carefully. I accidently picked up an adapter with an AC output…Some adapters allow you to change the voltage and polarity of the output.
It is a good idea to check your power supply with a multimeter. With the variable power supply in the previous picture, the label on the switch is not very accurate so I used my multimeter to adjust the switch to the proper position. I didn’t want to open up the project to take a picture but I still wanted a picture of my lovely multimeter so this was the best I could do. (Please see the Voltage Regulation section for an extra word on measuring your supply.)
Power supplies will usually come with some sort of connector at the end of it. Just remember that no matter the shape of these connectors, it always leads to a couple of wires. I don’t bother looking at the connectors anymore because I end up chopping them off and stripping the wires. If you want to keep the connector, you can pick up a female connector to add to your project so that you can easily plug and unplug your power.This supply for my PLC shows the symbol for DC power, the dotted line under a solid line. The symbol for AC power is a sine wave. It also has circuitry so that it can work internationally as seen by the input rating.
Sometimes, parts of your project may use a different voltage to one that your supply is giving you. The LM7805 is a 5v constant regulator that I use to power my Atmega 328 projects (unless I have a 5v supply). For other voltages, you can use other constant regulators or a variable one like the LM317.
If you are using an Arduino board, such as the Uno or Mega, there is an onboard regulator for you already. As long as you supply it with at least 7v DC, it will be happy. If you’re using a power adapter and it doesn’t have the correct barrel jack connector, you can strip the wires and power the Arduino through the Vin pin. Don’t forget to connect the ground too. One thing to note is that each pin on the Arduino can handle 40mA max, so you’ll need to consider the current draw of each component. That’s why people tell you to use an external power supply for servo motors because they’re one of those components that will draw a lot of current.
Switches can be added in various places around your project. Good places to put them are on your main power supply and the supply to major components that you’d ever want to cut power from. If you’re ever dealing with lots of power, be sure to check the rating of the switches.
About measuring your supply: Adapters can be regulated and unregulated. Regulated adapters have voltage regulator circuits built in them while unregulated adapters don’t. When you measure the voltage of an unregulated adapter, the voltage may be higher. The voltage will drop as the load on it gets larger. I’ve never experienced any huge variations in measuring my supplies but it may happen and it could affect your project.
When choosing a power supply, you look for one that is an appropriate shape for your project and one that meets the power requirements of your project. It’s a good idea to have a multimeter around when building and testing your project to make sure you’re getting the correct voltage and current in the places you expect. As you always should while building something, be cautious with what you’re doing to ensure the safety of you and your project.