ESP-32-cam "Setup Failed: ERROR" but visible in accesspoint

I have tried most guides, including the ones from randomnerd. While installing via arduino, I get the Camera init/issue. So, I thought my camera or ZIF/connector was wonky…
When trying to add the camera via espHome, I also get no picture, plus a “[E][esp32_camera:095]: Setup Failed: ERROR” error message. Again,confirming that I seem to have a camera issue… But then I notice that the camera has created an access-point named “ESP32-CAM-MB”. That I can connect to, and by going to 192.168.4.1, I can see the camera controls, plus see stills and a forking video stream… So the camera IS working…

After the espHome-install I can also access the camera controls via the IP address locally on my own networkk

Can someone point me in the right direction of what I might be doing wrong?

No logs, no yaml = no issue.

Sure. That can be shared. But I would believe that asking a question in general would be possible without:

esphome:
  name: birdycam
      
esp32:
  board: esp32dev
#  board: esp-wrover-kit
  framework:
    type: arduino
    version: latest

substitutions:
  # Modify variables based on your settings
  hostname: 'BirdyBirdy'


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "xx"

web_server:
  port: 80

wifi:
  ssid: !secret wifi_ssid # <-- My primary home SSID
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Birdycam Fallback Hotspot"
    password: "XX"

captive_portal:

esp32_camera:
  name: Pippipcam
  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
  max_framerate: 5 fps    # default: 10 fps, max 60
  idle_framerate: 0.2 fps # default: 0.1 fps - framerate for 'picture' in HA dashboard
  resolution: 800x600     # default: 640x480 (VGA) - higher res requires more memory
  jpeg_quality: 10        # 10 (best) to 63 (worst)

output:
#flashlight
  - platform: gpio
    pin: GPIO4
    id: gpio_4
#statuslight
  - platform: gpio
    pin:
      number: GPIO33
      inverted: True
    id: gpio_33
light:
#flashlight
  - platform: binary
    output: gpio_4
    name: $hostname flash
#statuslight
  - platform: binary   
    output: gpio_33
    name: $hostname status
    
    
    
sensor:
  - platform: wifi_signal
    name: $hostname WiFi Signal
    update_interval: 60s
  - platform: uptime
    name: $hostname Uptime

    
text_sensor:
  - platform: version
    name: $hostname ESPHome Version
  - platform: wifi_info
    ssid:
      name: $hostname WiFi

switch:      
  - platform: restart
    name: $hostname restart
    
binary_sensor:
  - platform: status
    name: $hostname status

log:

