A power supply is a critical part when it comes to microcontrollers. The power supply refers to the source of electrical power. First, we will look at using one power supply for your Arduino board, and then we look at using multiple power supplies. The most common operating voltages for Arduino are 5V and 3.3V. 5V to 12V power supplies are standard.
You can supply an Arduino Board using the DC barrel jack or use the VIN and GND pin. If you connect power to the DC barrel jack, it will reach a regulator that is on board. In case you want to connect your power source to the VIN / GND pin of the board, you will need to add a voltage regulator.
Regulated versus unregulated power supplies
power supplies come in two types, regulated and un-regulated. A regulated supply had electronic components build-in to ensure the voltage output is always the same in dependable on the current that is drawn.
Every power supply has a rating that describes how much voltage it will give out and how much current. The MAX ratings indicate what the supply is capable of giving. So if the power supply is rated at 2 AMPS, it will not supply 2AMPS all the time. If you have a circuit that takes more current than the power supply can give, the circuit is overloaded. Rule of thumb, if your circuit is demanding 2 AMP in total, then you will need a power supply that provides anything greater than 2 AMPS.
Unregulated power supplies do not have such electronics, and therefore, the voltage they give depends on the current they are supplying. Generally, if the current increases, the voltage will drop.
Based on the above, you would choose a regulated power source. But remember, a battery pack is an example of an unregulated power supply.
USB Connection to a computer: The most straightforward way of supply your microcontroller is to tap the supply from somewhere else. If you connect the Arduino to your computer with a USB connection, your Arduino will get enough “power” to work. The USB port should be able to supply 500 mA of current at 5V. The USB port will be sufficient for beginner projects such as turning an LED on, but what happens if you need more current or need more voltage or want to make your Arduino Board independent from your computer. In that case, you should use another power supply other than your computer. For instance, you can use batteries or a DC power supply.
DC power supply
here are many different DC power supplies, but we will examine one random dc power supply. Most power supplies have a rating label, such as the picture. Ensure that you know the polarity of the plug, so you do not reverse polarity and damage your circuit.
The figures below will show the two different types of polarity. The images below show two types of polarity. Center-positive polarity and center-negative polarity.
The following abbreviations can be seen in your DC supply.
V : Volts
A : Amperes
W : Watts
mA : milliamperes
VA : Volt Amperes
VAC : Volts AC
VDC : Volts DC
DC : Direct Current
AC : Alternating Current
Determine your power supply: To determine whether a power supply is right for your project, you will need to note the voltage that each component operates and the current they consume. In this way, you can make sure that the power supply can provide the right amount of power.
Multiple power sources
One common situation is your project needs more than 5V than you can get from a microcontroller. You might need 12volt to drive a motor. One question that arises is if we need to connect grounds. Is that dangerous?
First, let us look at what ground actually means. The ground is just a name given to a point in the circuit. That point is chosen by you against which all other voltages in the circuit are measured.
The 5V pin on the Arduino Board isn’t actually 5V – it is 5V with respect to the ground pin.
So ground has to be a single point in your circuit against which all voltages “make sense”.
You might think that the diagram below is the answer for using two power supplies.
In diagram 1, you can see that the Arduino Board is connected to a 5V power supply. Attached to the Arduino Board, is a 12V component which has his own 12V power supply. The problem in this diagram is where the ground in the circuit is?
The 5v pin of the Arduino is 5v with respect to the ground pin of the Arduino. From the Arduino Point of view, the ground is the bottom line of the Arduino Power supply. The 12V external circuit is 12V with respect to the negative side of the 12V power source.
That looks quite good, or not? Each device is correctly wired to its power source. However, take a look at the data signal going from the Arduino Board to the 12V device. What Voltage is that at?
Voltage is not absolute, and voltage is only relative to a reference point within the same circuit. It is impossible to know what the voltage is there.
There are two red arrows in the loops. That is the flow of current around the circuit. Current has to flow out of the supply, through the circuit, and back to the supply. The current can flow from the 5V supply through the Arduino and back to the 5V supply again in the circuit above. It is a complete loop.
Likewise, there is a loop from the 12V supply, through the 12V device, and back to the 12V power supply. Do you see any loop for the signal from the Arduino Board to the 12V device? The consequence that there is not a loop is that the data signal line will not work.
How do we make a loop? We connect the grounds as soon as you do that the circuit will look differently.
In diagram 2, the grounds of the 5V power supply and 12V power supply are now connected. Any current can flow from the Pin of Arduino Board through the 12V device, go out of the 12V Device ground connection, along the added green wire, and back through the Arduino Board’s ground connection. Also, now that the ground of the 5V section and the 12V section is one, any signal of the 5V side is recognizable by the 12V as 5V since the reference point (ground) is the same in the circuit.
So there you have it. If you have multiple power supplies in your project, whatever they may be (except in special circumstances), you must connect the grounds together for it to work. Suppose it works without connecting the grounds together. In that case, you are inadvertently relying on some pre-existing ground connections to do the job for you, and that is likely to fail if your setup ever changes.