Safely power off Raspberry Pi with PhotonVision image

We have a Raspberry Pi 4 with the photonvision image. I read somewhere that removing power the pi while it is writing data to the SD card can corrupt the SD card, and therefore it is best to run the command sudo shutdown -h now before doing that.

Problem is, our pi is powered by the VRM, and it will simply be powered on or off whenever we power the robot on or off.
Will this corrupt our SD card? If yes, is there a way to solve this problem?

(And another question, just out of curiosity: how come this isn’t a problem with other devices that use SD cards, like the RoboRIO?)

Some images may take this into account and make specific read-only settings to avoid data corruption. I know that WPILibPi does this, which is outlined on this page. I also think that the RoboRIO has a read-only setup, except while deploying code I assume.

I’m unsure about PhotonVision, but maybe who knows can comment here.

1 Like

You can make the disc read-only, but that will prevent you from setting things. As long as you’re not trying to update the firmware or something when you power it off, you’ll be fine just hard powering off.

I always recommend keeping a spare SD card with all your Photonvision stuff set up for a quick swap if anything goes wrong.


Just setup all your settings, then use raspi-config to enable read-only mode.

It’s relatively simple to remount to rw if you need to temporarily.


UPS are pretty common, e.g.

1 Like

I don’t think PhotonVision do this, because you can change settings that are remembered between power cycles.

This sounds like a good idea, we’ll try this. Thank you everyone for answering!

I would love to use a UPS, but they are most not legal. Sometimes they get missed in inspection, but sadly, they are not allowed by the current (2023) rules unless you can find one that has an “integral” battery or is powered by a USB battery pack.

Has there been any official judgment about that, e.g. by a regional inspector? I can’t find anything in the qa site.

In any case there are many versions of this idea, with varying levels of “integralness”


Yes, Jon Stratis is our LRI. Also, he said he ran it by Al and Chuck at HQ.

We ran a 10000mAh (or mWh, I can’t remember) power bank for our Orange Pi this year and it was given the OK by inspectors.

The rule we’re talking about is R602:

The PiJuice HAT would likely not be legal. It has a removable (non-integral) battery that is not a USB power bank.

The juice4halt might be legal, but it’s not powerful enough for a Pi 4. The Pi 4 needs at least 2.5A, but ideally 3.0A, and the juice4halt is only 1A!

Yes, a USB battery pack is legal, up to 100Wh, and 5V, 2.5 Amp. Which also is likely not powerful enough for a Pi 4, ours reports undervoltage when connected to a power bank. It would probably be workable, but the Pi won’t operate at full capacity.

We ran our Pi 4 with a 12 volt Milwaukee Tool battery and a USB adaptor. Took about 30 extra minutes and a bunch of calls during inspection, but they let us keep it. We found a better way to power it for later competitions luckily.

What we’ve done in the past is wire up a hardware button that gracefully shuts down the board. It doesn’t always get used, we’ve found that the pis remain stable most of the time, but it’s an option for peace of mind. I’m not sure if we did it this year because we aren’t using a Pi to run our LED strips, so it wasn’t worth the time / work of setting up a breadboard hat.