1
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ To clarify, I don't have a lot of experience designing large circuits on my own, or working with ICs. I know already that people have asked questions about supporting around 100 buttons, I just haven't seen anything on this scale. I know it's theoretically possible, now I want to know if it is practical. \$\endgroup\$ – Ely Eastman May 6 '17 at 5:19
1
\$\begingroup\$

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.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Raspberry Pi (the Broadcom chip)does not support multimaster I2C. It does support clock stretching however. \$\endgroup\$ – Jack Creasey May 6 '17 at 6:43
  • \$\begingroup\$ Did not know that...that's a strange oversight. \$\endgroup\$ – alphasierra May 6 '17 at 17:51
  • \$\begingroup\$ It's an oversight on your side, but a design decision for the RPi \$\endgroup\$ – m.Alin May 6 '17 at 18:46
  • \$\begingroup\$ Fair enough. It just seems strange to not include a basic piece of functionality for a standard protocol. What could be gained by leaving out that functionality? \$\endgroup\$ – alphasierra May 6 '17 at 19:29
1
\$\begingroup\$

To a large extent it is going to depend on how far apart your buttons are, it will also depend on the potential need to support multiple buttons activated at the same time.

I'd suggest you could use a simple PC keyboard controller (keyboards are really cheap), it supports about 104 keys (buttons), and provides N-key rollover so you can see many buttons down at once. If you use a keyboard controller then you can hook it up via USB, connect multiple via a hub (an 8 port hub would give you about 800 buttons) and the software for a keyboard device is simple to write.
If you get keyboards with USB sockets in them, they already have an internal hub, so you could serialize them that way too.

In many keyboards the controller is on a small separate motherboard separate to the key matric which makes things nice and easy. I've cut up many keyboards just to get the function keys for various projects and it works well.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.