Go Down

Topic: Software to parse bitmap images off an SD card (Read 817 times) previous topic - next topic

enochthered

I'm currently working on a project where I want to read bitmap images off an SD card and drive data out to a digital LED flex strip for "light painting" style effects. Because these LED strips do not implement "real" SPI, i.e. they do not have a tristate output and they do not have a chip select line, I have added a 74HC367 tristate buffer in line with the data and clock lines to the LED strip, allowing both the SD card and the LED strip to be deselected (i.e high-Z) off the SPI bus with an active-low chip select line for both devices.

The microcontroller is an ATmega328 at 3.3V running an Arduino bootloader, negating the need for level translation between the SD card and the microcontroller. The LED strip is supplied with a 5V power supply, and its data and clock lines are at 3.3V levels - although this works perfectly normally and the LED strip recognizes the 3.3V levels as valid logic highs (as most 5V digital devices usually do.)

I have tested this and confirmed that the hardware is working with known working code for testing both the SD card and the LED strip independently, using the SD library to display the list of files on the card and using the FastSPI_LED library to quickly write frames out to the LED strip (using the LED strip images pre-stored in fixed arrays defined in the Arduino sketch in the AVR's memory), while both devices are kept wired to the SPI interface and one device is enabled at a time.

What I would like to either find or develop myself is the appropriate code to open a bitmap file on the SD card (keeping in mind that the basic access to the SD card FAT filesystem with the SD library is already working) and to parse the bitmap file, generate a single array corresponding to a single line of the image, write that line out to the LED strip, and then reload the next strip out of the bitmap file and repeat. (It needs to be done in this fashion because storing the entire image in an array in the microcontroller's memory is impractical.)

Does anyone know of any existing example of code, or any existing project, which implements this sort of capability?

PaulS

Quote
What I would like to either find or develop myself is the appropriate code to open a bitmap file on the SD card (keeping in mind that the basic access to the SD card FAT filesystem with the SD library is already working)

The SD card and the SD library, specifically the open() method, do not care that the file is a bitmap file. Or an excel spread sheet. Its a collection of bytes. That the collection means something to some application is just a happy coincidence.

Quote
and to parse the bitmap file

Have you google reading bitmap files? They are quite well organized (strange for a Microsoft invention, I know).

Quote
generate a single array corresponding to a single line of the image

You'll need to be a lot more specific about the type, size, and contents of that array.

Quote
write that line out to the LED strip

You said, or at least implied, that you knew how to to that. At least for some type/size/contents of an array.




Go Up