![]() |
|
Raspberry Pi Shutdown Indicator LED - Printable Version +- OpenMarine (https://forum.openmarine.net) +-- Forum: MacArthur HAT (https://forum.openmarine.net/forumdisplay.php?fid=29) +--- Forum: How I did it (https://forum.openmarine.net/forumdisplay.php?fid=32) +--- Thread: Raspberry Pi Shutdown Indicator LED (/showthread.php?tid=6287) |
Raspberry Pi Shutdown Indicator LED - JanKoopmans - 2025-06-16 ? Raspberry Pi Shutdown Indicator LED using GPIO22 (OpenPlotter + MacArthur HAT) For those running OpenPlotter on a Raspberry Pi 5 with a MacArthur HAT: I've added a simple but super useful status LED to one of the GPIO pins. The LED indicates whether the Pi is still running. After issuing a Code: sudo shutdown now✅ What it does
? What you need
? Wiring Connect your LED as follows: less KopiërenBewerken Code: GPIO22 (pin 15) ──[220Ω]──>|── GND (pin 6)
⚙️ Software setup with Code: systemdCreate the script: bash KopiërenBewerken Code: sudo nano /usr/local/bin/led_on.pypython KopiërenBewerken Code: #!/usr/bin/env python3bash KopiërenBewerken Code: sudo chmod +x /usr/local/bin/led_on.pybash KopiërenBewerken Code: sudo nano /etc/systemd/system/boot-led.serviceini KopiërenBewerken Code: [Unit]bash KopiërenBewerken Code: sudo systemctl enable boot-led.service2. Turn off the LED during shutdown Create the script: bash KopiërenBewerken Code: sudo nano /usr/local/bin/led_off.pypython KopiërenBewerken Code: #!/usr/bin/env python3bash KopiërenBewerken Code: sudo chmod +x /usr/local/bin/led_off.pybash KopiërenBewerken Code: sudo nano /etc/systemd/system/led-off.serviceini KopiërenBewerken Code: [Unit]bash KopiërenBewerken Code: sudo systemctl enable led-off.service✅ Result Your LED now gives you clear visual feedback: Pi State LEDRunning ? ON Shut down ⚫ OFF Safe to power off? ✅ Yes, when LED is OFF ℹ️ Notes
RE: Raspberry Pi Shutdown Indicator LED - BellaX - 2025-12-31 Another way that works without any line of code: just connect the LED to the 3.3V power lane. Done. RPi 5 and CM5 have a dedicated button input to power down the system and restart it. No code needed. It works like your pc at home. Depending on the firmware version and RPi you maybe need to allow switching off the 3.3V lane on powerdown. Chris |