User Tools

Site Tools


You are not allowed to perform this action
arduino:external-power-supply

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 5V pin of the Nano and you are connecting the USB cable because you need to upload a new version of the program. The external power supply and the computer powering the USB port produce a different voltage. Yes, both are around the area of +5V, but different to each other. The one with the lower voltage will have to endure a current that passes through it, which is produced by the higher voltage power supply. Shall it survive? Who is going to be the victim, the external power supply or your precious PC?

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 Nano Power

Handmade schematic? See why..

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, then through a SS13PL schottky diode and then powers the internal circuitry. In Arduino Nano clones, the diode can be an MBR0520 and the fuse may not exist at all. The forward voltage of the schottky diode is very small (in the area of 0.35V to 0.38V) and allows the ATmega controller of the Arduino to work within its voltage specifications.

The Nano module provides another option to be powered through pin Vin. According to the specifications, Vin can range from 7 to 12V. This range is imposed by the LM1117-5.0 regulator which receives as an input a voltage at least 1.2V higher than its output and delivers current up to a maximum of 800mA.

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, the LM1117-5.0 does not present such unidirectional characteristics. Just try powering an Arduino Nano via the USB port and measure with a voltmeter the voltage at Vin. You will be surprised to find a voltage around 4.2V! This means that our PC is trying to source current into the external power supply!

Well, in “normal” circumstances, the power supply connected to Vin should be higher than 7V, so this voltage will block the schottky diode and will power the circuit. Unfortunately, there is nothing normal in electronics. We need to anticipate every possible situation and design our circuit accordingly. It is like software design where 90% of the code is written to cope with situations that may never occur. In the electronics design, the bug is identified by its burning smell!!!

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 5V pin. The pin of Arduino Nano marked as 5V is designed to be an OUTPUT, powering peripheral circuits such as a real time clock, an SD card reader etc. and not as an Input. The total consumption of the Arduino plus the peripherals should not exceed 800mA.

An opposing argument would come from the Documentation section of the official Arduino web site:

  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 circumstances and a combination of multiple modules. For example, if the USB powers the Nano with a voltage of 5.0V and at the same time we have a 4.9V voltage at pin 27, this means that a current will flow from USB into the external power supply. The Nano may not have a problem with that, but the external power supply will most certainly not be happy about this!

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, which is becoming an overkill for our project.

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 “reverse” voltage of 5V and does not allow it to interfere with Vin.)

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.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
arduino/external-power-supply.txt · Last modified: 2019/05/16 20:49 by Ilias Iliopoulos