Software-Controlled Per-Port Power Switching for USB Hubs

[Befi] wanted to add a second stage backup disk to his ODROID embedded-board server, which typically draws ~1.5W at idle. After adding the disk, he saw power consumption increase by 2W when the new disk wasn’t spinning. He thought about using one of those USB hubs with the adorable little rocker switches for each port and replacing them with transistors, but that was going to be messy. After some poking around in the USB standard, he found that most support per-port power switching (PPPS), and set about to hack a USB hub to enable software-controlled per-port switching.

[Befi]’s NEC hub uses a uPD720112 chip which supports PPPS according to the datasheet. After tying the configuration pin labeled GANG_B to +3.3V, the hub declared itself PPPS-compatible. Of course, the manufacturer saved a penny or two by omitting the  individual switches, so [Befi] added an open-drain NMOS to each port. He is using this program to switch the port on and off and made the switching transparent with autofs. [Befi]’s current script has the bus ID and device ID of the hub hard-coded, but he intends to update it to find them automatically. This hack saves him 10W on average, which is about €30 ($40) per year.

If your hub is under powered, you could try adding an external power supply.

33 thoughts on “Software-Controlled Per-Port Power Switching for USB Hubs

  1. 30€ per year? where does he buy the electricity from?!?! that’s crazy expensive.
    It would only save me about 8€. And that is if I had the hub connected 24/7 without ever disconnected in the entire year.

    1. I think he is talking about the devices attached to the hub which can much more power than the hub itself. The whole point of this hack is to turn off power to each of the ports

      1. Really that much though, for 2.5W from a port? I’d like to see the calculation just to be sure. My whole house uses that much over maybe 2 weeks.

    2. Even if only $10/year, that’s $100 over a 10 year life. If the hub manufacturer increased the price by $5 that would more than pay for the missing transistors. Why not make electronics less wasteful? We should be labelling prices for wasted vampire power on all electronics. The worst was a cable-TV box. I calculated about $60/year electricity cost for the DVR, $40/year for plain box, when the unit was turned off (standby). The cable company doesn’t pay the electricity and consumers don’t know power is wasted. We need all product designers to be as clever and resourceful as Befi.

    1. Our juice is a little more expensive but it came out to ~$10/year. Still, the hack is the thing, not the cash. Nicely done!

  2. Don’t know where this guy lives, but the cheapest price for 1kWh over here in the Netherlands is roughly €0.22, or US$0.30. So that’s nearly €20 each year.
    No, it will not buy you a new car, but it’s still quite a lot if you manage to make a save like this a couple of times.

    1. I live in Poland and to save money i simply don’t flush my toilet unless i’m doing a #2. Sure it stinks a bit but it’s better than paying for water.

        1. You’ve forgotten the jingle from the early 1990’s in Los Angeles?
          “If it’s yellow, let it mellow. If it’s brown, flush it down”
          For a few years there, you even had to ask for a glass of water at your diner table.
          Droughts or high water prices make water conservation seem like a good idea.

          1. I’m sure that jingle will be around this year. L.A. needs to quit taking the Norths water and develop better water strategies and management.

      1. It is true that the *average* cost of electricity is usually pretty low, but a good fraction of power companies use tiered billing, so if you can save much more per watt than the national average. Example, I was paying $.08/kw*h for tier one, for the first ~1kw, .012/kw*h for the next ~500w, then $.18/kw*hr for the next ~500w, and $.24/kw*hr for the next ~500w (never got to see what the next tier would have been!), so an average of $.14/kw*hr (roughly average for California), but reducing power consumption was worth $.24/kw*hr, nearly double my average!

  3. Let’s be honest, the cost saving is just a convenient excuse to hack something and make it perform how you want it to rather than to a level the manufacturer thought was “good enough”.

  4. I’m astounded about the stuff that’s available in common chips that are ignored completely, Stereo mic positioning in sound codecs, serial and parallel ports in motherboard management chips, temp sensors in MCU’s, switches in USB hubs, USB support in chips used in routers that don’t supply USB ports, the list is endless.

    1. It’s been like that for a long time.

      Put it another way, how many projects do you see here on HAD that use an AVR actually make use of all of the chips features?

    2. ++ this

      it pisses me off that we are being bombarded by castrated crap because someone decided to save $.20 in parts.
      Rigol power supply EEVBlog’s Dave tested is another example, some retard decided to put LM317 instead of properly speccing power transformer or SMPS chip = whole thing is a big heater and leats to power supply RESETS because lm317 is dissipating tens of watts of heat.

      or every other dump network switch build using same smart switch controller as proper managed switches, but someone decided $.20 serial eprom was too much.

      the list goes on and on.

  5. Please note that one needs to €30 (just like the $) and not 30€. Many Europeans tend to write the Euro symbol after the amount and not before. I think it’s historical since we noted our old currencies after the amount.

    It’s just a detail; and it is a cool hack, thanks for posting

  6. How is this a “HACK”?????

    The rest of the world has been aware of this functionality for about a decade now???

    WHY does HaD insist on posting things like this that have been done a million times over???? Can you guys PLEASE stop posting garbage like this???

      1. You wasted your time hacking up an ancient hub… If you look at the datasheet for a quality/more recent hub controller IC (Think TI/SMSC/VIA/etc), you will see that most incorporate high-side current limited switches inside the IC which can be controlled independently… I think you know this… This has been standard for quite some time. This allows software control of port power for each port individually… You could have just gone out and bought a newer $10 hub and saved a lot of time.

        My rant was targeted at HaD – Calling this a “hack” – There is nothing novel here – To be a “hack”, you must be doing something novel – Something that has not been done before – Something that the device was never intended to do, etc – You simply modified a cheapo hub to mimic a slightly more expensive one – The functionality already existed in the hub controller and you were correct in stating in the writeup that the manufacturer left this functionality out on purpose.

        I wish that this site would publish interesting and novel things. I really like the color scheme, but everything else here is garbage.

        1. Those hubs are quite uncommon. I went to a shop, tested 10 hubs from different manufacturers plus my 4 hubs at home. None of them supported PPPS out of the box. So again, please share your knowledge and give us a link to some $10 hubs that do support PPPS!

          1. And it would not surprise me if the “10 hubs” you tested all used the same crappy hub controller IC… Ignore cheesy un-powered hubs. Any self-powered hub should support this. Find one that uses a quality hub controller. LOOK AT DATASHEETS. I have a 5-year-old D-link hub on my desk that supports this. It is not hard to find.

            Do you want a pat on the back? *pat pat* there you go. Is that what you needed?

          2. oh, so your one hub that you have is those “done a million times over”?
            I havent seen a SINGLE usb hub with PPPS and I fix shit all the time.
            95% of computer crpa swims straight from one hung lo chinese manufacturers, and they remove every non essential component from the pcb.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s