0

I'd like to implement an electronic circuit to be able to restart my raspberry Pi when it has been shutdown (without plugging in and out the USB charger, which will obviously remain plugged all the time). For this, I just need to use the P6 pins, as described here (https://raspberrypi.stackexchange.com/a/59719/11224) and here (https://raspberrypi.stackexchange.com/a/19557/11224).

However, I surely don't want to accidentally shortcut the P6 pins while my Raspberry is running, because it will trigger a RESET signal, and I know for sure it could damage the SD card.

Thus, I want to be able to determine if the Raspberry is running or not. I've just tested mine : when it's powered then shutdown'ed, every GPIO is still powered with 3.3V/5V voltage as usual.

The only way I could think of is using a GPIO output that I would programmatically set to 1 (5V) while the raspberry is running, but this solution has a major drawback : the GPIO output won't be available until the raspberry has fully completed its boot (about 1 minute), so I still have the risk that an accidental RESET is done at this moment.

Is there another way to achieve that ?

  • I do not understand. You can't power on the Pi from the Pi itself. Do you mean you want to power off or reset the Pi from a program running on the Pi? In that case you know the Pi is running because the program is running. You need to clarify what you are trying to do. – joan Feb 19 at 21:34
  • When you power the Pi it automatically starts itself. Then you can do a "shutdown now" which will stop the Pi, but it will always be powered on. Then you can connect the P6 pins which will start you Pi again (as described in raspberrypi.stackexchange.com/questions/29339/…) – Orabîg Feb 19 at 21:53
  • I've edited my initial question to be more concise and used more reference @joan, even if the first version was far for letting anyone think I'd want to know programmatically if my Pi is running, which would be very stupid ! :D – Orabîg Feb 19 at 22:04
2

You've not mentioned which Pi you have but on some models the green/amber activity/status LED comes on at boot and goes off at shutdown, you could monitor that either by removing the LED and soldering wires to the pads or maybe an optoswitch of some sort.

A slightly better solution might be to monitor the TX line on the GPIO as described here. Again, you've not mentioned which model you have so you may need to enable the UART in config.txt for this to work. I've done this myself on a 3B and it seems to work as an indicator light but you do get a lot of flickering during boot that might cause false resets when connected to your circuit, you could overcome this by adding some capacitance to smooth the fast pulses out and then maybe a Schmitt Trigger to stop your reset circuit from re-arming too soon. You might be able to replace these two with a NE555 timer.

  • Thx for these suggestions. I won't certainly try to remove the green LED, and the optoswitch alternative seems funny, but as you said the best lead seems the TX line. I'll try that asap. – Orabîg Feb 19 at 23:07
1

You can set the Pi to assert a GPIO output on poweroff.

dtoverlay=gpio-poweroff

This is intended for use with external power circuitry.

There are many pins which may or may not provide a reliable indicator, but in general GPIO pins retain their state when shutdown so do not provide a reliable indicator.

See https://raspberrypi.stackexchange.com/a/89298/8697

  • I don't know if it handles correctly the riskI already mentionned : " the GPIO output won't be available until the raspberry has fully completed its boot " ? – Orabîg Feb 21 at 17:44
  • @Orabîg I don't know what "risk" you are concerned about. Using the software for its designed purpose should be safe. Incidentally the links in your question are ancient (so is your Pi Model B) and the current firmware has changed drastically. If you want a "safe" restart that is included in current firmware (but incompatible with gpio-poweroff) by pulling pin 5 LOW. – Milliways Feb 22 at 3:08
  • I'm talking about "rebooting hard" (I mean electrically) the Pi while it is booting and potentially writing on its filesystem that could severely damage the SD card. (said in 2nd paragraph on my initial question). And my main objective is to be able to start the Pi while it is off, and thus use P6. You forgot this when you talk about pin 5. – Orabîg Feb 23 at 8:34

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.