ESP32-CAM (DFR0602) error "Got invalid frame from camera!"

TL;DR

Back in October I purchased a ESP32-CAM but put it aside. After a couple of setbacks I now have the device connecting to my Wi-Fi and my Home Assistant server using ESPHome, and updating OTA.

I followed your ESP32 IR-Triggered Camera with Home Assistant Integration tutorial. I can turn the LED on/off from Home Assistant, but I am not getting any image. The log from the camera is continually reporting “[esp32_camera:162]: Got invalid frame from camera!”.
After googling for possible solutions, the best response seems to be [W][esp32_camera:151]: Got invalid frame from camera! · Issue #1225 · esphome/issues · GitHub which suggests that the camera module may have a hardware fault.

I accept that because it’s been 8 months and I have installed ESPHome firmware, that the ESP32-CAMs warranty is not valid, and that you probably don’t support ESPHome anyway - well OK, at least it wasn’t too expensive.

I can purchase another ESP32-CAM (or a different camera component) … but I how can I test it without having to install and learn Arduino, ESP-IDF and/or manufacturers’ custom apps ? I do NOT want to learn Arduino or Espressif IDE (too many learning curves already).

OK, now the long version…

I use Raspberry Pis and Home Assistant. I have already experienced too many “learning curves”, so I want to avoid having to learn Arduino or Espressif IDE. I made the decision to use ESPHome for microcontrollers where a Raspberry Pi is overkill.

The ESP32-CAM is plugged into a USB power adaptor, with CHARGER Doctor reporting 4.9-5.03V and 0.15-0.17A supplied.

I copied and pasted the Ai-Thinker Camera Example configuration entry (and have since checked against other tutorials) - but I have never been able to get a picture from the camera.

# Ai-Thinker Camera  - Example configuration entry
#
esp32_camera:
  name: $devicename
  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
  vertical_flip: false
  horizontal_mirror: false
#  resolution: 400x296
#  max_framerate: 12 fps

#
# Flashlight
output:
  - platform: gpio
    pin: GPIO4
    id: gpio_4
light:
  - platform: binary
    output: gpio_4
    name: $devicename light
    id: camera_flash

The code compiles and loads OTA.

