ESP32 Cam - working!

If the camera is working then this is just one bad frame detected while you were looking at the log. Nothing to worry about.

No, it is a warning. that’s what 'W‘ means.

I am fairly certain that lowering the frequency: 20MHz to 10 MHz will solve your cam-setup/initialize problem!

1 Like
# camera webserver
esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot  
 

for the webserver

The red LED can be used as an ESPHome status LED and also switchable with this:

# For the white LED.
output:
  - platform: ledc
    pin: GPIO4
    id: gpio_4
    channel: 2
    frequency: 500Hz

light:
  # For the white LED.
  - platform: monochromatic
    output: gpio_4
    name: espcam1 camera LED
  # For the red status LED.
  - platform: status_led
    name: espcam1 status LED
    pin:
      number: GPIO33
      inverted: true

EDIT, no this doesn’t work. This does, but it’s no longer a status LED:

output:
  - platform: ledc
    pin:
      number: GPIO33
      inverted: true
    id: gpio_33

light:
  - platform: binary
    output: gpio_33
    name: espcam1 status LED

Hi guys. I have a hard time to make this working with ESPHome.
Bought these cameras: https://www.aliexpress.com/item/1005001900359624.html?spm=a2g0o.order_list.order_list_main.10.47aa1802Zg5YWF

ESPHome flasher says it is ESP32-D0WD-V3 (revision 3) with 2 cores and 4MB flash size:

Device is coming with camera and “docking” board with micro USB port, so flashing is not the problem. I don’t need even to use FTDI, just connecting device to PC with USB cable via micro USB port and every flash is successful. However, camera will not show video stream. I already tried all possible configurations from : ESP32 Camera Component — ESPHome , none is working for me. This is the last one ( Ai-Thinker Camera):

esphome:
  name: camera-hall

esp32:
  board: esp32cam
  framework:
    type: arduino

logger:

api:

ota:

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

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
  resolution: 640x480
  name: Camera Hall
  jpeg_quality: 10

I have to say that same camera device is working with Tasmota, video is showing as expected. But I don’t want to use it with Tasmota, I want to use it with ESPHome :blush:. I installed Tasmota from Tasmota web installer as Tasmota WebCam (english) and configure with template from here: Ai-Thinker Camera (ESP32-CAM) Configuration for Tasmota. I compared PINs provided on Tasmota template page and in Ai-Thinker Camera ESPHome configuration - they are the same, with the difference that Tasmota has 4 PINs for SPI protocol configured, which are missing on ESPHome.

These are logs from ESPHome Flasher, right after installation during boot and right after boot, what I can see is: [E][esp32_camera:099]: Setup Failed: ESP_FAIL:

Using 'COM7' as serial port.
Writing at 0x000e32ac... (100 %)Wrote 880384 bytes (567887 compressed) at 0x00010000 in 13.1 seconds (effective 537.8 kbit/s)...
Hash of data verified.

Leaving...
Hard Resetting...
Hard resetting via RTS pin...
Done! Flashing is complete!

