An introduction to power supplies and managing different voltages

LED projects inevitably involve dealing with a few different voltages.

The electronics way to talk about this is to just say that voltage is about potential energy. There’s a lot more potential energy at higher voltages, as if you’ve got a high-pressure pipe or you are on the top of the hill. However, this also means that everything needs to be built a lot beefier. A switch that’s designed for 5v will probably generate sparks if you try to put 110 V or 220 V house current through it.

A lot of stuff in the early days of electronics was built around actually fairly high voltage, and then as electronics switched from vacuum tubes to semiconductors, there was a lot of incentive to move to lower voltages.

I guess they found it all re-volting.

There’s a bunch of regulations (NEC Class 2, UL 60950, ISO/IEC 60950 SELV) around the category of circuits that can be run through the walls with reduced regualations compared to regular old 120/220V house current. And they are a bit dependent on where you are but it’s generally something under 48-60 V and about 90 W and, obviously, if you are going to be building something large like this you want to look at electrical codes carefully, but for the purposes of this explanation, we’ll say that 48V is about the top-end of “low voltage”.

At these levels, the voltages are generally not regarded as dangerous under dry conditions for an area of contact about the size of the human hand. They can be dangerous if you pierece your skin or if the area is wet or under a bunch of other situations that you can create for yourself like a ground loop… so it’s a good idea to avoid fondling bare electrical wires but it doesn’t require the level of care that higher voltages demand.

Professional XLR microphones with phantom power uses 48V, as does Power over Ethernet.

24 and 12 volts are common as well, especially for DC-powered light fixtures. 24 volts is more efficent, but 12 volts is what your car has. 12V is also the highest voltage that your computer’s power supply will generate.

The earliest digital electronics used to be at 12V but fairly early on, this moved to 5V, stayed there for a while, and now the core voltage in your computer’s CPU is a volt or so. But because 5V has been common for so long, there’s a lot of parts that are built around that because it’s really easy to deal with. In the past decade or so, most of the microcontroller marketplace has been moving from 5V to 3.3V or lower.

RGB LEDs don’t work very well at 3.3V, given that blue LEDs tend to be right around 3V, that’s not very much headroom, so you tend to see 5V for LED stuff, at the minimum, thus you are generally going to have to think about what voltage things are at.

Voltage regulators

voltage regulators

Voltage regulators lower a voltage by converting energy to heat.

Obviously this isn’t very efficient and there’s a whole bunch of content about switching power supplies, but if you are going that road, you need a bunch of stuff, whereas a voltage regulator is mostly happy with a capacitor on either side.

You end up encountering voltage regulators a lot when you are dealing with microcontroller boards for this reason.

Voltage regulators generally have a certain amount of power and voltage that they are designed for.

The classic voltage regulator example is a LM7805 voltage regulator. It started out in a TO-220 package but you can get a mostly equivalent D2PAK surface mount version as well. It’ll handle 1.5A of current and you can feed it anywhere between 7V and 25V.

The difference between the lowest voltage you can feed it and the voltage it outputs is called “dropout”, so a 7805 has a dropout of 2V, which is not great. Also note that the current regulation voltage collapses quickly. If you put 5V into a 5V regulator, you might not see any voltage on the output at all.

If you make a more complex part, you can reduce the dropout, although if you want the least power noise and the highest input voltage, you will probably be happier with a high dropout regulator. However, you can see “Low Dropout” or “Ultra Low Dropout” regulators, where the dropout is maybe 0.3V or maybe sometimes less.

One example low-dropout regulator is the MIC5225, which is in a tiny SOT-23-5 package. It can handle 150 mA of power where the dropout is 0.31V and the input range can be more around 16V. Alternatively, there’s an AP2112, which is the same SOT-23-5 package, but it can handle 600 mA, except that the input voltage is limited to 6V. There’s a thermal limit here where you’d never see a SOT-23-5 that can handle 16V on the input and also handle 600 mA.

Pretty much any microcontroller board is going to have something like the AP2112 to convert from the 5V USB connection to 3.3V.

USB ports and power bricks

Classic non-USB power bricks had a variety of connector types and voltages, although there are fewer connector types and options these days.

You used to get “unregulated” bricks that would promise you that they’d always be above a rated voltage, say 12V, so when you plugged them in, you’d see 18V or more with no load, and then as you loaded them down, the voltage would descend until it approached 12V. I haven’t seen these available for purchase from the usual suspects in a while. These days, you tend to see smaller and more efficent that use a switching power supply that’s regulated.

For a lot of projects, either a USB “phone charger” power supply or a USB “battery bank” is a great option. Pretty much any of them will provide you with 5V power and, because of the modern phone, they tend to be perfectly happy to provide up to 2.5A without you doing anything special. You can get a little USB connector thing that has a USB plug on one and and screw terminals on the other and just connect the power and ground lines.

Some USB ports, generally intended for charging laptops, can handle a lot more power than that using USB Power Delivery, it’s just fiddly and tricky.

Microcontroller USB ports

It’s usually the least hassle sort of situation to just power a project via the USB port on your microcontroller board.

Most microcontroller boards have a USB port these days although not all of them have a connector that can handle the full 2.5A. You generally need to check the documentation.

If there are 3.3V pins on the microcontroller, those are often limited by the onboard regulator. So you might be able to draw only a few hundred mA off of that pin for any 3.3V peripherals.

Where to go from here?