Edited:
Question re-written
Hello,
So I am looking to build a system that will have around 400-500 input buttons. These buttons are basically used to select an option so only 1 button will ever be activated at any given time.
Below is a rough mock-up of a circuit I have designed that will allow the buttons to work like a binary input to the pi's GPIO pins.
By this I mean;
If you press button 3 below GPIO 1 & GPIO 2 will be activated. So when I read in the 4 GPIO pin states in the Pi I would see: 0011 which when converted to decimal will give 3.
The circuit allows for 8 inputs, but I have worked out that if I repeat the circuit 7 times and then link them into a further circuit I can build a chain of these to give a total of 512 buttons using 10 GPIO pins. I have made an excel file to simulate the connections and check it calculates out correctly. I would upload this but it's on my work pc.
Where I am looking for advice/help is;
The cable length from the Pi to these buttons could easily hit 3m. Would I be able to run these using the Pi's 3.3v or would the length become an issue?
Protection - I've never had to fully design protection so advice on where to place resistors & values would be greatly appreciated.
if the 3.3v from the Pi is not my best option, what would be your recommendations for isolating the pi from a larger supply voltage. In the past I have done work with using a Picaxe chip to drive some darlington pair transistors to run some point motors for a model railway. Would this be a good route to go, or would something like optocouplers be a smarter choice?
Hopefully this is better written than my original & I apologise for the poorly written original & delayed rewrite. Work this week has been a killer so my mind wasn't in the best state.
Edit:
Further details on what I mean by combining to get up to 512 buttons. I would use break out boards like this;
Boards 2 to 7 (giving up to 64 buttons). The J numbers would continue counting on each subsequent board;
All of the above 8 boards would then feed into this board (linked on the J numbers);
The All pin would then be used if more inputs are needed and further joiner boards are added to the chain (in the same way J5 is used). To add further in the chain you would use the joiner board but add another 3 rows (same as those being used for GPIO1 to 3) for GPIO 4 to 6. The diode structure would then start on GPIO 7. The GPIO 7 on the first joiner board would become a jumper the same as J9
MCP23017
I2C chips and eightMCP23S17
SPI chips. They give you 16 gpios per chip. So that combo of eight of each gives you 256 GPIOs. Then wire switches to 12V/24V opto-couplers wire the opto-couplers to the 5V MCP23x17 chips.