I need more than 250 individual pins for my project.(can't use multiplexing). so how can i get them? is there any good efficient and low cost modules for that. can MCP27017 do this?
3 Answers
You can increase the effective number of GPIO pins on your Pi but using an appropriate external IC. I've never used the MCP27017, but it looks like it will do the trick.
But, there's a catch if you want to get a ton of pins. The Pi has limited ability to provide power through the GPIO header. If you string together enough external ICs, you might get 250 pins, but you probably cannot power them all simultaneously in any meaningful way. Whether or not that matters probably depends on your application. (In theory you might need 250 connections but only want to power a few at a time? You might also be able to get around this in some cases by providing a separate power supply to the external IC, but that would depend on what you're doing.)
Here's more information on the power limits of the Pi: What is the maximum current the GPIO pins can output?

- 1,377
- 2
- 13
- 19
One way would be to use external I/O units connected through USB. If you connect them through a powered HUB, this might help overcome power issues.
Have a look at https://www.amazon.com/USB-Based-24-Channel-Digital-Module/dp/B003DV6W9G or https://www.amazon.com/Channel-GPIO-Module-Analog-Inputs/dp/B00MXJU6PK

- 2,929
- 3
- 25
- 34
You will need to use an I/O peripheral (like the MCP27017) assuming the serial access time is not an issue. The GPIO pins on the RPi are nowhere as rugged as the I/O pins on an Arduino. At startup all GPIO pins are inputs. You need to configure in software how much current you intend to drive through an output pin. Total current from all outputs cannot exceed 50 mA (i.e: you can push 16 mA through three output pins). The following documents need to be understood before using the GPIO pins: http://www.mosaic-industries.com/embedded-systems/microcontroller-projects/raspberry-pi/gpio-pin-electrical-specifications#rpi-gpio-input-voltage-and-output-current-limitations/ https://www.scribd.com/doc/101830961/GPIO-Pads-Control2/

- 21
- 2
Edit: In fact, the MCP seems to function that way, so yes, it can.
– mystery Jul 25 '17 at 09:24