● 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.
Pinout.net

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.
MFRC-522 RC-522 RC522 Antenna RFID IC Wireless Module For Arduino IC KEY SPI Writer Reader IC Card Proximity Module


TTP223 Touch Key Switch Module Touching Button Self-Locking No-Locking Capacitive Switches Single Channel For Arduino l8


HC-SR501 Adjust IR Pyroelectric Infrared PIR module Motion Sensor Detector Module for arduino for raspberry pi kits + Bracket


10PCS 2.54MM Pitch Single Row Female Pin Socket 2/3/4/5/6/7/8/9/10/11/12/13/14/40Pin PCB Connector Single Row Mother For Arduino


Black CCL Anti-etching PCB Circuit Board Ink Marker Double Pen For DIY PCB Repair CCL Printed Circuit Diagram For Arduino


5x7 4x6 3x7 2x8 cm 5*7 4*6 3*7 2*8 double Side Copper prototype pcb Universal Printed Circuit Board Protoboard For Arduino Green


5x7 4x6 3x7 2x8 cm 5*7 4*6 3*7 2*8 double Side Copper prototype pcb Universal Printed Circuit Board Protoboard For Arduino Blue


0.96 inch oled serial blue yellow white OLED display module LCD display board GND SPI I2C for Arduino


2.54mm Single Row Male 2~40P Breakaway PCB Board Pin Header Connector Strip Pinheader 2/3/4/5/6/8/10/12/15/20/40Pin For Arduino


diymore 2/3/4Pin 70cm Dupont Wire Female to Female Jumper Cables Connector for Arduino 3D Printer Reprap


DC 9V Battery Button Power Cable Battery Buckle Snaps Power Cable Connector DC 5.5*2.1 For Arduino Diy


TCRT5000 3PIN Tracking Module IR Infrared Line Reflection Track Follower Sensor TCRT5000 Obstacle Avoidanc For Arduino


18b20 Temperature Probe Temperature Sensor 18B20 Sensor Electronic chip DS18B20 TO-92 chips Waterproof for arduino Diy Kit


ESP8266 serial WIFI Module Adapter Plate Applies to ESP-07, ESP-12F, ESP-12E Wireless Board for arduino


SUQ DC 9V Battery button power plug for Arduino Mega 2560 1280 UNO R3 132 9V battery buckle


10pcs 2.54MM Pitch Single Row Female Pin Socket 2/3/4/5/6/7/8/9/10/11/12/13/14/40Pin PCB Connector Single Row Mother For Arduino


TCRT5000 Infrared Reflective Sensor IR Photoelectric Switch Barrier Line Track Module For Arduino Diode Triode Board 3.3v


Electronic PCB Board 2x8cm 3x7cm 4x6cm 5x7cm 8x12cm 9x15cm Green Double Sided Prototype PCB For Arduino Copper Board IGMOPNRQ


Double Sided PCB Board Prototype Kit Universal Printed Circuit Board for DIY Soldering with for Arduino Kits


Single Sided PCB Board Prototype Kit 6 Sizes Universal Printed Circuit Protoboard for DIY Soldering Project for Arduino Kits


1 Set EC11 Rotary Encoder Code Switch Digital Potentiometer 360 Degree with Knob 7 Pins Shaft Dia. 6mm*20mm for Arduino


Electronic PCB Board 2x8cm 3x7cm 4x6cm 5x7cm Diy Universal Printed Circuit Board 5*7cm 4*6cm 3*7cm Blue PCB For Arduino IGMOPNRQ


LilyPad Lotus Leaf Slide Switch Slide Switch Toggle Switch AYZ0202 Induction Switch for Arduino DIY Kit


2.54mm Double Row Male 2~40P Breakaway PCB Board Pin Header Connector Strip Pinheader 2 * 2/3/4/6/8/10/12/15/20/40P For Arduino


