Varying the lead length on the LED packages eases identification of the pins. It also serves to ease insertion into PCBs. The longest lead is located in the board first, followed by the next longest lead, etc., gradually advancing the component into the board until all are located and the LED pushed in to the required depth.
Note that many of the packages have shoulders on the leads to provide a positive stop against the PCB for ease of alignment, etc.
T-sizes
Early LEDs were made to conform to standard “T” sizes. The “T” designation indicated tubular shape and the numbers after indicated the tubular diameter in 1/8″ multiples. The original LEDs were made in T1-3/4 or T1.75 (5.5 mm – 5 mm nominal) and later in T1 (1/8″ = 3 mm) packages.
Most LEDs are simple single device with two leads but packages with two or more LEDs are common and there are various LED pinouts in use.
Simple LED test circuit
Most LEDs will light at less than 5 V and can tolerate 5 V reverse voltage. A 5 V supply is available from a USB supply or, for example, an Arduino. You can use a higher voltage such as a 9 V battery and double the value of R1 but you might damage sensitive devices on reverse voltage.
See Testing unknown LEDs for more on this topic.
Note that LEDs usually have no two pins the same length. This is for two reasons:
It helps identify the pins.
It helps during assembly as pins can be inserted one at a time from longest to shortest without having to align all the pins simultaneously.
2-pin
The most common type of LED is the 2-pin, 5 mm, round lens type. Generally these are a single LED. Polarity is indicated by the long lead (+ / anode) or the flat on one side of the base (- / cathode).
Be aware that bi-colour LEDs are also sold in this package. Some are dual-colour so that reversing the current through them changes the colour. Others may have both LEDs the same colour and this can be useful in AC applications as it can conduct on both cycles of the mains and eliminates the need for a rectifier.
The bi-colour LED’s datasheet will specify which way round to connect to ensure the correct colour.
3-pin
The three-pin LED is usually a pair of LEDs of different colours sharing a common anode or common cathode. Either LED can be turned on independently or blended to create a combination.
4-pin
The 4-pin package is most commonly seen on RGB (red-greeen-blue) LEDs. Common cathode and common anode versions are available.
6-pin
When the number of pins reaches six all sorts of strange variations are possible. One sensible one is to bring out each LED anode and cathode on individual pins. This allows a single part to be used for common anode, common cathode and series LED configurations.
A slightly strange 6-pin, RB-GB, LED, has two separate 3-pin LEDs in one package.