Arcade Bartop With Illuminated Buttons Per Console
by alexpikkert in Circuits > Raspberry Pi
1003 Views, 5 Favorites, 0 Comments
Arcade Bartop With Illuminated Buttons Per Console
updated january 2024
In this instructable I describe how to connect and program the illuminated buttons from an Arcade Bartop game machine to only light up the buttons that are used by each console. No additional led controller is needed, the leds inside the buttons are connected via transistors to the GPIO (General-Purpose Input/Output) pins from the built-in Raspberry Pi 3b. Via the Retropie software (various runcommand scripts) they are switched ON and OFF. The design and building instructions for the Retropie Arcade Bartop game machine with a Raspberry pi 3b can be found here.
Supplies
Arcade bartop game machine with 19 led illuminated control buttons, see here.
. colored stranded wiring 0.2 sqmm.
1 Joy-it RB-CON+01 GPIO flatcable with 40-pole plug and connectors 40xGPIO bus - 40x GPIO bus. (connection for the Raspberry GPIO pins).
12 transistors BC547.
12 resistors 1 kOhm 1/8 Watt.
1 prototype pcb board hole-pitch 0.1 inch, 26x38 holes.
6 wood screws.
4 nuts M5 (used as spacers).
. MDF wood 6 mm. for the PCB base.
1 string of 16 pcb board connectors.
. heat shrink tubing.
1 piece MDF wood 6 mm. 20x20 mm. with a 10 mm. hole (for wire guidance)
. wood glue.
. tie wraps for the internal wiring.
PCB for the Leds
The leds inside the arcade buttons operate on 9 Volt DC. The Raspberry pi GPIO pins however use a maximum voltage of 3.3 Volt DC. To protect the Raspberry pi these leds are connected via transistors type BC547. All GPIO pins are safely connected to the base of these transistors via a 1k resistor.
The collectors are directly connected to the button leds because these leds have an integrated current limiting resistor built in. If your leds do not have this integrated resistor you must add a 470 Ohm resistor in series with the button led.
Each button led is connected to the plus of the 9 Volt DC power supply. A led is switched ON when a transistor is activated via a GPIO connection and connects the GND to the led. My Arcade Bartop has 19 led illuminated buttons, but only 12 transistors are used. This is possible by activating a few pairs of button leds, X & Y, Right & Left Shoulder and Flipper Left & Right. Select and Start from player 1 are not connected via a switching transistor, they are always ON because they are always used by the Retropie menu. I assembled a circuit board with these transistors, resistors, board connectors and the flatcable connector mounted on a small wooden base.
The wiring is connected via small board connectors, I bent these connectors 90 degrees to create a horizontal wire connection. All wire connections are fully insulated wit heat shrink tube. See attached drawing for the wire colors I used.
I added a single blue led on the front, top left from the screen. This led is only lighting up when the MAME control buttons on the front are active (for game exit/confirm, game pause and game reset).
All GPIO wires are connected to the Raspberry pi GPIO pins with a flatcable with 2 40-hole connectors. The GND connection from the power supply is also connected to this pcb as shown on the wiring diagram. The GND connection from the Raspbery pi is connected to this GND via the flatcable connection. See the GPIO layout for the numbering of the pins. I refer to the board pin numbering, NOT the GPIO numbering.
The Startup Software (boot Sequence), Written in Linux and Python
First connect all wiring and pcbs as described in step 1. The software neccessary to control the illuminated buttons is written in Linux (.sh script files) and in Python (.py files). To write both type of files you must use the editor Notepad++. Other editors might corrupt linux files during editing. Change the following setting in Notepad++ to use linux files properly:
Under settings-preferences-new document-format(line ending) set format(line ending) on UNIX(LF).
To transfer all files to the Raspberry pi the program WINSCP can be used.
I wrote all files on a windows 10 laptop and transferred them later on to the Raspberry pi with this WINSCP.
To use WINSCP you must add the following data in the settings from the start menu:
scp protocol, user name pi, password raspberry, port number 22, retropie as host name, under advanced at environment scp/hell set: shell sudo su - (This is to get root access). Else you will have only access to \home\pi…. and not to all other directories. Save this configuration as standard.
remark: WINSCP only works when the SSH option in the Raspberry pi is also activated.
(Check this at Raspi Config/Interface options in the Retropie menu).
I wrote a small led testing program (gpio_ledtest.py) that can be used when the Raspberry pi boots. This program switches all leds ON and OFF with an interval of 0.5 seconds. Copy this Python program on the Raspbery pi with WINSCP in the following directory: /opt/retropie/configs/all/.
After the Raspberry pi boots only the buttons A, B, Select and Start from player 1 are active with the Retropie main selection menu on screen. To activate this copy the Python file leds_menu.py in the directory /opt/retropie/configs/all/.
To start both programs during boot sequence the following commands must be added to the existing file: /etc/rc.local.
Open this file with WINSCP and add at the end of the file just above the existing line exit0 the following lines:sudo python3 /opt/retropie/configs/all/gpio_ledtest.py
sudo python3 /opt/retropie/configs/all/leds_menu.py
Now both programs will be activated during startup.
The Software for the Console Button Leds
For each console I wrote a Python file to activate the actual button leds. The setting matrix is shown in the attached picture. Copy all these .py files with WINSCP into the directory /opt/retropie/configs/all/.
These ON/OFF settings will be activated when a console is started in the main Retropie menu using the
runcommand-onlaunch.sh script.
See the Retropie documentation for all details about the runcommand scripts.
Stopping a console ( pressing Select and Start from player 1 at the same time twice) returns to the main Retropie selection menu and all button leds will be reset using the script runcommand-onend.
If something goes wrong during installation you can check the logfile for runcommand with WINSCP at:
/dev/shm/runcommand.log.
Linux script files .sh are not supported by instructables, so I added these files as PDF.
Open these files with a pdf reader and copy each text with ctrl-c/ctrl-v into Notepad++.
Save both files with the original name as .sh file instead of .pdf and copy them with WINSCP into the directory /opt/retropie/configs/all/.
Reboot and enjoy !
The Software for the Flipper Button Leds
The flipper button leds can be activated when a pinball game is started. As an example I added this option already to both runcommand.sh files from step 3. Copy the file leds_flipper.py into the directory /opt/retropie/configs/all/.
Most pinball games use the joystick right and A button to activate the flippers, to change this to the actual flipper buttons a new retroarch config file must be placed in the same directory as the pinball game rom.
This retroarch file must have the same complete name as the game rom and ends with .cfg.
(filename.zip.cfg)
Inside this file the original flipper codes must be replaced with the codes from the actual used flipper buttons.