I recently got my hands on a Nexus 7 tablet; while it is capable of supporting USB peripherals, like most tablets it lacks a USB A socket. Instead, the micro USB socket must be used with a USB OTG (On-The-Go) cable; this utilises the otherwise unused fifth pin in the micro USB plug to switch the tablet into host mode. To avoid having to carry around an extra, I’ve added a switch to allow a lead to function both in standard and OTG mode.
The starting point for this hack was a multi USB lead that I picked up free at a careers fair; a fairly common retractable lead with a male USB A plug on one end and a module on the other end providing a mini USB, micro USB and an iDevice connector.
Enabling OTG functionality is a simple case of connecting the (otherwise not connected) pin 4 in the plug to ground. Once I’d removed the case it was very easy to identify the ground pin by the markings on the board, while pin 4 was equally obvious by virtue of being the only pin not connected to anything. I removed one lead from a small SPDT slide switch and trimmed the remaining legs to the appropriate lengths to rest against the edge of the board for support then soldered it in place.
All that remained was to cut some slots into the case with a box cutter to accommodate the leads and super glue the case back on. As a finishing touch, I labelled the switch positions with a permanent marker.
I now had a lead capable of switching devices into host mode, but it still had a male USB A connector on the other end; this is trivially fixed with a USB A female-female connector. These are cheap, prevalent and small, they also allow the same lead to be used as both standard and OTG. Here it is in use, I have connected a USB keyboard to my Nexus 7.