UNO R3/Power/04. Four ways to power it
Power · 04 of 6

Four ways to power it

The UNO takes power through the USB-C socket, the barrel jack, the VIN pin or the 5V pin, and all four end on one 5 V rail. Each has different protection in front of it, and the pin with the least is the 5V pin. A comparator decides between USB and the jack, and the rule it uses is one number: 6.6 V.

One rail, four doors

Everything on the board runs from one 5 V rail: the ATmega328P, the lamps, the LM358, and the XC6206 that makes 3.3 V. The rail is also the 5V pin on the power strip, the IOREF pin next to RESET, and pin 2 of the ICSP header. Power gets onto it four ways, and what sits in front of each is different.

Way inWhat is between it and the rail
USB-Ca 0.5 A resettable fuse, then a MOSFET switch
Barrel jacka diode, then the 5 V regulator
VIN pinthe 5 V regulator only
5V pinnothing

Who feeds the rail

Who feeds the 5 V rail
USB only
What is plugged in
VIN
0 V
Q2 (USB switch)
on
5 V rail
just under 5 V
Serial port
yes
USB feeds the rail through the fuse and Q2. VIN is 0 V, under 6.6 V, so the LM358 holds Q2 on. Everything on the board shares the fuse’s 0.5 A, and the rail sits a little under 5 V after the fuse and the switch.

Pick a source and follow the moving line. Three of the six cases are the board working as designed. The other three are the ones to understand before wiring anything to VIN or 5V.

USB-C

The socket's 5 V goes through F2, a resettable fuse that holds 0.5 A, and then Q2, an FDN340P P-channel MOSFET, onto the rail. Two 5.1 kΩ resistors on the socket's CC pins tell a USB-C charger or computer to send 5 V, so a C-to-C cable works as well as an A-to-C one.

The CH340C, the chip that is the serial port, is fed from between the fuse and Q2. It has power when a USB cable is in, and the computer sees a port. That matters on the jack: with no USB cable the sketch runs, and nothing can read what it prints.

The rail on USB sits a little under 5 V, after the fuse's resistance and the switch's. Measure the board's own supply reads it from inside the chip.

The barrel jack

The jack goes through D2, an SS14 Schottky diode, to the VIN net, and VIN feeds U1, an AMS1117-5.0 regulator, which makes 5.0 V for the rail. The diode is the reverse-polarity protection: a supply wired the wrong way round meets it backwards, nothing flows, and the board stays off and undamaged. It costs under half a volt.

The regulator needs about 1.1 V more at its input than at its output. Take off the diode's drop as well and the jack needs at least about 6.5 V to make a steady 5 V; 7 V gives some margin. The top of the range is the regulator's datasheet, which recommends no more than 12 V at its input. Between 7 and 12 V everything works, and the lower end is better, because every volt above 5 is turned into heat. The next article works out how much.

The switch between them

Plug in both and only one feeds the rail. Half of the LM358 compares VIN, halved by two 10 kΩ resistors, with the 3.3 V rail. When VIN is above 6.6 V the LM358 turns Q2 off and the regulator feeds the rail. Below 6.6 V, which includes no supply in the jack at all, Q2 is on and USB feeds it.

So with a 9 V supply in the jack and the USB cable in, the jack powers the board and USB only powers the CH340C. Uploads and the Serial Monitor work as usual. (A 7 V supply leaves VIN right at 6.6 V, so with USB in as well either one may end up feeding the rail; both work.) This is the arrangement to use when a sketch needs more than USB can give and still needs to print.

The VIN pin

The VIN pin is on the VIN net, after the diode. A supply on it feeds the regulator exactly as the jack does, with the same 7 to 12 V range, and none of the protection: wired the wrong way round, it reverses the regulator's input, and nothing stops it. With a supply in the jack, the VIN pin carries the jack voltage less the diode's drop, which is how a shield gets the raw supply.

In this book, nothing is ever wired to VIN.

The 5V pin

The 5V pin is the rail. A supply on it powers the board with nothing in between: no fuse, no diode, no regulator. It has to be a regulated 5 V, the right way round, because whatever it is reaches every chip on the board directly.

It also reaches backwards. Q2's built-in body diode points from the USB side to the rail, so while Q2 is off it stops the rail feeding back into the USB socket. But Q2 is on whenever VIN is below 6.6 V, which is always when the jack is empty, and a MOSFET that is on conducts both ways. A supply on the 5V pin then also powers the CH340C and appears on the USB-C socket's 5 V pin. Plug a cable from there to a computer and two 5 V supplies are joined through Q2 and the fuse: whichever is higher pushes current into the other, and the other is the computer's port.

Power the board from the 5V pin or from USB, never both. Better still, power it from USB or the jack, which have protection in front of them, and use the 5V pin the other way round: as an output, which is the next article.

When it does not work

Nothing lights with a supply in the jack

Check the supply first: it must be DC and at least 7 V. A plug wired the wrong way round meets the SS14 diode backwards, and the diode blocks it, so the board stays dark and undamaged. Swap to a supply with the right polarity.

On the jack the ON lamp lights but the board keeps resetting

The supply is too low or sagging under load. Below about 6.5 V on the jack, the AMS1117 cannot hold 5 V, and the rail falls with the supply until the chip resets. Use 7 to 12 V, and check the supply's rating against what the board and its load take.

On the jack alone there is no serial port

The CH340C is powered from the USB side, so with no USB cable there is no serial port for a computer to see. The sketch still runs. Plug the USB cable in as well: above 6.6 V the jack keeps powering the rail and USB only feeds the CH340C.

Everything stops when I connect something, and comes back after unplugging

On USB, the resettable fuse has tripped: whatever you connected took more than the board can pass. It resets itself once the load is removed and it has cooled for a while. Find out what the load draws before plugging it in again.

The computer complains about the USB port while a supply is on the 5V pin

The two supplies are joined through the USB switch, which is on whenever the jack is not powering the board, and current is flowing into the computer's port. Unplug one. Power the board from the 5V pin or from USB, never both at once.

Where this goes next

How much current the board can hand on, from USB and from the jack.

The 5V and 3V3 pins →

Edit this page — content/books/uno/four-ways-in.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

UNO R3 USB-C (ATmega328P)

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum →