Sunday, April 14, 2013

SD card adventures

This morning I went to NCIX and bought myself a microSD card. It was the ADATA 16 GB microsdhc class 10, and worked great with the Sparkfun microSD shield. The card came pre-formatted in FAT32. I found a copy of FAT libraries for the Arduino by William Greiman . After changing the CS pin in the software to be 8 (the software default was 4), the ReadWriteSdFat example code executed perfectly. I was also able to read the test file on my computer.


The next step was to collect a camera image, and store it on the microSD card. To do this, I adapted my previous LynxCamera code to make LynxCamera_SD. In this version of the software, the camera and SD card are both initialized. The user presses a keyboard button to tell the camera to take the photo. This time, instead of streaming the photo to the console, it is logged to the SD card. I can eject the SD card, insert it in my computer and use my conversion script to make it into the beautiful image of my apartment below.





While this works, I have observed a couple disappointments already. Getting the data from the camera onto the SD card is slow. I may be able to update the baud rate slightly, but at 38400 I was seeing transmission errors, so there is not a ton of speed to be gained here. The camera itself is a bit disappointing (though I was sort of expecting this). The photos have poor contrast, and are a bit dark. Seems the exposure time is automatically set, so I don't have a ton of flexibility here. Finally, I'm already at 15508 bytes out of a potential 30720... not leaving me a ton of room for doing LCD screen, radio and push button integration. 

But I think there is still lots of potential for this project! I'm charging my battery at the moment, so that, as the next step, I can start integrating the radios into this system. I think I will try to get all the aspects of this project integrated before starting to optimize the speed and space utilization.

No comments:

Post a Comment