Please do not post a support request without first reading and following the advice in

Does the RetroFlag MEGAPi work with the Raspberry Pi 1?

  • @cyperghost This one? That's the first one I tried.

    A few messages ago you said that "Pi 1B+, 2, 3B, 3B+, 3A+ got all the same GPIO layout". Does this mean that the Pi Zero has a different layout? If this is the case then that's the problem, because the image I downloaded is for the Pi1 and Pi Zero.

    Isn't there a way to manually set pin 7 and pin 8 to OUT, instead of what they're set now?

  • @Sage-Freke All RPi (expect the first series of the Raspberry Pie) have the same GPIO layout for sure. If you installed wPi then try to set GPIO3 to high and set GPIO7 to output (that's mandentory!)

    If I compare the python script that is used by RetroPie and the one for Recalbox/Batocera then RetroPie script does not initialze the GPIOs and that maybe the reason why the script is not working on your device.

    So I think it is worth to use the MultiSwitch Shutdown Script because this inits the GPIOs, too. You can follow the instructions here - Step by Step.I tested the RetroFlag script on a 1B+ and it worked but I lost that unit.

    You downloaded the correct image.... Pi1 and Pi0 is the right choice.

  • @cyperghost It sort of works but ON and OFF seem swapped, so let's say that the Pi is powered off:
    -when I switch to ON nothing happens, but
    -when I switch to OFF again the Pi powers it on and then immediately starts the shutdown script and powers it off again.

    While If the Pi is already powered on (by manually connecting the power cord): reset works, and the power off switch works correctly, but at the next start it does what I described above.

    P.S. now pin7 and pin8 are correctly set to OUT

  • @cyperghost P.S. I didn't uninstall the previous scripts.

    First I installed this:
    When I saw it wasn't working I installed this:

    And then I installed yours, maybe they're interfering in some way?

  • @Sage-Freke said in Does the RetroFlag MEGAPi work with the Raspberry Pi 1?:

    First I installed this:
    When I saw it wasn't working I installed this:

    It does not matter which of these scripts you install. In the base they all work equal. Power button shuts down the Pie and Reset button is doing some action....

    Please edit rc.local with sudo nano /etc/rc.local and remove or comment the line with python /opt/Retroflag..... and do a reboot.
    Then the script is disabled and the multi switch script will works standalone. It could happen that those scripts interfering with each other (but not the two python script mentioned above)

  • @cyperghost I tried a fresh install on a new SD card (I just enabled SSH and set up the controller).

    After that I

    • 1-Installed your script and rebooted: nothing happened, the switch doesn't work.
    • 2-Installed raspi-gpio, now the switch works but badly as I described before.

  • @Sage-Freke I provide a modified version for this issue. I think about the power on/off issue this looks very strange.

    1. If you edit config.txt with sudo nano /boot/config.txt and add
      1.1 a line dtoverlay=gpio-poweroff,gpiopin=4,active_low=1,input=1 to it
      1.2 and reboot
      Does this change some behaviour?

    Annother approach... if first will fail (then please remove the changes made to config.txt)
    2. If you use the modified script I can provide here
    2.1 Please remove or comment old version in
    2.2 Follow instructions I've posted here
    2.3 Download with wget
    2.4 Remeber the filename change to

    I hope that this helps now

  • @cyperghost With the first solution the mechanical behaviour is the same, with the only difference that it freezes at shutdown (Kernel panic):
    alt text

    With it finally works (thanks!) but ON and OFF are indeed swapped: the pi powers on with OFF and shuts-down with ON.
    I'm wondering if it's possible just a quick swap of the on and off functions in the script, but if it's too much of a hassle I'll just leave as it is. You've done more than enough, thank you :)

  • @Sage-Freke Well that is not the problem....
    Go to SSH and what is the output of raspi-gpio get 3
    it should look like level=1 fsel=0 func=INPUT (maybe there are some values changed)

    Then you take your output and edit this line in the script with your output then it should work.

    With it finally works (thanks!) but ON and OFF are indeed swapped: the pi powers on with OFF and shuts-down with ON.

    That's strange! But that is the reason why the python scripts never seems to work.

  • @cyperghost The output of my raspi-gpio get 3 was "level=0 fsel=0 func=INPUT", but if I put it in line 322 the Pi always turns off as soon as emulationstation loads, even if completely disconnected from the case.

    However, I just realised something... the power socket on the MEGAPi case it's not just a cutout, like the HDMI port, but it has its own little board, I didn't notice until now, I just mindlessly plugged the power directly to the Pi, and that was the problem, the now works perfectly. Sorry for wasting your time :( (however, the fact that almost worked without using the power board was in itself impressive).

    As a partial way to make amends I'll correct an error on the installation instructions of the script:

    Here you have to add a sudo before chmod, otherwise it gives you "permission denied"

    wget && chmod +x

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.