Why does micro USB 2.0 have 5 pins, when the A-type only has 4?
What is the extra, 5th, pin on micro usb 2.0 adapters for?
Here is an image with the different connectors. Most of them have 5 pins, but the A-type host only has four.
It's for On-The-Go, to select which device is the host or slave:
The OTG cable has a micro-A plug on one side, and a micro-B plug on the other (it cannot have two plugs of the same type). OTG adds a fifth pin to the standard USB connector, called the ID-pin; the micro-A plug has the ID pin grounded, while the ID in the micro-B plug is floating. The device that has a micro-A plugged in becomes an OTG A-device, and the one that has micro-B plugged becomes a B-device. The type of the plug inserted is detected by the state of the pin ID .
And since a Type-A connector is nearly always host it doesn't need to have a 5th pin?
If you mean a standard 4-pin Type-A plug, this would be used for a permanent host - you wouldn't use this in an OTG device. The ID pin is only used if the device can change between host and slave. For standard USB the ID pin is just left disconnected in the device.
It might be helpful to "restate the obvious": before the cable is attached, both devices in the illustrated scenario are eligible to be a host or slave device. It is when the cable is connected that the device attached to the A-end of the cable becomes the host, and the device attached to the B-end of the cable becomes the slave. In situations where a device is always intended to be a host device, the mini-A and micro-A connectors exist that will only accept the A-end of the OTG cable. In such situations, the device is explicitly a host device.
To complete Oli Glaser's answer, 5 pins USB respects the On-The-Go standard (OTG). The additional pin added to the conventional USB port is the ID pin added to the 4th electrical pin, and allow to recognize the device. Here is the resulting electrical setup of the pins:
- VDD (+5V)
- D- (Data-)
- D+ (Data+)
- ID (ID)
- GND (Ground)
As compared to other 4-pins USB devices, where there is no ID pin, the advantage is to be able to distinguish the host device from slave devices.
- Host: ID connected to GND
- Slave: ID not connected (floating)
It's for host:client negotiation.
Permits distinction of host connection from slave connection
host: connected to Signal ground
slave: not connected
There is no info carried by the 4th pin. When connected to the ground (5th pin) it serves to notify the host that it is connected to a dumb-client device instead of a smart-client device. This is confusing at best because some client devices only act as dumb-clients and some client devices can be either smart-client, another peer-host, or a pass-through repeater. You will probably only ever see OTG actually used in case of a keyboard being plugged into the micro or mini connector on a tablet computer. Other client devices usually have enough inherent software capability to notify the host that they are a client using the normal 4-wire USB connection.
Before USB OTG was popular, the 5th pin was an auxiliary pin to allow the USB port on portable devices to be used for other purposes via passive components/circuits. A resistor array in the cable would indicate the function of the cable to circuitry in the device. Sometimes this could be a composite TV out, but it was mostly used for audio. Manufactures HTC and Motorolla did this audio out on many phones, with different pinout schemes.