ESP32 Cam - working!

yes, no problem.

Does it need an sd card to work properly?

No. It does not require an sd card. I would have just answered no, but I have to write 10 characters, which is a PITA at times.

Is there a possibility to store image on motion detection or send it via telegram bot?
So if something appears in the camera sight I get a notification.

If i insert an SD card to esp32cam, will it store captured data on this SD automatically?

Not in esphome.

Nice project! Is there any chance to fix a broken clip like on the photo below?

image

It should be possible to insert the camera, jam the clip in place and fix it with a drop of superglue. However,removing it subsequent to that would of course be nigh-on impossible without destroying the connector further.

Hi there - Has anyone been able to get this working with the stream component for google assistant? I’ve tried casting it to a chromecast (using the services dev tool) and it fails with an error:

Failed to call service camera/play_stream. camera.front_door_camera does not support play stream service

Any ideas how to get this working? It’s the Ai-thinker module set up normally in ESPHome and in Homeassistant. I have no other problems with Google Assistant integration. Actually, the camera also doesn’t show in the Google Home app either despite being correctly exposed in my config.yaml. So I must be doing something wrong…

I’m in the middle of trying to use the Ai-thinker esp32-cam in a dummy camera linked to a 433mhz button as the doorbell, which then would play a sound on my google homes, and display the camera feed on my TVs, but this is a key bit of functionality which seems to not be available. Help! :slight_smile:

I tried to make a doorbell camera with esp32cam.
The idea was:

  • When someone presses the doorbell button – it takes a picture and sends it to me via Telegram.
  • If it detects motion – it takes a picture and saves it.

I fitted all to the old doorbell


But it is very unstable and I don’t know why.
When I try to view logs I often get this warning and no connection:

WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect
WARNING Disconnected from API: Timeout while waiting for message response!

And I don’t see the image from the camera in HA.
Any ideas what can be wrong?
Are TTGO cameras more stable, maybe I should get TTGO?

The config:

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

  # Image settings
  name: ESP32CAM1
  # ...
  
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: True
    name: "Doorbell"
    filters:
      - delayed_off: 100ms
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT
    name: "Motion"
2 Likes

Is the lovelace config still working? I’m trying to set up my cam with similar settings, but picture-glance return a blank tab.

I’m using a ttgo t-camera plus and it is barely working. But I’ve seen people using the regular ttgo t-camera without issues.

Haven’t checked in a long time, (I don’t use the cam) but should still work

Sorted, now I’m having issues with my cam.

Nice project! I didn’t think to try to fit within the actual doorbell. Always assumed it would be too big. May have to refactor my project!

Try an external pigtail IPX wifi antenna. I was having all sorts of problems with my Ai-thinker till I realised the factory resistor was soldered to use the external pigtail wifi antenna on the IPX plug (which I didn’t have till I bought it). Bought one, added it on and rock solid performance since.

It’s tip number 7 from here: https://randomnerdtutorials.com/esp32-cam-troubleshooting-guide/

1 Like

Very interresting!
How do you make the motion detection? Is there a built-in mechanism for that in esphome?

For motion detection I used HC-SR505 sensor like this:


It uses 5V power and if motion is detected it creates 3v power on the output pin. The output pin of sensor is connected to GPIO pin on ESP32CAM and GPIO Binary sensor ESPhome mechanism is used https://esphome.io/components/binary_sensor/gpio.html

But it is a cheap sensor with no sensetivity and timing configuration so it fires to often.

I see. I thought maybe you’d found some magic trick for using the esp32 cam to detect motion. Would be nice if that was possible.

Do you use ESPHOME? How do you take a picture and send it to you on Telegram? Could you show me the code you use?

Yes, I use ESPhome for the camera. My ESP32-CAM is little unstable yed, sometimes it disconnects and not available in HA, I think this is a power issue. I am planning to try a new power supply.
I also didn’t managed to get PIR to work properly, it is either always shows “on” state or constantly changes from “off” to “on” and back. I tried to use GIPO12 for PIR.
This is ESP32-CAM config:

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
  idle_framerate: 0.05 fps
  max_framerate: 5 fps

  # Image settings
  name: "Door camera"
  
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
      mode: INPUT_PULLUP
      inverted: True
    name: "Door ring button"
    filters:
      - delayed_on: 10ms
      - delayed_off: 10ms

And this is picture sending automation, it is overwriting the picture every time.

    - alias: "Уведомление в Телеграм когда звонят в дверь"
      trigger:
      - platform: state
        entity_id:  binary_sensor.door_ring_button
        from: 'off'
        to: 'on'
      action:
      - service: camera.snapshot
        data:
          entity_id: camera.door_camera
          filename: '/config/www/snapshots/doorbell.jpg'
      - delay: '00:00:02'
      - service: notify.leha
        data:
          title: TEST
          message: "Звонок в дверь!"
          data:
            photo:
              - file: /config/www/snapshots/doorbell.jpg
                caption: "Кто-то приперся и звонит в дверь"

And this is Telegram configuration in configuration.yaml:

telegram_bot:
  - platform: broadcast
    api_key: <MY API KEY>
    allowed_chat_ids:
      - <MY CHAT ID>
notify:
  - name: leha
    platform: telegram
    chat_id: <MY CHAT ID>
5 Likes

Anyone got it working properly?
I’ve got constant API disconnections. It is very unstalbe. I am not getting snapshots each time I push doorbell button. Is it useless?
Log loooks like this:

[00:28:37][D][esp32_camera:157]: Got Image: len=4890
[00:28:37][D][esp32_camera:157]: Got Image: len=4913
[00:28:37][D][esp32_camera:157]: Got Image: len=5005
[00:28:38][D][esp32_camera:157]: Got Image: len=5208
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.152:6053 (192.168.1.152)
INFO Successfully connected to 192.168.1.152
[00:28:40][D][esp32_camera:157]: Got Image: len=4935
[00:28:40][D][esp32_camera:157]: Got Image: len=5286
[00:28:41][D][esp32_camera:157]: Got Image: len=5076
[00:28:41][D][esp32_camera:157]: Got Image: len=5041
[00:28:42][D][esp32_camera:157]: Got Image: len=5107
[00:28:43][D][esp32_camera:157]: Got Image: len=4924
[00:28:43][D][esp32_camera:157]: Got Image: len=5371
[00:28:45][D][esp32_camera:157]: Got Image: len=5022
WARNING Disconnected from API: Timeout while waiting for message response!
INFO Connecting to 192.168.1.152:6053 (192.168.1.152)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 1 seconds
INFO Connecting to 192.168.1.152:6053 (192.168.1.152)
WARNING Couldn't connect to API (Timeout while waiting for message response!). Trying to reconnect in 2 seconds
INFO Connecting to 192.168.1.152:6053 (192.168.1.152)
INFO Successfully connected to 192.168.1.152
[00:28:56][D][esp32_camera:157]: Got Image: len=5169
[00:28:56][D][esp32_camera:157]: Got Image: len=4834
[00:28:56][D][esp32_camera:157]: Got Image: len=4996