This simple trick isn’t handy nearly as often as it used to be, but I still see examples of people who haven’t thought of it yet.

It is possible with some powered USB hubs to use the hub itself as the power supply for a Raspberry Pi while the Pi is using the hub for peripherals, avoiding the need for both a powered USB hub that supplies 5 volts over a USB connection and a USB charger that supplies 5 volts over a USB connection… which is a little silly, when you think about it.

The bad news is that it doesn’t work with all powered USB hubs, but it does work with some very good and affordable ones. If you’re in a position to buy a powered USB hub just for the Raspberry Pi, there is certainly no reason to have both a charger/power supply and a powered USB hub hooked into the same Raspberry Pi. If you already have a powered USB hub it may work, if you’re lucky.

Once upon a time, the Raspberry Pi just came with two USB ports, and those didn’t supply a lot of power. Basically, if you plugged in a mouse and keyboard, you were maxed out, and in those days the RPi didn’t have Wifi or Bluetooth built-in. For interactive, as opposed to embedded applications you almost always had to have a powered USB hub. To some degree we’ve gone back to that situation with the Raspberry Pi Zero, although the on-board Wifi and Bluetooth on the RPi Zero W helps quite a bit.

Looking at a powered USB hub, at least every one I’ve seen, there’s a “master” jack for the computer that the hub is supposed to serve.  There has to be one and only one “client” machine for the hub, the rest of the jacks are for the devices serving that machine.

In most cases this “master” jack is different from the others, usually a USB “B” jack or USB “B mini” jack rather than a USB “A” jack, and they give you one USB cord for this jack, with a USB “A” male plug on one end and the USB “B” or “B mini” on the other. Since this is a powered hub, there will most likely be a “wall wart” external power supply plugged into it as well to provide more current at 5 volts to the devices plugged into it than can typically be supplied by a single USB jack. If there is not an external power supply there must at least be an AC power cord.

So, with the hub plugged into an AC wall socket, and the “master” USB cord plugged into one of the USB jacks on the Raspberry Pi, we still have jacks on the powered hub that are ready to supply 5 volts. All of the current Raspberry Pis use a micro-USB jack for to power the Pi itself, so what we need is the common-as-dirt phone charger cable with a USB “A” plug on one end and a USB micro plug on the other, the sort that comes with hundreds of different devices these days, and which the retailers usually call a “charge and sync” cable.

So there are then two cables attaching the Raspberry Pi to the powered hub- the “master” data cable, that being the one “special” USB cable that came with the hub which can be plugged into any of the non-power-input USB jacks on the Raspberry Pi, and an ordinary charge-and-sync cable plugged into any of the other USB jacks on the powered hub with the other end plugged into the power input jack of the Raspberry Pi. You do need two cables.

Of course, the Raspberry Pi Zero series uses a USB 2.0 micro jack for data as well as power, so you’ll need an adapter to plug connect the USB 2.0 “A” plug of the cable that came with the hub to the micro-USB jack of the RPi Zero.

In theory this rig works just fine. In practice… it depends on the powered hub.

The problem is that a great many powered USB hubs do some sort of mode switching when one of the plugs starts to draw power, or exceeds some threshold in drawing power.

Understand that these hubs were intended to power relatively simple devices, and most of the designers of the hubs assume that these devices won’t care much or at all if the power is interrupted for a fraction of a second while the hub switches modes. That’s almost always true… in the USB world, the simple devices like keyboards and mice draw only tiny amounts of power, and when a device is pulling a significant amount of power it’s usually trying to charge its internal battery. In all of these cases- keyboards, mice, USB thumb/flash drives, Wifi and Bluetooth dongles, even USB hard drives, the device doesn’t seem to mind if the power drops for a fraction of a second while the device is powering up.

Now, however, we’re pushing the envelope. We are actually trying to use the USB hub as the power supply for a computer, and non-laptop/notebook computers care a great deal if the power switches off for a fraction of a second while they’re powering up. What happens is they go into a “boot loop”, where the Raspberry Pi starts to power up, but as it draws power (or as an attached USB hard drive draws enough power to exceed a threshold) the USB hub switches modes in order to accommodate the demand, but the act of switching interrupts the power to the Raspberry Pi, which starts the boot cycle all over again, and this repeats until you intervene to stop it. You can’t really blame the hub designers too much for this, they didn’t really anticipate their device being used as a computer power supply.

However, there are a number of models of powered hubs that do not have this problem and work fine. Well known among these are a couple from a company called Plugable.

The most affordable and available of these right now seem to be the USB2-HUB4BC which currently sels for about $17 on Amazon and is listed as “Plugable USB 2.0 4-Port High Speed Charging Hub with 12.5W Power Adapter and BC 1.1 Charging Support for for Android, Apple iOS, and Windows Mobile Devices” (one of the available photographs of it in the Amazon listing actually shows it powering a RPi), and the USB2-HUB-AG7 which currently sells for about $17-18 on Amazon, and is listed as “Plugable USB 2.0 7-Port High Speed Hub with 15W Power Adapter”. I’ve had a couple of these for years and used them with a lot of Raspberry Pis, no issues at all. Yes, you go from four to seven pors and gain a little power for one dollar. On the other hand, if the 4-port is all you really need, it can save some space.

Plugable as a company has in the past taken this issue seriously and addressed the Raspberry Pi specifically, which nearly no other hub manufacturer seems to. They published some guidance as to which of their products are usable as power supplies for the Raspberry Pi here. It doesn’t seem to have been updated for a while, but then, I’m not sure how often they come out with new products.

For other brands, you can search on-line for information if you’re shopping, but you’ll likely just have to try it if you already own it.

– Robert the Wombat

Powering a Raspberry Pi from a Powered USB Hub While it Uses the Hub
Tagged on:         

Leave a Reply

Your email address will not be published. Required fields are marked *

Sorry about this hassle, but we had a LOT of bots registering: