2
\$\begingroup\$

I'm connecting to an arduino or raspberry pi and would like to have 256 io pins. I found a 16bit io expander which has 8 unique addresses for 128 but that's the max I can do on i2c. Any other thoughts on how to expand my io ports?

\$\endgroup\$
  • \$\begingroup\$ ... another I2C bus? \$\endgroup\$ – Brian Drummond Dec 24 '14 at 20:03
  • 7
    \$\begingroup\$ @Majenko To be fair, I think this question would still hold if you replace Raspberry Pi or Arduino with MSP430 or some such appropriate μC. \$\endgroup\$ – Nick Alexeev Dec 24 '14 at 20:24
  • 1
    \$\begingroup\$ Can you describe your application in more detail? There might be a way that doesn't require 256 i/o pins. \$\endgroup\$ – pericynthion Dec 25 '14 at 0:35
  • \$\begingroup\$ -1 for lack of detail. \$\endgroup\$ – DoxyLover Dec 25 '14 at 1:29
  • \$\begingroup\$ Do you need I/O pins, or unidirectional inputs or outputs? \$\endgroup\$ – alex.forencich Dec 25 '14 at 2:00
7
\$\begingroup\$

You can put an I2C Multiplexer in there between the Arduino and your devices, then only put one of each address on each downstream bus. A 1-to-2 Multiplexer that I've used with Arduino before is PCA9540BD,118. That will get you to 256 with the hardware and interfaces you are already using with the addition of one more component.

| improve this answer | |
\$\endgroup\$
6
\$\begingroup\$

There are inexpensive CPLDs available with lots of I/O pins. It's a good tool to have in your toolbox. For example, XC2C32A with 33 I/O for $1.25. Or slap down a $50-ish XC2C512 with 270 I/O and it's all over but the programming.

| improve this answer | |
\$\endgroup\$
4
\$\begingroup\$

This is a solution if all you are looking for is low-speed output-only: 74HC595. http://www.nxp.com/documents/data_sheet/74HC_HCT595.pdf

I once used this chip for animating a lot of LEDs.

You can connect a chain of these chips together, so that the output of a Q7S goes to it's neighbor's DS. Then, take an SPI output of your main micro and connect it to the chain. The micro's SPI-MOSI should connect to the free DS chip and then SPI-CLK should connect, in parallel, to all of the SHCP pins. Then, use a free I/O to pulse all of the STCP pins. Your transmission should look like this:

  1. Transmit 8 bytes on SPI.
  2. Pulse STCP

Once you pulse the STCP line, all of the outputs will change.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

The MCP23S17 has 16 I/O pins and uses SPI. Throw in a 4:16 demux for the select and you get 256 I/Os.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Both MCP23017 and 23S17 have addresses so 8 23017's on I2C and 8 23S17's sharing one SPI bus.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.