How to switch OFF the USB 5V RPi3 in LibreELEC

  • Hello.

    I am using RPi3.

    I want off power completely.

    I've made electronic circuit can power ON and OFF on their own.

    It was working in the OSMC.

    However, I changed to LibreELEC, the power is turned OFF does not.

    My circuit to detect RPi3 USB 5V voltage.

    Power OFF button is pressed, the "shutdown -h now" shell runs.

    Not detect USB 5V, timer is working, turns off after about 1 minute.

    It was working fine at OSMC.

    But LibreELEC runs "shutdown -h now", also continues to produces a USB 5V.

    As a result, my circuit cannot detect with USB 5V is turned OFF, timer does not work.

    So my circuit is RPi3 power not turn OFF completely.

    So, the question is.

    How do I run "shutdown -h now" on the LibreELEC, USB 5V turn OFF completely?

    There was one you know, please let me know.

    Thank you in advance.

    My English is not good.

  • The shutdown command will not turn off 5V completely - it goes to standby. In standby it will listen to GPIO, and can be switched on with a GPIO button.

    I have been installed a power on/off button at my RPi3B+, which works perfectly with LibreELEC. Read this thread for instructions. If I understand you right, your timer will do a complete 5V power off after the shutdown.

    PS: With the off-button.py script (see linked thread) you can trigger a GPIO signal right before shutdown. If you listen to that GPIO "off" signal with your timer, it should work.

  • Another hint: I have been added this lines before the "try" statement in the off-button.py:

    Code
    led_gpio_number = 13
    GPIO.setup(led_gpio_number, GPIO.OUT)
    GPIO.output(led_gpio_number, True)

    This will turn my status LED on when LibreELEC starts. The status LED will turn off automatically at shutdown, because the shutdown will set all GPIO levels back to default state.

    You can use the same code, too: If you connect GPIO 13 (and maybe it's opposite ground pin) with your circuit, it will have the same effect like connecting and listening to an USB port (whether it has the default 5V or not).

    The only difference is that you have to handle 3.3V of the GPIO instead of the 5V of USB.

  • Hello Da Flex,

    Thanks for all the tips.

    It will be very helpful.

    Based on your tips, I'll try to experiment.

    Thank you so much.

    If my experiment goes well, I will report again!