Question about potential sd card storage applications...

Hey everyone, Im planning a future project and was wondering if I might be able to incorporate an SD card/reader into it somehow, but am also unfamiliar with how they interface and work with arduinos (and storage systems in general). If I find it is potentially something I can work into my project, then I can do my own due research, I just had some cursory quest first...

So I would imagine that one of the fundamental things is a simple read/write function, but what file types are compatible between it and and an Arduino?

Also, I would imagine another of the more fundamental uses is just general data storage- reading and recording sensor data- and I would imagine that processing this data would be handled through custom functions written into the Arduino program itself, but could an SD card potentially be used to store custom functions that the Arduino could then retrieve as well? I understand that you can't just read an Arduino program from an SD card as they need something to compile and flash to them and can't do it to themselves, I was just wondering if there was a way to save space for larger programs by creating a custom function and populating it that way, for example, or if this would just result in a syntax error.

Also, aside from straightforward data storage (pictures, music, or sensor data), are there any other more creative applications for an SD card reader? I have potential uses for it regardless, just curious to know the limitations, applications, etc. Thanks!

CatDadJynx:
Im planning a future project and was wondering if I might be able to incorporate an SD card/reader into it somehow

As long as you reserve the right pins (hardware SPI pins in fact) and some space in both memories (flash/program and RAM), you can.

CatDadJynx:
but am also unfamiliar with how they interface and work with arduinos (and storage systems in general).

SD cards communicate with an Arduino via SPI; but storage systems "in general" I would say "most of" since there are external EEPROMs that interface with I2C instead.
Nevertheless, any storage solution that is relatively large or with high data rates, will always opt for SPI or any other faster protocol.

CatDadJynx:
what file types are compatible between it and and an Arduino?

Actually any type, since in the end it's just a bunch of bytes (1s and 0s if we talk at a physical level). The included library treats all files as binary (as a growable array of bytes); but since plain-text files can be considered a subset of binary files, it works for both purposes.

CatDadJynx:
but could an SD card potentially be used to store custom functions that the Arduino could then retrieve as well? I understand that you can't just read an Arduino program from an SD card as they need something to compile and flash to them and can't do it to themselves, I was just wondering if there was a way to save space for larger programs by creating a custom function and populating it that way, for example, or if this would just result in a syntax error.

And you're right, AVR microcontrollers have the instruction fetching microcode "hard-wired" only to the flash memory, making impossible to execute code even from RAM.

However, I do know it's possible to reprogram the flash memory on the fly but only if you change the bootloader. In fact, it should be possible because otherwise you couldn't upload sketches without an ISP (via UART serial for example).

Another alternative would be implementing an interpreter, although it will (at best) execute the program as slow as the old-school BASIC of the 80's.

CatDadJynx:
aside from straightforward data storage (pictures, music, or sensor data), are there any other more creative applications for an SD card reader?

It's a digital (mass) storage medium, there's not much to think about besides the obvious things.

The most creative applications I currently have in mind are a PC SD card reader (although a painfully slow one, slower than even a commercial one running on USB 1.0) and a local database (not a simple logger, I mean a database where you can insert, delete and query records).

CatDadJynx:
just curious to know the limitations

Limitations... maybe not being fast enough for certain time-sensitive events (unless a workaround is possible), editing text files is a headache (too little RAM to do the task easily), the "8.3" limit in filenames (at least in the "stock" library), 2 or 4 GB size limit per file, guaranteed capacity support up to 32 GB, and the fact the library takes almost half the RAM of an ATmega328, and aprox. 10 KB of flash/program memory.

Awesome, thanks so much!