Set GPIO Pin

Good day, I would like to set one of the GPIO Pins to powered when osmc is running and unpowered when you select shutdown within osmc. Can someone please help me. Total noobs here. Thanks

Check this out, I assume you can use one of the Pins that are pulled up

It’s a dead link. Please help. I just need a pin that gives power when osmc is on and has no power when you say “Power off system” within OSMC

What is a dead link?

Sorry I tried the link it disn’t work but eventually it worked. I have a raspberry pi 3 modal b v1.2. What what would I be looking for in the code? I understand none of it. Please help me. Just tell me the pin number and I will test it

We believe this is a generic raspberry pi issue and as such you should look at addressing the issue directly on their forums.

Thanks yknivag but I don’t think you understood what I meant. Lets say I want to connect a LED to the Raspberry Pi 3 Modal B V1.2 but I want the LED to only be on as long as OSMC is on not as long as the board gets power. So for as long as OSMC is running the LED must be on. If I go into OSMC and select power off inside OSMC the LED must turn off as soon as the sytem is off.

OSMC is the operating system, it is “on” from the moment you plug your pi in to the moment it is powered off.

There is already an LED on the board that shows when the pi is active.

Or did you mean you want an LED when something is playing? Or kodi is running?

At the Raspberrypi forum they say I should use the following code in the config.txt
gpu_mem_1024=256 hdmi_ignore_cec_init=1 disable_overscan=1 start_x=1 disable_splash=1 gpu_mem_256=112 sdtv_aspect=1 gpu_mem_512=144 dtoverlay=gpio-poweroff,gpiopin=5,active_low=1
but it doesn’t work. On raspbian it works but not with OSMC I think I’m using the wrong overlay but I could be wrong. Any suggestions? I want an LED to show if the system is powered ie the pi is booted into osmc and when you shutdown OSMC the LED must turn off even if the power is still connected. The LED you talking about stays on aslong as the board has power.

You should just add the last line of the config to the standard OSMC config.txt

How do you mean it doesn’t work? What happens with that code running and an LED connected to GPIO5?

Because GPIO05 is default high it puts out 3.12 volts on startup bit on shutdown it stays at 3.12 volts. With raspbian on startup it goes to 3.2 volts and on shutdown it goes to 0 volts. Otherwise how can I edit the shutdown script to set a pin from 3.12 volts to 0 volts but only on shutdown not on reboot

Are you simply trying to shut down the pi in this manner to prove you can? Because the device is designed to run 24/7 and use a negligible amount of power while doing it. It probably costs about $5/yr to allow it to run all the time. I would also wager that other folks around here, as I do, have pi’s that have been running 24/7 for >2-3yrs without device failure.

It’s not to shut down the pi but this is a two part setup actually. The LED was just an example. I want to have it so if you do shut it down within OSMC you can use the power button to turn it back on but for that I need to have a power out so it knows that the pi is off before trying to wake it. I know it sounds supper complicated but all I need is a way to detect when the pi is off. For my own use I’m designing something that may be over complicated but just to learn how the pi works and all that and how to set the gpio pins to states that I want.

Not terribly… Why not kang some code from something like this? I run this on an Rpi3 mpd server in my truck…