You can write raw binary data to an SD card. Most people do this using the 4-pin SPI interface supported by the SD card. Unfortunately, the data is not addressed to bytes, but block addresses (the block size is usually 512 bytes).
This means that if you want to write 4 bytes in byte 516, you will need to read in block 0x00000001 (second block), and then calculate the offset, write data, and then write the entire block back. (I can’t say that this restriction applies to the SD interface using more contacts, I have no experience with it)
This complication is why many people choose to use libraries that include “unnecessary overhead”.
With that said, I should have done this in the past because I need a way to log data that was reliable before power failures. I found the following resource very useful:
http://elm-chan.org/docs/mmc/mmc_e.html
It will probably be easier for you to make your smaller entries into the memory buffer and upload them to the SD card when you have enough data to make it useful.
If you look around, you will find many open source code related to the SP SPI interface to use directly or as a reference to implement your own system.
source share