Page 1 of 2

Can we come up with a Standard Plug/Socket for I2C

Posted: Mon Aug 26, 2013 1:13 pm
by simplesi
A number of people are developing I/O devices - some directly using I2C straight out of the GPIO pins but others are building boards and then expsoing I2C pins so that further devices can be added.

I was wondering if we coudl come up with some sort of agreed (I'm not talking IEE certification here) "standard" 4 pin inter-connector.

This would enable people to make future I2C devices that just plugged into other add-on boards. It would be nice if the connector could be made reasonably robust and capable of being mounted directly to a board or mounted in the side of a case etc...

For existing boards, people could just make up adaptors to let them use the new standard.

Just throwing this out for a discussion.

Simon

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Mon Aug 26, 2013 1:29 pm
by alexeames
It's a good idea Simon, although I'd be surprised if there wasn't one already. AFAIK the GND and +Ve should be on the outside (I think it was Romilly Cocking who told me that), that only leaves two possible configurations if it's a straight inline connector. :D

If it was to be a 2x2 connector, you could just follow the exact layout on the P1 header for pins 3-6. (But then there's four different ways to plug it in, so that could be confusing).

Here's an interesting link that contradicts what I said above...
http://www.i2cchip.com/i2c_connector.html
SCA
VDD
VSS
SCL

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Mon Aug 26, 2013 3:37 pm
by simplesi
Ta for link - I was already thinking we need at least 5 pins in order for add-ons to utilise the 5V RPi rail

Simon

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Aug 28, 2013 12:55 pm
by AndrewS
There's already several different pseudo-standards e.g. http://quick2wire.com/i2c-pinouts/ (see http://www.skpang.co.uk/catalog/raspber ... 0_248.html ) and http://www.seeedstudio.com/wiki/GROVE_System , a quick google finds http://www.interfacebus.com/Design_Connector_I2C.html and http://www.mcc-us.com/ipicon.htm , and several of the http://www.abelectronics.co.uk/ boards also break out the I2C pins.
I've already wired up my own simple adapters to connect the Pi's P1 and P6 headers directly to Quick2Wire-style I2C connectors :)

http://quick2wire.com/the-babelboard-is-coming/ would have been interesting, but it seems Quick2Wire have "gone under" and SK Pang are now selling their products.
One potential fly in the ointment is that some devices (like Arduino) run the I2C bus at 5V-levels, and others (like Raspi) run the I2C bus at 3.3V-levels, which means logic-level-convertors become necessary (which some Raspi add-on boards already include).

EDIT: I just had a look through some of the various I2C boards that Adafruit sell to see if they had any common wiring convention, but they don't - each board has it's I2C pins (I looked at VDD, GND, SCL & SDA) in an arbitrary order.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Aug 28, 2013 1:33 pm
by jgreen71
Obligatory xkcd reference: http://xkcd.com/927/

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 9:10 am
by IanH2
At the risk of resurrecting the 1980's, the standard VGA connector pinout (https://en.wikipedia.org/wiki/VGA_connector) has defined pins for I2C (SDA = pin 12, SCL = pin 15), +5V power (pin 9) and ground (use pin 10). It has the major advantage that you probably have a bin full of the required leads ...

Ian

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 10:15 am
by simplesi
:)

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 10:35 am
by meltwater
I agree with the need to include the 5V.
Unfortunately, there are two layouts even on the RPi itself (P5 included).

The layout I've gone for is:
5x1 Connector (better for prototyping boards) - also allows the 5V pin to be dropped when not wanted:
5V
3V3
SCL
SDA
GND
It was also influenced by the pinout of the DS1302 / DS1307 RTC chips to have minimal wiring (seems a common layout for RTC boards), and also buffer chips seem to match this (PCA9517).

The previously suggested one is probably just as good (although I would prefer the INT on the outside so it can be optionally dropped):
SDA
VDD=3V3
VSS=GND
SCL
INT/CS
VAUX=5V
Interestingly, this seems to be the least common from the ones I've seen (typically SDA/SCL are together).

Adafruit 8x8 Matrix uses:
SCL
SDA
GND
VCC
Also seen the same used for ADC/DAC I2C unit elsewhere (several boards on DX.com including I/O Extenders/EEPROM/I2C-GPS/some RTCs/). There are still just as many slight variants though (particularly with VCC and GND reversed).


For a 3V3 I2C only device, then the clear choice would be (to direct connect to P1):
3V3
SDA
SCL
INT/NC
GND

