0

I have bought a Raspberry Pi zero and I need a Raspberry Pi hub. The hub is not available in Pakistan. How can i create my own Raspberry Pi hub?

What have I tried?

I connected,below wire enter image description here

to a USB hub, enter image description here

and connected the pin to Raspberry Pi zero but it did not work.

  • 2
    Do you need a USB hub or something else? I bet you can buy one, even in Pakistan. – Dmitry Grigoryev Nov 7 '16 at 12:11
  • @DmitryGrigoryev: I don't need a USB hub. I bought a USB hub and connected it with a raspberry pi zero output wire to USB wire but it did not work. I learned that I will be needing a raspberry pi output pin to usb hub output to work. – fuddin Nov 7 '16 at 12:13
  • You don't need a special hub made just for the raspberry pi. You need one with an OTG plug for the data line. I think you should be able to use a normal hub if you can put an OTG adapter in line with the data plug, but you'd need an adapter. They are not unusual because they can be used with Android phones and tablets. – goldilocks Nov 7 '16 at 12:16
  • What you did with that hub won't work because the hub has only one data connection, see here: raspberrypi.stackexchange.com/a/31840/5538 The data line is the one on the back with the male end. The cord in the first picture is not an OTG cable. It's a normal microUSB cable. You need something that looks pretty much the same but the big end is a female jack. If you search around for "OTG cable" you will see plenty of examples. They are easy to get. However, you could I am sure make one your self -- but you still need to get a female jack. – goldilocks Nov 7 '16 at 12:22
  • See my answer here Key is - as @goldilocks suggests in his comments and answer - that it will not work as is with the two cables you show in the question. There you would connect the Pi with the micro-usb cable (top figure) and its A-Type connector (plug) to the so called downstream port of the hub (A-Type jack). This is not how USB works. You need to connect to the upstream port of the hub (lower fig., the cable at the hub). That happens to be also an A-Type plug. Either get an OTG adapter cable or resolder the wiring as Goldi' suggests. – Ghanima Nov 7 '16 at 13:34
3

You should be able to, although as per my comments it probably is not necessary; all you need is a commonplace OTG adapter. Based on the wikipedia description, however, you could make one yourself using one end of a normal microUSB cable and a female USB jack from somewhere (here's someone who has), since that is the context: You need to insert the male end of whatever you are connecting to.

There are five lines in a micro-B plug, but only four of them connect to the female jack. The extra one on the male end is simply pulled low by attaching it together with the ground.

enter image description here

Notice the pin ordering on the receptacle (female, here the big type A) is the same as it is looking face on at the plug (male), meaning the lines cross over in the cable. By number they are:

  1. 5V power.
  2. D- (data)
  3. D+ (data)
  4. Ground
  5. Ground

Based on that, you could also snip the cord from the hub you have (or open the case and desolder it, probably a better idea) and attach a micro-B plug.

The sheilding on the small wires inside a USB cable is usually color coded, those should be red for 5V power, black for ground, white for D+, green for D-.

  • By the book (An OTG product must have a single micro-AB receptacle and no other USB receptacles.) an OTG device should have an micro-AB (and not an micro-B) jack and the OTG cable should have an micro-A plug (not an micro-B). The Pi however has an micro-B jack and the adapters that ship with it have a micro-B plug. It would seem that neither the Pi nor other devices really care about the spec. So your answers seems to be right - in the real world. – Ghanima Nov 7 '16 at 16:08
  • @Ghanima I have a stack of Android devices here from various big names that will work as OTG hosts and they all follow the same pattern: micro-B jack. So obviously the industry did not really go with the microAB type receptacle -- possibly because that jack is square and the big ones are confusing enough having to peer into to determine which way is up so you don't snap something. – goldilocks Nov 7 '16 at 16:29
  • Yeah, the article states that many devices use A over AB. – Ghanima Nov 7 '16 at 16:31
2

Note that the very same hub you have bought exists in OTG variant as well:

enter image description here

This one should work with RPi Zero just fine. Check out the shop you got your hub from: perhaps they have the OTG model as well and are willing to exchange the hub you have bought for the one you actually need. Or just keep the hub you got for your laptop, and buy a new one for the RPi.

Another solution is to buy an OTG cable which will enable you to use the hub you have:

enter image description here

As a final note, if you want to connect something more power-hungry than a mouse and a keyboard, you should really consider buying an externally powered hub.

  • 1
    Thanks. I found this hub here: aliexpress.com/item/… – fuddin Nov 9 '16 at 16:06
  • @FahadUddin Yep, that looks good. You only get 2 USB-A sockets, but that's probably enough. Note that this hub is powered: you can provide extra power via the female micro USB connector if you connect power-hungry devices like HDDs and WIFI / 3G dongles. – Dmitry Grigoryev Nov 9 '16 at 16:21
  • I can connect another otg to usb in the otg cable get 1 more usb port. Can't I? – fuddin Nov 9 '16 at 16:48
  • Technically, yes, practically - no. You'll probably face power issues, and if the hub is well designed, it will even refuse to enumerate. It's against USB spec to plug an unpowered hub into another unpowered hub. – Dmitry Grigoryev Nov 9 '16 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.