Power supply for Arduino and ESP32: operate microcontroller with PC power supply & LED power supply unit
- Power Supply Basics for Microcontrollers
- Arduino Power Supply
- Arduino Power Supply via USB
- Arduino Power Supply via Hollow Connector
- Arduino Power Supply via VIN Pin
- Arduino Power Supply via the 5V Pin
- What Are Regulated And Unregulated Power Sources?
- ESP32 Power Supply
- ESP32 Power Supply via USB
- ESP32 Power Supply via the 5V Pin
- ESP32 Power Supply via the 3v3 Pin
- Power Supplies
- LED Power Supply aka Built-in Power Supply aka Switching Power Supply
- PC Power Supply resp. ATX Power Supply
- The Molex Connector
- ATX Power Supply Power Distribution Boards
Today I will show you all the different ways you can power up your Arduino, ESP32 or ESP8266 – which ports and pins can be used and what to take care of.
Then I will show you two power supply setups if you need a little bit more amperes. On the one hand we will have a look a LED power supply (aka built-in power supply or switching power supply). And on the other hand I will show you how you can easily use an ATX PC power supply as a power source for your microcontroller and why they are so practical.
Power Supply Basics for Microcontrollers
Before we start tinkering, let’s take a look at the power supply options for Arduino, ESP32 and ESP8622.
Where and how can I actually supply power to the microcontroller?
In this article I use so-called affiliate links. If you use these links, I get a small commission from the linked merchant.
This has no influence on your purchase price - the price stays the same for you!
Arduino Power Supply
Let’s take a look at the Arduino UNO first. Here there are four possibilities for the power supply:
- Power supply via the USB port
- Power supply with a power supply unit via the 5.5 mm hollow plug socket
- Power supply with a power supply at the VIN pin
- Power supply via the 5V pin
But attention: there are a few special features to consider.
Arduino Power Supply via USB
This is the simplest option. Simply connect via USB to a computer, powerbank or power supply with USB plug. All power supplies that have a USB plug must supply 5 volts according to the USB specification. However, this also means the other way around: any device that receives power via a USB socket expects exactly 5 volts here.
If you want to use such a power supply with a USB plug, please check before – the output current must be written on every power supply. If there is nothing on it, it is strange. Then I would dispose of the power supply right away. Attention, sometimes the print is very very very small – such as the power supplies from Apple.
Arduino Power Supply via Hollow Connector
The Arduino UNO boards have, in addition to the USB port, a 5.5 mm hollow socket where a power supply can be connected. However, it should be noted that the power supply must have a voltage between 7 and 12 volts.
“Why not 5 to 12 volts? The Arduino runs on 5 volts, right?”
Justified question: here the peculiarity is that this power supply runs through a voltage converter, which is installed on the Arduino. This one takes care of converting the 7 to 12 volts into exactly 5 volts. For technical reasons, this only works if the voltage fed in is at least 2 volts above the target voltage of 5 volts: 5 + 2 = 7.
Arduino Power Supply via VIN Pin
You can also supply the Arduino UNO with power via the pins: the negative pole of the power source is then connected to Ground. The positive pole is connected to VIN. The VIN pin runs, just like the hollow socket, via the above mentioned internal voltage converter. I.e. the same specifications apply here – use a voltage between 7 and 12 volts.
So here you could also use unregulated power sources like battery packs, like 4 × 1.5 volt batteries.
“Hey, wait a minute: 4 × 1.5 volts makes 6 volts. That must be at least 7 volts, right?”
Yes, that is true. However, the Arduino is frugal and usually runs with a little less voltage. Of course, you can also take 5 × 1.5 volt batteries, then you are officially within the specifications.
Arduino Power Supply via the 5V Pin
And last you can use the 5V pin for the power supply. Negative pole again to Ground and positive pole to 5V.
But be careful: At the 5V pin this is only possible with a regulated current source that supplies exactly 5 volts. Because this pin does NOT run through the voltage converter mentioned above.
So this could be a power supply, or a cut USB cable, which is connected to a USB power source.
By the way, if you supply power to the Arduino via the USB port, hollow socket, or VIN, then the 5V pin and the 3v3 is an output pin and regulated 5 volts and 3.3 volts are then available there for tapping.
What Are Regulated And Unregulated Power Sources?
What does regulated and unregulated power supply actually mean?
A power supply always delivers exactly a set voltage. You can rely on a 5 volt power supply to always deliver 5 volts. Internal components in the power supply regulate this. Therefore, a power supply belongs to the regulated power sources.
An AA battery supplies 1.5 volts, but only for a certain time. When the battery is full to the brim, it supplies slightly more than 1.5 volts. As the amount of stored current in the battery decreases over time, the voltage also decreases to well below 1.5 volts. In this article I go into more detail about the topic: Power supply of ESP with batteries
There are no regulating components installed here to compensate the voltage curve of a battery. Batteries and accumulators therefore belong to the unregulated current sources.
ESP32 Power Supply
Now let’s take a look at the power supply options for ESP32 and ESP8266. This is quite similar to the Arduino UNO.
Attention: In principle, the power supply options for the ESP8266 and ESP32 are the same. Both have an operating voltage of 3.3 volts. The problem is that there are a lot of so called Dev Kits or Dev Boards with ESP32 and ESP8266. In the video I go into more detail about what exactly an ESP32 or ESP8266 is. The boards often have differences in the voltage converters, so that there are different maximum and minimum voltages that the voltage converter can convert. Sometimes the voltage converter even changes from batch to batch.
ESP32 Power Supply via USB
As with the Arduino, the power supply via the USB port is also the easiest possibility. Because USB is standardized to 5 volts, you can hardly do anything wrong here.
ESP32 Power Supply via the 5V Pin
Attention, there are significant differences. There are boards, which can be operated over the 5V pin with an unregulated current source between 5 and 9 volts.
Other boards only allow regulated 5 volts – so they don’t have a voltage converter.
If you can’t find the information in the datasheet of your board (and this is often not easy), then use regulated 5 volts – then nothing should go wrong.
Positive pole of the power source goes to the 5V pin and negative pole to Ground (GND).
ESP32 Power Supply via the 3v3 Pin
And finally the 3v3 pin of the ESP32 – here you can feed regulated 3.3 volts current with the positive pole of the current source. Minus pole then to Ground (GND).
By the way: if you supply the ESP32 with power via the USB port, the 5V pin and the 3v3 is an output pin. There are then regulated 5 volts and 3.3 volts available for tapping.
Hm, but are there power supplies that deliver 3.3 volts?
Yes, e.g. PC power supplies. I will discuss this in the next section.
So enough talking about pins, now let’s have a look at the two power supply variants I want to show you. Let’s start with the built-in power supply or LED power supply or switching power supply.
LED Power Supply aka Built-in Power Supply aka Switching Power SupplyThis is a 5 volt, 8 amp power supply from MeanWell*. Mostly you can find them under the term built-in power supply, LED power supply or switching power supply. They are easy to install in a larger case. These power supplies are also available with more power like 5 Volt and 12 Ampere*.
The only catch is that you have to take care of a 230 volt supply line.
To do this, I either take a leftover power cord and cut off the part I don’t need. Or I get a power cable and a plug to assemble it from the hardware store.
For the connection of the cables you could get out the good old luster terminal – but stop: that is out. Nowadays one relies on so-called spring-loaded terminals. They hold the contact better and are also easier to use.
I have this spring clamp cable quick connector* in the test and am very satisfied. The individual elements even have a small connection rail system. So you can put together the right element depending on the required number of wires.
And at the back there is a small measuring aid for stripping. Plug in, fold down, done. Be careful that the lever does not hit your fingernail. It snaps shut quite nicely.https://geni.us/LO7h
At the output of the LED power supply I also use these spring terminals. For this I cut two jumper cables and can easily lead the current into the breadboard – ready is the power supply.
Pay attention to the power supply, where the 230 Volt alternating current (AC) has to go in and where the 5 Volt direct current (DC) comes out. On this power supply AC In and DC Out are labeled.
The MeanWell LED power supplies I’ve used so far are almost completely silent. There are also cheaper power supplies, but they have a loud annoying coil beeping. There I am sensitive. But if that doesn’t bother you, I’m sure you can find other cheaper counterparts.
PC Power Supply resp. ATX Power Supply
Now let’s have a look at a PC power supply. If the PC is not very small or exotic, it will probably be a power supply according to ATX standard – depending on whether an ATX motherboard was installed in the PC.
Why are ATX power supplies so convenient?
Because these power supplies deliver three different voltages: 3.3 volts, 5 volts and 12 volts.
Well, if that’s not a coincidence, that here the usual voltages are used like in microcontrollers & Co. 12 volts are rather uncommon, but they do happen. But 5 volts and 3.3 volts are exactly the operating voltages of Arduino and ESPs.
Perfect to operate our microcontrollers especially in the prototype phase, where optics or compact dimensions are not yet important.
The Molex Connector
The heart of the whole power supply via a PC power supply is the so-called Molex connector. There everything comes what we need.
Here I have made a graphic, which shows the pin assignment.
Attention: Current ATX power supplies have an additional 4-pin connector, which together with the 20-pin Molex connector results in a 24-pin connector. This shifts the numbering of the pins, depending on whether the 20-pin connector or 24-pin connector is meant.
ATX power supplies do not have an on/off switch. This is normally done by the PC’s switch, which in turn tells the power supply to start up via the motherboard.
All the motherboard then does is connect two specific pins in the Molex connector and the PSU delivers power.
To start the PSU, you can solder a switch between the wires of pin 14 (on the 20 pin Molex connector) or pin 16 (on the 24 pin Molex connector) and ground to turn the PSU on and off. This is always the same pin (in the picture the green pin PWR_ON), you only count differently if you talk about the Molex connector with 20 pins or with 24 pins.
So one possibility now would be to cut off the Molex connector or the cables you need and prepare them accordingly, so you can use them as a power source for 3.3 volts, 5 volts and if needed 12 volts.
But before you get the string cutter now, be sure to check out the next section.
ATX Power Supply Power Distribution Boards
I saw that there are such distribution boards for ATX power supplies exactly for this situation – of course I got one.
Here you only have to plug in the Molex connector … done!
The 3.3 volts, 5 volts and 12 volts can now be tapped conveniently via the corresponding terminals or pins and there is also a button to switch the power supply on and off again.
Now we only need two cables and we can bring the regulated current to the microcontroller. If we take the 5 volts, then we have to take the 5V pin at the Arduino.
It looks similar with the ESP32 or ESP8266. I have for example such ready-made Micro-USB connector cables*. I can then send the 5 volts directly into the USB socket of the ESP Dev Board.
And of course, the same power source can also be used to power external loads, such as LED strips.
Speaking of LED strips: if you are interested in this topic, I recommend my LED Strip Ultra Guide. There I explain all important basics about LED strips and how to control them with ESP and Arduino.
A word about the ATX power supply: check the specifications of the power supply, so you know how many amps are available. You can usually find them as a sticker on the power supply.
The wattage of an ATX power supply is usually a combined wattage. If it says 500 watts, it doesn’t refer completely to the 5V, but to all three voltage types.
With my 500W bequiet PC power supply here you can see that for 5 volts “only” 15 amps are available and not 100 amps, as one could assume with 500 watts (watts = volts × amps). And since one may not call up more than 75 to 80% percent of the achievement of a power supply permanently anyway, one should connect in this case no 5 volt consumer, which needs more than 12 amperes.
We have clarified which options and pins you can use to power Arduino UNO, ESP32 and ESP8266. We also went into the specifics of the different pins regarding the voltage converter.
We also looked at two types of power supplies that can deliver a bit more amps than the usual cell phone power supply.
Especially because I still had a PC power supply left over, this one is now always on my tinkering table and I can run my microcontroller tinkering very easily and with enough power reserves.
I hope you now have a good overview about powering microcontrollers with power supplies.
Always be careful with power – especially with the current power prices!
Product recommendations from this article and video:
- Spring clamp cable quick connector*
- ATX Power Distribution Board*
- Arduino UNO Starter Set*
- ESP8266 D1 Mini*
- ESP32 DevKit*
- be quiet! ATX power supply, 500W*
- MeanWell LED power supply, 5V 12A*
- MeanWell LED power supply, 5V 8A*
- ready-made Micro-USB connector cables*
- Micro-USB breakout board for soldering*
- Breadboards, terminals & pin headers*