ESP32CAM compile problem

Stumped and probably dumb problem. I cannot get my yaml file to validate or compile. Trying to install a simple esp32cam into HA using esphome. Have tried numerous setups for board and framework. Problem compiling before I even connect to the board.

esphome:
  name: esp32-cam

esp32:
  board: esp32cam
  framework:
    type: arduino
        

# Enable logging
logger:

# Enable Home Assistant API
api:
    reboot_timeout: 0s

ota:

web_server:
  port: 80

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esp32-Cam Fallback Hotspot"
    password: "C3FOhAPFtouw"

captive_portal:

# Example configuration entry
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32

  # Image settings
  name: My ESP32-CAM 

# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4

## GPIO_4 is the flash light pin
light:
  - platform: binary
    output: gpio_4
    name: flashlight

You might get more help if you include the logs including the error you are seeing. The message usually provides at least a clue as to what the problem might be.

Sorry - new to this. I get this error message when validating or installing. This problem is in the esp32_camera: section. ESPHome shows “component requires psram”. My cam board has this psram.

INFO ESPHome 2025.11.0
INFO Reading configuration /config/esphome/100.yaml...
WARNING GPIO0 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
WARNING GPIO5 is a strapping PIN and should only be used for I/O with care.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
Failed config

esp32_camera: [source /config/esphome/100.yaml:35]
  
  This option requires component psram.
  external_clock: 
    pin: GPIO0
    frequency: 20MHz
  i2c_pins: 
    sda: GPIO26
    scl: GPIO27
  data_pins: 
    - GPIO5
    - GPIO18
    - GPIO19
    - GPIO21
    - GPIO36type or paste code here

I think the problem has to do with psram. The board I am using is a standard wsp32cam with 4 psram, but esphome new version does not handle it.

I had a similar problem which was related to psram and I added:

psram:
  mode: quad
  speed: 80MHz

…and all compiled ok.

1 Like

Yes, you have to define the psram you want to use.

I was able to make it compile by just adding psram: - without any settings as I wasn’t sure and the docs say they are all optional. The device is working fine since.

I agree that it must be a bug in the new version, my cameras won’t validate either. Can confirm that adding just “psram” fixes validation and makes it compile.

This is not a bug but I believe it was a change from a few months ago in how things are defined in yaml.

https://esphome.io/components/psram/

Thank you for the help. I believe you guys are correct. I have have now successfully compiled where it would not before. part of the problem is that apparently “octal” on the psram: option has been removed, which is what was advised previously. This now validates - have not tried on the device yet. It would not validate / showed errors without the psram lines.

esphome:
  name: p1s-hope
  friendly_name: P1s Hope

esp32:
  board: esp32cam
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "XXXX"

ota:
  - platform: esphome
    password: "XXXX"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "P1S-Hope Fallback Hotspot"
    password: "XXXX"

psram:
  mode: quad
  speed: 80mhz

captive_portal:

# Example configuration entry
esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
#  frame_buffer_location: dram #alternate code from working version
  
  # Image settings
  name: My ESP32-CAM 

# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4

## GPIO_4 is the flash light pin
light:
  - platform: binary
    output: gpio_4
    name: flashlight
1 Like

Thanks.
This did the trick.

Thansk for sharing the final code. Mine was similar and this was a great guide

Thanks for sharing! works like a charm!

Thanks, I had this issue also and just needed to add the psram lines like suggested above