Showing logs:
[06:22:51]E (253) psram: PSRAM ID read error: 0xffffffff
[06:22:52][I][logger:258]: Log initialized
[06:22:52][C][ota:469]: There have been 0 suspected unsuccessful boot attempts.
[06:22:52][D][esp32.preferences:113]: Saving 1 preferences to flash...
[06:22:52][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[06:22:52][I][app:029]: Running through setup()...
[06:22:52][D][esp-idf:000]: E (405) cam_hal: cam_dma_config(306): frame buffer malloc failed
[06:22:52]
[06:22:52][D][esp-idf:000]: E (405) cam_hal: cam_config(390): cam_dma_config failed
[06:22:52]
[06:22:52][D][esp-idf:000]: E (416) camera: Camera config failed with error 0xffffffff
[06:22:52]
[06:22:52][E][esp32_camera:024]: esp_camera_init failed: ESP_FAIL
[06:22:52][E][component:113]: Component esp32_camera was marked as failed.
[06:22:52][C][wifi:037]: Setting up WiFi...
[06:22:52][C][wifi:038]:   Local MAC: C8:F0:9E:49:EC:40
[06:22:52][D][wifi:386]: Starting scan...
[06:22:58][D][wifi:401]: Found networks:
[06:22:58][I][wifi:445]: - 'Please wait void...' (A0:F4:79:97:3B:6C) ▂▄▆█
[06:22:58][D][wifi:446]:     Channel: 2
[06:22:58][D][wifi:447]:     RSSI: -60 dB
[06:22:58][I][wifi:445]: - 'Please wait void...' (00:24:01:A9:2B:DC) ▂▄▆█
[06:22:58][D][wifi:446]:     Channel: 8
[06:22:58][D][wifi:447]:     RSSI: -81 dB
[06:22:58][D][wifi:450]: - 'TS-WDh8' (C4:69:F0:C7:93:20) ▂▄▆█
[06:22:58][I][wifi:257]: WiFi Connecting to 'Please wait void...'...
[06:23:01][I][wifi:518]: WiFi Connected!
[06:23:01][C][wifi:362]:   Local MAC: C8:F0:9E:49:EC:40
[06:23:01][C][wifi:363]:   SSID: 'Please wait void...'
[06:23:01][C][wifi:364]:   IP Address: 192.168.0.141
[06:23:01][C][wifi:366]:   BSSID: A0:F4:79:97:3B:6C
[06:23:01][C][wifi:367]:   Hostname: 'camera-hall'
[06:23:01][C][wifi:369]:   Signal strength: -59 dB ▂▄▆█
[06:23:01][C][wifi:373]:   Channel: 2
[06:23:01][C][wifi:374]:   Subnet: 255.255.255.0
[06:23:01][C][wifi:375]:   Gateway: 192.168.0.1
[06:23:01][C][wifi:376]:   DNS1: 8.8.8.8
[06:23:01][C][wifi:377]:   DNS2: 8.8.4.4
[06:23:01][C][ota:093]: Over-The-Air Updates:
[06:23:01][C][ota:094]:   Address: camera-hall.local:3232
[06:23:01][C][api:025]: Setting up Home Assistant API server...
[06:23:01][I][app:062]: setup() finished successfully!
[06:23:01][I][app:102]: ESPHome version 2022.12.3 compiled on Dec 27 2022, 06:20:53
[06:23:01][C][wifi:504]: WiFi:
[06:23:01][C][wifi:362]:   Local MAC: C8:F0:9E:49:EC:40
[06:23:01][C][wifi:363]:   SSID: 'Please wait void...'
[06:23:01][C][wifi:364]:   IP Address: 192.168.0.141
[06:23:01][C][wifi:366]:   BSSID: A0:F4:79:97:3B:6C
[06:23:01][C][wifi:367]:   Hostname: 'camera-hall'
[06:23:01][C][wifi:369]:   Signal strength: -59 dB ▂▄▆█
[06:23:01][C][wifi:373]:   Channel: 2
[06:23:01][C][wifi:374]:   Subnet: 255.255.255.0
[06:23:01][C][wifi:375]:   Gateway: 192.168.0.1
[06:23:01][C][wifi:376]:   DNS1: 8.8.8.8
[06:23:01][C][wifi:377]:   DNS2: 8.8.4.4
[06:23:01][C][logger:293]: Logger:
[06:23:01][C][logger:294]:   Level: DEBUG
[06:23:01][C][logger:295]:   Log Baud Rate: 115200
[06:23:01][C][logger:296]:   Hardware UART: UART0
[06:23:01][C][esp32_camera:048]: ESP32 Camera:
[06:23:01][C][esp32_camera:049]:   Name: Camera Hall
[06:23:01][C][esp32_camera:050]:   Internal: NO
[06:23:01][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[06:23:01][C][esp32_camera:053]:   VSYNC Pin: 25
[06:23:01][C][esp32_camera:054]:   HREF Pin: 23
[06:23:01][C][esp32_camera:055]:   Pixel Clock Pin: 22
[06:23:01][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[06:23:01][C][esp32_camera:060]:   I2C Pins: SDA:26 SCL:27
[06:23:01][C][esp32_camera:062]:   Reset Pin: -1
[06:23:01][C][esp32_camera:080]:   Resolution: 640x480 (VGA)
[06:23:01][E][esp32_camera:099]:   Setup Failed: ESP_FAIL
[06:23:01][C][psram:020]: PSRAM:
[06:23:01][C][psram:021]:   Available: NO
[06:23:01][C][mdns:103]: mDNS:
[06:23:01][C][mdns:104]:   Hostname: camera-hall
[06:23:01][C][ota:093]: Over-The-Air Updates:
[06:23:01][C][ota:094]:   Address: camera-hall.local:3232
[06:23:01][C][api:138]: API Server:
[06:23:01][C][api:139]:   Address: camera-hall.local:6053
[06:23:01][C][api:143]:   Using noise encryption: NO
[06:23:02][D][api:102]: Accepted ::FFFF:192.168.0.21
[06:23:02][D][api.connection:918]: Home Assistant 2022.12.8 (::FFFF:192.168.0.21): Connected successfully
[06:27:52][I][ota:113]: Boot seems successful, resetting boot loop counter.
[06:27:52][D][esp32.preferences:113]: Saving 1 preferences to flash...
[06:27:52][D][esp32.preferences:142]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[06:38:11][D][api:102]: Accepted ::FFFF:192.168.0.21
[06:38:11][D][api.connection:918]: ESPHome Logs 2022.12.3 (::FFFF:192.168.0.21): Connected successfully
[06:38:11][I][app:102]: ESPHome version 2022.12.3 compiled on Dec 27 2022, 06:20:53
[06:38:11][C][wifi:504]: WiFi:
[06:38:11][C][wifi:362]:   Local MAC: C8:F0:9E:49:EC:40
[06:38:11][C][wifi:363]:   SSID: 'Please wait void...'
[06:38:11][C][wifi:364]:   IP Address: 192.168.0.141
[06:38:11][C][wifi:366]:   BSSID: A0:F4:79:97:3B:6C
[06:38:11][C][wifi:367]:   Hostname: 'camera-hall'
[06:38:11][C][wifi:369]:   Signal strength: -67 dB ▂▄▆█
[06:38:11][C][wifi:373]:   Channel: 2
[06:38:11][C][wifi:374]:   Subnet: 255.255.255.0
[06:38:11][C][wifi:375]:   Gateway: 192.168.0.1
[06:38:11][C][wifi:376]:   DNS1: 8.8.8.8
[06:38:11][C][wifi:377]:   DNS2: 8.8.4.4
[06:38:12][C][logger:293]: Logger:
[06:38:12][C][logger:294]:   Level: DEBUG
[06:38:12][C][logger:295]:   Log Baud Rate: 115200
[06:38:12][C][logger:296]:   Hardware UART: UART0
[06:38:12][C][esp32_camera:048]: ESP32 Camera:
[06:38:12][C][esp32_camera:049]:   Name: Camera Hall
[06:38:12][C][esp32_camera:050]:   Internal: NO
[06:38:12][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[06:38:12][C][esp32_camera:053]:   VSYNC Pin: 25
[06:38:12][C][esp32_camera:054]:   HREF Pin: 23
[06:38:12][C][esp32_camera:055]:   Pixel Clock Pin: 22
[06:38:12][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[06:38:12][C][esp32_camera:060]:   I2C Pins: SDA:26 SCL:27
[06:38:12][C][esp32_camera:062]:   Reset Pin: -1
[06:38:12][C][esp32_camera:080]:   Resolution: 640x480 (VGA)
[06:38:12][E][esp32_camera:099]:   Setup Failed: ESP_FAIL
[06:38:12][C][psram:020]: PSRAM:
[06:38:12][C][psram:021]:   Available: NO
[06:38:12][C][mdns:103]: mDNS:
[06:38:12][C][mdns:104]:   Hostname: camera-hall
[06:38:12][C][ota:093]: Over-The-Air Updates:
[06:38:12][C][ota:094]:   Address: camera-hall.local:3232
[06:38:12][C][api:138]: API Server:
[06:38:12][C][api:139]:   Address: camera-hall.local:6053
[06:38:12][C][api:143]:   Using noise encryption: NO

Logs from device (but, this is mostly the same as previous from ESPHome Flasher):

INFO Reading configuration /config/camera-hall.yaml...
WARNING GPIO0 is a Strapping PIN and should be avoided.
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
INFO Starting log output from camera-hall.local using esphome API
WARNING Error with socket 21 (('10.66.66.1', 5353))): [Errno 126] Required key not available
Traceback (most recent call last):
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 1056, in sendto
    self._sock.sendto(data, addr)
OSError: [Errno 126] Required key not available
INFO Successfully connected to camera-hall.local
[06:38:11][I][app:102]: ESPHome version 2022.12.3 compiled on Dec 27 2022, 06:20:53
[06:38:11][C][wifi:504]: WiFi:
[06:38:11][C][wifi:362]:   Local MAC: C8:F0:9E:49:EC:40
[06:38:11][C][wifi:363]:   SSID: [redacted]
[06:38:11][C][wifi:364]:   IP Address: 192.168.0.141
[06:38:11][C][wifi:366]:   BSSID: [redacted]
[06:38:11][C][wifi:367]:   Hostname: 'camera-hall'
[06:38:11][C][wifi:369]:   Signal strength: -67 dB ▂▄▆█
[06:38:11][C][wifi:373]:   Channel: 2
[06:38:11][C][wifi:374]:   Subnet: 255.255.255.0
[06:38:11][C][wifi:375]:   Gateway: 192.168.0.1
[06:38:11][C][wifi:376]:   DNS1: 8.8.8.8
[06:38:11][C][wifi:377]:   DNS2: 8.8.4.4
[06:38:11][C][logger:293]: Logger:
[06:38:11][C][logger:294]:   Level: DEBUG
[06:38:11][C][logger:295]:   Log Baud Rate: 115200
[06:38:11][C][logger:296]:   Hardware UART: UART0
[06:38:12][C][esp32_camera:048]: ESP32 Camera:
[06:38:12][C][esp32_camera:049]:   Name: Camera Hall
[06:38:12][C][esp32_camera:050]:   Internal: NO
[06:38:12][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[06:38:12][C][esp32_camera:053]:   VSYNC Pin: 25
[06:38:12][C][esp32_camera:054]:   HREF Pin: 23
[06:38:12][C][esp32_camera:055]:   Pixel Clock Pin: 22
[06:38:12][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[06:38:12][C][esp32_camera:060]:   I2C Pins: SDA:26 SCL:27
[06:38:12][C][esp32_camera:062]:   Reset Pin: -1
[06:38:12][C][esp32_camera:080]:   Resolution: 640x480 (VGA)
[06:38:12][E][esp32_camera:099]:   Setup Failed: ESP_FAIL
[06:38:12][C][psram:020]: PSRAM:
[06:38:12][C][psram:021]:   Available: NO
[06:38:12][C][mdns:103]: mDNS:
[06:38:12][C][mdns:104]:   Hostname: camera-hall
[06:38:12][C][ota:093]: Over-The-Air Updates:
[06:38:12][C][ota:094]:   Address: camera-hall.local:3232
[06:38:12][C][api:138]: API Server:
[06:38:12][C][api:139]:   Address: camera-hall.local:6053
[06:38:12][C][api:143]:   Using noise encryption: NO

Camera has success to connect to WiFi, it was successfully integrated to Home Assistant, but as said, video stream is missing. Does anybody has any clue?

Thx.

Is your USB port v1.x, v2.x, or some other? Does it provide enough current (milliamps) for the ESP32? It’s often helpful to power these devices through their 5V and GND pins instead of through the USB port, which is frequently limited to 500 mA.

Also, double-check and verify your GPIO pin assignments for the OV2640 camera. The three error lines above ESP_FAIL seem to indicate the pin numbers are not correct.

[06:22:52][D][esp-idf:000]: E (405) cam_hal: cam_dma_config(306): frame buffer malloc failed
[06:22:52]
[06:22:52][D][esp-idf:000]: E (405) cam_hal: cam_config(390): cam_dma_config failed
[06:22:52]
[06:22:52][D][esp-idf:000]: E (416) camera: Camera config failed with error 0xffffffff

Finally, this Espressif forum post seems to indicate issues downloading files for this camera. It might be helpful to get their downloads, and see precisely which GPIO / PIN numbers their Arduino code is using.

Camera.ino file contains this:

//
// WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
//            Ensure ESP32 Wrover Module or other board with PSRAM is selected
//            Partial images will be transmitted if image exceeds buffer size
//
#define CAMERA_MODEL_HONGKE // Has PSRAM

So it appears the board likely has PSRAM.
These pin assignments were found in the file camera_pins.h.
They seem to match your values, but there are a few things to possibly note:
a) using GPIO0 for the external clock seems odd
b) it may be helpful to reverse the order of the camera data pins Y2 to Y9. Might work, cannot hurt to try.
c) try dropping your jpeg_quality: 10 value down to 7 instead.

#if defined(CAMERA_MODEL_HONGKE)
#define PWDN_GPIO_NUM     32
#define RESET_GPIO_NUM    -1
#define XCLK_GPIO_NUM      0
#define SIOD_GPIO_NUM     26
#define SIOC_GPIO_NUM     27

#define Y9_GPIO_NUM       35
#define Y8_GPIO_NUM       34
#define Y7_GPIO_NUM       39
#define Y6_GPIO_NUM       36
#define Y5_GPIO_NUM       21
#define Y4_GPIO_NUM       19
#define Y3_GPIO_NUM       18
#define Y2_GPIO_NUM        5
#define VSYNC_GPIO_NUM    25
#define HREF_GPIO_NUM     23
#define PCLK_GPIO_NUM     22

Big thanks for your suggestions, but…

Low current was already eliminated, I tried with 5V 4A power supply (which btw isn’t mobile phone charger at all), via 5V & GND PINs, no luck. Beside that, I’m not sure could this be a case, since same camera is working on Tasmota and on stock firmware via same micro USB port, but ok, I tried.

My biggest doubt is either PIN assignment isn’t ok, or maybe the problem could be in ESPHome, since this was already the case before. Ok, I tried PIN reverse order last night, cause Aliexpress seller was send me same files you recommending (I asked him does he know ESPHome config, of course he sent me stock files :rofl:)

Just one little correction: As per ESPHome wiki, 10 is best quality, 63 worst, so I tried with 20, and no luck :sleepy:

More and more I believe that problem is in ESPHome and HA, cause Tasmota template is using same PINs as AI Thinker example from ESPHome wiki and it is working in Tasmota + it is not showing video stream/camera entity in HA as integrated Tasmota device, or maybe I’m doing something wrong :rofl: :rofl: ? (this is some new moment I just discovered).

It very likely is something incompatible with ESPHome camera code, then. i know the ESPHome low-level interrupt code for ESP32-cam is incompatible with other devices, specifically because of how Espressif handles the interrupts. Good luck with your cameras. It looks like Tasmota is handling it very well!

Actually, something was screwed in latest versions of ESPHome, check this issue:

All these comments are by 2 weeks ago and last week.
I deleted ESPHome container and re-downloaded version 2022.11.5 - ESP32 cam is working now, with most usually used config example - AI-Thinker.

As for now, it stays mystery for me why in case of Tasmota, video stream is shown in Tasmota web UI, together with button switch and dimmer for flash LED, and there is no camera entity in HA when I integrate same that Tasmota device.

Perhaps because the tasmota integration makes no mention of supporting cameras Tasmota - Home Assistant

1 Like

True story :smiley:

Hi, may i ask how you did that?
I didn’t get an option to choose an other version.

First, I would ask you how do you using docker? If you are using it via Portainer and GUI, then I don’t know. Long time ago I tried Portainer and didn’t liked it.
I’m installing all my containers with docker-compose (command line). So, procedure in my case would be:

Stop container (replace esphome with the name of your ESPHome container):

docker stop esphome

Delete all stopped containers and unused networks:

docker system prune -a

Edit docker-compose.yaml file, so you appending the version of container you want to pull, instead of default, i.e. latest one, e.g. image: esphome/esphome:2022.11.5 Example of my docker-compose.yaml file, ESPHome section:

  esphome:
    container_name: esphome
    image: esphome/esphome:2022.11.5
    volumes:
      - "./esphome:/config"
      - "/etc/localtime:/etc/localtime:ro"
    restart: always
    privileged: true
    network_mode: host
    ports:
      - 6052:6052
      - 6123:6123

Finally, executing following command from directory where docker-compose.yaml file is located:

docker-compose up -d

In short, what ever way you are using to run docker containers, you basically need to:

  1. Stop container
  2. Delete container
  3. Append :2022.11.5 to your command line.

So no matter if you are using Portainer, docker-compose or docker run, just replace esphome with esphome:2022.11.5 (or esphome:latest with esphome:2022.11.5, depending on your current setup).

not sure if you are still having issues with this or not.

but i will mention i got the exact same camera you have and loaded the esp32 cam code in your post and it seems to be working.

not final config but setup enough to get video working.

substitutions:
  display_name: Camera
  device_description: ESP32
  friendly_name: Camera

esphome:
  name: "esp-cam"

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-0364Dc"
    password: "oQFv7YaFlvBK"

captive_portal:

web_server:
  port: 80    

time:
  - platform: homeassistant
    id: time_homeassistant
    on_time_sync:
      - component.update: sensor_uptime_timestamp

sensor:
  - platform: uptime
    id: sensor_uptime
  - platform: template
    id: sensor_uptime_timestamp
    name: "$friendly_name Uptime"
    device_class: "timestamp"
    accuracy_decimals: 0
    update_interval: never
    lambda: |-
      static float timestamp = (
        id(time_homeassistant).utcnow().timestamp - id(sensor_uptime).state
      );
      return timestamp;
  - platform: wifi_signal
    name: "$friendly_name Signal"
    update_interval: 60s

button:
  - platform: restart
    name: "$friendly_name Restart"

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
  resolution: 640x480
  name: $friendly_name
  jpeg_quality: 10

Hey, thanks for the hint. In mean time, I gave up of ESPHome for this certain device. One reason: I had no success to make it work with latest version of ESPHome. Another one: I made it work with ESPHome 2022.11.5, but performances were really disappointing in my case.

I made it work with Arduino code from here. Afterwards, I integrated it to HA as MJPEG IP cam. Good thing with above Arduino code is that it has still image URL as well, so I can use it directly in DoubleTake, this was my intention.

On the other hand, I didn’t gave up from ESPHome completely, cause I like it and it gives you lot of control possibilities, so I will try your example as soon as I’m back to my home these days.

Do you know maybe what part of your code was deserved that video start working?

Thx

Sorry, but no joy, still getting same errors with your code.
I think that something is different on these boards I bought on Aliexpress. For example: I also had no success to get it work if I flash them from Arduino, using native ESP32 board libraries, which could be downloaded from Arduino IDE. Only with these libraries from here, found it here, I had success (manual unpack method to C:\Program Files (x86)\Arduino\hardware\espressif). You know how it’s going with Chinese no-name devices, maybe something was changed.
I will stick with MJPEG IP method for now, only one difference: will try this stuff which can be accessed from multiple clients same time: GitHub - arkhipenko/esp32-cam-mjpeg-multiclient: ESP32 MJPEG Multiclient Streaming Server

1 Like

had another look at your error above and it seems to be a pin-mismatch error, got a few of those until I stumbled on the right pinout config. if you got it working with the arduino code from [here]( arkhipenko/esp32-cam-mjpeg: ESP32 mjpeg streaming server (github.com)), it has to use one of the 5 pin outs defined in the camera_pins.h file, did you try them all in ESPHOME? My code uses the CAMERA_MODEL_AI_THINKER pins.

I will add that this is how I built the ESPHOME code for mine:

  • basic flash from ESPHOME web installer
  • adopt into ESPHOME add-on in HomeAssistant
  • turn on webserver and flash OTA
  • add to HomeAssisstant via the ESPHOME integration
  • add reboot button and flash OTA
  • add esp32_camera code and flash OTA

kept flashing different pin-outs until I found the one above that did not generate an error on esp32_camera:099

add remaining items like time, sensors and substitutions.

here is the device info from the esphome text sensor:
Device Info 2022.12.3|Flash: 4096kB Speed:40MHz Mode:DIO|Chip: ESP32 Features:WIFI_BGN,BLE,BT, Cores:2 Revision:1|ESP-IDF: v4.4.2|EFuse MAC: 40:22:D8:03:64:DC|Reset: Software Reset CPU|Wakeup: Unknown

Yeah it used to be that Ali vendors had some info from which you could get the pin outs, but that seems to have disappeared.

@briodan and @nickrout

@briodan : big thanks for your help, but it shouldn’t be wrong pin out (at least from my understanding :grinning:).

Yes, I tried all pin outs provided in mentioned Arduino code and was also tried all pin outs from ESPHome wiki. My camera is using AI-Thinker pin out, and sorry cause I forgot to mention, with Arduino code I’m using it as AI-Thinker model, not as ESP EYE, as provided per default on esp32-cam-mjpeg github (commented #define CAMERA_MODEL_ESP_EYE and uncommented #define CAMERA_MODEL_AI_THINKER).

image

To make things more clear, my 3 cameras bought here, for some reason simply:

  • Works with mentioned Arduino code, AI-Thinker model, if I’m using these board libraries
  • Works with ESPHome 2022.11.5 (and below probably), AI-Thinker model
  • Not working with latest ESPHome

Real thanks for your help, but I really think that I already tried everything. Maybe some next ESPHome update fix the problem.