Esphome esp32 cam is unstable

My ESP32 cam (AI-Thinker) is very unstable. Sometimes it stops sending after 3 minutes, sometimes after a few hours.
Hassio 0.96.4 on an Intel NUC with esphome addon.
What can be wrong? I’ve tried with several board types.
My ESP32 is this: https://www.aliexpress.com/item/32968914613.html?spm=a2g0s.9042311.0.0.27424c4dfR2UzN
My config:

esphome:
  name: musikkvolum
  platform: ESP32
  board: esp32dev

wifi:
  ssid: "x"
  password: "x"
esp32_camera:
  name: stuemusikk
  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
  max_framerate: 5 fps
  resolution: 160x120
  jpeg_quality: 10

And your logs?

INFO Connecting to musikkvolum.local:6053 (192.168.10.126)
INFO Successfully connected to musikkvolum.local
[22:33:20][I][app:096]: esphome version 1.13.6 compiled on Aug  5 2019, 20:58:58
[22:33:20][C][wifi:372]: WiFi:
[22:33:20][C][wifi:254]:   SSID: [redacted]
[22:33:20][C][wifi:255]:   IP Address: 192.168.10.126
[22:33:20][C][wifi:257]:   BSSID: [redacted]
[22:33:20][C][wifi:258]:   Hostname: 'musikkvolum'
[22:33:20][C][wifi:262]:   Signal strength: -51 dB ▂▄▆█
[22:33:20][C][wifi:263]:   Channel: 12
[22:33:20][C][wifi:264]:   Subnet: 255.255.255.0
[22:33:20][C][wifi:265]:   Gateway: 192.168.10.1
[22:33:20][C][wifi:266]:   DNS1: 92.220.228.70
[22:33:20][C][wifi:267]:   DNS2: 109.247.114.4
[22:33:20][D][esp32_camera:157]: Got Image: len=2996
[22:33:20][C][switch.gpio:042]: GPIO Switch '“stuemusikk_lys”'
[22:33:20][C][switch.gpio:043]:   Pin: GPIO4 (Mode: OUTPUT)
[22:33:20][C][switch.gpio:059]:   Restore Mode: Restore (Defaults to OFF)
[22:33:20][C][logger:137]: Logger:
[22:33:20][C][logger:138]:   Level: DEBUG
[22:33:20][C][logger:139]:   Log Baud Rate: 115200
[22:33:20][C][logger:140]:   Hardware UART: UART0
[22:33:20][C][esp32_camera:043]: ESP32 Camera:
[22:33:20][C][esp32_camera:044]:   Name: stuemusikk
[22:33:20][C][esp32_camera:045]:   Board Has PSRAM: YES
[22:33:20][C][esp32_camera:047]:   Data Pins: D0:5 D1:18 D2:19 D3:21 D4:36 D5:39 D6:34 D7:35
[22:33:20][C][esp32_camera:048]:   VSYNC Pin: 25
[22:33:20][C][esp32_camera:049]:   HREF Pin: 23
[22:33:20][C][esp32_camera:050]:   Pixel Clock Pin: 22
[22:33:20][C][esp32_camera:051]:   External Clock: Pin:0 Frequency:20000000
[22:33:20][C][esp32_camera:052]:   I2C Pins: SDA:26 SCL:27
[22:33:20][C][esp32_camera:053]:   Reset Pin: -1
[22:33:20][C][esp32_camera:056]:   Resolution: 160x120 (QQVGA)
[22:33:20][C][esp32_camera:097]:   JPEG Quality: 10
[22:33:20][C][esp32_camera:099]:   Contrast: 0
[22:33:20][C][esp32_camera:100]:   Brightness: 0
[22:33:20][C][esp32_camera:101]:   Saturation: 0
[22:33:20][C][esp32_camera:102]:   Vertical Flip: ON
[22:33:20][C][esp32_camera:103]:   Horizontal Mirror: ON
[22:33:20][C][esp32_camera:120]:   Test Pattern: NO
[22:33:20][C][restart:021]: Restart Switch 'stuemusikk_restart'
[22:33:20][C][restart:021]:   Icon: 'mdi:restart'
[22:33:20][C][ota:029]: Over-The-Air Updates:
[22:33:20][C][ota:030]:   Address: musikkvolum.local:3232
[22:33:20][D][esp32_camera:157]: Got Image: len=2964
[22:33:20][C][api:103]: API Server:
[22:33:20][C][api:104]:   Address: musikkvolum.local:6053
[22:33:20][D][esp32_camera:157]: Got Image: len=2963
[22:33:21][D][esp32_camera:157]: Got Image: len=2988
[22:33:21][D][esp32_camera:157]: Got Image: len=2971
[22:33:21][D][esp32_camera:157]: Got Image: len=2955

and so on until it suddenly stops.
After a stop, Show Logs only shows the configuration.

I had the same problem - it’s overheating - you should set the idle_framerate to 0.05 - that helped

1 Like

Great @cva! I changed the idle_framerate, and now it has been stable since yesterday.

Solved: ESP32-cam stops serving frames
Hi,
I have the ESP32-cam now running continuously for a few days without any issues. In the past, the camera module used to stop working after a few hours, though the other functions of the ESP32 board would still work (e.g. turning on the flash through GPIO)
The root cause in my case was the camera sensor getting overheated. I mounted the sensor on a pretty large heat sink and that seems to have solved the issue.
See also: https://github.com/esphome/issues/issues/551#issuecomment-547326784
BTW, also set the “board type” to "esp32dev "
Hope this helps anyone with the same issue
chris

Could you post a pic of how the heatsink is set up?

Hi @nickrout
Unfortunately I have already mounted everything outside on the wall, but I can describe things for you.
So the main issue was not really the ESP32-cam board heating up, it was that tiny cam-sensor heating up. So, I took a left-over piece of metal and attached the cam sensor to it. The metal plate slides in-between the cam sensor and the ESP32-cam board. At the front side of the plate, I glued the cam sensor to it. I isolated the back side of the plate with plastic because it touches the ESP32-cam board and it would create short-circuits. It doesn’t have to be a “real” commercial heat-sink, anything that can dissipate the heat would do.
Makes sense?

Thanks for replying. I am assuming you mean the heatsink goes on the back of this bit? https://www.seeedstudio.com/OV2640-Fisheye-Camera-p-4048.html

Sorry if I am being dense.

Hi @nickrout no problem, glad to answer
yes I added the heat sink (piece of metal; circle of 5cm diameter) to the back of the standard OV2640 mini-sensor that came with the ESP32-cam board. That seems to be enough. I’m not sure if it will be large enough for the summer times. For future projects, I ordered those with a longer flatcable so I have more flexibility to mount them: https://www.aliexpress.com/item/33062602653.html?spm=a2g0s.9042311.0.0.60504c4dkFA01k
chrisV

2 Likes

Old post, but this did the trick for me! :slight_smile: Thanks!

1 Like

Quite old post, but still useful. I was thinking… would it be possible to utilize the SDCard slot on the espCam module as a heat sink for the camera. E.g. on AI Thinker modules, it seems to fit perfectly. My only concern is if it would create any kind of short circuit… It seems that SD card slot is grounded but the small metal plate on camera module, doesn’t seem to be connected to anything… Has anybody tried that?