Submind YouTube summaries
Thumbnail for John Park's CircuitPython Parsec: Fruit Jam SD Card Contents

John Park's CircuitPython Parsec: Fruit Jam SD Card Contents

Watch on YouTube

Video summary

In this demonstration of CircuitPython Parsec, the presenter showcases how to utilize the Adafruit Fruit Jam device along with its specific peripheral libraries to mount and inspect the contents of an SD card. The process begins by booting up a Raspberry Pi equipped with a microSD card, which automatically triggers a check for the storage media upon startup. The system successfully identifies the card, provided it is formatted in FAT32, as it attempts to read the directory structure. This functionality is particularly useful for arcade projects where numerous small SD cards are used to store game ROMs; labeling these tiny cards can be difficult, so being able to quickly plug them into the Fruit Jam device allows users to instantly verify which games, such as Galaga or Ms. Pac-Man, are stored on each specific card without needing to read physical labels. To facilitate this workflow, the presenter swaps out different SD cards while the system is running, demonstrating how the device adapts to new media. When a new card is inserted and the system reboots, it immediately scans for the storage item and lists its contents in the REPL view. For instance, swapping from a Galaga card to an Ms. Pac-Man card results in the system displaying the corresponding directory and files, such as "Ms. Pac-Man F" and "Ms. Pac-Man." This capability allows the user to confidently organize their collection by placing verified cards into designated slots within a custom card holder, ensuring that each game cartridge is correctly identified before being used in an arcade cabinet setup. Under the hood, this functionality relies on importing specific modules like OS, storage, and the Adafruit Fruit Jam peripherals to construct the necessary object that mounts the SD card. The Fruit Jam library simplifies these tasks by providing higher-level commands that make common operations significantly faster and more efficient than writing raw code from scratch. By creating a variable to retrieve the mounted storage item and printing its Virtual File System label, the script can easily list the directory contents or handle scenarios where no card is detected. This approach offers a streamlined method for CircuitPython users to manage and verify SD card data directly within their projects, eliminating the need for complex manual file system navigation.
Read the full video transcript
What I wanted to show for the Circuit Python Parsec today is using the Fruit Jam along with its Fruit Jam library peripherals to mount and read the contents of an SD card. Now, this works really well if you just plug into an HDMI monitor because it will just show the REPL. Uh it'll be easier for me to display it here just inside of my uh REPL view here. So, I'm going to set that up first. We'll do screen uh whoop, let me reset it and make sure that that's the right There we go. Uh so, I have booted up the Raspberry Pi and I have a uh SD card, a little microSD card in there and you can see down in the REPL when it started up it said SD card name and it looks for a name. Now, I believe that works for a FAT32 but not a FAT16 formatted card. Uh and I might look into that. These are some FAT16 uh little mini cards I'm using. But then it does read off the contents for me. So, it sees this uh item called ROM, which I know is a directory but again, I can update this to be a little more explicit. Uh and then just a file called Galaga. The reason I'm using these is for my arcade project I have a bunch of little SD cards. Kind of difficult to write on them. They're so small to put a label on them. Uh but I want to with a few of them at hand be able to pop it into the Fruit Jam and just see what's on this card. So, what I'll do now, let's uh I'm just going to turn that off. I'm going to pop that card out. I'm going to pop a different card in and I'll turn this back on and open up the REPL. And you'll see as this boots up it checks the card. It says, "Okay, uh the card contents here is uh the ROM directory and then Ms. Pac-Man F and Ms. Pac-Man." So, this can now go into my little card holder that I'm using for the project. So, I know that was the Galaga one. I'll sit that back in there. And then when I am done with this, I'll turn it off, unplug that, and put that over into the Ms. Pac-Man slot. Now, the way this works in code, you can see here I'm importing the OS, I'm importing storage, and I'm importing the Adafruit Fruit Jam peripherals. Then I construct the peripherals object, and that's actually what mounts the SD card. So, again, the Fruit Jam library makes it a lot faster to do certain common things with these higher-level commands. So, that's all I have to do. That has now mounted the card, and then I'm just going and checking creating a variable here for storage get mount SD card, and then I'm printing if there's a VFS label for that storage item, listing the directory SD, and then printing that out. If it's not there, I say there's there's nothing in there. If we don't detect a card, then we can say no SD card detected. And so, that is a simple way that you can use Fruit Jam and Fruit Jam library to check the contents of your SD cards inside of Circuit Python. And that's Circuit Python Parsec.