I am developing my board, which is based on ATMEGA328P (as in UNO). I need to add a few additional IO pins to the board (LED control, read buttons state).
Initially, I saw the PCF8574 (I2C) expansion board, I already wanted to use it, but suddenly I learned that it was an outdated board and it works at low speeds, which is not very good. After I saw the IO Extender MCP23008, like it is newer and works at high speeds. Nevertheless, I was not fully determined with the choice.
Advise the best and most reliable solution in terms of IO extenders, working on I2C, and not requiring complex processing code in the main controller (ATMEGA328P).
Do you need outputs or inputs? I'd recommend using a shiftregister if you're able to. They're cheap, fast and easy to interface with. Use 74HC165 if you need inputs, and use 74HC595 if you need outputs.
However you can also step up to a microcontroller with a little more IO pins. The ATmega32 or ATmega324A/324P/324PA is a great alternative. The ATmega324 is a newer version of ATmega32, and is ~99% compatible with exising "Arduino UNO" code. The ATmega324 is not very expensive eiher, and it will reduce you overall component count.
My personal preference is the MCP23008 for general purpose IO expansion. Unlike shift registers, you can have part of the pins as inputs and part of the pins as outputs at the same time (ex. keypad interface). The MCP has the capability to enable internal pullups on input pins (ex. for switches). There is the capability to use pin change interrupts on every pin (works like pin change interrupts on a 328 chip). The programming is a bit more involved for the I2C expander partly because it is I2C and partly because the MCP chip is more versatile.
Granted the shift registers can be faster than the MCP chip if speed is needed.
The two devices you mentioned, the PCF8574 and MCP23008, are no different in speed - as they both use the I2C interface.
The MCP23008 is available with the faster SPI interface as the MCP23S08 but that speed isn't necessary for additional pushbuttons and LED’s and you loose two additional gpio pins when using SPI.
Are all your pins used; people at occasion forget than analog pins can be used as digital IO.
I you have analog pins free (or can free one or more of them) you can hook 5 or so up to an analog pin. That can free up pins for oter purposes.
Initially, I saw the PCF8574 (I2C) expansion board, I already wanted to use it, but suddenly I learned that it was an outdated board and it works at low speeds, which is not very good.
It's all relative. How fast does it have to be? For what reason?
If you want simplicity and low cost shift register is better then PCF which is better than MCP. OTOH MCP is much more useful and versatile then PCF which is much better than shift register. It is up to you which one is the right device for your project.
The PCF8574 is "outdated". But it does not mean it is a bad device. Very similar new devices exist but they are not in DIP package.
I would recommend you to use 74HC165 and 74HC595 for increasing your input and output pins. The I2C chips you mentioned are not that good.
74HC595 is a shift register and it works on Serial IN Parallel out. You can control 7 outputs from signal pin using single chip. You can use multiple chips. You should read Arduino 74HC595 Interfacing: Increase Output Pins and also download its Proteus simulation. They have used 4 chips to increase the output pins by 32.
74HC165 is also a shift register but it works on Parallel In Serial Out. So, you can easily get data from multiple inputs and this data will be fed in single Pin of Arduino.
Let me know if you want Proteus Simulation for these chips, I think I have them somewhere.
groundFungus:
Would you tell us how you came to that conclusion?
It works on I2C Protocol, which I think is quite complex as compared to shift registers which are too easy to use.
Moreover, if you want more I/Os you can easily connect multiple shift registers and their response time is also fast. You can take its pinouts individually quite easily.
jackthom41:
It works on I2C Protocol, which I think is quite complex as compared to shift registers which are too easy to use.
Moreover, if you want more I/Os you can easily connect multiple shift registers and their response time is also fast. You can take its pinouts individually quite easily.
But the port expanders have (pseudo)bidirectional pins and works with only 2 signal wires. Which is great advantage! And since Arduino Uno has hardware I2C the complexity is not so much higher.