arduino:external-power-supply
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | arduino:external-power-supply [2024/11/22 12:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Power Arduino Nano with an external power supply ====== | ||
+ | {{htmlmetatags> | ||
+ | metatag-description=(Power Arduino Nano with an external power supply) | ||
+ | }} | ||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | The issue of powering an electronic circuit may seem more or less trivial. Yet, powering an Arduino project may not be such a straight-forward task. Just think about the case where you are powering your device with an external power supply connected to the '' | ||
+ | |||
+ | This article provides a solution to this problem, with an easy and inexpensive solution. | ||
+ | |||
+ | < | ||
+ | WARNING: | ||
+ | This article refers only to Arduino Nano. | ||
+ | |||
+ | For a discussion regarding Arduino UNO, see below | ||
+ | </ | ||
+ | |||
+ | ===== Schematic ===== | ||
+ | |||
+ | {{arduino: | ||
+ | |||
+ | //Handmade schematic?// | ||
+ | |||
+ | Let's have a look at the power circuit within Arduino Nano. This is presented in the dotted box of the schematic. Note that I have excluded capacitors and other components of the power circuit because I want to focus on the principle. You may look at the official Arduino schematics if you need more details. | ||
+ | |||
+ | The Nano can be powered via the USB socket. In that case, current flows through a fuse that protects your computer from over-current, | ||
+ | |||
+ | The Nano module provides another option to be powered through pin '' | ||
+ | |||
+ | The output of the LM1117-5.0 and the output of the schottky diode are connected together and they can both power the internal circuitry. Either of them can by itself power the Nano, or even both of them at the same time. The circuit voltage will be the higher of the two sources. The schottky diode makes sure that current from the power source connected to Vin will not flow through the USB port. Unfortunately, | ||
+ | |||
+ | Well, in " | ||
+ | |||
+ | **WARNING: | ||
+ | It is typical in new designs and repairs of old circuits to power the Arduino from a power supply that is also used for other purposes. Consider the case where you want to update your Arduino code, in-circuit. You turn off the power supply and connect a USB cable from your PC to the Arduino USB port. Although your intention would be that only the Arduino will power-up, you will find yourselves in a situation where your PC is providing power to all external circuitry that happens to be connected to Vin! A solution to this problem is easy and can be implemented using the method that I describe below. | ||
+ | | ||
+ | |||
+ | Now, let's go to the '' | ||
+ | |||
+ | An opposing argument would come from the Documentation section of the [[https:// | ||
+ | |||
+ | < | ||
+ | Power | ||
+ | The Arduino Nano can be powered via the Mini-B USB connection, | ||
+ | 6-20V unregulated external power supply (pin 30), or 5V regulated | ||
+ | external power supply (pin 27). | ||
+ | The power source is automatically selected to the highest voltage source. | ||
+ | </ | ||
+ | |||
+ | This states that the Nano can be powered from a 5V regulated external power supply on pin 27, so why do I believe that the pin is OUTPUT only? Because our designs must take into account all possible | ||
+ | |||
+ | |||
+ | |||
+ | Now, we are getting to the real problem. What happens when the peripherals are Ethernet boards, relay boards etc that consume power exceeding the capabilities of the Nano? An external power supply is needed. Most peripherals designed for Arduino are powered by 5V. We end up with a situation where we need a 7-12V supply for the Arduino and another 5V supply for the peripherals, | ||
+ | |||
+ | On top of that, LM1117 is a linear regulator. This means that the voltage difference between its input and its output is consumed as heat. This is really bad, especially when you are forcing the component to work close to the limit of 800mA, where the device suffers from the high temperature. There is absolutely no thought for enhancing the component with a heat sink, because of the limited space. | ||
+ | |||
+ | The above issues make several project designers who are already using an external 5V power supply for all devices of their project to take the short path and power the Nano via the 5V pin. This arrangement will work, provided that the designer has made sure that the USB port will never be used. But if not, disaster is just waiting to happen. And we all know that software development is a never ending process, requiring updates for bug corrections and upgrades. | ||
+ | |||
+ | The solution is very simple, inexpensive and I believe it is compliant to the Arduino architecture. If the external power supply is not directly connected to the 5V pin but through a diode, all three power sources (Vin, USB and the external power supply) will be protected from receiving inbound currents, thus protecting both themselves and the other power sources. | ||
+ | |||
+ | Such a diode should have a very low forward voltage to allow the ATmega to operate within its specified voltage range. Do not consider at all diodes such as the common 1N4001-1N4007. The most appropriate diode in our case is a **1N5817 Schottky Barrier rectifier** which has a very low forward voltage drop and is able to withstand a maximum current of 1A. Another diode of the same family, 1N5819 can also be used, although its characteristics are not so good as the 1N5817. Both diodes have the same price and are easy to find in stores. | ||
+ | |||
+ | In my projects with an Arduino Nano, I always include a 1N5817 diode and use it exclusively for powering the Nano module. All other devices are powered directly by the external power supply, as shown in the schematic. This provides the capability to separate the power feeds and use bypass capacitors at each point of the circuit where they are required. | ||
+ | |||
+ | Remembering also the problem in back-powering circuits from USB to Vin that was discussed above, if we wish to power our circuit through Vin, we can also use a diode at the point of entry to Vin. This will ensure that current will never flow from our Arduino to other circuits. Any diode of the 1N400x series will do, provided that you have 0.7V to spare, otherwise a 1N5817 will do the job. | ||
+ | |||
+ | ===== Can I use it for Arduino UNO? ===== | ||
+ | |||
+ | Arduino UNO, according to its V3 schematic, has a bit more elaborate power circuit where an opamp comparator checks the voltage at pin Vin. | ||
+ | |||
+ | If the voltage at Vin is higher than 6.6V, the comparator blocks a FDN340P MOSFET which normally allows current to flow from the USB power supply to the circuit and therefore, power is provided **only** by the Vin source. But, if Vin is lower than 6.6V, the MOSFET conducts and power is provided **only** by the USB port, since Vin is too low for the NCP1117 regulator to provide a proper 5V output (see note). Due to the fact that MOSFETs conduct in both directions, a voltage applied at the 5V pin might interfere with the USB voltage, creating a condition that we need to avoid for the sake of all power sources. (**Note**: When power is provided by the USB port, the 5V voltage is also applied to the output of the NCP1117ST50T3G regulator. Normally, such regulators require their input to be at least 1 to 2 Volts higher than the input, that is why the value 6.6V has been chosen for the source selection and transition. The Arduino design team has probably tested that the regulator blocks this " | ||
+ | |||
+ | Therefore, the 5V Arduino UNO pin should be used only as Output. | ||
+ | |||
+ | My personal view on the subject is that I would never waste an UNO to operate as a controller somewhere inside a closet. The UNO board is suited mostly for development activities. If you want a pure controller board having the exact same functionality as the UNO, with the same ATmega328p chip but in smaller size and with smaller price, go with a Nano. | ||
+ | |||
+ | ~~DISQUS~~ |