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

image03

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!

Steps

Step #1:

PrevNext
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:

PrevNext
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:

PrevNext
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:

PrevNext
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.

blog comments powered by Disqus