Posts: 1
Joined: Wed Jul 01, 2020 6:44 am

Using USB as input vs GPIO

Wed Jul 01, 2020 7:43 am

HI All,

I wanted to see if someone could point me in the right direction regarding a project me and my son are starting. Basically, we want to do a Reaction test game similar to what they use in sports.
Link to game here -

We've tried to do the simple ones using Raspberry Pi GPIOs, but with this game, we have 24 arcade buttons that light up. And from my understanding Raspberry Pi 3 B+ only have 28 GPIOs, so if I use these and need them to light up individually, I don't have enough GPIOs.

So we were planning to use the GPIOs to trigger the LED light inside each button and then use a Zero delay USB joystick encoder ( We've built a Retro Pi using these encoders before so I know they can work), like these ... Sw6VRaNUSm to register the button presses.

So my questions are:
1. Would this solution work using the USB encoder?
2. Are there any similar projects around that we can jump off from?
3. Are there any special drivers or libraries to use a Zero delay joystick USB encoder if I build this in Python?

Any info would really be appreciated.


Posts: 3932
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: Using USB as input vs GPIO

Wed Jul 01, 2020 9:09 am

You might be able to use WS2812 addressable LEDs ("neopixels") as indicators. You only need one gpio to control lots of LEDs.
You can scan lots of buttons in a matrix of rows and columns ("multiplex"), and a more efficient version "charlieplex". That sort of things works well for keyboards. You can scan N x M buttons with N+M gpio pins (more buttons with fewer gpios with Charlieplexing).
There is a small delay to do a scan and a small chance of missing very fast presses. That might matter in a reaction game, or it may not.

You can us i2c gpio expanders to connect lots of signals and they can latch which input changed and output a single interrupt line. That could catch one of many buttons.Your code could respond to the interrupt pin than read the latch to find which button was hit.


Return to “Beginners”