image03

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

Project Steps

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.

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.

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.

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.