_______________________
If using a 3x2 connector, the obvious choice is (to direct connect to P1):
3V3 5V
SDA 5V
SCL GND

The choice for P5 would probably be easiest to connect to the whole thing 4x2 and get 2x INTs (note, this is from the top side):
3V3 5V
SCL SDA
INT1 INT2
Gnd Gnd

But Q2W use:
5V 3V3
SDA SCL
GND INT


____________________

Perhaps having standard colours would be a good plan, with SDA and SCL being a 1x2 connector, and the VDD and GND being a separate one 1x2 (It is just a shame that there isn't a 3V3 and GND pin next to each other on the GPIO pins) or easy point to pick up 5V/3V3/GND together.

Edit: On reflection - on the Pi Side we can have (although excludes the use of a TTL cable, unless it will work without the 5V):
P1:
3V3 5V
SDA 5V
SCL GND

P5:
3V3 5V
SCL SDA
INT1 INT2
Gnd Gnd

On the board side, most likely to fit most boards with:
SCL SDA on one connector
GND 3V3 5V on another connector (will many require only GND and 5V? since I expect 3V3 will be needed for reference of the level shifting)

Whatever happens can't fit everything.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 12:17 pm
by AndrewS
Not easy, is it? :lol:


VGA - *shudder* bit bulky isn't it?! Hardly the sort of cable you want to be using to connect breadboards together. Although I suppose it does guarantee well-shielded cables if you're looking for longer connections.

One of the advantages of the Q2W IDC connector is it's a keyed connection, so you can't get the wires in the wrong way round (and as mentioned there are already a number of boards using it). But one of the disadvantages is the 2x3 IDC connectors seem to be much harder to find than other size connectors.

meltwater - Adafruit have lots of different I2C pinouts (I guess they're driven by the pin-ordering of the chip, rather than a desire for a consistent order), compare
https://www.adafruit.com/products/992 (VDD, GND, SCL, SDA)
https://www.adafruit.com/products/931 (VDD, GND, RESET, SCL, SDA)
https://www.adafruit.com/products/815 (GND, OE, SCL, SDA, VCC)
https://www.adafruit.com/products/870 (VCC, GND, SDA, SCL)
https://www.adafruit.com/products/439 (GND, ADDR, INT, SCL, SDA, VCC)
https://www.adafruit.com/products/255 (GND, VCC, SCL, SDA)
etc. etc.

And then there's http://picru.st/ which has GND, 5V, SDA, SCL (which is the same as https://www.adafruit.com/products/264 )

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 3:09 pm
by meltwater
The 2x3 (or other double ones) are not friendly for breadboards or prototyping, so I would suggest any standard would have to have a 1x version.

The best solution I can think of so far (although I really don't know lol) :

Module Pins
5V
3V3
SDA
SCL
INT/NC
GND

RPi Cable (5x1 + a single female jumper lead [5V] for connecting on the RPi)
[5V]

----
| 3V3
| SDA
| SCL
| INT/NC
| GND
----

This would allow the bottom part to connect directly to P1, and a single female jumper lead to be used to add 5V from the P1 header if required.

It would mean you can use any set of 1x wide header cables to connect to RPi and any compatible I2C device with 1:1 wiring. The bit I am not keen on is the INT/NC part, since some don't need it others need two, so a STANDARD connector probably shouldn't have it...

We should probably have have different connections for the RPi side anyway, but with the standard I2C connection on the other:
To direct connect to P1 (assuming NC for the INT/NC):
3V3 5V
SDA 5V
SCL GND

To direct connect to P5 (assuming INT1 for the INT/NC):
3V3 5V
SCL SDA
INT1 INT2
Gnd Gnd

Perhaps that ends up with the following standard type connector for modules as follows (with 5V, INT1, INT2 optionally used as required):
INT2
INT1
5V
3V3
SDA
SCL
GND

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 3:36 pm
by AndrewS
If your intention is breadboarding, I'm not sure a "standard" single-row connector makes sense, since it might be too easy to get an "off by one" error and e.g. mistakenly connect GND to 5V.
Also when you're breadboarding you've typically got a chip sitting in the middle of the breadboard, and the I2C pinout of the chip may not 'line up' with your standard, so IMHO it'd be more useful to just have flying jumpers that you could just plug in wherever the chip needed them (sorta like this but with male instead of female jumpers), instead of connecting your inline-connector to the breadboard, and having extra jumpers connecting the inline-connector to the chip :)

I'm personally leaning towards the Q2W idea of a standard "non breadboard" connector, and then you'd have a "RPi P1" -> "standard connector" cable, a "Rpi P5" -> "standard connector" cable, a "male jumpers" -> "standard connector" cable (for breadboarding) and multiple "standard connector" -> "standard connector" cables for joining everything together. And you could even imagine "standard connector" -> 2 x "standard connector" 'splitter cables'.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 4:02 pm
by rurwin
We could use this for the connection to the Pi:
3V3 5V
SDA 5V
SCL GND

That would result in a cable with the following cores:
3V3
5V
SDA
5V
SCL
GND
Which is quite nice because it interleaves power and signals. GND would be better than 5V, but it should still be good.

That could then mate with a single line socket like this:

3V3
5V
SDA
Missing for polarization
SCL
GND

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 8:47 pm
by meltwater
The single inline connector still my preference (it is a lot easier to use on prototype boards and we can avoid another set of pins to remember) -- you'd be able to make up a series of bus connectors in 2 mins on stripboard, otherwise you'd need custom pcbs.

I like the idea of building in the key (filled hole/missing pin) to stop backwards connections . If you had it this way round you can still drop the 5V if you don't need it, and still know which way around the connector goes (and you don't have 5v sitting next to a 3v3 only gpio pin).
5V
3V3
Missing for polarization
SDA
SCL
GND

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Wed Sep 04, 2013 11:36 pm
by AndrewS
So, when connecting to P1 there'd be a 'twist' on the first two wires and a 'twist' on the second two wires (with the 2nd 5V pin missing). Seems reasonable.
Do we want to decide on a standard wiring colour-scheme too? :D Red, Orange, Missing, Green, Blue, Black?

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Thu Sep 05, 2013 7:56 am
by rurwin
The trouble I can see with a twist, is that someone somewhere is going to forget, and put 5V into their 3.3V circuit. The simpler you make it, the less chance there is of getting it wrong. The advantage of my scheme is that you can use an IDC plug on the Pi to grey ribbon cable, and then just hand-terminate the straight plug on the other end pin-for-pin. It's simple, impossible to forget, and easy to visual check. The worst mistake you could make would be to terminate the second 5V core, which you would realise when you came to insert the polerisation blanker, and wouldn't cause damage in any case.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Thu Sep 05, 2013 12:42 pm
by meltwater
The direct pin numbering and ribbon numbering sounds good to me, and nice and logical too.
It could even be optional to use 2x3 connectors for boards which plan to directly connect anyway, with a clear 1x6 version for modules which may be used with breadboards etc.

Sounds excellent.

Colours...I'd pick something other than Green, but the rest are fine (I use orange for 3V3 a lot, and blue for clock quite often). Purple perhaps.
Red, Orange, Missing, Green, Blue, Black?

I don't expect the colours will be widely adopted (would depend on what they can source) but having a suggestion is always helpful if makes no difference otherwise.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sat Sep 07, 2013 12:56 am
by mikronauts
The I2C pin out I use on my existing (and future) products is:

3v3
SDA
SCL
GND
simplesi wrote:A number of people are developing I/O devices - some directly using I2C straight out of the GPIO pins but others are building boards and then expsoing I2C pins so that further devices can be added.

I was wondering if we coudl come up with some sort of agreed (I'm not talking IEE certification here) "standard" 4 pin inter-connector.

This would enable people to make future I2C devices that just plugged into other add-on boards. It would be nice if the connector could be made reasonably robust and capable of being mounted directly to a board or mounted in the side of a case etc...

For existing boards, people could just make up adaptors to let them use the new standard.

Just throwing this out for a discussion.

Simon

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sat Sep 07, 2013 1:03 pm
by panik
jgreen71 wrote:Obligatory xkcd reference: http://xkcd.com/927/
Yes. Adopting an existing standard beats coming up with a new one (although there are a few exceptions).

I like the idea of the Olimex UEXT 'standard': http://en.wikipedia.org/wiki/UEXT

A 2x5 IDC pin that has I2C, SPI, UART and power. All your serial communication in 1 ribbon cable.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sat Sep 07, 2013 7:27 pm
by meltwater
Surely that defeats the object of a 2-wire interface. Are there many modules which would use both I2C and SPI at the same time? BTW: We have a 2x13 connector which includes a good selection...

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sat Sep 07, 2013 7:47 pm
by panik
Fair enough :)

I think the idea of UEXT is to have 1 connector to possibly connect to a selection of breakoutboards. A bit like 'arduino shields'. But you're right, we already have a 2x13 connector for that.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sat Sep 07, 2013 11:56 pm
by AndrewS
With so many existing 'standards', and each of us having different requirements, I guess we'll never all agree on one? :?

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sun Sep 08, 2013 7:55 am
by meltwater
I doubt we ever will, but for those cases where someone is designing from scratch and wondering...is there a standard pin out I could use rather than making one up? Then we might be able to give an answer.

The idea of using the top part of the 2x13 header and use direct pin mapping as it would be on a ribbon seems the simplest to implement/use/remember etc. It is yet another "standard" (or at best another alternative) but there hasn't been much compelling evidence there is a common one, so it seems better to pick something which works best for the Raspberry Pi.

The one thing I've not looked at is how the I2C is used on Arduino (again I don't think there is a standard) but it would be helpful to ensure that a suggested connection isn't too confusing if used with an Arduino too.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Sun Sep 08, 2013 11:04 am
by AndrewS
meltwater wrote:I doubt we ever will, but for those cases where someone is designing from scratch and wondering...is there a standard pin out I could use rather than making one up? Then we might be able to give an answer.
...with the answer being "there's many different 'standards', so feel free to pick one, or make up your own" :lol:
The idea of using the top part of the 2x13 header and use direct pin mapping as it would be on a ribbon seems the simplest to implement/use/remember etc.
Hmm, I'm afraid I'm not convinced - are there any boards which only use 'partial connectors' to connect to P1? IIRC every addon board/accessory for the Pi I've seen always connects to the full 2x13 connector, regardless of how many pins it's actually using? Which then leads to things like:
http://uk.farnell.com/jsp/search/produc ... ku=2327992
and
http://www.piborg.com/triborg
It is yet another "standard" (or at best another alternative) but there hasn't been much compelling evidence there is a common one, so it seems better to pick something which works best for the Raspberry Pi.
That's why I was suggesting the Q2W "standard", as IIRC that's the connector used by the largest number of existing addon boards for the Raspberry Pi?
But of course it doesn't meet your breadboard-able requirement... :|
The one thing I've not looked at is how the I2C is used on Arduino (again I don't think there is a standard)
Correct ;) http://arduino.cc/en/Reference/Wire

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Mon Sep 09, 2013 8:42 am
by meltwater
There are some boards which use a partial connector (I've seen an RTC board which does this). That doesn't help much though since as you say, you still then need P1 splitters unless you use ribbon cables etc, as something will get in the way. Although if you used a stacked header design (which has also been used) then you avoid this problem, while also allowing use of ribbon cables, jumper wires etc etc. It is quite flexible that way.

I know I'm not the only one who isn't keen on anything which hogs the whole P1 connector (particularly if it isn't using most of it).

Q2W only produce 4 boards, but at least they are consistent I suppose, and they provide pass through of the signals to another connector.

There probably will still end up with a wide range of variations anyway, since each board will have different needs, not all will want to use additional leads while others will want the flexibility to use them. Would be nice to reduce some of the variation though where it isn't required, by providing some recommended guidelines (avoiding cases where the DA and CL lines are crossed over for example). There isn't an ideal solution.

Re: Can we come up with a Standard Plug/Socket for I2C

Posted: Tue Sep 10, 2013 10:35 pm
by AndrewS
meltwater wrote:I know I'm not the only one who isn't keen on anything which hogs the whole P1 connector (particularly if it isn't using most of it).
I tend to agree, but I suspect we're in the *vast* minority as I suspect (wildly stabbing in the dark here... ;) ) that most people don't have any addon boards for their Pi. Of the small number that do, I suspect that most of them only have one addon board. Of those that have more than one addon board, I expect the majority only need to connect one at a time.
So I'm not sure how many people that leaves wanting to connect more than one addon board at once? :ugeek: :lol:
There's obviously less potential for alignment errors if the addon board covers the whole 26-pin header.

While I agree that stacking headers are great, maybe for most people making and selling addon boards it's more profitable to just use non-stacking headers? *shrug*
I've also found that on the board I have with stacking headers (I only have one with stacking headers, so other stacking headers may be different?) the 'poking up' male header pins are thinner than normal, so while it fits snugly in other soldered-on style female headers, it's actually too loose when used with the common 26-way IDC ribbon cables and just falls out / doesn't make an electrical connection.


Sorry for going a bit OT there...