Adding a 9th button to GPIO
-
@loujez Make sure you're using a power supply that can handle the pi. This could be why you don't have sound. How are you outputting sound? HDMI or audio jack? Take a look at your main config file. There are options to comment or uncomment lines depending on how you're outputting the sound.
-
I would suggest, if you are getting a lightning bolt, that you should look to replace the power supply. A Pi3 really wants a minimum of 5.2V @ 2.5A. I use one of these: https://www.rapidonline.com/stontronics-t5875dv-official-raspberry-pi-psu-5-2v-2-5a-uk-euro-plugs-75-0532
How are you outputting sound from your Pi? Also could you post a copy of your /boot/config.txt (remember to enclose it in code blocks or put it on pastebin and post a link here)?
Si
-
Thank you guys for your fast answers.
@theRog05 Actually i have a 5v power supply with 3amp connected to a Western digital external hard drive (called PiDrive), which redistributes power to my raspberry, my arcade controllers and so on.
Regarding to my arcade cabinet audio outputting, i'm using an amplifier + 2 audio speakers which are linked directly to the raspberry with the jack 3.5 cable.
@simonster Here is my /boot/config.txt (sorry dont know how to code block):
https://pastebin.com/h4CyQc1d
Just to say that sound was working in game before i set my 2nd player arcade controllers. After it was done, nothing comes out from my speakers except in the emulationstation menu. Because gamepad 2 was not detected, i used theses command lines :
sudo nano /etc/modules
i 've added:
mk_arcade_joystick_rpi
mk_arcade_joystick_rpi map=1,2then i tapped:
sudo nano /etc/modprobe.d/mk_arcade_joystick.conf
and added:
mk_arcade_joystick_rpi map=1,2
Then (to see which options were launch at the boot) :
grep "mk_arcade_joystick_rpi" /etc/modprobe.d/*
Then i've seen 2 options one with map=1,2 and an other one with "mk_arcade_joystick_rpi.conf with map=1"
So i changed it by adding map=1,2 to the lineThen
sudo reboot
But there are still to different .conf options launch at the boot system. I supposed one isn't useful
@simonster Regarding to the hotkeybuton, i'm going to use the "rm -r mk_arcade_joystick_rpi" line that you gave me this afternoon. I will give you a feedback
Thank you again guys, your help is very nice.
Looking forward to reading youEDIT: i've just tried to enter theses command lines:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install alsa-utils
sudo modprobe snd_bcm2835On the last one i get :
pi@retropie:~ $ sudo modprobe snd_bcm2835
libkmod: ERROR ../libkmod/libkmod-config.c:673 kmod_config_parse: /etc/modprobe.d/mk_arcade_joystick.conf line 1: ignoring bad line starting with 'mk_arcade_joystick_rpi'with
grep "mk_arcade_joystick_rpi" /etc/modprobe.d/*i see
/etc/modprob.d/mk_arcade_joystick.conf options mk_arcade_joystick_rpi=1,2
/etc/modprob.d/mk_arcade_joystick_rpi.conf options mk_arcade_joystick_rpi=1,2I think my 2nd gamepad set up is in conflict with the sound. Is it a possible way of solutions.. ?
-
With regards to the sound issue, have you set the sound output in the raspi-config to 3.5mm (you can access this from the RetroPie menu in ES)?
With regards to the joystick working: I'm not sure why you've done a number of these changes, if you installed from the update script first, the options were already setup for you, you just needed to configure the joysticks in ES (both of them as they are listed as separate devices with unique configurations).
The instructions for autoloading the driver are as follows, these are the only sections that should be used to configure it:
Open /etc/modules :
sudo nano /etc/modules
and add the line you use to load the driver :
mk_arcade_joystick_rpi
Then create the file /etc/modprobe.d/mk_arcade_joystick.conf :
sudo nano /etc/modprobe.d/mk_arcade_joystick.conf
and add the module configuration :
options mk_arcade_joystick_rpi map=1,2
-
Yes i have set the 3.5mm raspi_config. As i said sound is ok in emulationstation menu and worked before i set up weirdly my 2nd gamepad.
I had installed the update-script but in emulationstation only "1 gamepad was detected". That's why i have tried to do it by myself. I am aware that i have made one mistake with the creation of mk_arcade_joystik.conf.
I am going to clean all that things and i will come back to say you if there is a sound improvement. I'm pretty sure to have created a conflict somewhere. I will come back laterThanks again
-
@simonster !!!!!!
I have manage to diagnostic where comes the sound probleme. I have reinstall everything today from zero !!!
For the hotkey button it works !!! thank you so muchI have managed to get the 2nd player working and the sound was here , unbelievable !
But as the first time i set up the 2nd gamepad, up and down wasn't recognised and left and right reversed.So on my computer i went to retroarch.cfg and manually corrected these lines :
input_player2_up_axis = "+3"
input_player2_down = "nul"
input_player2_down_btn = "nul"
input_player2_down_axis = "-3"
input_player2_left = "nul"
input_player2_left_btn = "nul"
input_player2_left_axis = "+0"
input_player2_right = "nul"
input_player2_right_btn = "nul"
input_player2_right_axis = "-0"by :
input_player2_up_axis = "+1"
input_player2_down = "nul"
input_player2_down_btn = "nul"
input_player2_down_axis = "-1"
input_player2_left = "nul"
input_player2_left_btn = "nul"
input_player2_left_axis = "-0"
input_player2_right = "nul"
input_player2_right_btn = "nul"
input_player2_right_axis = "+0"After i've done it, the sound has disappeared again !!!!!!!! It still here in the menu, but not in game.
So the issue comes from retroarch.cfg. I suppose that i can't modify it manually and that's what i did the first time also.
I'm going to reinstall everything
-
ok everything is working !!!! I have configured retroarch.cfg mapping from the cabinet. Before i was doing it with the help of my computer and my local network.
Thank you again for your time. I just have to play with a hotbuton key working as never !!!
Cheers from france
-
I'm still not sure why you got the issue with Up/Down and Left/Right on the 2nd controller the first time, but I'm glad you got it all working.
Si
-
@loujez: I'm glad you got everything working! I was on vacation without internet for a few days and just got back to reading this. As for the second controller not working, I had that same issue to begin with. It had to do with me creating multiple instances of the file where
mk_arcade_joystick_rpi map=1,2
was saved. I had two files named differently and the one being used only hadmk_arcade_joystick_rpi map=1
, hence the reason it was only finding one controller.As for the sound, I still have issues sometimes when booting up. It seems if I do a reboot from the command line, there will be no sound. But if I shut off the system completely and then load it up. It works fine. Weird, but I haven't figured out why that happens.
Anyways, glad everything is working! Hopefully this helps some others in the future!
-
Hey guys. It's been a while, but I came back to this post to get my new system set up. I got my two sets of joysticks set up, but my js1 (second set) has an issue. Whenever I press the hotkey button, it shuts down the pi. And if I press it again, it starts back up again. I did a
jstest /dev/input/js1
in terminal and all buttons are recognized, but as soon as I hit that hotkey (key 8: even in terminal) the pi turns off. Any clue to what's going on? I am using my same set up, just a new install of retropi. Thanks in advance! -
@therog05 Where did you wire the button - which GPIO pin ? Looks like you connected to the Pin 5 / 6, which are involved in powering on/off the PI - see https://elinux.org/RPI_safe_mode#Wake_from_Halt.5B1.5D.
-
@mitu I'll have to check tomorrow. It used to work fine with my other build and I didn't change any wires around. Maybe something is shorting out? Gotta catch some zzz's right now but I'll check tomorrow.
-
So here's where I'm at:
I started with pulling apart the cabinet to check the wires going to that button. I followed the wires back to the GPIO pins and found that, that button is connected to GPIO3 (Pin 5). Looking at a diagram, there doesn't seem to be anything special with this pin other than it is the HK (hotkey) button for a two person layout (according to RecallBox).
After some digging through folders and files, I found a "shutdown.py" script in the home/pi/scripts folder. I read the code and it shows that the shutdown happens on that pin 5! I got excited that I might have found the problem, so I researched a little and found someone that ran
sudo nano /etc/rc.local
and commented outsudo python /home/pi/scripts/shutdown.py &
. I then rebooted and unfortunately, that didn't work.So I figured maybe I would just rename the shutdown.py file in case something else was calling it. This also, unfortunately did not work.
Lastly, I noticed that when I pressed that button again while in the terminal, the command
logout
showed. Is it possible that there is another script out there called "logout", or is it just showing that it's logging out because it ran some shutdown script in the background?Anyways, I'm at another roadblock with this an was hoping some of you out there might have a solution. Anyways, I hope you're all having a great night and again, thank you so much for your continuous help in this forum.
-Cheers!
-
@therog05 I think you have a script running that reboots on PIN5 pull up/down. That being said, you should start with a clean image of RetroPie - we don't supportd 3rd party images - and see if you get the same problem.
-
Thanks for the input, @mitu. I've put a lot of time into what I have right now, so I may spend some more time messing with it. If I don't figure it out, I'll just disable the one hotkey button since I don't really need a player 2 hotkey. I would much rather figure out the problem though. So we shall see. Thanks again.
-
@simonster said in Adding a 9th button to GPIO:
I have just tried this method and it worked for me completely:
Install MK_Arcade_Joystick from the drivers in the retropie setup. Then exit Emulation Station by pressing F4
rm -r mk_arcade_joystick_rpi
git clone https://github.com/recalbox/mk_arcade_joystick_rpi.git -b hotkeybtn
sudo mkdir /usr/src/mk_arcade_joystick_rpi-0.1.5.1/
cd mk_arcade_joystick_rpi/
nano dkms.conf
change the line that begins PACKAGE_VERSION to read
PACKAGE_VERSION="0.1.5.1"
Press Ctrl+X and then Y and Enter to exit and save changes
sudo cp -a * /usr/src/mk_arcade_joystick_rpi-0.1.5.1/
sudo dkms build -m mk_arcade_joystick_rpi -v 0.1.5.1
sudo dkms install -m mk_arcade_joystick_rpi -v 0.1.5.1 --force
Once installed, restart the Pi using the following command
sudo shutdown -r -t 0 now
WORKS. THANK YOU
-
I'm back at it again. I installed a while new setup but I'm having issues with the kernel headers again. I followed the steps to build and install 0.1.5.1 but I'm getting this error when trying to build...
Error! Bad return status for module build on kernel: 4.19.66-v7+.
Any ideas? Thanks!
-
@theRog05 The driver is not compatible with Linux Kernel versions > 4.14 and the Github repository is not updated anymore . The driver version included in RetroPie has this fixed, but it's using the main branch and not the
hotkeybtn
branch - which I think you might need.
However, RetroPie should still be at kernel version 4.14 - have you usedrpi-update
to update your installation ? -
@mitu I have not tried
rpi-update
yet. I can do that now. -
@theRog05 I wasn't suggesting to use that, since it will upgrade your Linux Kernel. What version of RetroPie are you using ?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.