The place where random ideas get written down and lost in time.

2025-09-28 - ESP-RS: Rust on the ESP32-CAM (again)

Category Esp32

I looked at using Rust a few years ago on ESP32, but quite frankly the platform did not seem mature enough. It was really bleeding edge. Like razor sharp. I can barely stand the “better-than-thou” hype around Rust, so that was too much. Then I checked again last year when I did the SDB project and it still wasn’t looking stable enough for my needs.

This time it looks like I could at least do what I want: use Rust with ESP-RS on the ESP32-CAM and actually capture image frames. There’s now some good ESP Camera component circulating around with some tangible support:

To use this in an ESP-RS project, we need 3 changes:

First, we need a git checkout of the https://github.com/espressif/esp32-camera project.
In a serious project, that would be a git submodule, but for a throw-away test that can be just good ol’ boring
git clone:

$ mkdir components
$ pushd components
$ git clone
https://github.com/espressif/esp32-camera.git

In the main Cargo.toml, we need the esp-idf-sys crate and we need to use (import?) that esp32-camera component:

$ cargo add esp-idf-sys
$ vim Cargo.toml
[[package.metadata.esp-idf-sys.extra_components]]
component_dirs = "components/esp32-camera"
bindings_header = "components/bindings.h"
bindings_module = "camera"

Now the first I compiled this, it failed at runtime in the esp_camera::init:

I (657) cam_hal: Allocating 384000 Byte frame buffer in PSRAM
E (657) cam_hal: cam_dma_config(509): frame buffer malloc failed

That sounds like “esp_psram” is not enabled on the project. That’s done in the sdkconfig.defaults file:

CONFIG_ESP32_SPIRAM_SUPPORT=y

My own “webcam sample” for the ESP32-CAM is located here:

https://github.com/ralfoide/arduino/tree/main/ESP32-CAM/Rust/esp-rs-std-webcam


  Generated on 2025-10-07 by Rig4j 0.1-Exp-f3ee0b3