Hi
I have some basic projects recently and lack of i/o pins was on micro controllers is annoying and made me to change path every time .
first example i want to use some neopixel with my pcf8574 that can't be possible or control spi part like max7219 with mcp23017 or pcf8574 and it's not possible again .
Or for some project i want to use a tiny microC and have some additional i/o pins .
Is there anyway that i can extend my controller i/o pins that act like itself and control them from micro controller ?
It appears you do not comprehend what a bus is. I highly recommend getting the Arduino Cookbook and skim it cover to cover, then read the sections perternante to your project. Your I2C bus has 127 available addresses, in theory that states you can connect that many devices to those two pins. There is also a practical limit but that is many devices depending on layout. You also have a SPI bus available for use. The MCP23017 data sheet states this:
16-bit input/output port expander with interrupt output
Cascadable for up to 8 devices on one bus
25mA sink/source capability per I/O
Supports 100kHz, 400kHz and 1.7MHz I2C™Compatible compatible modes
That gives you 128 lines from just two on your micro.
The PCF8574 and PCF8574A are at different address bases so with those you
can add 16 devices on the I2C bus. This will give you another 128 lines again from the same two pins so you get 256 outputs/inputs by using only two pins. Those outputs all connect via the chips specified to the same two pins at the same time. Spend some time with the cookbook.
No, no pin extender can fully replace MCU pins; there are always some limitations.
Extend to the extender those pins for which you use only input-output operations like digitalRead()/digitalWrite() , without using any libraries (for example Neopixel) or protocols (spi or i2c)
Or in your situation, you just have to choose a controller with the right number of pins.
Port expanders and bi-directional shift registers (might be the same thing) give digital pins that you can set mode on a per pin basis. They are not cheap.
Output shift registers can be run from the SPI bus at about 10% speed of MCU I/O pins but with ~40 or so mA shared. They are good for indicator leds in less than brightly lit situations and they are cheap.
Input shift registers cost a bit more and don't need external power. They otherwise match the output shift registers.
To work them right you should learn more about SPI with default clock rate that supports 512KB/sec data transfers. 10% of that is pretty fast!
For less cost you can wire a row-column matrix and get rows x columns "pins". You will need diodes for that and I'm not sure if the matrix can be wired to do both In or Out by choice but really cheap and can be fast enough to need to debounce buttons.
Charlie-plexing can get more "extra pins" but the coding is messy.
The ATmega1284P (Budvar10 sold me a board with one overclocked at 24 MHz (50% faster than 16, including SPI!) but you can put one on a breadboard to PCB with clock source you want (use a crystal for super solid clock rate!) and other extras. That AVR has 32 IO pins as 4 8 bits open ports (Uno running serial gives 3 ports with 6 pins clear.
I agree. High speed, high precision timing is required for neopixel, and that is probably impossible through I/o expanders.
I disagree. It is possible. The timing and precision required is much easier, mostly because max7219 has a clock pin. But it is not easy for a beginner because the Arduino libraries for max7219 can only use the controller's I/o pins. So it is necessary to control the chip without any library, or creating your own library.