Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!


In order for your Android phone or tablet to host a USB device such as an Arduino, you need a USB On-The-Go (OTG) cable. You can buy these for a few bucks online, but if you have old USB cables around it’s more fun to make one!


Step #1:

Make Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) Cable
  • All you need are two donor USB cables, one with a female type A end like you’d find on a USB extension cable (shown in the first photo here) and one with a male micro B end (second photo). When you’re finished, you’ll have a cable that plugs into your phone on one side and accepts a standard USB cable on the other.
  • First, cut your 2 donor cables to expose the red, black, white, and green wires within, and strip the insulation off the tips.
  • Match up the wire colors from both sides of your soon-to-be Frankencable and solder them together. Insulate the soldered joints from each other using shrink tubing, electrical tape, or hot glue. Don’t forget to connect the braided shielding as well — that’s the uninsulated stranded wire that surrounds the 4 colored wires.

Step #2:

Make Your Own USB On-The-Go (OTG) Cable
  • After splicing the 2 cables together, wrap the junction in electrical tape for protection and strain relief.
  • Many Android phones are USB On-The-Go devices, which means they can act as the USB host (providing power) or slave (receiving power). You want the phone to be the USB host for this project, and you can ensure it acts as such by means of a special Sense pin on the micro B connector.
  • When the sense pin is connected to ground, the USB OTG device attached to the cable enters host mode. If the sense pin is left in its usual disconnected state, the USB OTG device will remain in slave mode.

Step #3:

Make Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) CableMake Your Own USB On-The-Go (OTG) Cable
  • Carefully cut open the micro B end of your spliced cable and solder pins 4 and 5 together as shown in the diagram. Be careful not to bridge any other connections besides pin 4 and 5!
  • Once that’s done, reassemble the micro B plug and tape or glue it back together to complete your cable.

Step #4:

