SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Pin numbering

Thu Jan 19, 2017 9:57 am

I admit I didn't know where else to put this, so this seemed appropriate.

In all the pin-out descriptions and tables I have seen, from the first Pi to the most recent (except, of course the Compute Modules), the pins are numbered "incorrectly", which has only just dawned on me while I was trying to layout a PCB using Fritzing.

Conventionally, for an IC or other connector, if it is oriented "correctly", pin#1 is top left, and the numbers increase going down the left side, and increase coming back up on the right.

If for example, you look at the specification for the MCP23008, you can see just this.

However, for the Pi, whether it's a 26 pin or 40 pin header, they go from left to right, then down to the left and right again, and so on.

Now, I recognise that this means that the pin numbering for the 26 pin version and the matching pins on the 40 pin version is the same, which is useful. But it does mean that there is a bit of a mental shift needed when designing a PCB to connect to the Pi, since what is referred to as pin#2 on the Pi (5V) is different to pin#2 on the connector (I2C#1 SDA).

If you had only a list of pin assignments, not a diagram, this could cause much cursing and gnashing of teeth, particularly if you put 5V through the I2C pin.

Of course, the answer is that if you're designing your own PCB, you should double check these things anyway, but out of interest, why was it done this way, against normal convention?

(I know - if it took me 5 years to notice, why am I complaining about it? No, I didn't blow anything up, but it did add an extra layer of "thinking" about the board layout...)
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

User avatar
DougieLawson
Posts: 37070
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Pin numbering

Thu Jan 19, 2017 9:59 am

Eh?

http://pinout.xyz and all the Fritzing stuff appears to be zig-zag numbering and 100% correct to me.

http://electronics.stackexchange.com/qu ... ng-schemes
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
joan
Posts: 14652
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Pin numbering

Thu Jan 19, 2017 10:02 am

I thought the error was meant to be that pin 1 should be on the outer edge of the PCB, not the inner.

User avatar
DougieLawson
Posts: 37070
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Pin numbering

Thu Jan 19, 2017 10:03 am

It's numbered for the conductors in an IDC cable.
http://connector.pinoutguide.com/10_pin_IDC_male/
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: Pin numbering

Thu Jan 19, 2017 10:09 am

Not if you compare the numbering scheme to any common IC. For those, the actual physical pin numbers run 1-20 on the left side, and 21-40 (going upwards) on the right side, whereas in the diagrams on the site, they go row-wise, not column-wise.

I'm not saying the pin descriptions are wrong, just that they are not numbered conventionally.

Don't know about the fritzing parts for the Pi, since I use headers only. Having just looked at it a few minutes ago, I now see what you mean. That will save me some work after all - I did wonder how the Pi components mapped through to the PCB layer, and now I know (and feel suitably enlightened and embarrassed in equal measure).
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: Pin numbering

Thu Jan 19, 2017 10:12 am

Thanks Dougie, I now see what you mean, and in the context of the Pi that makes perfect sense - and of course it also means that 40->26 "downgrade" cabling will work perfectly well.

I will go and sit on my hands now, and use my brain instead. :)
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 5334
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Pin numbering

Sun Jan 22, 2017 5:29 pm

SteveSpencer wrote:Thanks Dougie, I now see what you mean, and in the context of the Pi that makes perfect sense - and of course it also means that 40->26 "downgrade" cabling will work perfectly well.
I will go and sit on my hands now, and use my brain instead. :)
And, just for confirmation (as performed many moons ago :) ) :
http://www.cpmspectrepi.uk/raspberry_pi ... -pin_cable
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, B2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, A+ and a B2) but Buster on the P4B's. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

User avatar
Douglas6
Posts: 4809
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Pin numbering

Sun Jan 22, 2017 6:21 pm

My understanding is that conventional numbering is different for ICs than it is for pin headers. https://en.m.wikipedia.org/wiki/Pin_header

Return to “Interfacing (DSI, CSI, I2C, etc.)”