Mickel
Posts: 3
Joined: Tue Jan 10, 2012 7:52 pm

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 8:15 pm

Hi, new to the forum and currently in the planning stage for my R-Pi !

I have a few questions, some related to USB and how it works.

1) Can one of the R-Pi's USB ports power a non-externally powered USB-hub with 4 ports.

I plan to connect a WiFi-dongle, flash drive, keyboard/mouse receiver and then leave one port free for future use.

I've read that one USB port only puts out 500 mA, will this be enough?

2) If this isn't enough, can I wire my PSU so that it send power through the R-Pi's second USB port, onto the board and out through the first port and help drive this hub, or do these ports have separate 5V lines?

3) What exactly does a non-externally powered USB-hub do? Are the ports' wiring simply connected parallelly? Does it contain any logic or is that taken care of by the USB-controller on the R-Pi?

Below is a sketch of the above. If this doesn't work, would one solution be to buy an externally-powered hub to tear down, and feed the 5V lines directly via my R-Pi PSU? I'd rather not have 1 PSU for the R-Pi and one for the hub.

Thanks

http://i44.tinypic.com/kug5j.png

BlueClogger
Posts: 34
Joined: Mon Dec 26, 2011 11:01 am

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 8:32 pm

You might get away with just the peripherals you mention, particularly if you are using a wireless keyboard/mouse, but remember that the Pi draws several hundred milliamps on top of your USB devices, all of which will need to be provided by your PSU. If you add something like an exernal HDD you will almost certainly run into problems.

As far as I am aware the 5V line connects to the USB ports through the voltage control circuitry and fuse, so your #2 suggestion would not be advisable, as it would bypass this protection.

There is some circuitry in a USB hub, but it draws minimal current.

error404
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 8:38 pm

1) Yes, but obviously the power available to connected devices will be limited. IIRC the minimum power a device can reserve is 100mA, and that includes the hub, so (if that's right) all of your connected devices must reserve the minimum or be self powered for all 4 ports to work. The flash drive and keyboard dongle are probably okay, but I think most WiFi cards use quite a bit of power.

2) As long as you can provide 5V and sufficient current to the hub, it will be happy. It's fine if that power comes from the same supply driving the Pi, as long as it's rated for sufficient power output to handle the load you put on it. Driving the hub from the second USB port should work, but personally I would probably prefer to drive the Pi from the hub and just provide power to the hub. You will need a hub designed to take external power though, as a non-powered hub will be programmed to respect the power limits of USB and won't be aware that you're providing it external power, so your devices will fail to initialize if there isn't enough power available.

3) USB hubs aren't passive, you can't just parallel the lines and expect it to work. So they negotiate that, as well as managing power budgets and a few other things.

Mickel
Posts: 3
Joined: Tue Jan 10, 2012 7:52 pm

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 9:19 pm

error404 said:


1) Yes, but obviously the power available to connected devices will be limited. IIRC the minimum power a device can reserve is 100mA, and that includes the hub, so (if that's right) all of your connected devices must reserve the minimum or be self powered for all 4 ports to work. The flash drive and keyboard dongle are probably okay, but I think most WiFi cards use quite a bit of power.

2) As long as you can provide 5V and sufficient current to the hub, it will be happy. It's fine if that power comes from the same supply driving the Pi, as long as it's rated for sufficient power output to handle the load you put on it. Driving the hub from the second USB port should work, but personally I would probably prefer to drive the Pi from the hub and just provide power to the hub. You will need a hub designed to take external power though, as a non-powered hub will be programmed to respect the power limits of USB and won't be aware that you're providing it external power, so your devices will fail to initialize if there isn't enough power available.

3) USB hubs aren't passive, you can't just parallel the lines and expect it to work. So they negotiate that, as well as managing power budgets and a few other things.



Thanks for your replies. I don't really understand what you mean with the minimum reserve. I've read somewhere that flash drives normally use 60-80 mA, does that mean that even though it doesn't use 100 mA is will reserve this which cannot be used by other devices? So the 500mA from the USB port will have to be shared by the hub and 4 ports, splitting the avaliable current to 5x100 mA? 100mA for the hub 100 mA per port?

