Avoiding corruption with SD card write protection

A project log for Dementia-friendly music player

Lovechild of MP3 & 1940s radio UI. For seniors with dementia who can no longer use CDs & iPods. Good project for kids.

Ross PorterRoss Porter 08/12/2017 at 19:030 Comments

Micro-SD cards can make Raspberry Pi projects less durable, particularly when power can be yanked at any time. This project log describes how to reduce SD card corruption with the rarely used TMP_WRITE_PROTECT feature in the SD card standard. It's a big hammer (love those!) and works well with DQMusicBox.

The DQMusicBox project already does SD card write *reduction* by using DIetPi and RAM logging. Thus, engaging TMP_WRITE_PROTECTION is optional. I love saying "optional" to a group of hackers -- it's like bait!

I was inspired to do this by the SD Locker project that I saw here on Hackaday.  But I wanted to use a Pi to do this. So I setup a Pi 3 that boots from a USB thumb drive. I installed sdtool. Now when I want to TMP_WRITE_PROTECT a micro-SD card, I just pop it in the slot and run sdtool from the command line. Here is the rig that I use:

The slightly tricky bit was getting the Pi 3 to boot from USB. I used DietPi as it has setup support for USB booting. Detailed instructions for setup and use are in Appendix 1 of the DQMusicBox build instructions