Fastest Finger First System Using Raspberry Pi



Construction and testing

fig 2Fig. 2: Solid-state relay module and its connections
Fig. 2: Solid-state relay module and its connections

Each bulb holder and push-button switch is mounted on a suitable box, with separate pair of wires for the bulb holder and the switch. GPIO board numbering is used throughout the project. Push-button switches’ wires are connected to GPIO pins 11, 13, 15, 16 and common to ground pin 9 of Raspberry Pi as shown in Fig. 1. A 5V, 4-channel solid-state relay module (refer Fig. 2), purchased from, is connected to Raspberry Pi GPIO pins 18, 19, 21 and 23.

A 5V supply is given to relay module from Raspberry Pi. Coloured indicator bulbs (Bulb 1 through Bulb 4) are connected to the output of the relay board with 230V supply as shown in Fig. 1. System’s various connecting points are shown in Fig. 3.

Run the Python script on the terminal by giving the command:
[stextbox id=”grey”]$ sudo python[/stextbox]

fig 3Fig. 3: System’s various connecting points
Fig. 3: System’s various connecting points
fig 4Fig. 4: Author’s prototype
Fig. 4: Author’s prototype

The program executes from main subroutine. It prompts for user inputs like names of the teams and allowable time (in seconds) to respond to a question. Then it clears the screen and prompts you to continue or to stop. To continue the game, type 1 followed by pressing ‘Enter’ key. Raspberry Pi initialises the push-button switches’ pins as input and clears the solid-state relay pins to switch off the indicators.

As soon as contestants press their switches, names of the respective teams with their rank numbers get displayed on LCD screen, along with glowing of respective indicator bulbs. If no contestant presses the switch within specified time, all the switches’ pins get latched, so no more inputs will get registered and ‘Time Up’ message is displayed on screen.

By typing Ctrl+C keys at any time, the host or operator can stop the quiz without restarting the whole system or waiting till time up. When prompted, enter 1 to continue or 0 to quit the game.

Download source code: click here

Nitin Kisan Palte is a B.E. (instrumentation) and an electronics hobbyist, currently working as instrument mechanic in College of Agricultural Engineering and Technology, Dr Balasaheb Sawant Konkan Krishi Vidyapeeth, Dapoli



  1. Wouldn’t an Arduino or other micro-controller work better than an rPi? The Linux system of the rPi could be doing other work when the first person presses the button, thus your python script will miss the actual first button press, and could then perhaps read the next persons press instead!


Please enter your comment!
Please enter your name here