[guide] kitsch-bent i2c board without a teensy

Various user-contributed guides for hardware-related things
Post Reply
vizigr0u
Posts: 3
Joined: Wed Mar 22, 2017 5:27 pm
Been thanked: 2 times

[guide] kitsch-bent i2c board without a teensy

Post by vizigr0u » Fri Mar 31, 2017 2:32 am

Hey guys,
I recently acquired my input board from kitsch-bent, i2c version.
I finally got this to work and now I hope this guide can help anyone that wanted to use this board !

Foreword:
Maybe I should have looked at these threads before buying.
As my first DIY/electronics project, this board wasn't the easiest to figure out ;)
My choice for this board was because I didn't want to use the gameboy main board but still felt like the project wouldn't be as fun if I bought one of the board that already have everything pre-built in them (USB hub, teensy etc.).
I also wanted to experiment with buttons straight on the raspberry pi so this board looked perfect for just this!

A few obstacles were on the way, including the mk_arcade_joystick_rpi driver that has had a bug for almost a year now, which basically ignored the MCP23017...
I'm a programmer and I had a lot of fun writing a python program to test i2c communication with my board, remapping the keys in the driver and finally debugging and fixing the MCP23017 bug. Now to the guide!

The Guide:

Prerequisite:
a shell to your raspberry pi with root/sudo rights (follow this tutorial to enable ssh)

Wiring the board
Connect each pin to your raspberry pi (I'm using 3.3V as Vcin because it's closer but you can use 5V).
MAKE SURE YOUR WIRING IS CORRECT BEFORE TURNING ON THE RASPBERRY PI
Image

Connect to your board:
Enable i2c and install everything needed (I followed this adafruit tutorial)
If your board is properly connected, you should see it on "port" 20

Code: Select all

sudo i2cdetect -y 1
Image

Test your buttons:
I made this python script to figure out the button key codes on the board. You can use it to make sure all your buttons are working before you try installing a driver for the board.

Code: Select all

wget https://gist.githubusercontent.com/vizigr0u/5308bef88934967b687ca6921846f49b/raw/72aef1d19d47280b646ae63538d6c982e3046f62/i2ctest.py
python i2ctest.py
 
pressing buttons should display them on your console. (press CTRL+C to quit)

Install an input driver:
Unfortunately, as the time of writing, the mk_arcade_joystick_rpi driver has a bug for MCP23017. It also doesn't have the right mapping for the Kitsch-Bent board.

So I went ahead and forked that repo and made a version that both fixes the bug and uses the Kitsch-Bent inputs here.
(appologies to kitsch-bent, at the time of coding I was certain your name was Kitsch Bench ;) )
I also compiled it and uploaded a debian package to my github.

Anyway, to install a version of my driver on your raspberry pi:

Method A (easy and untested) :

Code: Select all

wget https://github.com/vizigr0u/mk_arcade_joystick_rpi/releases/download/v0.1.5b-0-1/mk-arcade-joystick-rpi-0.1.5.deb
sudo dpkg -i mk-arcade-joystick-rpi-0.1.5.deb
Method B:
compiling from source :

Code: Select all

git clone https://github.com/vizigr0u/mk_arcade_joystick_rpi.git
cd mk_arcade_joystick_rpi
git checkout git checkout kitsch-bench-board
make
sh utils/makepackage.sh 0.1.5
sudo dpkg -i build/mk-arcade-joystick-rpi-0.1.5.deb
Please note that if a method doesn't work and you try the other one, you should probably try to uninstall the driver first :

Code: Select all

sudo dpkg -r mk-arcade-joystick-rpi-dkms
(by the way, I have no idea why the name keeps changing between the package the .deb and the module, but I guess it's related to some configuration somewhere...)

Testing the driver (final step!) :

Let's start the module, then test it!

Code: Select all

sudo modprobe mk_arcade_joystick_rpi map=0x20
jstest /dev/input/js0
If it looks like it's working, congratulations, you can now enable the module to start at boot !
Add mk_arcade_joystick_rpi to your /etc/modules file

Code: Select all

echo mk_arcade_joystick_rpi | sudo tee -a /etc/modules
and don't forget to give the modules its parameter, by adding a conf file in /etc/modprobe.d/ :

Code: Select all

echo options mk_arcade_joystick_rpi map=0x20 | sudo tee /etc/modprobe.d/mk_arcade_joystick_rpi.conf

User avatar
Helder
Trailblazer
Trailblazer
Posts: 2985
Joined: Thu May 05, 2016 8:33 am
Location: Rogers, AR
Has thanked: 1459 times
Been thanked: 3114 times

Re: [guide] kitsch-bent i2c board without a teensy

Post by Helder » Fri Mar 31, 2017 7:04 am

Awesome! many people who bought this board have had trouble getting it setup and this guide will fix that. I will move it to the appropriate subforum.
Chat with me and other members On Discord

Don't contact me about obtaining my board files (as you will not get them). If my Boards or PCB Kits are sold out, they will be restocked as soon as I can get them and there is demand for them. You can join the mailing list on my Website to be notified when they are available.


Helder's Game Tech Website

We will not support any cloned work so don't come to us with technical issues to resolve, go talk to the cloner for help.

User avatar
abrugsch
Posts: 971
Joined: Tue Aug 02, 2016 10:00 am
Has thanked: 356 times
Been thanked: 430 times
Contact:

Re: [guide] kitsch-bent i2c board without a teensy

Post by abrugsch » Fri Mar 31, 2017 7:20 am

there's a new driver on the block too, adafruit's arcade bonnet now uses an MCP23017 for the hardware interface so their retrogame service now caters for it.

stewbacca
Posts: 1
Joined: Tue Apr 18, 2017 1:12 pm

Re: [guide] kitsch-bent i2c board without a teensy

Post by stewbacca » Sun May 07, 2017 10:08 pm

I want to start by giving huge thanks to vizigr0u for doing this tutorial, I purchased two of these i2c based kitsch-bent boards, however I'm running into an issue. I've enabled i2c and teh i2ctest.py scripts works perfectly as far as the button presses go, but once I install the driver, either method, the x, y, start, and select buttons don't work at all. I noticed that it seems to identify the board as a 2 axis 8 button joystick, but the d-pad seems to show up under the buttons when the driver is loaded and the a and b buttons are registering as axis 1. I'm using a raspberry pi zero ver 1.3 and I've enabled the pwm audio overlay, otherwise it's a basic install of RetroPi 4.2 Any assistance would be appreciated.

UPDATE: I found that if I ran the install script with the update options on the mk_arcade_joystick_rpi driver install, then followed these instructions it works perfectly. In case anyone else runs into the same issue.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest