ESP32 Cam - working!

I have checked. Mine is not. What annoyed me is that I purchased the device with the antenna combo. I would think the device would be setup for external use.

Aliexpress?

Never heard of it? I think you earn enough :rofl:

Same here,…external antenna was supplied but the board needs the small modification if you want to use it…Aliexpress order as well

I didn’t use a resistor, just a small blob of solder. A few of the things I read/watched said that just using solder is good enough, so thats what I did. Works great for me. Just putting solder between the two pads is relatively easy compared to trying to add a resistor.

Its a zero ohm resistor so solder has the same effect.

1 Like

right, I knew there were actual words for what I was saying. lol

1 Like

I think I just found some bug. I have ESP32 Cam with esp home. For some reason camera stopped working and when I tried to open stream from android HA app I got notification about unsuccessful login from my IP. I tried two more times and banned my self :slight_smile: I’m not sure where should I report this and to what part of HA or esp home is this bug related (I’m running 2022.6 and esphome v2022.6.2). I removed my IP from banned list, rebooted HA and same thing happened. I also tried from PC/browser and same thing happens. Can somebody else try and recreate this. Just unplug camera and click to open stream…

Who banned you? Afaik esphome doesn’t include any banning technologies :thinking:

Which list is this? Where it is located?

Looks like it is related to ha - but did you add something to your installation?

Just did that and I only get a grey box:

image

When you click on grey box to open stream do you get notification from HA about failed login attempt? Yes I have ip_ban_enabled: true in HA configuration.yaml

No, it just does nothing.

Well, that’s it than. Nothing to do with esphome in particular.

It’s something to do with loading a Lovelace panel with a camera on it.

I got a warning every time, and sometimes it would ban

Now I make sure there is no cameras on the default page

Is this still an error if the camera is 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