2.54mm Single Row Male 2~40P Breakaway PCB Board Pin Header Connector Strip Pinheader 2/3/4/5/6/8/10/12/15/20/40Pin For Arduino


TTP223 Touch Switch Module TTP223B 1 Channel Jog Digital Capacitive Touch Sensor for arduino DIY KIT


1.27mm 1.27 Pin Header Single Row Male Breakaway PCB Board Connector Pinheader 1*2/4/5/6/8/10/12/15-40p 50p For Arduino Gepyun


TTP223 TTP224 TTP226 TTP229 MPR121 V12 Digital Switch Touch Module 1 4 8 16 Channel Capacitive Touch Sensor Module For Arduino


0.5 inch Common Anode LED Digital Display Tube 7 Segment 1Bit Digital Tube Red for Arduino


Rc Mini Micro 9g 1.6KG Servo SG90 for RC 250 450 Helicopter Airplane Car Boat For Arduino DIY With Bracket


Piezoelectric shock tap sensor Vibration switch module piezo sheet percussion for Arduino 51 UNO MEGA2560 r3 DIY Kit


2.54mm Double Row Male 2~40P Breakaway PCB Board Pin Header Connector Strip Pinheader 2 * 2/3/4/6/8/10/12/15/20/40P For Arduino


HC-SR501 Human Infrared Induction Brackt Module Probe Scaffold For Thermoluminescence Sensor Support For Arduino


ESP8266 Serial WIFI Module Adapter Plate ESP8266 White Baseboard Applies to ESP-07\ESP-12E\ESP-12F Wireless Board for Arduino


2.54mm Single Row Male 2~40P Breakaway PCB Board Pin Header Connector Strip Pinheader 2/3/4/5/6/8/10/12/15/20/40Pin For Arduino


DC 9V Battery Button Power Cable Battery Buckle Snaps Power Cable Connector DC 5.5*2.1 For Arduino Diy


1-50Pcs Pro Mini Atmega168 Microcontroller Module 16M5V Plug-in Crystal Oscillator Pin Header for Arduino Nano Replace Atmega328


TTP223 Touch Key Switch Module Touching Button Self-Locking No-Locking Capacitive Switches Single Channel For Arduino l8


9V battery buckle for Arduino uno 2560 due DC3.5 12.5cm power conversion head


10PCS PCB Board SMD Turn To DIP Adapter Converter Plate SOP 8/16/14/20/24/28P SOT89 SOT23 SOT223 TO DIP SOP/MSOP/TSSOP


1PCS TCRT5000 Infrared Reflective Sensor IR Photoelectric Switch Barrier Line Track Module For Arduino Diode Triode Board 3.3v


Rc Mini Micro 9g 1.6KG Servo SG90 for RC 250 450 Helicopter Airplane Car Boat For Arduino DIY SG90 Bracket


Mini/Micro USB to DIP Type A Female/ Male USB Adapter Converter for 2.54mm PCB Board DIY Power Supply For Arduino Module


10PCS 2.54MM pitch single row female pin socket 2/3/4/5/6/7/8/9/10/11/12/13/14/40Pin PCB Connector Single Row Mother For arduino


TTP223\TTP223B Channel Jog Digital Touch Sensor Capacitive Touch Switch Modules Accessories TTP223 for Arduino Diy Kit


1PCS Rc Mini Micro 9g 1.6KG Servo SG90 for arduino RC 250 450 Helicopter Airplane Aeroplane Car Boat Remote Controller Motor


DC 9V Battery Button Power Cable Battery Buckle Snaps Power Cable Connector DC 5.5*2.1 For Arduino Diy GOHJMY


US-100 US-015 US-016 US-025 US-026 CS100 HC-SR04 Ultrasonic Ranging Sensor Module Board Distance Measuring Detector For Arduino


HC-SR04 Distance Ranging Sensor Module Ultrasonic Wave Detector HCSR04 HC SR04 HC-SR04+ CS100A Test Board Bracket for Arduino