Hello!
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.
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.
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.
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.