Unable to save image to SD card with ESP32 and Arducam Mega

Hey everyone. I’m trying to save images to an SD card using an ESP32 and an Arducam Mega. The camera side works, but I can’t get the image to actually write to the SD card. I’ve tried nearly every possible way I can think of — different wiring, SPI settings, different libraries — and still no luck. Has anyone gotten this combo working?

Hi, thanks for the report. To dig in, can you share a bit more about your setup? Which ESP32 board, how the Arducam Mega and SD card are wired (SPI pins, CS lines), and which libraries/versions you’re using? Also, any serial output or error messages you’re seeing while it fails would help.

I don’t have any useful logs from the serial monitor right now — it either just stops or there’s no clear error. Environment is an ESP32, an Arducam Mega, and an SD card. I’m attaching the sketch I’ve been working with: capture2SD-2.ino.

Thanks. We don’t have an ESP32 + SD card setup available on our side at the moment, so I can’t reproduce it directly. But if you post your capture2SD-2.ino code here, we can go through the capture-to-SD path — especially how you’re initializing the SD, creating the file, and writing the camera buffer to it.

Here’s the code: capture2SD-2.ino. It’s basically my working capture sketch modified to save the image to SD, but the file never gets created (or the write fails). I’ve tried changing the SD.begin and file.write logic around without success.

Got it, thanks. We’ll review the sketch. Right now we don’t have a confirmed root cause yet — it’s still pending review of your code. In the meantime, if you can add serial prints right after SD.begin() and after the file write call, that output would give us a lot more to work with.

Sure, I’ll add those prints and get back with the serial output once I have it.

Sounds good. Quick summary so far: the issue is confirmed as saving images to an SD card with an ESP32 + Arducam Mega, but there’s no confirmed root cause or fix yet. We’re reviewing capture2SD-2.ino, and we don’t currently have the exact hardware available to reproduce it. Once we’ve gone through the code and your serial output, I’ll follow up with next steps.