question

belsy003 avatar image
belsy003 asked

Venus + Raspberry + automated safe shutdown options (perhaps PiJuice)?

Hi everyone,


I've been researching but doesn't appear that anyone has already asked/answered this, so apologies if this is a double-up. I'm new to the forum, Victron, raspberry and linux, so I'm learning my way :)


I'm wishing to have a safe shutdown option for a Venus Pi (preferably a 3b+) as it will be inaccessible and also likely experience power loss overnight during the winter months (off-grid DC setup, huge battery and solar but also a power hungry system).


I don't want to take the chance of just pulling the power, because any corruption of the micro SD card will be a huge pain to remedy. It would need to be a fully automated process (all of the Raspberry shutdown procedures I've seen need to be manually triggered) - and also having UPS functionality would be an added bonus.


The PiJuice HAT seems to be the most intuitive hardware option, however it appears that the 'soft shutdown' function only works through scripts on a Raspbian OS, and so doesn't appear to be compatible with the Venus OS.


It would seem to me that my options are -

1. Find someone who has PiJuice or similar properly working on a Venus OS, who can provide advice for activating automated safe shutdown

2. Find an old Venus package for Raspbian, and PiJuice should work out of the box (anyone have a link?)

3. An alternative software / hardware / UPS option which offers safe shutdown functionality (any suggestions?)

4. Get a Cerbo instead? (assuming they won't be affected by sudden power loss)


Has anyone come across this situation before and provide any advice please? I'm not looking to reinvent the wheel, I can reasonably follow other people's coding but have zero coding experience of my own.

Venus OSRaspberry Piups
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

5 Answers
johanndo avatar image
johanndo answered ·

No sudden power loss if you have a battery to monitor (what you have btw.) this is better than any UPS solution. Just wire its power supply next to the battery.

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

belsy003 avatar image belsy003 commented ·
Thanks for your thoughts, however I expect the battery to reach maximum safe discharge, hence the need for safe shutdown (more important than a UPS, which would just be a nice benefit on top)
0 Likes 0 ·
johanndo avatar image johanndo belsy003 commented ·

A safe shutdown doesnt mean it uses no more power, just a thought.

It is not meant to handle bms disconnects. However, it would be easy to shutdown the Pi / Venus by a script based on a voltage reading, SOC or any other parameter / alarm from the dbus to chicken out before the battery disconnects - but then you loose remote control. You just use python to call halt or shutdown -h now

you can do it easily by using this in your dbus callback function:


import subprocess

...

subprocess.run('shutdown -h now')

0 Likes 0 ·
gainestr avatar image
gainestr answered ·

https://off-grid-garage.com/victron-venus-os-shutdown-feature/

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

belsy003 avatar image belsy003 commented ·

I've seen this video before, however rewatching gave me the idea of using a relay to detect power loss and trigger the jumpers, rather than a push button / switch. Theoretically it seems like a viable (albeit a bit cumbersome) option. Worth prototyping. Thankyou :)

0 Likes 0 ·
jeroen avatar image
jeroen answered ·
2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

belsy003 avatar image belsy003 commented ·
Brilliant, that definitely seems like a viable option
0 Likes 0 ·
jeroen avatar image jeroen ♦ belsy003 commented ·
For completeness, that is not supported by Victron Energy. It is literally "AS IS", no promises that is doing anything useful or that someone will make it do something useful if it doesn't.
0 Likes 0 ·
pvpax avatar image
pvpax answered ·

You have huge PV, battery and hungry consumers. By the time the load gets cut off, the battery should quickly recover from "unhealthy" voltage and should easily be able deliver a few watts for the raspi. At least for some hours until PV production starts again.

I have enough faith in my battery to keep the venus running via a DC-DC converter connected directly to the battery, bypassing the BMS.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Kevin Windrem avatar image
Kevin Windrem answered ·

As mentioned in a previous post, look at ShutdownMonitor:

https://github.com/kwindrem/ShutdownMonitor

In combination with:

https://github.com/kwindrem/RpiGpioSetup

These will give you a menu-based shutdown and also a way to trigger shutdown by grounding a GPIO pin. This, you can connect to a low voltage cut-off relay.


I have yet to have a single SD card corruption by just powering down my Pi 4. If there is corruption, it is repaired on the next boot by the OS and I never see it.


Another approach is to make a copy of the system SD card and carry it with you in case there are problems.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

johanndo avatar image johanndo commented ·
Hi Kevin,

Would be great to have a backup menu on the Venus to mirror the current installation on a bootable SD card in a usb sd card reader.

0 Likes 0 ·

Related Resources

Victron Venus OS Open Source intro page

Venus OS GitHub (please do not post to this)

Additional resources still need to be added for this topic

Raspberry Pi running Victron’s Venus firmware - Blog Post

Venus OS Large image: Signal K and Node-RED - Install

raspberrypi install venus image


Additional resources still need to be added for this topic