Perhaps if I plug the wifi into the first USB port and the hub in the second, that would leave 500 mA for the wifi alone and 500 mA for the hub to be shared, right? Or is the 500 mA rating for both USB ports?

The PSU I have is a switching mode 2A at 5V. I plan to get the R-Pi B, so that's 700 mA, 60-80 for the flash drive, keyboard receiver and wifi are unknown to me but that leaves me with 1220-1240 mA for those 2 units which I think is more than enough.

Thanks for reply nr 3, I had almost suspected that it couldn't have been that easy

error404
Posts: 351
Joined: Wed Dec 21, 2011 11:49 pm

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 9:52 pm

Mickel said:

Thanks for your replies. I don't really understand what you mean with the minimum reserve. I've read somewhere that flash drives normally use 60-80 mA, does that mean that even though it doesn't use 100 mA is will reserve this which cannot be used by other devices? So the 500mA from the USB port will have to be shared by the hub and 4 ports, splitting the avaliable current to 5x100 mA? 100mA for the hub 100 mA per port?
USB includes provisions for power budgeting. When a device is attached it requests power from the host, which keeps track of how much power is being drawn from each port. If the requested power isn't available, the host won't allow the device to initialize. Looking at the USB spec now I think I was wrong that 100mA is the minimum since the spec allows for a 2mA resolution, but regardless if you run out of the 500mA/port budget, new (bus-powered) devices won't be able to initialize.

This isn't really managed by actual power draw either, so devices will usually request more than they actually need. You can find out how much power your devices are requesting with lsusb -vv on Linux (or I think somewhere in the Windows device manager). If it adds up to less than 500mA (including the hub) then it should work.


Perhaps if I plug the wifi into the first USB port and the hub in the second, that would leave 500 mA for the wifi alone and 500 mA for the hub to be shared, right? Or is the 500 mA rating for both USB ports?


This depends how the Pi is wired and how its USB hub is configured, so I don't know at this point. That might work though.

Mickel
Posts: 3
Joined: Tue Jan 10, 2012 7:52 pm

Re: Can I power my R-Pi like this? Also USB-related

Tue Jan 10, 2012 10:15 pm

error404 said:

USB includes provisions for power budgeting. When a device is attached it requests power from the host, which keeps track of how much power is being drawn from each port. If the requested power isn't available, the host won't allow the device to initialize. Looking at the USB spec now I think I was wrong that 100mA is the minimum since the spec allows for a 2mA resolution, but regardless if you run out of the 500mA/port budget, new (bus-powered) devices won't be able to initialize.
This isn't really managed by actual power draw either, so devices will usually request more than they actually need. You can find out how much power your devices are requesting with lsusb -vv on Linux (or I think somewhere in the Windows device manager). If it adds up to less than 500mA (including the hub) then it should work.


Excellent, I will be ordering the parts then and see how much power they will use on my PC. Thank you very much.

Rubidium
Posts: 1
Joined: Wed Jan 11, 2012 5:23 am

Re: Can I power my R-Pi like this? Also USB-related

Wed Jan 11, 2012 5:26 am

You want a hub with a lead like this



that will allow the hub to draw power direct from the power source instead of from the pi

Janoz
Posts: 1
Joined: Wed Jan 11, 2012 10:54 am

Re: Can I power my R-Pi like this? Also USB-related

Wed Jan 11, 2012 11:01 am

I might be completely wrong, but a little thinking outside of the box gave me another idea:

Might it be possible to get a powered hub, and use one of the ports to power the R-Pi? In that case you only have the PS foor the hub. For this to work the hub needs to supply power to the outputs regardless of the availability of the host (the R-Pi in this case).

jblood
Posts: 7
Joined: Thu Jan 19, 2012 9:49 pm

Re: Can I power my R-Pi like this? Also USB-related

Thu Jan 19, 2012 10:02 pm

http://www.raspberrypi.org/for.....l-a#p32061

"The simplest way (whatever the internal hw config) would be to get a powered USB hub and cut the power cord, create 2 parallel power lines and use 1 to power the RPi and the other for the hub. : )"

Return to “Other projects”