How to Protect a Rasperry Pi from a Powered USB Hub

As most readers of this blog probably know, there's a limit to how much current you can pass through a Raspberry Pi. When used with a WiFi dongle, mouse and keyboard, a connected Hard Drive or external webcam can be all too much - so it's best to power them from their own supply. With the smaller models like the Zero, anything beyond a single attached device might need external assistance.

Cognisant of this, a while back I used a powered USB hub to attach a webcam to a RasPi A+. When I plugged the hub into the Pi, I noticed the RasPi powered up - despite the lack of its own power source. Everything looked ok - the Pi worked, the camera worked, and the WiFi dongle did its job. It seemed like a great way to cut down on cables, so I left it as it was.

A few weeks later, I read somewhere that by "backfeeding" the RasPi, I was "bypassing the voltage protection circuit" - which in certain circumstances, could damage my Pi. A quick look at the Raspberry Pi official FAQ seems to confirm this.

CAN I POWER THE RASPBERRY PI FROM A USB HUB?

It depends on the hub. Some hubs comply with the USB 2.0 Standard and only provide 500mA per port, which may not be enough to power your Raspberry Pi. Other hubs view the USB standards more like guidelines, and will provide as much power as you want from each port. Please also be aware that some hubs have been known to “backfeed” the Raspberry Pi. This means that the hubs will power the Raspberry Pi through its USB input cable, without the need for a separate micro-USB power cable, and bypass the voltage protection. If you are using a hub that “backfeeds” to the Raspberry Pi and the hub experiences a power surge, your Raspberry Pi could potentially be damaged.

Google Shmoogle

Googling the subject of "backfeed" on the Pi gives tons of information. Some say it's no longer a problem because of added protection circuitry in later models. Others say that USB hubs don't backfeed anymore. Yet others talk about the different standards of USB 1, 2 & 3.

Reading the plethora of opinions, it's easy to get confused. What's current and what's out of date? Which models are protected and which aren't? Does the USB standard affect anything?

As I'm always careful to state in my posts - I'm not a professional, and I write from the viewpoint of "the enthusiastic amateur." As I haven't been able to find a concise, simple and definitive answer, I revert to the source; as long as the Raspberry Pi blog doesn't tell me otherwise, I assume it's an issue with some USB hubs.

So, in simple terms, what's the problem?

It basically boils down to the wiring. When you attach a powered USB hub to the Pi, in some cases, the electricity that's powering the hub "backfeeds" into the RasPi through the USB port. I treasure my Pis and if this could damage them, I'd prefer to find a remedy.

A bit of research revealed that with a tiny adjustment, it's possible to stop backfeed easily. Here's how.

USB Wiring

There are four wires in a USB cable. Two of them carry electricity in and out (+5v and ground) and the other two carry digital data back and forth. This table shows which pins carry which for each type of USB plug - (except Type C).

To eliminate backfeed, you need to make sure that the cable entering your Pi from the hub does not carry current. This is done by interrupting the +5v flow - or in simple terms, disconnecting the wire leading to the USB pin 1. (The other three wires should be left intact.)

El Cheapo USB

We all know we should buy only quality products but the truth is, a powered USB hub isn't something we really want to spend much on. I bought a cheap seven-port hub from a local store that basically does the job. I opened it up to reveal this:

On one side of the board it has five USB sockets.

On the other side, it had two USB sockets, a single USB input (blue), and a barrel power connector.

We will be concentrating on the blue socket. This is the one that feeds into the Pi from the USB hub. When I apply power to the hub, this blue port carries +5v. It is this feed that I want to stop. (Your own hub may have a different USB connector. What's important is that you disconnect the correct terminal. You can see which is Pin 1 from the table above).

In my case, I de-soldered the USB socket, took it out and used a multimeter to locate the base of pin 1. Once I'd checked myself several times, I cut the pin - then re-soldered the socket back on the board.

When I connected everything up with my Pi, I no longer had backfeed, and all my ports were working fine. I'm still not sure if it was absolutely necessary, but at least I'm confident that backfeed is no longer an issue threatening my Pis.

Mike Diamond

Lawyer, writer & author, medical education consultant, and enthusiastic self-taught maker.

Subscribe to What I Made Today

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!