SD Card File Protection on Windows Only

Hi All,

I'm making a SD Card data logger.

I'm using an Arduino Uno Rev3 with Adafruit Datalogger shield.

The user can remove the SD card and insert it into their computer to copy the file.

Does anyone know anyway that I can protect the file on the SD Card?

I want to be able to write to SD Card when in the datalogger but not allow the user to edit and save the file when the SD card is in a windows PC.

I've used some commercial dataloggers and I don't know how they work but when you plug them into a PC you can edit the files on them but as soon and you unplug and plug them back in all the files are reverted to their un-edited form.

Does anyone know how I can do something similar with Arduino?

Cheers

Steve

Once the card is loaded into a PC, I can't see any way you can stop someone doing whatever they like to any files on it - read only switch aside. The only reliable way to keep the file intact is if the logger has another copy of the data and can rewrite it.

You could write a second copy of the file onto the card and then mark it as deleted to recover the data from later, but that wouldn't be reliable or stop someone even mildly determined.

That's interesting. I understand that I wouldn't be able to stop someone who is determined from modifying / deleting the data but what I'm after is stopping someone with average computer knowledge (they know how to use windows and that's about it).

How would I go about marking a file as deleted and how would I later recover it?

On a FAT filesystem, deleting a file just marks it as such - the blocks that make up the file aren't overwritten although they can then be reused which is why it's an unreliable way to keep the data. IIRC, you can find the directory entry using lower level methods and just remove the deleted flag & if you're lucky enough that your blocks haven't been reused - you have your file back.

While it may be possible to recover the file it would be best to assume that you can't. And you should also assume that once the SD Card goes into anothe computer you lose all control of it. Even if the PC user has limited knowledge they could delete and overwrite the file without realizing they are doing something silly.

If you are worried about these things you should make your own back-up copy of the file before you give the SD Card to someone else.

...R