Help with saving a high-res image in chunks

Hi,

I plan to use an Arducam Mega 5MP SPI Camera with an Arduino Mega R3 to take a high-resolution still image approximately once a minute.

From what I understand, saving the image to an SD card from the camera can take a long time (at least 10-20 seconds) due to the limited RAM of the Mega R3. This causes an issue for my project, as the program hangs during the image transfer. I would like to record data from other sensors during that time.

Is it possible to save the image in segments? That is, can the program pause the image saving process, perform other actions, and then resume saving the same image? Ideally, I would like to break the saving process into 1-second chunks.

Thank you in advance for your help!

Best regards,
K

You can add some FRAM for a buffer and then transfer from that to the SD card at what ever rate you want. FRAM is non volatile, and no delay on read or write. Works on a byte level and has almost unlimited read/write cycles. I2C 32K x 8 for a few dollars.

Do you know of modules with more the 32KB ?

A high res image likely has more bytes.

What does the API to get the image look like in your code ?

Mouser lists some SPI FRAM chips up to 16MBit / 2MByte capacity. Adafruit sells one with 4MBit / 512KByte capacity https://www.adafruit.com/product/4719.

Not sure if I would want to transfer a 5MBit image over a 400KHz I2C bus, that could be a bit slow since you need time to write the entire image, then read it back while saving to the SD card.

That would depend a lot on the interface to the camera, and whether it allows portions of the image to be retrieved with pauses in between.

Of course! In fact, the code (that you have apparently only read about at this stage) already does that because of the extremely limited RAM and small SD card buffer.

Take baby steps. When you get to the point that you can successfully save an image, post that code and the questions that came up in the process.

I have used FRAM in SPI and I2C. Mouser stocked them up to 16 Meg byte 16 by 256K, I have not used that one.It will run on SPI from 25 to 40 Mhz, depending on the part you get. I believe Cypress makes them with a parallel access. Get your search engine out there are a large variety of them available.

Ah cool - I was not aware !

Thank you for the great suggestions, everyone!

I just don't really know if I am sufficiently familiar with the camera module, which has a reputation for being difficult to work with, to implement these solutions. I am considering two other potential options, but each has its own caveats.

  1. Using two Arduino Megas: one dedicated to controlling other sensors and the other dedicated to taking high-resolution photos and saving the data collected by the first one when it is not busy saving a photo. The Megas can potentially communicate with each other via I2C. It seems I will need a separate power source for each board. Is there any way to stack both boards to make the setup more streamlined?

  2. Using a more powerful board such as the Arduino Giga. However, I am uncertain whether I can get the Giga to work with the Arducam Mega, as Arducam has not been officially tested with the Giga (the Due was tested, but that board is now obsolete). I am also unsure if the Giga's performance would ensure fast photo saving.

Does anyone have experience with these two potential solutions and can offer some insights? I would appreciate any feedback!

Thank you for your help!

Best regards,
K

There are ESP32S3 Dev boards with a connection for a camera, OV2640 to OV5640 (5MP).

The boards have plenty of Flash and PSRAM for storing images, built in SD card interface too. Circa 11 Free GPIO pins when the camera and SD card are in use.

The Dev boards cost circa £3 + camera.

Thank you, sirnet! I am taking your advice and planning to get an ESP32 to work with the Arducam Mega, due to its better housing. The multithreading capability of the ESP32 should resolve the issue I encountered.