Electronic – A huge number of buttons on a Raspberry Pi

i2cinputintegrated-circuitraspberry pitexas instruments

I am working with a friend (he's got the vision, building the structure, I'm working on the electronics) on a large scale project that involves a grid of pictures illuminated by an LED at the push of a button. He plans on having 1000 pictures, each with their own buttons. I plan on running the whole project on a Raspberry Pi. The LEDs will go through SPI. I am having trouble figuring out how to connect and monitor such a large number of buttons (I've done LEDs a lot but have little experience with monitoring multiple inputs). I have figured a couple options and wonder which is best, if this is even feasible:

  1. A number of keypad scanner ICs (like the TCA8418 or LM8330) connected to an I2C multiplexer connected to the RaspberryPi. I don't know if this would have a reasonable response time or if certain sections of the keyboard would be unresponsive while others were active.
  2. Multiple smaller arduinos monitoring a small number of buttons feeding info back to the Pi. We would be able to handle more simultaneous presses, but it seems to be the priciest option.

Are either of these feasible options to run on a single RaspberryPi with good response times? Registering multiple presses is less important than having something that responds quickly with each individual press in this scenario.

Best Answer

It could certainly work, I2C can run pretty fast. Just makes sure the ICs you're using support an address space wide enough to sit on the same bus. The nice thing about I2C is that it's multimaster, if you find an IC that can let your main controller know when a button has been pushed that should work fine. Even if you have to resort to polling the raspberry pi should be able to handle that load just fine.

As for response times, you can calculate that roughly by going through timing diagrams in the datasheet, and with a little experimentation. Start with how long it takes you to acquire the data in the first place. Unless there's an awful bottleneck somewhere it should run fast enough for your intended function.