2

I don't have a Raspberry Pi laying around at the moment and I would like to detect if my Raspberry Pi is shuted down. My Idea is that maybe after the Pi shutted down the Voltage at the 3V3 pin will drop and I can detect this. And if this still works when the Pi is getting powered via the 5V Pin. Unfortunatly the Raspberry Pi Schematic is not completly available so I am not able to check this right now.

  • 2
    It will consume less power, at the same voltage, so no. It doesn't have much in the way of power management, it is either plugged in or not. "Shutdown" is mostly about the state of the operating system. – goldilocks Jun 29 at 13:30
  • Ook sad to hear but hey thanks man :) – Freygeist Jun 29 at 14:41
  • @Freygeist you could make a very simple script with the gpio utility that sets a pin high at boot and low on shutdown based on different run levels – calcinai Jun 29 at 18:06
3

The Pi has 3 "components" the CPU, GPIO and Video Core which are relatively independent. Even when the Pi is shutdown the Video Core continues to run, and the GPIO pins retail their state; only the CPU is not running.

The 3.3V is supplied by separate circuitry and will be present while ever the Pi is connected to a 5V supply.

The best way to reliably detect Pi shutdown is to use the gpio-poweroff service built into recent firmware which "Drives a GPIO high or low on poweroff" - I believe this was included to control power circuitry. NOTE read the instructions carefully as there is some interaction with other services.

Name:   gpio-poweroff
Info:   Drives a GPIO high or low on poweroff (including halt). Enabling this
        overlay will prevent the ability to boot by driving GPIO3 low.
Load:   dtoverlay=gpio-poweroff,<param>=<val>
Params: gpiopin                 GPIO for signalling (default 26)

        active_low              Set if the power control device requires a
                                high->low transition to trigger a power-down.
                                Note that this will require the support of a
                                custom dt-blob.bin to prevent a power-down
                                during the boot process, and that a reboot
                                will also cause the pin to go low.
        input                   Set if the gpio pin should be configured as
                                an input.
        export                  Set to export the configured pin to sysfs

As GPIO retain their state, other methods of detecting state are unpredictable - the Pi sets the state of the poweroff pin before finally shutting down (and flashes the ACT LED 10 times).

The Pi4 puts the power management chip into a low power state when off - turning off the 3.3V supply and effectively totally shutting down the SoC. This low power on the Pi4 can be disabled e.g. to use the soft reboot option, but requires modified firmware.

2

This howchoo post shows how to connect an LED to show the status of the Pi. The LED is steady on when the Pi is running, and off after shutdown.

Briefly:

Add this line to /boot/config.txt, and reboot

enable_uart=1

Connect the TxD pin (GPIO pin 8) to the positive lead of a 2 or 3 volt LED.

Connect a ground pin (e.g. GPIO pin 6) to a 330 ohm resistor, then to the negative lead of the LED.

Copied from https://raspberrypi.stackexchange.com/a/99366/101680

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.