INFO Reading configuration /config/esphome/esp32-cam.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
WARNING GPIO4 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 Generating C++ source...
INFO Compiling app...
Processing esp32-cam (board: esp32cam; framework: arduino; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <ESPmDNS> 1.0
Compiling /data/esp32-cam/.pioenvs/esp32-cam/src/main.cpp.o
Linking /data/esp32-cam/.pioenvs/esp32-cam/firmware.elf
RAM:   [=         ]  14.2% (used 46592 bytes from 327680 bytes)
Flash: [======    ]  58.3% (used 1070242 bytes from 1835008 bytes)
Building /data/esp32-cam/.pioenvs/esp32-cam/firmware.bin
esp32_create_combined_bin(["/data/esp32-cam/.pioenvs/esp32-cam/firmware.bin"], ["/data/esp32-cam/.pioenvs/esp32-cam/firmware.elf"])
Wrote 0x115510 bytes to file /data/esp32-cam/.pioenvs/esp32-cam/firmware-factory.bin, ready to flash to offset 0x0
========================= [SUCCESS] Took 38.53 seconds =========================
INFO Successfully compiled program.
INFO Connecting to 192.168.1.163
INFO Uploading /data/esp32-cam/.pioenvs/esp32-cam/firmware.bin (1070352 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from 192.168.1.163 using esphome API
INFO Successfully connected to 192.168.1.163
[17:16:49][I][app:102]: ESPHome version 2022.5.1 compiled on Jun  7 2022, 17:15:47
[17:16:49][C][wifi:491]: WiFi:
[17:16:49][C][wifi:353]:   Local MAC: A4:E5:7C:D5:4A:14
[17:16:49][C][wifi:354]:   SSID: 'erykah'[redacted]
[17:16:49][C][wifi:355]:   IP Address: 192.168.1.163
[17:16:49][C][wifi:357]:   BSSID: 18:D6:C7:56:D5:64[redacted]
[17:16:49][C][wifi:358]:   Hostname: 'esp32-cam'
[17:16:49][C][wifi:360]:   Signal strength: -43 dB ▂▄▆█
[17:16:49][C][wifi:364]:   Channel: 1
[17:16:49][C][wifi:365]:   Subnet: 255.255.255.0
[17:16:49][C][wifi:366]:   Gateway: 192.168.1.1
[17:16:49][C][wifi:367]:   DNS1: 192.168.1.1
[17:16:49][C][wifi:368]:   DNS2: 0.0.0.0
[17:16:49][C][logger:274]: Logger:
[17:16:49][C][logger:275]:   Level: DEBUG
[17:16:49][C][logger:276]:   Log Baud Rate: 115200
[17:16:49][C][logger:277]:   Hardware UART: UART0
[17:16:49][C][gpio.output:010]: GPIO Binary Output:
[17:16:49][C][gpio.output:011]:   Pin: GPIO4
[17:16:49][C][light:104]: Light 'esp32-cam light'
[17:16:49][C][esp32_camera:048]: ESP32 Camera:
[17:16:49][C][esp32_camera:049]:   Name: esp32-cam
[17:16:49][C][esp32_camera:050]:   Internal: NO
[17:16:49][C][esp32_camera:052]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[17:16:49][C][esp32_camera:053]:   VSYNC Pin: 25
[17:16:49][C][esp32_camera:054]:   HREF Pin: 23
[17:16:49][C][esp32_camera:055]:   Pixel Clock Pin: 22
[17:16:49][C][esp32_camera:056]:   External Clock: Pin:0 Frequency:20000000
[17:16:49][C][esp32_camera:057]:   I2C Pins: SDA:26 SCL:27
[17:16:49][C][esp32_camera:058]:   Reset Pin: -1
[17:16:49][C][esp32_camera:076]:   Resolution: 640x480 (VGA)
[17:16:49][C][esp32_camera:101]:   JPEG Quality: 10
[17:16:49][C][esp32_camera:103]:   Contrast: 0
[17:16:49][C][esp32_camera:104]:   Brightness: 0
[17:16:49][C][esp32_camera:105]:   Saturation: 0
[17:16:49][C][esp32_camera:106]:   Vertical Flip: OFF
[17:16:49][C][esp32_camera:107]:   Horizontal Mirror: OFF
[17:16:49][C][esp32_camera:108]:   Special Effect: 0
[17:16:49][C][esp32_camera:109]:   White Balance Mode: 0
[17:16:49][C][esp32_camera:112]:   Auto Exposure Control: 1
[17:16:49][C][esp32_camera:113]:   Auto Exposure Control 2: 0
[17:16:49][C][esp32_camera:114]:   Auto Exposure Level: 0
[17:16:49][C][esp32_camera:115]:   Auto Exposure Value: 300
[17:16:49][C][esp32_camera:116]:   AGC: 1
[17:16:49][C][esp32_camera:117]:   AGC Gain: 0
[17:16:49][C][esp32_camera:118]:   Gain Ceiling: 0
[17:16:49][C][esp32_camera:124]:   Test Pattern: NO
[17:16:49][C][psram:020]: PSRAM:
[17:16:49][C][psram:021]:   Available: YES
[17:16:49][C][captive_portal:088]: Captive Portal:
[17:16:49][C][mdns:084]: mDNS:
[17:16:49][C][mdns:085]:   Hostname: esp32-cam
[17:16:49][C][ota:085]: Over-The-Air Updates:
[17:16:49][C][ota:086]:   Address: 192.168.1.163:3232
[17:16:49][C][api:138]: API Server:
[17:16:49][C][api:139]:   Address: 192.168.1.163:6053
[17:16:49][C][api:143]:   Using noise encryption: NO
[17:16:51][W][esp32_camera:162]: Got invalid frame from camera!
[17:16:55][W][esp32_camera:162]: Got invalid frame from camera!
[17:16:59][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:03][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:07][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:11][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:15][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:19][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:23][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:27][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:31][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:35][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:39][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:43][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:47][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:51][W][esp32_camera:162]: Got invalid frame from camera!
[17:17:55][W][esp32_camera:162]: Got invalid frame from camera!

In Home Assistant the integration does work to turn the ESP32-CAM’s LED on and off, so it is definitely communicating correctly - but the camera is “unavailable”.

After googling for possible solutions, the best response seems to be [W][esp32_camera:151]: Got invalid frame from camera! · Issue #1225 · esphome/issues · GitHub which suggests that the camera module may have a hardware fault.

1 Like

Hi Donald,

I had a read through the GitHub issue you linked, and it looks like it’s a hardware fault as you say.

Have you tried cleaning the camera ribbon cable connector with IPA as suggested in the issue? While it may not fix things, I think it’s worth a go, it’d be the fastest way to get you back on track.

If that doesn’t work, send us an email (address on our Contact page) and we can look into this under warranty (It’s still within .

Please let me know if you have any more questions!
-James

2 Likes