Hi there
I tried to build my own IP security Camera with an Ai-Thinker ESP32-Cam. I have done a lot of research, but I can’t get it to work properly.
The Problem is that the Camera just freezes after 5 seconds of opperation. Also it is only a greyscale image. When I restart the ESP32, the camera begins to work for 5 seconds and just hangs up again.
Here is my ESpHome YAML:
esphome:
name: esp32-cam-security-camera
friendly_name: ESP32-CAM Security Camera
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "37ip2TftZD3XJoX8ZpkqPqWKzNuogSXhtkNaANS3eAU="
ota:
password: "1234XYZ"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp32-Cam-Security-Camera"
password: "1234XYZ"
captive_portal:
esp32_camera:
name: ESP32-CAM Security 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
# Image settings
max_framerate: 30fps
idle_framerate: 0.05 fps
resolution: CIF
jpeg_quality: 15
output:
# white LED
- platform: ledc
channel: 2
pin: GPIO4
id: espCamLED
# red status light
- platform: gpio
pin:
number: GPIO33
inverted: True
id: gpio_33
light:
- platform: monochromatic
output: espCamLED
name: esp-cam light
- platform: binary
output: gpio_33
name: esp-cam led
switch:
- platform: restart
name: "esp-cam restart"
sensor:
- platform: wifi_signal
name: "ESP32-CAM Security Camera WiFi Signal"
update_interval: 60s
binary_sensor:
- platform: status
name: esp-cam status
- platform: gpio
pin: GPIO1
name: "PIR Sensor"
device_class: motion
# http server setting
esp32_camera_web_server:
- port: 8080
mode: stream
- port: 8081
mode: snapshot
For the Home Assistant I used a Picture Entity Card, since I have also hooked up a PIR sensor to detect motion:
show_state: true
show_name: true
camera_view: live
type: picture-entity
entity: binary_sensor.esp32_cam_security_camera_pir_sensor
name: ESP32-CAM Security Camera
theme: macOS Theme
camera_image:
camera.esp32_cam_security_camera_esp32_cam_security_camera
Any help is highly appreciated. Thanks a lot!