(2023-05-22, 10:39 PM)rszemeti Wrote: Is there an easy way to bring the power out to an LED see we can see if the device has shut down ... even better woudl be an LED that came on as the shutdown process started and went out as the device *really* powered down ... I could mount this in the display bezel to give me confidence it was niot staying on and flattening the batteries ...
Well worth asking an AI nowadays.
Perplexity AI suggested this, might need a loop or trigger the python from node red every couple of seconds. >>
"on a raspberry pi computer is there a way to retrofit an LED to a gpio pin to check if the device has really powered down after a shutdown command"
PERPLEXITY
Yes, it is possible to add an LED to a GPIO pin on a Raspberry Pi computer to check if the device has really powered down after a shutdown command. Here are the steps to do so:
Gather the necessary materials: Raspberry Pi computer, breadboard, LED, resistor (220 ohm), and jumper wires.
Connect the LED to the breadboard. The longer leg of the LED should be connected to a GPIO pin (e.g. GPIO 18) and the shorter leg should be connected to a resistor, which is then connected to ground.
Write a program in Python to control the LED. You can use the RPi.GPIO Python module to control GPIO pins from the Raspberry Pi's GPIO header
1
. Here is an example code:
python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.OUT)
# Turn on the LED
GPIO.output(18, GPIO.HIGH)
time.sleep(1)
# Turn off the LED
GPIO.output(18, GPIO.LOW)
This code will turn on the LED for one second and then turn it off. You can modify this code to suit your needs.
Run the program after shutting down the Raspberry Pi. If the LED turns off, it means that the Raspberry Pi has successfully powered down.
Note: Always make sure that your Raspberry Pi is powered off before connecting or disconnecting any hardware component