Attaching Devices to a regulated PSU
When prototyping a hardware device you may wonder “how do I power all my parts from the same power supply?”
You may have a Raspberry Pi (microusb powered), a speaker (microusb powered), a pushbutton (red/black wires), an analog meter (red/black wires), etc and want to run power to all of these devices.
Never fear, a regulated power supply is here! Take for example this Adafruit 5v switching power supply.
Power Supply Basics
Why 5 volts?
If you know nothing about digital electronics, the thing to know is that most devices you’re working with are either 5v or 3.3v devices. They are mostly compatible. Digital signals are binary, so your devices output (and take as input) either HIGH or LOW voltages and read them as 1 and 0. How do you make 5v and 3v devices compatible? By agreeing on Logic Levels, which indicate an agreement like “anything above 2.4v is HIGH and anything below is LOW”. Then you can base your device’s operation on what kind of voltages you’re getting from your inputs, and communicating by changing your output voltages.
We use 5v power supplies to provide the right kind of power to all devices. 3.3v devices generally have circuitry to step down the voltage as needed because these devices came later, after 5v became common (they’re generally devices that try to use less power, for example my small bluetooth speaker is a 3.3v device). Rest assured you should be safe hooking up 3.3v devices to a 5v power supply.
Power Draw
You might notice that in the adafruit power supply I linked there is a listed amperage that it can provide (4 amps). Your devices will draw amps, and you should not exceed how many amps the PSU can supply.
A Raspberry Pi 3 Rev B draws on average ~0.75 amps. My little bluetooth speaker draws ~0.6 amps. Add it up and add some headroom, and if that’s all I need then the power supply I need just has to supply ~1.35A.
Note that you realistically want to factor in peak usage. So if say your Raspberry Pi is being used to power other devices through USB, you should provide higher amperage to it (e.g 2A is common) and factor that into your power budget.
Connecting devices to the power supply
You’ll notice the power supply has one of those round male connectors for plugging into devices. So the next step is, for whatever you’re building, to add a female jack to take that connector as input. You should use something like this.
Now you’re wondering: all my devices are microusb. How do I attach them to the jack I just bought?!
Well the answer to that is: get ready to tear up some microusb cables!
Bluetooth Speaker
Question: I want to power my bluetooth speaker. It only has micro-usb input for power. What do I do?
Answer: modify a microusb cable. Get a pair of wire strippers and strip off the outer covering of your microusb cable. ALL microusb cables will have the red and black wires seen in this picture. SOME microusb cables will additionally have data cables. You can ignore the data cables. Cut them. You only need power.
Now you can splice / solder these leads to your 2.1mm female power connector jack!
Raspberry Pi
You can use the modified microusb approach for the raspberry pi as well, and it’s definitely recommended.
However there is one more way: there are 2 GPIO pins for 5v power on the pi (2 and 4) as well as multiple pins for ground, so you can take two one-sided female jumper cables and plug them into 5v power + ground; for example pins 2 & 20.
IMPORTANT: by not using the micro-usb port, you lose fuse protection / regulation from over-voltage / current spiking. This can permanently damage your raspberry pi, so be careful powering the pi this way.
There are also 3v pins (1 & 17) you can use to connect a 3.3 volt power supply if you’re doing something with low-power application. Same caveats apply.
Take the jumper cables and splice / solder them to the 2.1mm jack just like you did for the microusb cable if you want to connect it to the power supply, otherwise tear up a micro-usb cable and use that.
Power Smoothing
If you anticipate that your power draw will fluctuate, it may make sense to solder a capacitor to the female jack / all those power leads. Capacitors have a smoothing effect that protects your devices + power supply.
When will your power fluctuate? Well if you attach a high-powered device that is only used sometimes. For example a thermal printer is only drawing strong current when printing. At all other times it’s at rest. Those spikes in power usage need to be smoothed over.