Automatic Safe Shutdown - Navio2 state and power consumption

Hi I have been testing an auto safe shutdown unit I built. Its basically a 500mAh UPS connected via the USB power input, I am running a script which monitors the other backup power coming in via the servo rails and calls a scripted shutdown. This all works really well, however it appears the Raspberry pi (4) maintains the pin state upon shutdown, which really means the 5V rail etc are still active and the Navio2 still draws some power, draining my small UPS battery. I have a timer circuit which now turns off the UPS, but I was wondering if there are any NAVIO2 pins which actually change state after shutdown? I had originally wanted to use a pin change after shutdown to turn off the UPS; it appeared in previous versions of the Pi the 3.3V output from the regulator went low on shutdown but that does not now appear to be the case. So are there any specific Navio2 pins I could use as an indicator that the raspberry Pi has gone into shutdown / halted state?

Hi @ralphkoch

Sorry for the delayed response.

I’m afraid I hardly can help you with what you are trying to accomplish as there is no ready solution provided for such a task. Using an external board to manage the power delivery to RPi and Navio2 could be a workaround. However, the manual shut down of the RPi and Navio2 will not cause any issues.

Hi,

Thanks for getting back to me. I currently run a microcontroller to shut the UPS down after 2 minutes. I run a script in the background which tests the voltage on the backup power supply (Navio Servo Rail). And when it goes below 4V it calls a shutdown, part of the shutdown routine is a pin state change, which is monitored by the microcontroller which then starts a timer which turns off the UPS battery after 2 mins unless the shutdown is aborted. The UPS includes a charger circuit so as soon as it is powered it gets fully charged again. The whole lot is about the size of a matchbox and makes sure my autopilot SD card doesn’t get corrupted on power failure or someone turning off the power without correct shutdown. Its a great system for any autopilot, and I have provided this description so others can do the same.

Just an update on the power module. If you want to trigger a shutdown off a pin and then detect when its safe to disconnect power, you can use a simple overlay in your config.txt file (in boot directory):

adding the following to /boot/config.txt

dtoverlay=gpio-shutdown,gpio_pin=17
dtoverlay=gpio-poweroff,gpiopin=18,active_low=1

will cause GPIO17 going LOW to do a shutdown, and GPIO18 will indicate the pi is running when HIGH and will go LOW when safe to disconnect power. I have tested this on a Pi 4. Behaviors may be different on Pi 3. What I would suggest is finding out which pins are naturally pull up or down while in halted /shutdown state (I used a multimeter to test as I couldn’t find a reliable document) and then make it pull in the natural direction on shutdown.

Hi Ralph,

Thank you for sharing your results! I think that it might help other users too.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.