Make Your Own USB On-The-Go (OTG) Cable
  • You can run a quick test of your cable by connecting one end to your Android phone and the other into Arduino.
  • If all is well, the Arduino should power up! If not, unplug both ends of your cable and check for short circuits or loose connections.
  • Note that you won’t be able to test the data connection until you get some code on both the phone and the microcontroller.


  1. Asaj says:

    Would it be possible to make this male to male? It seems like as is, you would have to use another cable to connect the two devices.

    1. RAM says:

      The male to male is a standard micoUSB to USB cable. You can get one in RadioShack or even Walmart, for some $10 USD or less

      1. Trevor Shannon says:

        well, it wouldn’t quite be just a standard microUSB cable. The key here is that the microUSB end has pins 4 and 5 shorted together–that makes it “On-The-Go”. A standard microUSB cable has pin 4 disconnected.

        1. James says:

          Couldn’t I achieve the same result with a standard usb to micro cable by making the usb into a female by taking off the outer cage and bending the prongs slightly?

  2. Me says:

    That depends what you want to hook up. To be useful the device has to have drivers for it. Usually that limits you to USB memory sticks and keyboards. Memory sticks have the male end soldered right onto their ends and so would fit a female USB OTG cable. Keyboards usually have their USB cables attached as well.

    If you want to get fancier with it and hook up other things you probably ahve to compile your own kernel modules. Then.. you will probably need a powered hub too. Does your hub have an attached USB cable or a USB-B Female socket on the back. Only if it’s the latter would a male end on the cable make any sense.

  3. SmokeTester says:

    I’ll have to look into this further, I have an official USB OTG adapter dongle I ordered with my Nexus 7 (N7) for use with my IOIO. If indeed it is just a straight male to female adapter with no electronics inside, then my plans of hacking my Nexus 7 and incorporating a built-in OTG female USB connector would be pretty simple. Of course I’ll need the room inside the N7 which I plan on accomplishing by replacing it’s battery with a smaller one freeing up room for this and some other hacks I’d like to do. Just a matter of finding a smaller battery with acceptable power density at this point.

  4. Graham says:

    This may not work for all devices. For host mode to work properly there is a 5th wire (the id pin) which needs to be grounded for host mode and floating for device mode. So a typical usb cable doesn’t wire out this pin. Its probably better to just spend the $2 and buy one online.

  5. Gobb says:

    It’s possible to charge a device while you are using OTG? How would this circuit look?

  6. tech36 says:

    Wow, it is a cool and creative idea. If you can make your own usb otg cable then lot of money will be save as well as you can earn some penny by making the usb otg cable.

  7. sunny says:

    The device usually only has one microUSB port. And we need to change frequently if we want to use OTG and also the data cable?
    Would it be possible to make one cable that has both of OTG and data functions together?


    1. Trevor says:

      You could make a switch that either connects pins 4 and 5 or disconnects them.

  8. Christopher says:

    I have a Samsung Galaxy tab how can I connect it?

  9. dreadylock says:

    how about micro sb 3.0 femaile to micro usb 3.0 male

    1. Trevor says:

      The micro B connector for USB 3.0 is a completely different shape and is therefore probably incompatible.

  10. Pohchee Kay says:

    I find that Micro USB OTG cables are a-plenty. But what I need is a Mini USB OTG.cable.

    1. I have never seen such a cable. All cables seem to be Micro USB OTG. But my device was released in the cusp between using Mini and Micro USB connectors. After that everything went Micro. Any idea where I can buy one?

    2. The manual does not say anything about OTG but I have a Mini USB keyboard, meaning the device can act as host. Hopefully with a Mini USB OTG cable I can use other USB slave devices like thumb drives.

    3. If I cannot buy that, can I get a donor Female Mini USB cable and cut it as you tell us to do with the Micro USB cable? Or, better still where can I buy a Mini USB connector with solder terminals?


  11. E.ddie T.orres says:

    You have to say “no homo” after something like that lol.

  12. Haseeb says:

    Respected Friends,
    I have Panasonic LCD which Includes two HDMI ports, it is possibl that i connect this OTG cable to my LCD, and connect USB Flash Drive in it, kindly give me reply and solve my problem, sorry for poor English .

  13. Doug N6TQS says:

    What I need, and will probably have to figure it out, is a powered hub that can also power the “host” while giving multiple USB ports. I have a new Lenovo Mix 2 8 Windows 8.1 tablet to play with.
    If anyone has any hints, I’d appreciate it.

      1. Doug Faunt says:

        That’s close, but not it, if I read the specs correctly. The microplug is only to charge an device from the computer’s power. Data and the power source is on the A plug.

  14. Kriss says:

    You can buy it very cheap at Serwis komputerowy Opole. Not worth doing yourself

  15. Landon Galbraith says:

    I need a cable that has a male micro usb as the main, and a female USB as well as a female micro usb on the two ends of the Y. This is so I can use both a keyboard( plugged into the female micro USB) and a wireless mouse( plugged into the female USB) and all of that plugged into my tablet. WILL THIS WORK if the female USB is the bottom of the Y? Where do I get this custom made? I can’t find this anywhere…

    1. Landon Galbraith says:

      I ask will it work because it is the only one I can find:

      This is what I need, but the female USB and male micro USB switched. Help?

    2. Pohchee Kay says:

      Kriss, there is an easier solution. Buy an USB combo mouse and keyboard. If you don’t need tablet size, you can get PC-sized combo for about $25. I have found it to work on three tablets I use, and on every Android phone I have tried.

      This also overcomes the problem that the OTG cable is a hardwire interface. It is not a data interface. You cannot use a hub. Your question, mentioning a Y wire seems to ask if you can run two parallel Type B females from the same microUSB. I don’t know. Can you parallel USB devices? I doubt so. I always use hubs and OTG cannot support hubs.

  16. Greg Hendrick says:

    My problem is that I have a USB device I want plugged into a Nexus7 but I also want to CHARGE at the same time. I want to make an OTG cable that lets me access the USB device and accept a 5 volt POWER input to charge the Nexus at the same time.

  17. ballu says:

    Nt working

In the Maker Shed