Port expansion, 100s of ports?

I want to build a cable tester, which will have a dozen connectors, each with 15-80 pins. The software will check to see which pin pairs are connected, pair by pair.

Which i/o port expander is better (simpler) for this purpose? I2C, SPI, or serial?

It would simplify programming if each connector had its own expander, but I don't find any that have 80+ pins.

For example, the finished device would check if pin 9 on connector 1 is connected to pin 9 on connector 2, and so on. Speed is not an issue.

Thanks!

You can daisy-chain a virtually unlimited number of [u]shift registers[/u]. (That's a serial data connection.)

For example, the finished device would check if pin 9 on connector 1 is connected to pin 9 on connector 2, and so on.

Assuming these are point-to-point connections (i.e. 80 separate wires with 80 connections on each "end" of the cable/harness) the simplest test is a "walking ones" test. Write to one end of the cable and read at the other, and as long as you read what you write the connections are OK. With 4-bits (4 wires) the data looks like this:

0001 0010 0100 1000

With a high wire-count, you'll need multiple byte/word variables, and you'll need to bit-shift between all of those variables.

SPI is easy to use.

2017-05-13_16-20-05.jpg

Edit
Updated schematic
.

You'll still need to determine how many pins your Arduinio will required.

Worst case, you said 80 pins. That's a total of 160 pins that you want to connect to.

SPI needs three wires plus one for each expander chip. If you use something like the MCP23S17, you'd only need a total of 13 I/O to address 160 distinct points (10 slave selects + 3).

Going with I2C, you'd need two buses since the maximum number of i2C addresses is 8. The expander I mentioned above is available in I2C as the MCP23017. But, you only need at total of 4 wires at the cost of slightly more complex software.

Whatever I/O expander you select, I'd go with something in a DIP package - just so they'll be easy to replace when they get blown. Separate TVS diodes on each cable test line would be a good idea as well.

If you want to actually measure the resistance of each wire, it gets a bit more complicated by still doable. It just depends on what specific problems you're checking the cable for.

Tdk408: I want to build a cable tester, which will have a dozen connectors, each with 15-80 pins. The software will check to see which pin pairs are connected, pair by pair.

So you want to build a cable tester that will need to test for the possible connections (or not) between 12 x 80 = 960 connections.

Really ?

Exam question ?

Commercial appication ?

How much are you prepared to pay ?

avr_fred:
Going with I2C, you’d need two buses since the maximum number of i2C addresses is 8.

No there are two things you can do here:-

  1. You can add a multiplexer to the bus.
  2. You can wire the address lines on the chip to a digital output. Then all the devices have one of two addresses. You only ever use the second address with all the remaining devices having the same unused address. You need one digital output for each device you have. Or use a demultiplexer to derive 2n select lines from n digital outputs.

You mentioned testing connectivity 1-1 2-2 etc, but consider with mixed custom cables you may have other arbitrary pin sets matching. This doesn't necessarily make your hardware more complex, but you should write your code to support mapping tables - then you can add/edit different cable schedules.

Shift in and shift out registers. Only need 5 IO pins max. Daisy chain as many as you want. On the input side, 74HC165 with pullup resisters on the inputs. On the output side, TPIC6C595. Shift out a 1, one TPIC6C595 output pin will go low. Capture all levels from the 74HC165 and confirm there is only 1 low input, and it's on the correct pin. If multiple pins are low, there is a short somewhere. TPIC6C595 has open drain outputs, so outputs can be shorted and not be a problem electrically. The pullup resisters limit the current flow so there are no direct connects to +5 or Gnd.

This is incorrect: "Going with I2C, you'd need two buses since the maximum number of i2C addresses is 8." I2C supports 128 addresses.

Grumpy_Mike:
No there are two things you can do here:-

  1. You can add a multiplexer to the bus.
  2. You can wire the address lines on the chip to a digital output. Then all the devices have one of two addresses. You only ever use the second address with all the remaining devices having the same unused address. You need one digital output for each device you have. Or use a demultiplexer to derive 2n select lines from n digital outputs.

Nonsense. How many pins do you have to dedicate to the address lines of a multiplexer? You’re not going to do it with only two wires so what’s your point? Just posting without thinking me thinks…

CrossRoads:
This is incorrect:
“Going with I2C, you’d need two buses since the maximum number of i2C addresses is 8.”
I2C supports 128 addresses.

Sure, the I2C Standard supports 128 device address but it’s not practical in the real world. Find me a commonly available I2C I/O expander with 7 pins dedicated to assigning its address and I’ll show you an I/O expander without as many I/O pins as it could have had… The MCP23017 mentioned as well as the common PCF8574 have only three address pins. 8 unique devices.

I guess it must be a slow night on the board when threads abandon the practical for the purely academic, pointless “you’re wrong” crap. :slightly_frowning_face:

Nonsense. How many pins do you have to dedicate to the address lines of a multiplexer? You're not going to do it with only two wires so what's your point? Just posting without thinking me thinks...

No this is a case of you responding before thinking. It is a technique I have used many times in practice and only requires one address line per I2C chip to work. You treat this address line like it was a chip select on the SPI bus, and only ever talk to the active address. So the address of each device is dynamic not static or fixed. This can be obtained from a single I/O pin per device, or from a demultiplexer to save on I/O pins.

I guess it must be a slow night on the board when threads abandon the practical for the purely academic, pointless "you're wrong" crap.

You started it by not understanding what was said. This is a valid and practical technique, the fact that it takes you out of your "thinking" comfort zone is not my problem but yours.

Grumpy_Mike is right. It is common practice to use an address pin as chip select pin.

You can have as many chips with only one address pin (two I2C addresses) on an I2C bus as you want. By setting one chip to a different address, and talking to that one. Leo..

avr_fred: SPI needs three wires plus one for each expander chip.

Not for a daisy chain. Only one CS is needed for all then.

This post is to let OTHERS (mainly beginners who get steered wrong then waste pages of topic insisting it's right) know that SPI doesn't always need separate Chip Select lines and that with daisy-chained shift registers you select an entire set at a time. There's a real good Wikipedia SPI article with diagrams and explanations or at least there was 5 or 6 years ago showing different SPI techniques. It's well worth looking up.

srnet:
So you want to build a cable tester that will need to test for the possible connections (or not) between 12 x 80 = 960 connections.

Yes, really.

I work at an electronics shop where we make custom cables. The last one I did had about a dozen connectors, each with an average of maybe fifty pins. We double check the continuity of each pin by hand. That is super complex and error-prone. Just a couple goofed pins adds hours to repair.

I finure I can define the correct connections in a text file. Then plug a cable in to the proper connectors and check that the connectors are wired properly. Is pin 9 connected to pin 9, and not any of the others.

Since there are no expander chips with 90 pins, I’m figuring the program will have a translation table that translates “connector 9, pin 75” into “expander chip 23, pin 5”, and do that for every pin in the definition file.

I would use PCF8574 because it is easy to use and in DIP package. It is 8 bit quasi-biderectional port. It means it is either weak pull-up or strong pull down and can read voltage applied on the pin. It has only 8 addresses so you will need multiplex the address (or I2C) if you want more pins. On the other hand newer PCA8674 has clever addressing enabling 64 addresses with only 3 pins. But available only in SMD package. If this is no problem for you this is probably the best expander for this application.

Some commercial cable testers deal with cross-connections by having a ‘learn’ mode - you connect a known good cable, record it’s connections, and check cables to be tested against that.

It’d be handy for checking out Enigma rotors…

Allan.

I'm with CrossRoads on this one. By far the simplest solution and fastest too. You will need to buffer the clock & latch lines every so often, given the number of chips. But if you build a number of identical, chain-able boards, each with, say, 10 x tpic6c595 and 10 x 74hc165, you can probably get away with one buffer chip per board.

Would 74hc596 be a replacement for tpic6c595, assuming it was cheaper? That has open collector outputs.

Well with a 4052 you can have 4 banks of I2C lines, and 8 devices in each bank, using only three extra pins. Then you will have 16 I/O on each device giving a grand total of:- 4 * 8 * 16 = 512 I/O lines, from 32 chips.

In my opinion this is much easier to actually get going than the equivalent length of shift registers. Which for the maximum case is 512 / 8 = 64 chips.

You could work modular and give every port on the tester an AVR of its own, then maximum pins = 90 or whatever. In quantity you can get ATmega328P DIP chips for $2 ea (for 100 at Futurlec for example) and run them at 3V on the internal clock source (no resonators or crystals needed, just 1 bypass cap per AVR).

Just a thought, will you need to be able to source or sink from any port on the tester? The word custom implies not knowing. With a dozen-headed cable will all the lines always run down to a single main connector?

Maybe per port use one or multiple AVRs (get 15 or 16 checked pins ea, need a few for the chip bus) on I2C (they can address how you want, full range change on command), set pin patterns and report results.

There are 40 pin DIP AVRs like the 32A that might save a little, I dunno, they're as big as 8088's. Of course if you use surface mount you have lots of other choices for m-o-a-r pins and can think about using CAN bus.

allanhurst: Some commercial cable testers deal with cross-connections by having a 'learn' mode - you connect a known good cable, record it's connections, and check cables to be tested

Wow, brilliant idea. Won't work for me, though. because the cables are custom each time.

There are so many great ideas suggested. Thanks everyone!