● Tips and Tricks ●  
Electrical Tips and Tricks

Android OTG cable for USB flash HDD mouse keyboard and 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!

All you need are two donor USB cables, one with a female type A end like you'd find text
on a USB extension cable (shown in the first photo here) and one with a male micro B end.
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.
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.

Figure 3

You have to spoil the black wires as you see it in the picture

How to tell if your Android phone or tablet supports USB On-The-Go?
The fastest and most effective solution by far is to install USB OTG Checker, 
a free app that quickly and effectively determines whether your Android phone or tablet supports USB OTG.
You can download it free from Google Play Store.

Figure 4

You can use it also with Arduino.
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 wont be able to test the data connection until you get some code on both the phone and the microcontroller.