RPi4 GPIO using in LibreELEC

  • Da Flex

    Just been to the local shop to get the switch.

    So after some research managed to get it sorted..

    Led,Start,Restart and Shutdown all in one..

    short press is restart..long press is shutdown..press from off will switch on..

    Now gonna test it for a few days...happy to share script if anyone wanna test..

  • Well although power button works as intended..unfortunately it doesn't work if system is for some reason frozen..so it might still need a dirty power shutdown once in a while..

    Led On - Start - Quick Press Restart - Long Press Shutdown

  • Mario77, Da Flex,

    Your explanations are very useful. I was thinking to implement such a button on my Pi4 BUT I was thinking... What if the power button is with IR for the regular TV or Bluetooth from the phone. Is this possible to be done? I think this will be just a bit better for usage

    Thanks again for your explanations!

  • Mario77, Da Flex,

    Your explanations are very useful. I was thinking to implement such a button on my Pi4 BUT I was thinking... What if the power button is with IR for the regular TV or Bluetooth from the phone. Is this possible to be done? I think this will be just a bit better for usage

    Thanks again for your explanations!

    That will be usefull just for startup if it works...basically reboot and shut down are the same as the ones you r using now from Kodi power menu..so you can set the remote buttons even without switch..

    Just a quick idea is a transistor between pin 5 and 6 and an ir receiver connected to it...basically if you short pin 5 and 6 rpi will start.

  • That will be usefull just for startup if it works...basically reboot and shut down are the same as the ones you r using now from Kodi power menu..so you can set the remote buttons even without switch..

    Just a quick idea is a transistor between pin 5 and 6 and an ir receiver connected to it...basically if you short pin 5 and 6 rpi will start.

    True for the reboot and shutdown. In fact I am using the Kodi app on the phone as a remote control but for the activation I can not use it

    So you said just shorting pin 5 and 6 will start rpi( you mean GPIO3 and GND)??? Directly shorting them with nothing else?

  • True for the reboot and shutdown. In fact I am using the Kodi app on the phone as a remote control but for the activation I can not use it

    So you said just shorting pin 5 and 6 will start rpi( you mean GPIO3 and GND)??? Directly shorting them with nothing else?

    Yeah thats what I mean gpio3 and the gnd across it...you add dtoverlay=gpio-shutdown to config.txt..

  • Yeah thats what I mean gpio3 and the gnd across it...you add dtoverlay=gpio-shutdown to config.txt..

    If I want just to start rpi only do I need to add the dtoverlay=gpio-shutdown to config.txt. and 1 maybe stupid question - where is this config.txt file on pri4

  • If I want just to start rpi only do I need to add the dtoverlay=gpio-shutdown to config.txt. and 1 maybe stupid question - where is this config.txt file on pri4

    To power up, all that’s required is to connect physical pin 5 (BCM 3) to the ground next to it. This functionality is enabled by default.

    To shut down with the same button, just add the line dtoverlay=gpio-shutdown to /flash/config.txt

    config.txt is read only

    to edit ssh

    Code
    mount -o remount,rw /flash

    then to make it read only again

    Code
    mount -o remount,ro /flash
  • To power up, all that’s required is to connect physical pin 5 (BCM 3) to the ground next to it. This functionality is enabled by default.

    To shut down with the same button, just add the line dtoverlay=gpio-shutdown to /flash/config.txt

    config.txt is read only

    to edit ssh

    Code
    mount -o remount,rw /flash

    then to make it read only again

    Code
    mount -o remount,ro /flash

    Millions of Thanks!!!

  • Create this /storage/scripts/status_led.py :

    Thank you very much for the guide!

    I came up with a problem that after I changed the led GPIO to 4 (BCM Mode), the LED was blinking slightly when Pi shutdown. But GPIO 13 works well. I can hardly find anything about the GPIO state after Pi shutdown. Is there any way to solve it cause I want to make the wires more concentrated.

    Thank a lot!

    • Official Post

    Thank you very much for the guide!

    I came up with a problem that after I changed the led GPIO to 4 (BCM Mode), the LED was blinking slightly when Pi shutdown. But GPIO 13 works well. I can hardly find anything about the GPIO state after Pi shutdown. Is there any way to solve it cause I want to make the wires more concentrated.

    Thank a lot!

    The "Raspberry Pi Tools" GPIO library seems to be broken right now. I also have LED problems (switches off after some time while RPi is still on). I think we have to wait for an update.

  • It's strange. I am running the LE 10 Nightly (currently 20210703) on RPi 4B, using output GPIOs 4, 6 and 27 for relays and LED, also in BCM mode and did not encounter any issue so far.

    There's a difference between GPIO pins so it may play a role... For instance, GPIO 13 supports hardware PWM while GPIO 4 does not.

    GPIO - Raspberry Pi Documentation

  • Hello and thanks for all the tip here. Just one thought, can i change dtoverlay=gpio-shutdown to dtoverlay=gpio-reboot if i just want to get the pi out from halt and just reboot?

  • Hello and thanks for all the tip here. Just one thought, can i change dtoverlay=gpio-shutdown to dtoverlay=gpio-reboot if i just want to get the pi out from halt and just reboot?

    Sure. First try without keyboard.xml. If you get a menu screen instead of instant reboot, use keyboard.xml, and replace shutdown by reboot.

  • Da Flex : I am also looking for, a way to shutdown LE with a button, so I came on this toppic.

    Connected a button on pin 5 and 6, of the GPIO, and startup from standby, worked by default. Added dtoverlay=gpio-shutdown to config.txt, also made and added, /storage/.kodi/userdata/keymaps/keyboard.xml, after reading this toppic
    Via SSH:

    mount -o remount,rw /flash

    (added dtoverlay=gpio-shutdown to config.txt)

    mount -o remount,ro /flash

    reboot

    But, startup still works, shutdown does not, also tried several other syntaxes, like leaving the “=”sign out(as Allissonhsp, suggested) ,or adding ,gpio_pin=05 to the line(on my own accord, looking at the line for ir on pin 18) but still nothing happens after reboot. Now, I'm not an absolute beginner, but scripting is so not my Forte.

    I’m working LE 11.0.3 with Kodi-Nexus on a RPI 3b. What am I missing?