[23:32:18][I][app:102]: ESPHome version 2022.3.1 compiled on Mar 27 2022, 23:30:57
[23:32:18][C][wifi:491]: WiFi:
[23:32:18][C][wifi:353]:   Local MAC: XX
[23:32:18][C][wifi:354]:   SSID: [redacted]
[23:32:18][C][wifi:355]:   IP Address: XX
[23:32:18][C][wifi:357]:   BSSID: [redacted]
[23:32:18][C][wifi:358]:   Hostname: 'birdycam'
[23:32:18][C][wifi:360]:   Signal strength: -52 dB ▂▄▆█
[23:32:18][C][wifi:364]:   Channel: 1
[23:32:18][C][wifi:365]:   Subnet: 255.255.255.0
[23:32:18][C][wifi:366]:   Gateway: 192.168.0.1
[23:32:18][C][wifi:367]:   DNS1: 192.168.0.1
[23:32:18][C][wifi:368]:   DNS2: 0.0.0.0
[23:32:19][C][logger:233]: Logger:
[23:32:19][C][logger:234]:   Level: DEBUG
[23:32:19][C][logger:235]:   Log Baud Rate: 115200
[23:32:19][C][logger:236]:   Hardware UART: UART0
[23:32:19][C][gpio.output:010]: GPIO Binary Output:
[23:32:19][C][gpio.output:011]:   Pin: GPIO4
[23:32:19][C][gpio.output:010]: GPIO Binary Output:
[23:32:19][C][gpio.output:011]:   Pin: GPIO33
[23:32:19][C][uptime.sensor:031]: Uptime Sensor 'BirdyBirdy Uptime'
[23:32:19][C][uptime.sensor:031]:   State Class: 'total_increasing'
[23:32:19][C][uptime.sensor:031]:   Unit of Measurement: 's'
[23:32:19][C][uptime.sensor:031]:   Accuracy Decimals: 0
[23:32:19][C][uptime.sensor:031]:   Icon: 'mdi:timer-outline'
[23:32:19][C][light:104]: Light 'BirdyBirdy flash'
[23:32:19][C][light:104]: Light 'BirdyBirdy status'
[23:32:19][C][esp32_camera:048]: ESP32 Camera:
[23:32:19][C][esp32_camera:049]:   Name: Pippipcam
[23:32:19][C][esp32_camera:050]:   Internal: NO
[23:32:19][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[23:32:19][C][esp32_camera:053]:   VSYNC Pin: 25
[23:32:19][C][esp32_camera:054]:   HREF Pin: 23
[23:32:19][C][esp32_camera:055]:   Pixel Clock Pin: 22
[23:32:19][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[23:32:19][C][esp32_camera:057]:   I2C Pins: SDA:26 SCL:27
[23:32:19][C][esp32_camera:058]:   Reset Pin: -1
[23:32:19][C][esp32_camera:079]:   Resolution: 800x600 (SVGA)
[23:32:19][E][esp32_camera:095]:   Setup Failed: ERROR
[23:32:19][C][version.text_sensor:021]: Version Text Sensor 'BirdyBirdy ESPHome Version'
[23:32:19][C][version.text_sensor:021]:   Icon: 'mdi:new-box'
[23:32:19][C][restart:022]: Restart Switch 'BirdyBirdy restart'
[23:32:19][C][restart:022]:   Icon: 'mdi:restart'
[23:32:19][C][status:034]: Status Binary Sensor 'BirdyBirdy status'
[23:32:19][C][status:034]:   Device Class: 'connectivity'
[23:32:19][C][psram:020]: PSRAM:
[23:32:19][C][psram:021]:   Available: NO
[23:32:19][C][captive_portal:088]: Captive Portal:
[23:32:19][C][web_server:129]: Web Server:
[23:32:19][C][web_server:130]:   Address: birdycam.local:80
[23:32:19][C][mdns:084]: mDNS:
[23:32:19][C][mdns:085]:   Hostname: birdycam
[23:32:19][C][ota:085]: Over-The-Air Updates:
[23:32:19][C][ota:086]:   Address: birdycam.local:3232
[23:32:19][C][ota:089]:   Using Password.
[23:32:19][C][api:138]: API Server:
[23:32:19][C][api:139]:   Address: birdycam.local:6053
[23:32:19][C][api:143]:   Using noise encryption: NO
[23:32:19][C][wifi_signal.sensor:009]: WiFi Signal 'BirdyBirdy WiFi Signal'
[23:32:19][C][wifi_signal.sensor:009]:   Device Class: 'signal_strength'
[23:32:19][C][wifi_signal.sensor:009]:   State Class: 'measurement'
[23:32:19][C][wifi_signal.sensor:009]:   Unit of Measurement: 'dBm'
[23:32:19][C][wifi_signal.sensor:009]:   Accuracy Decimals: 0
[23:32:19][C][wifi_info:011]: WifiInfo SSID 'BirdyBirdy WiFi'

Screenshots of website reached after connecting to the AP named “ESP32-CAM-MB” and going to 192.168.4.1


Those screenshots seem to be the web server installed by the tutorial from the randomnerds tutorial (compare here at about 3:23 ESP32-CAM Video Streaming and Face Recognition with Arduino IDE | Random Nerd Tutorials)

These esp32 camera modules are pretty flaky. Try a lower res like 640x480.

This line in the log seems important:

[23:32:19][E][esp32_camera:095]:   Setup Failed: ERROR

In the past, this happened to me when the camera cable was not inserted properly in its slot. Try cleaning it with some isopropyl alcohol and inserting it again. You won’t be able to start the camera unless you get rid of this error.

1 Like

Thats right. I’ve seen those post on several forums. And I have tried to reposition in the ZIF. But as in the first post I can see the image on the Accesspoint the camera is setting up (for some reason). So the camera is working fine…

That’s the funny thing. The webserver/accesspoint is not working when I install the arduino-based reciepie from randomnerd. But when I install the camera component via esphome, it pops up…

PS, I tick “erase board” when uploading in esphome.

btw, I have another cam in the mail… Will try the same with that one.

I managed to resolve this eventually, but I believe I had issues by updating the board wirelessly. So when connecting the dedicated esp32-cam-programmer board, I managed to get it working as a with this code:

esphome:
  name: birdycam
  
esp32:
  board: esp32cam
#  board: esp32dev
#  board: esp-wrover-kit
#  board: m5stack-core-esp32
 
substitutions:
  # Modify variables based on your settings
  hostname: 'BirdyBirdy'


# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:
  reboot_timeout: 0s

web_server:
  port: 80

ota:
  password: "XX"


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: True
  
  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "XX"
    password: "XX"



time:
  - platform: homeassistant
    id: homeassistant_time

# ESP32-CAM
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: birdycam
  max_framerate: 1 fps
  resolution: 1600x1200
  jpeg_quality: 20
#  contrast: 2
#  saturation: 2

output:
#flashlight
  - platform: gpio
    pin: GPIO4
    id: gpio_4
#statuslight
  - platform: gpio
    pin:
      number: GPIO33
      inverted: True
    id: gpio_33
light:
#flashlight
  - platform: binary
    output: gpio_4
    name: $hostname flash
#statuslight
  - platform: binary   
    output: gpio_33
    name: $hostname status
    
    
    
sensor:
  - platform: wifi_signal
    name: $hostname WiFi Signal
    update_interval: 60s
  - platform: uptime
    name: $hostname Uptime

    
text_sensor:
  - platform: version
    name: $hostname ESPHome Version
  - platform: wifi_info
    ssid:
      name: $hostname WiFi

switch:      
  - platform: restart
    name: $hostname restart
    
binary_sensor:
  - platform: status
    name: $hostname status

Now everything works and I can re-grow my hair…

Try 10MHz instead of 20!!!

For me, it was because my ESP32cam board could not handle the resolution: 800x600.

ESP32 Camera Component — ESPHome mentions this. I fixed the error by just using the default resolution of 640x480

1 Like