Ultimate iCade Raspberry Pi bartop arcade mod – Part VII – touch button

I have mentioned in one of my first iCade mod texts that I have used following component for coin slot:

Touch_sensorAdafruit Standalone Momentary Capacitive Touch Sensor Breakout


Neat little sensor, that fits perfectly behind 25¢ plastic on iCade enclosure. It lights up when pressed, but this can easily be modified if needed. I like the red light so that I know that my tap was registered.


I have connected the sensor to GPIO pin 23, together with 5V and GND.

For some time I have used Adafruit’s Retrogame to get it running, so I will explain the needed changes to get it working.

First you need to download the latest package from github and make appropriate changes in the file “retrogame.c” to get this button to work.

wget https://github.com/adafruit/Adafruit-Retrogame/archive/master.zip
unzip master.zip
cd Adafruit-Retrogame-master/

First step is to edit the correct pin where you have connected your touch button, so find in code following:

 { 7, KEY_LEFTALT }, // B/Bomb/secondary
 // For credit/start/etc., use USB keyboard or add more buttons.
 { -1, -1 } }; // END OF LIST, DO NOT CHANGE

Above comment line starting with “//” add following line:

> { 23, KEY_ESC }, // Exit key

Find the following line to since we are using pulldown button it needs to be changed:

gpio[GPPUD] = 2; // Enable pullup

change it to:

gpio[GPPUD] = 0; // Enable pulldown

Then we need to invert the button state since touch sensor is actually seding true if not pressed and false if pressed, so find:

pinConfig(io[i].pin, "active_low", "0"); // Don't invert

and change to:

pinConfig(io[i].pin, "active_low", "1"); // Don't invert

Now you can compile the code and test it with running:


If it you are satisfied with the result you can edit your rc.local and add this to the end of the file before “exit 0”:

/home/pi/Adafruit-Retrogame/retrogame &


Last few days I have been using even better program with excellent installer and even Web GUI called GPioneer. Check out the following link:


Everything is really well documented so there is no need for special instructions.GPionner_GUI

You can change your config on the go with simple, yet effective Web GUI.


2 Replies to “Ultimate iCade Raspberry Pi bartop arcade mod – Part VII – touch button”

    1. I have tried the same thing and failed. Google gave me some ideas why it failed, but I am not 100% sure. It has something to do with PullUp and PushDown nature of the sensor and zero delay USB encoder. To be honest I gave up and removed touch sensor button from my iCade because it was registering some false positives instead behind that plastic there is sensor for my remote control with control light. If you find a way to connect I would appreciate if you share the info.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.