i want to collect information over a hall effect sensor on a sd card, not connected tp the computer.
I first connect the sd card, sensor and a 9V battery on my arduino card and connect the whole on the computer to run a script. Then i disconnect the card and the computer for the experiment, hoping mesures will be collected on my sd card. However when i opened the documents on my sd card the mesure's file is empty.
Does the sd card only work when connected to the computer?
SD cards we use are formatted as DOS Drives with a DOS File Allocation Table (DOSFAT) to say where on the physical drive each segment of a file is written. That info is kept in RAM to speed file operations since before MS/PCDOS.
You have to close the file to update the FAT on the drive. How often you do that is up to you, it takes time to close and reopen a file to append data.
The 9V battery is a low current supply. Worse, a 5V regulator throws away all of the power of the extra 4V.. almost half of low. The same 9V battery driving a DC Buck Converter (cheap board for < 3A) and getting 95+% efficiency.
With a Buck Converter you can drop 6 or 12V to 5V as efficiently but take care not to draw the rated max; at half-load the device lasts much longer! 100 mA of 12V makes more than 200 mA of 5V -available-. So what power do the sensors need?
If you don't need full speed Arduino, running on a slower clock and lower VCC is possible with some boards and DIY-duinos. 3.3V Arduinos can wire directly to SD without voltage leveling and run at 8MHz, still very fast.
A buck converter will take any source. If you put a bunch of 9V batteries in parallel it would be 9V with many times the current of 1.
The converter wastes less power than a regulator is all.