# Why does pin numbering and placement (in general) appears to be done so haphazardly to the uninformed person (me)?

Be it an ESP development board, an IC controller, even an LED segment number itself, pin placement never seems to follow a logic when it comes to actual numbering, or function. I can't find a simple general answer to why this is. I suppose there are a few parts to this question:

### 1. I assume pin placement has some design factors in it, such as trace length and EMF, am I correct on this?

For instance, I would think it would make more sense to put the VIN next to the 5V, next to the 3.3V, next to the ground on the Arduino, just to keep all the power pins grouped together. Is there a technical reason they are not, or is it just a design choice?

### 2. When it comes to ESP development boards, why are the GPIO pins usually all over the place?

They seem mostly out of order, and why is the SPI clock always on the opposite side of the board of the MOSI MISO?

### 3. When it comes to ICs, why are pins with similar functions not always completely grouped?

A great example of this is the MAX7219, not to list them all but pins 1-5 are DIN, DIG0, DIG4, GND, DIG6. Why not put the digits in the order of pins? It doesn't make sense to me, can someone explain?

• for #2, that isn't true of all devices. for #3, Yeah that '7219 does seem a bit sadistic. For lines that carry power or high dI/dt, there can be actual reasons, like keeping important loops small as you suggest. For data lines? It would have to be historical, esp. something like a 7segments which go back a long way. Don't know. Might have to do with internal layout of the IC, so the bonding wires don't cross over for instance. Dec 30, 2020 at 2:46
• The '7219 sounds like an example of why it's a bad idea to let the PCB layout person decide the connector pinouts. See, for example, the ancient S-100 bus. Dec 30, 2020 at 4:40
• glad this is an interesting question! hopefully someone with some historical knowledge can come in Dec 30, 2020 at 18:46

I assume pin placement has some design factors in it, such as trace length and EMF, am I correct on this?

Yes, but sometimes it is more about internal routing than external signals. Whether it be tracks on a PCB, or metallization layers on the surface of a monolithic IC, the shorter the route and less vias needed the better. The more compact the layout the harder it is to get signals to pins without being blocked by other tracks, so the designer may decide to change the pin layout instead. For example the Z80 has scrambled data pins for no apparent reason, but makes sense once you understand how it is laid out internally.

But wouldn't ease of use be more important than having the shortest possible route inside the IC or module? In many cases no, because the same problem occurs on the PCB the device is put on. That nice orderly pin sequence may get messed up as soon as you try to route the signals to other places. Modern PCB layout programs take care of ensuring that signals go to the correct places, so you don't need to worry about physical pin assignments, just ensure they are correct on the schematic (where you can arrange the symbol's pin order any way you like).

MCU GPIO pins are often used for 'random' functions rather than arranged in groups, so the pin order (or even which port it is on) isn't an issue. Some MCUs have programmable pin assignments for special functions as well, allowing even more flexibility in pin routing. The PCB designer can then route signals to whichever 'random' MCU pins produce the best layout, and do the assignments in software.

For instance, I would think it would make more sense to put the VIN next to the 5V, next to the 3.3V, next to the ground on the Arduino

Putting all the power pins right next to each is good for EMI, but bad for safety. The Arduino was designed for hobbyists with little electronics experience who are likely to make mistakes such as accidentally shorting adjacent pins while working on it. It might be better to have power pins separated by others that don't mind being shorted to them. For example if the Arduino's VIN pin was right next to the +5V pin, shorting them together would apply high voltage to the MCU which would probably destroy it.

When it comes to ESP development boards, why are the GPIO pins usually all over the place?

Most likely for some of the reasons stated above. To keep the module size down the chip pins will most likely be routed to the nearest module pins. IC pin ordering will be influenced by signal routing on the chip itself.

There are several reasons for pin placement, and user convenience is evidently not at the top of the list. Within an IC package the pins have to match the pads on the die itself and that’s likely to be driven by what’s going on in the silicon, which may be difficult to describe, somewhat like a high density PCB with limited layers. In some cases it may be actively desirable to keep high-speed signals apart. From an end-user point of view it may or may not matter - if you’re hand-wiring an Arduino to a breadboard then positioning isn’t really important, you just plug the wires in as needed. If you’re tracking a PCB for a wifi module then for the most part you just route the tracks wherever they need to go.