- 3DRAG + MOTORFISH: How to prevent step losses in 3D printerPosted 2 weeks ago
- Motorfish: The stepper does not misses a step (the Firmware)Posted 3 weeks ago
- Motorfish: The stepper does not misses a stepPosted 4 weeks ago
- “Maker Faire Rome – The European edition” returns to the Gazometro OstiensePosted 3 months ago
- Single-chip saturation meterPosted 3 months ago
- Raspberry Pi Relay BoardPosted 5 months ago
- PCB CAD, A SELECTION GUIDEPosted 5 months ago
- Automatic dispenser for catsPosted 6 months ago
- Do you have a mask? RASPBERRY Pi SEES ITPosted 6 months ago
- RFID based Attendance system using Arduino and External EEPROMPosted 6 months ago
Feeding power to Arduino: the ultimate guide
Let’s deal with the problems of the various powering modes for the most famous Arduino boards, in order to overcome doubts users may have and to provide useful advices.
When you want to use an Arduino board in stand-alone mode, the first problem to face is the one of how to power it, once it is disconnected from the computer’s USB port. Unfortunately, a faulty knowledge of the theme of powering sometimes leads people to make unforgivable mistakes, since the first result is often that of seeing the board go up in smoke and almost always irremediably, since from that moment it will not work any more.
In the premise it is good to point out that the article will deal with the powering modes of the Arduino boards operating at 5 V (UNO, MEGA, Duemilanove); a short, specific note will be dedicated to Arduino YÚN, that is still a 5 V board, but with features that are different from the other ones.
THE EXTERNAL POWER SOURCES
Basically, in addition to the computer’s USB port, the external power sources for Arduino are: linear and switching power supplies, or having a specific USB output (that most likely is of the switching kind) and batteries of various types.
THE POWER SUPPLIES
Amongst the many mistakes that are made, there is surely the one of recycling power supplies kept in a drawer, and by treating them as if they were all the same. Let’s start immediately by making it clear that those of the alternating current kind have to be absolutely excluded (they were used a lot by the analog modems of some years ago). In the figure we can see the comparison between the two power supplies that are very similar, from a physical point of view: one operates on alternating current (AC) and the other one on direct current (DC).
Comparison between power supplies operating on AC and DC
As it can be noticed from the symbols found on the respective tags, it is quite simple to distinguish the two models, even though they are physically similar.
In the alternating current model, shown on the right side of the figure, the line with the indications concerning the output says: AC 12 V 500mA 6VA, that respectively represent: alternating current, maximum output load and power, expressed in VA (that can always be obtained by means of the P = V*I formula). In some cases, in the place of the AC abbreviation, the symbol “~” may be found, and it still means “alternating current”.
On the left, on the contrary, the direct current model, in the line with the output values shows in an equally clear way +5 V 2A, moreover the symbol “═” graphically points to the direct current; finally, in these power supplies, the voltage polarity is always indicated on the output JACK; in this case the graphics represented on the tag indicates that the positive pole (+) is connected to the central part of the jack while the negative pole (-) is connected to the external part. We may still notice the presence of the “~” symbol on the tag, but it is clearly referred to the power supply input that, obviously, must be connected to the alternating current network.
In the course of this article we will talk about direct current only, having already clearly ruled out the alternating one for our purposes. Basically, the power supplies can be divided in three categories:
Unregulated linear power supplies: an unregulated linear power supply always takes into account an AC transformer converting from 230 Vac to a definitely lower value (usually from 3 to 24 Vac), a diode bridge rectifier (that has the task of converting the alternating current into direct current) and an electrolytic capacitor for filter and levelling. There are the so-called “multiple winding” models that have a transformer with a single primary winding for 230 Vac and many different secondary windings, and it is capable of supplying different alternating current voltages that, by means of a commutator, are connected (only one per time) to the diode bridge and to the capacitor, and therefore to the output. By measuring the behaviour of an unregulated power supply (regardless of the fact it is a single or multiple winding model) with a normal multimeter, it is possible to immediately notice how the voltage, in the absence of load, may be definitely higher than the nominal one, while in the presence of a load it proportionally decreases, depending on the current draw of the last one, decreasing even under the level of the nominal voltage. These power supplies do not offer any reliability and are often even harmful for the machineries that, if absorbing little, are powered at voltages that are much higher than the required ones. Consequently, they are absolutely to be avoided!
Unregulated linear power supply
Regulated linear power supplies: this kind of power supply is characterized by the presence of further electronic components, in comparison with unregulated models, such as a voltage regulator and other capacitors with filter and anti-self-oscillating functions. In the greatest majority of cases they are single voltage tools, and very reliable ones, of dimensions that are proportional to the deliverable power; the voltage is very stable (typical variations of ±0,1V in respect to the nominal value), regardless of the current (always within the limits of the nominal value). In addition to an excellent stability, they have a very low ripple value (the residual variation of alternating current over direct current), but their performance is quite low (between 40% and 60%) since much power is dissipated by the regulator that, for this reason, may require a dissipation system that can even be quite bulky. The power dissipation is directly proportional both to the drop-out (the difference between input voltage at the regulator and output voltage from the same) and to the deliverable power. Moreover, the greater is the dissipated power, the greater is the temperature reached by the regulator’s case and, consequently, the lesser is the deliverable power. For such reasons the input voltage should always have a slightly higher value than the nominal one of the regulator. These power supplies are ideal for applications whose noise (ripple or high frequency) may prove harmful to the proper functioning of the circuit, typically when dealing with very low voltages. In general, they require an input voltage corresponding to the one of the electric network (230 Vac) or with quite a narrow range (220-240 Vac), moreover they are quite bulky.
Regulated linear power supply
Switching power supplies: this last family of power supplies is the most recent, from a technological point of view; it is based on a high frequency work system and it is capable of regulating the output voltage at a value that is lower (step-down) than the input one (as in the case of the kind seen before), or at a higher value (step-up). The design of these systems is much more complex than the linear ones, but recently many integrated circuits have been put on the market, and with the help of a few external components, whose values can be calculated with the help of the data-sheet, and that make their creation quite easy. The dimensions are very limited, because of the high efficiency of such technology (80-90%) and even the stabilization is excellent. On the other hand, in respect to the regulated linear models, these power supplies have high ripple levels in addition to high frequency noise, which makes them not suitable to power circuits that suffer from such residual presences on powering. In general, they operate with a wide range of input voltages (100-240 Vac) and have dimensions that are definitely much smaller than their counterpart of the linear kind.
Switching power supply
A particular type of switching power supplies is the one of mobile phone chargers; in general their usage is inadvisable since they have been designed for the exclusive purpose of recharging the battery, and thus often paying little attention to the noise filtering. Some models even incorporate the control system of the battery charge power, for example the ones for LiPo or Li-Ion batteries, thus making them totally unsuitable to power circuits that are different from the ones of a mobile phone.
It is important to deal briefly with the problems connected with battery powering, since the need to make a circuit independent from the home electric network is not rarely felt. When deciding to resort to battery powering, the ratios between their capacity (usually expressed in mAh) and the power required by the Arduino board and the peripheral circuitry connected to it are often neglected, thus leading to results that are often disappointing (autonomy is very low or the system does not turn on at all).
In figure we represented an overview of the most commonly used battery types.
Since a single battery cannot always satisfy all circuital needs, because of the low voltage value and/or low capacity, it becomes important to understand the series and parallel mechanism, that is to say, the ways with which two batteries may be connected between them to increase the said values. As a premise it must be very clear that all the batteries that will create a “pack” must be absolutely identical and possibly coming from the same batch; in the case of alkaline batteries they must strictly be new, in the case of rechargeable batteries all of them must be either fully charged or discharged.
Identical batteries, connected in parallel (all the positive poles between them and all the negative poles between them, see in figure) keep the same nominal voltage of a single one and sum up the capacities: e. g. four 1,5 V 200 mAh alkaline batteries connected in parallel make up a 1,5 V battery with a capacity that is equal to the one of a single battery multiplied by four (800 mAh). One resorts to this system when the voltage of the single battery is enough to power the circuit but a greater autonomy is needed.
Battery Pack in parallel
Identical batteries, connected in series between them (the negative pole of the first one goes to the positive pole of the second one, and so on), keep the capacity of the single battery and sum up the voltages: e. g. five 1,2 V 2000 mAh NiMh batteries, connected in series, make up a 6 V 2000 mAh pack. The connection in series is used when the single battery has a voltage that is too low and is unable to power the circuit; in fact in the specific example, with a single 1,2 V battery we could never power Arduino, and not even with 2, 3, or 4 batteries in series, since we would obtain 2,4 – 3,6 – 4,8 V respectively, and these wouldn’t still be enough for the purpose; on the other hand the fifth battery enables us to reach a 6 V tension that can be applied, for example, to the Vin pin, as we will see.
Battery Pack in series
Of course, it is possible to combine the two types of packs, when in need to increase both the voltage and the current. For example, by connecting in parallel two packs already connected “in series” and made up by five 6 V 2000 mAh NiMh batteries (the pack described just a while ago), it is possible to obtain a 6 V 4000 mAh pack.
Hermetic Lead-Acid batteries are packs made up by 2 V elements that are connected in series; usually they are used alone, since they exist in various “sizes” as for voltage and capacity, but they still can be used in series or in parallel.
It is quite a complex thing to create Li-Ion or LiPo battery packs (the single cells must be “balanced”) therefore it is definitely more convenient to resort to commercial products. There are, however, specific battery chargers for these models’ packs, since each cell of the pack must be charged individually.
Battery charger for LiPo/Li-Ion batteries
It is necessary to keep into account that the recharge system used by LiPo/Li-Ion batteries is very different from the one used by NiMh or hermetic Lead-acid batteries, thus you have to read up correctly before adopting any kind of batteries for your own project.
As regards autonomy, the calculation is quite a simple one, even though the thing gets complicated in the cases of “multi voltage”; in general it is enough to operate a division between the global capacity of the battery (expressed in mAh) and the circuit power consumption (expressed in mA) so to obtain the autonomy time (expressed in hours).
For example, an hermetic 12 V 2400 mAh Lead-acid battery, powering a circuit requiring 12 V 300 mA overall, guarantees a maximum autonomy of 2400/300=8 h(ours).
LiPo/Li-Ion batteries have the peculiarity to be able to deliver, even if for a very short time, current for values that are definitely greater than their nominal value, therefore they are very used in fields that require high inrush currents. On the other hand, they do not lend themselves for the creation of the so called “buffer” applications, that is to say, when a circuit is normally powered by the electric network and the batteries, constantly kept under charge, are used only when the power goes out (for example, in domotic installations), since they would get damaged in a very short time.
In these cases, the most suitable batteries are Lead-Acid ones, while NiMh or, worse, the older NiCd, suffer from the so called memory effect, thus it is better to use them until they are fully discharged to recharge them again.
For the usage as buffer, the Lead-acid batteries are definitely advisable, since they can be left constantly under charge, thus lending themselves to the task.
There are however recharge control circuits, very sophisticated ones, that in some cases allow some exceptions to what has been stated above.
THE INPUTS FOR POWERING
Now that we have quite a clear idea of the possible external power sources, we may see how to apply them to Arduino. Everything we will describe in this paragraph can be applied to all the kind of sources previously described, thus both power supplies and batteries. We point out again the need to pay maximum attention to the polarities: it is very important to connect properly the positive and the negative poles to the Arduino board, otherwise there is the risk to see nothing work or even to make irreparable damages. In fact, while in some cases there are some intrinsic protections on the board, in other cases the polarity inversion might cause immediate damages!
Arduino has four possible powering inputs:
Arduino’s powering inputs
1 – USB Port: 5 V have to reach this socket (different voltages are not allowed, absolutely!), coming from a computer’s USB port, or from any power supply that is provided with a USB port (in general, they are small size power supplies, suitable to power devices that are provided with a USB cable). If the powering comes from a computer, there is a current limitation of 250 mA or 500 mA, depending on the USB port of the said computer; if on the other hand you are using an external power supply, the maximum output current (regardless of the one guaranteed by the same power supply, that in general is a maximum of 1 A or 2 A) is anyway limited to 500 mA by the PTC self-resettable protection fuse.
2 – JAPAN JACK socket: an external source (a power supply, usually) must be connected to this socket, with the positive pole going to the central part of the jack, and the value must be ranging between 6 V and 20 V, even though the range recommended by the manufacturer is 7÷12 V, thus it is not advisable to use voltages that are lower than 7 V or greater than 12 V, if not in the case of a real need; 6 V may not guarantee a proper stabilization on the part of the regulator, it is in fact needed to consider the voltage fall of the protection diode, placed in series at the regulator’s input (whose purpose is to preserve the board from destruction in the case of polarity inversion on the jack); while values above 12 V would create an excessively high drop-out (an electric potential difference between the regulator’s input and output) that would cause a pointless overheating of the regulator, even with low levels of current draw.
3 – Vin socket: this socket has a dual function.
3a – input for external powering, not protected by polarity inversions: in fact the connection goes directly to the regulator’s input and below the JACK socket’s diode; of course no voltage must be applied to the jack socket, otherwise dangerous conflicts might arise;
3b: output from which to draw the voltage applied to the JACK socket, detracting the protection diode’s fall. It might prove useful to power small loads, requiring a voltage higher than 5 V and equal to the one applied to the JACK socket (always considering the diode’s voltage fall).
In both cases the voltage negative pole can be found on the board’s GND sockets.
4 – 5 V socket: it is directly connected to the regulator’s output, thus the 5 V to power external loads to Arduino can be drawn from it. In the case voltages are not applied to the USB Port or to the JACK socket, the 5 V socket can be even used to power Arduino directly, if having an external stabilized 5 V source. One has to consider that, in general, regulators do not like voltages being applied to their output, but in this particular case this situation turns out to happen even when powering Arduino from the USB port, therefore we may assume that the designers judged this problem as harmless. Even in this case there is no form of protection, since both the diode and the PTC fuse are found above this socket and thus they do not have any active function. As in the case of the Vin socket, the voltage negative pole can be found on the board’s GND sockets.
NOTE: regardless of the input used, Arduino has a 3.3 V output socket to power loads operating at this voltage; in fact a second regulator, right for the purpose of generating 3.3 V, is directly connected to the 5 V. This socket cannot be used as input.
Arduino is provided with a comparison circuit that controls a type P MOSFET; if a tension is found on Vin (powering from the JACK or from the Vin socket), the MOSFET is interdicted and the possible presence of voltage coming from the USB port is ignored; in the opposite case, the MOSFET will connect the USB port’s 5 V to the 5 V socket, hence below the regulator, thus powering Arduino.
Management circuit of the power conflicts
Therefore it is clear that if you apply the voltage to the USB port and an external source to the JACK socket at the same time, it will be this last one to power the circuit, while the USB connection will keep working for the data exchange with the computer and no longer as a power source. We remind that in both cases the 5 V socket cannot be used as input, but only as output.
THE CHOICE OF THE INPUT
Having now a clearer picture on the subject of the power sources and the various inputs offered by Arduino, it is necessary to decide which of the latter should be used for each specific project. The choice must obviously be made on the basis of the source available, but also on the basis of the external peripherals to be powered.
It must be noticed that, as regards the current delivered, it is important that the source is capable of making it available for as much as needed by the maximum load, to be increased by about 20%, in order to avoid that the said source works at the limits; it then has no importance if the increase is by 50% or even 100% greater; in fact if the power supply is capable of delivering 2 A and the load required is only 100 mA (thus 20 times less), there is no risk to damage things, since the residual power quantity will simply remain “available”.
On the other hand, it is extremely dangerous not to take the voltage into account, since it has never to exceed the limits provided or allowed; for example for no reason it will be possible to apply voltages exceeding the 5 V socket even by a single Volt, since the board’s integrated circuits would burn immediately!
1 – USB Port: this one is handy for experimenting with small loads, requiring 5 V, since it enables the dual function of powering and programming the board; the power limit imposed by the PTC fuse is 500 mA, and actually, these components tolerate up to almost twice the value before a protective intervention, but it is better to consider the nominal value; the polarity on the USB socket is a standard one and thus does not cause problems;
Powering Arduino by means of USB Port
2 – JAPAN JACK Port: in general, one resorts to this port to increase the power availability on the 5 V (within the limits allowed by the regulator) and/or to have available a voltage greater than 5 V, in order to power external loads. For example, if you have to power a 12 V relay, Arduino’s pin alone is not enough, but it can be used to pilot a transistor that will bring, as a conductor, the 12 V needed by the relay. In this case a 12-12,5 V voltage is applied to the JACK socket, Arduino’s board is powered by the regulator’s 5 V and from the Vin socket it is possible to draw 12 V to send to the relay (by means of an appropriate circuital configuration); the positive pole must be applied to the JACK’s central pin, the negative pole to the external one;
Powering Arduino by means of a JAPAN JACK socket
3 – Vin socket: as said before, this one can be useful as input if an external voltage is needed and you only have 6 V available, in fact the Vin socket bypasses the protection diode and the regulator may operate properly; or it may be useful to draw the voltage coming from the JACK socket; considering the fact that the Vin socket is unprotected, its usage by the unexperienced is definitely not advised. The positive pole must be connected to the Vin socket, the negative one to the GND. In figure you can see Arduino powered via the Vin socket on the left, while on the right it is powered by means of the JAPAN JACK socket and from the Vin the voltage to light a LED is drawn.
The Vin socket used as input or as output
4 – 5 V socket: even in this case it should be preferable to resort to drawing rather than to inputing voltage, given the enormous risks that are taken when missing protections; one of the possible situations in which this socket comes in handy is the one of having a stabilized 5 V power source but without a USB jack; as previously seen it is necessary to apply at least 7 V to the JAPAN JACK socket and at least 6 V to the Vin socket, thus this socket is the only one capable of accepting 5 V exactly. Going back to the relay example, if having the availability of a model operating at 5 V, but that requires a greater power than the one delivered by one of Arduino’s pins (that cannot exceed 30-35 mA), even here the problem would be solved very well with a transistor and by drawing 5 V from this socket. The positive pole must be connected to the 5 V socket, the negative to the GND.
The 5 V socket used as input or as output
THE LIMITS OF THE CURRENT
Let’s start by remembering that you cannot pretend to power a load requiring a certain current, without the source being capable of delivering it, and that any load draws the power it needs and not the available one. Let’s see some examples, assuming that Arduino will draw the maximum possible (200 mA), the rest is then absorbed by the external components:
a – Global current consumption of 400 mA; in this case it is possible to power everything via USB, on the condition that the computer’s port (or the power supply with USB output, used as its substitute) is capable of delivering all the 500 mA considered as maximum limit;
b – Global current consumption of 600 mA; in this case it is NOT possible to power the circuit via USB since we saw that the limit set by the PTC protection fuse is of about 500 mA; we have then to resort to an external source applied to the JACK port, one that is capable of guaranteeing a current that is greater than the one required by at least 20-30%, thus for a total of at least 600-700 mA, and as stated before the exceeding current available is not used. The voltage for the peripherals can be drawn from the 5 V pin. As already seen, however, the USB connection may be kept for the programming of the micro or for the usage of the serial monitor.
c – Let’s see the case in which the total drawing is 1A; even in this case we have to resort to an external voltage to be applied to the JACK, but as we will see in the next paragraph we are operating at the extreme limit of the regulator, thus it will be needed to separate Arduino’s powering from the one of the external loads.
In the case in which there are no peripherals requiring a voltage greater than 5 V, for example 12 V, it is needed to resort to an external power supply, applied to the JACK socket, but to understand how to draw the two voltages one must always assess the currents drawn by Arduino and the 5 V and 12 V loads. Let’s see some examples:
d – Let’s see the case of Arduino (200 mA), with 5 V (50 mA) peripherals and 12 V (300 mA) peripherals; by applying a 12 V power supply with at least 1 A maximum current, the limits of the regulator (that we will see in the next paragraph) enable us to power Arduino and its 5 V and the 5 V peripherals; as regards the 12 V peripherals, on the other hand we could draw that voltage from the Vin pin;
e – Let’s see the case of Arduino (200 mA), with 5 V (300 mA) peripherals and 12 V(1A) peripherals; by applying a 12 V power supply with at least 2 A maximum current, the limits of the regulator (that we will see in the next paragraph) will impose to power Arduino alone with its 5 V, while it will not be possible to use the Vin pin (see following NOTE), at this point it a different solution should be found.
NOTE: let’s consider another factor, this time concerning the Vin pin; apparently there should not be limits of deliverable current, in addition to the one imposed by the applied power supply; however all the current will have to flow within the protection diode, that is anyway quite sturdy, but de facto one has to consider that the copper track, that connects the regulator’s input to the Vin pin placed on Arduino’s POWER header, is not very thick and consequently may not endure high currents, as it would risk burning.
THE REGULATOR’S LIMITS
We now have to face the problem of the power the regulator has to dissipate; by reading the specifications on the data-sheet of the NCP1117ST50T3G regulator in the SOT-223 case (the one used on Arduino UNO r3) it can be seen that the maximum operating temperature is 150°C (being a “maximum rating” value one should keep himself at about 20% under it, thus let’s consider 120°C); it can also be read that the regulator reaches a temperature of 67°C for each Watt to dissipate, thus we can reasonably consider a maximum power to be dissipated of about 2W (actually the formula on the data-sheet calculates 1,87W at 25°C). We have already seen how to calculate the power by means of formulae; by opportunely moving the terms we can calculate the maximum deliverable power: for example I = W / (Vin-Vout). Let’s see some examples:
– 12 V Power Supply: I = 2 / (12-5) = 2 / 7 = 285mA
– 9V Power Supply: I = 2 / (9-5) = 2/4 = 500mA
– 7 V Power Supply: I = 2 / (7-5) = 2/2 = 1A
These calculations do not take into account the fall on the input diode, but are however based on a power that is greater than the advised one, thus we may consider them to be reasonable. It can be clearly inferred how it can be definitely preferable to apply the lowest power possible to the regulator.
In the previous “b” example, in which 600mA were needed, it can be well understood h now how voltages greater than 8V cannot be applied to the JACK, while in the “c” example we are definitely at the limits, even applying 7 V at the input, thus in this case we cannot think to make all the current flow through the regulator, but a different system has to be thought of; the same goes for the “e” example, while we have seen that the “d” example lends itself to the usage of a single internal power.
POWER SOURCES THAT ARE EXTERNAL TO ARDUINO
In the previously seen examples, we verified possibilities that go beyond the limits of the internal regulator and even of Arduino’s tracks; in these cases a possible solution is the one to create an external board that makes available a series of outputs to power both Arduino and the external peripherals operating at 5 V or other voltages (typically 9 V or 12 V).
– Let’s consider the “c” case: 5 V 1 A are needed, since 200 mA are allocated to Arduino and 800 mA to the 5 V peripherals; for example there can be a 9 V source with a deliverable power that has to be about 20-30% more, for example a 9 V 1,5 A or 2 A regulated power supply; it will be enough to create a small board with an input that is compatible with the power supply jack, below it uses a 5 V regulator (for example the classic 7805 with a TO-220 case and the typical four capacitors), whose exit will go to power the external 5 V peripherals; the 9 V from the external power supply will be brought as output as well and will be connected to a JACK pin for Arduino’s socket.
High power consumption 5 V circuit plan
– Let’s consider the “e” case: 5 V 500 mA are needed (200 mA are allocated to Arduino and 300 mA to the 5 V peripherals), and 12 V 1 A by the 12 V peripherals; for example there can be a 12 V source with deliverable power of at least 2 A; it is enough to create a small board with an input being compatible with the power supply jack, below a 5 V regulator is used (for example the previously seen 7805), whose exit will go to power the external 5 V peripherals; the external power supply’s 12 V will be brought as output as well and split on two sockets: one to be connected to a JACK pin for Arduino’s socket and the other one to be connected to the 12 V peripherals.
High consumption 5 V and 12 V circuit plan
NOTE UPON ARDUINO YÚN
In conclusion of this article, let’s leave a particular note concerning Arduino YÚN, given that, even if requiring 5 V, it has a powering system that differentiates it from all the other boards. Since it does not have a power regulator on board, it can be powered exclusively with regulated 5 V power sources:
- by means of its micro-USB port;
- by means of the Vin pin, to which we need to supply 5 V exactly, just because a power regulator below is missing.
How to power Arduino YÚN
Finally, we have to keep in mind that, on the contrary of other Arduino boards, YÚN cannot be powered by the 5 V pin on the lateral header. In fact, as it can clearly be seen on the original electric plan (pag. 5) on the 5 V pin, Arduino YÚN has a diode (D9) that allows the current to flow only as an output.
Sponsored Techno Tip: Arduino programmers can stay 24*7 productive by moving their programming and testing environment into the cloud with XenDesk with top-notch support from one of the best provider of cloud based solutions – Apps4Rent.