ESP32 Cam - working!

Just now managed to get this ESP32 cam working in HA with ESPHome.
Pic%20of%20board%20and%20pinout


Running HASS.IO on a Raspberry Pi 3B+

Created a new node in ESPHome (chose esp-wrover-kit as the type of ESP32 board)
Used this yaml code for config of the ESP32 camera in the ESPHome node:

esp32_camera:
  name: My Camera
  external_clock:
    pin: GPIO32
    frequency: 20MHz
  i2c_pins:
    sda: GPIO13
    scl: GPIO12
  data_pins: [GPIO5, GPIO14, GPIO4, GPIO15, GPIO18, GPIO23, GPIO36, GPIO39]
  vsync_pin: GPIO27
  href_pin: GPIO25
  pixel_clock_pin: GPIO19
  resolution: 320x240

To upload firmware, I plugged in a micro-USB cable in the TTGO ESP32 Cam and connected it to a free USB port on the Raspberry PI3B+

Restarted ESPHome

Chose the new option for upload that now appeared in ESPHome in the top right menu for upload (not OTA and not the one called /dev/ttyACM0 [at least on my ESPHome dashboard])

Clicked Upload and after compilation and a report of successful upload and connection from ESPHome, I disconnected the TTGO ESP32 board from the RPi3 USB port, connected it to a separate USB power supply, and restarted Home Assistant.

A new device was now discovered by HA and clicking the link in the frontend to configure the integration of the new ESP32 TTGO Cam node, the new node showed up in a popup window, and “submit” was clicked. After that a picture from the new camera node showed up in the HA states frontend (I don’t use the Lovelace frontend as yet). The picture updates around every 10 seconds. If clicked on, the video stream starts in a small pop-up window:

Perhaps there is a faster way to install the ESP32 cam, without ESPHome and HA restarts, but I found that this procedure worked well in my case.

Have not yet bothered about configuring the OLED or the PIR on the TTGO ESP32 board.

9 Likes

Thanks for sharing.

Could you post the H part of your config?

I struggle to find a reason of having an OLED there, do you have a use case?
It’s more reasonable for PIR (like send a signal so the device starts streaming or HA reacts to it), but as far as I can see, it on has an interface (GPIO?) to support PIR, not an actual sensor…

I’ve tried installing different software on the camera:

-ESPhome: ESP32 Camera Component — ESPHome
-Micro-RTSP: GitHub - geeksville/Micro-RTSP: A RTSP video server intended for very small CPUs (ESP32 etc)
-ESP32-CAM Video Streaming and Face Recognition with Arduino IDE: ESP32-CAM Video Streaming and Face Recognition with Arduino IDE | Random Nerd Tutorials
-ESP32-CAM Video Streaming Web Server (works with Home Assistant): ESP32-CAM Video Streaming Web Server (works with Home Assistant) | Random Nerd Tutorials

All of them are partially integrated in HOMEASSISTANT. They allow to see the image but I have not been able to use the following:

-Stream: Stream - Home Assistant
-Camera.proxy to zoom/crop de stream/image: Camera Proxy - Home Assistant
-Camera.record to save a .mp4 recording
-Camera.play_stream to play a stream to media_player: Stream - Home Assistant

3 Likes

This is the whole part of my camera config, the other part of the yaml code is only standard wifi setup. Or, maybe I did not quite understand which code you meant.

The TTGO board came with pre-installed firmware which had a webserver. In its original configuration the camera stream was accessed by connecting to this webserver with a web browser. With the original firmware the OLED was used to display the SSID of the webserver WiFi, so that you would know what to connect to. Some boards have a multisensor BME280, and then the OLED is used to display temperature, hunidity, etc. My particular board does not have bme280, I think.


But, otherwise I fail to see any clear important use for an OLED on a ESP32 Cam.

I agree with you, the PIR is most likely meant to setup motion detection for the camera stream. Haven’t got to that part yet.

Doorbell cam - give a message to courier driver, or someone expecting you to be home (but yes I do puzzle about it what else it is useful for).

The PIR is pretty obvious in the pics.

the Digoo cameras, and others, are at around 20$, can’t see why would you spend 18$ plus you need a , difficult to get , enclosure

Cloud based I presume?

The ESP32 cams are available at different prices, of course. The link I posted was something I grabbed off the web just now. Mine came at around $11.
The aim, however, was mainly to tinker and see if such a board could be integrated into Home Assistant. Now, I know that it works fine. It may or may not become a part of my home automation system.

Sure, to me the enclosure is important though. And also the infrared LED.

Any ESP32cam with infrared for night vision, available?

I think they work also locally: I need to check if they communicate outside the lan, nevertheless I connect to it with rtsp://192.168.x.x

thanks for the info.

but you replaced it with esphome one, didn’t you?

I would rather have two-way audio communication.
Have no idea if that’s much more demanding/difficult to programm/use though…

they come in different forms and shapes…
anyway, it’s not bad as it’s a) pre-wired and b) keep the device compact so you only need a proper enclosure to start using it.

yeah, completely forgot about that. very useful feature indeed, sometimes I’m tempted to make that IR lights myself, but simply don’t know where to start (and I presume factory-built ones will be better anyway)

Yes, replaced it with ESPHome firmware.

But, there is definitely an issue with the TTGO Cam board and ESPHome in my setting. After reset the board behaves correctly, updating a still image to the HA frontend every 10 seconds. If the video stream is started by clicking in the window this works too, but after the video stream is stopped by closing the pop-up window, the cam does not revert back to updating every 10 seconds. Now, it feeds 10 still images per second according to the logs in ESPHome (the serial log fills up quickly), and after a while the node stops working and no image is available in HA. Only a reset of the cam board will get the image back in HA. Also, a restart of ESPHome is necessary for the cam board to start correct updating every 10 seconds. So, not a very stable setup at the moment. Maybe, the videostream is not shut down properly, I am not sure.

I don’t know if this is an issue with this particular TTGO ESP32 cam board, or if similar unstability is seen with other ESP32 cam boards?

well, it can be everything, considering how new the stream feature, esphome and that ESP32 Cam thingies are…
let’s hope someone spot the reason of that/file a new issue and it will improve eventually as it doesn’t sound right as it is.

I suggest you post an issue on the esphome issues tracker.

thanks, your config sorted out the video.

below is what I have for the display and pir.
I plan to use these in the basement using pir to turn lights on.
Camera is not low light, bonus for security just in case.

font:
  - file: "Ubuntu-Regular.ttf"
    id: ubuntu
    size: 20

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    rotation: 180
    lambda: |-
      it.print(0, 0, id(ubuntu), "S Kitchen");

binary_sensor:
  - platform: gpio
    pin: GPIO33
    name: "PIR Sensor"
    device_class: motion
1 Like

perhaps can be used instead of the missing infrared LED?

really?! how? :slight_smile:

Turning it on at night?

nah… a proper one should illuminate objects in at least a meter radius.
this one won’t get anything further than 5 cm I think :wink: