Tried 'every' GPIO configuration, still: [ESP32-S Cam] + [ESPhome] -> "Setup Failed: ERROR"

Hi everyone,

About a month ago I ordered this ESP32-S Cam from China, which arrived in the beginning of this week. Since then I’ve been trying to get it to work, but without any luck. Do you have any suggestions?

All the facts + logs:

Home Assistant: 0.92.2
ESPHome: 1.12.2

The module:


[Note: The RX and TX aren’t connected on the FTDI adapter side]

The yaml file:

esphome:
  name: esp32_1
  platform: ESP32
  board: esp32dev

wifi:
  ssid: "myssid"
  password: "ssidpassword"

# Enable logging
logger:

api:
  password: 'apipassword'
  reboot_timeout: 0s

ota:
  safe_mode: True
  password: 'otapassword'

esp32_camera:
  external_clock:
    pin: GPIO0
  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
  name: My Camera

The log:

[22:18:42][C][wifi:371]: WiFi:
[22:18:42][C][wifi:253]:   SSID: 'myssid'[redacted]
[22:18:42][C][wifi:254]:   IP Address: xxxxxxx[redacted]
[22:18:42][C][wifi:256]:   BSSID: xxxxx [redacted]
[22:18:42][C][wifi:257]:   Hostname: 'esp32_1'
[22:18:42][C][wifi:261]:   Signal strength: -64 dB ▂▄▆█
[22:18:42][C][wifi:262]:   Channel: 6
[22:18:42][C][wifi:263]:   Subnet: xxxxx[redacted]
[22:18:42][C][wifi:264]:   Gateway: xxxxx[redacted]
[22:18:42][C][wifi:265]:   DNS1: xxxxx[redacted]
[22:18:42][C][wifi:266]:   DNS2: 0.0.0.0
[22:18:42][C][logger:142]: Logger:
[22:18:42][C][logger:143]:   Level: DEBUG
[22:18:42][C][logger:144]:   Log Baud Rate: 115200
[22:18:42][C][logger:145]:   Hardware UART: UART0
[22:18:42][C][esp32_camera:044]: ESP32 Camera:
[22:18:42][C][esp32_camera:045]:   Name: My Camera
[22:18:42][C][esp32_camera:046]:   Board Has PSRAM: YES
[22:18:42][C][esp32_camera:048]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[22:18:42][C][esp32_camera:049]:   VSYNC Pin: 25
[22:18:42][C][esp32_camera:050]:   HREF Pin: 23
[22:18:42][C][esp32_camera:051]:   Pixel Clock Pin: 22
[22:18:42][C][esp32_camera:052]:   External Clock: Pin:0 Frequency:20000000
[22:18:42][C][esp32_camera:053]:   I2C Pins: SDA:26 SCL:27
[22:18:42][C][esp32_camera:054]:   Reset Pin: -1
[22:18:42][C][esp32_camera:075]:   Resolution: 640x480 (VGA)
[22:18:42][E][esp32_camera:092]:   Setup Failed: ERROR
[22:18:42][C][api:101]: API Server:
[22:18:42][C][api:102]:   Address: esp32_1.local:6053
[22:18:42][C][ota:127]: Over-The-Air Updates:
[22:18:42][C][ota:128]:   Address: esp32_1.local:3232
[22:18:42][C][ota:130]:   Using Password.

See my post below for the list with things I tried, since I can’t post more than 2 links in 1 post as a new user.

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
  power_down_pin: GPIO32
  pixel_clock_pin: GPIO22
  resolution: 640x480
  jpeg_quality: 10
  name: entrance cam

Maybe the camera module is not aligned with the holder/socket correctly?

Have a photo of the other side of the module? I ask because I’ve not seen that exact module before. Most esp32 camera modules I’ve seen have different markings.

You could try the possess of elimination and try every camera setting there are. There are only four configs known atm so it would be a quick process to try.

Hope its of help.

have you managed? I think I have the same cam, and tried 3 different settings, but all give same error as yours

[22:18:42][E][esp32_camera:092]:   Setup Failed: ERROR

I’ve seen that error.
I damaged the camera module during tinkering, think I may have crushed it wile putting it in a enclosure.

Swapping the camera module works in my case.

I have a working config, data_pinshas to be in the below exact ORDER

esphome:
  name: cam
  platform: ESP32
  board: esp32dev

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

wifi:
  networks:
  - ssid: "fff"
    password: "vvv"
  - ssid: vvv
    password: ccc
  manual_ip:
    static_ip: 192.168.1.21
    gateway: 192.168.1.254
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

web_server:
  port: 80


esp32_camera:
  name: My 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
  


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
#    on_state:
#      then:
#        - light.turn_on: light.cam_status    
#    off_state:
#      then:
#        - light.turn_off: light.cam_status
6 Likes

I hate to revive an old thread, but I just want to thank you for posting this. I’ve been bashing my head for weeks trying to get my esp32cam to work and your code did it for me.

@Klagio
worked for me
thanks

Well I ended up copying all and that extra stuff is sweet !!