ESP32-Cam Arduino Flash through to HA guide

Hi All,

I had a lot of trouble getting mine to work and thought I’d share with everyone how I got mine to work.

The board I am using is the AI-Thinker model, I used and Arduino Uno to flash it but you can use your FTDI or TTL adaptor.
To use and Arduino Uno you need to join the reset pin to ground (both on uno), 5v (uno) to 5v (ESP32), Ground (uno) to Ground (ESP32), RX (uno) to RX (or U0R on ESP32), TX (uno) to TX (or U0T on ESP32), GPIO0 (ESP32) to Ground (ESP32).

In Arduino IDE go to File>Prefrences and int the addition boards manager enter the following: https://dl.espressif.com/dl/package_esp32_index.json
Now go to Tools>Board>Boards Manager and search for ESP32 and install the lastest version.

Now go to File>Examples>ESP32>Camera>CameraWebServer
Select the model you have by commenting out the other models, if you have the AI_Thinker it will look like this:

// Select camera model
//#define CAMERA_MODEL_WROVER_KIT
//#define CAMERA_MODEL_ESP_EYE
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE
#define CAMERA_MODEL_AI_THINKER

Now enter your wifi ssid and password details.

Now select your board by going to Tools>Board>ESP32 Wrover Module
Set Flash Mode to ‘DIO’
Set Flash Frequency to ‘80MHz’
Set Partition Scheme to ‘HUGE APP (3MB no OTA)’
Set Upload Speed to ‘115200’
Set Core Debug Level to ‘None’
Select your COM port.

Now I unplugged the uno from the PC and reconnected it then pressed the reset button (only once about a second or two after reconnecting) on the ESP32 and hit upload. It takes a while and when it successfully completes there is a message:

Leaving…
Hard resetting via RTS pin…

At this stage you remove the GPIO0 (ESP32) and Ground (ESP32) connection.
Start the Serial Monitor and press the reset button on the ESP32.
If it worked correctly it should connect to your wifi and show the IP address and tell you about port 80 and port 81.

The first time I loaded the IP address I got a list of options, hit Start Streaming and got no picture, what worked for me was disconnect the 5v from the ESP32 and connected it to the VCC and pressed reset, then disconnected the VCC and put it back on the 5v.
Now when I hit Start Streaming I now had a picture!!

Now in the HA configuration yaml I added the following:

camera:
  - platform: generic
    name: ESP32Cam_1
    still_image_url: http://192.168.xxx.xxx:80/capture
    stream_source: http://192.168.xxx.xxx:81/stream

Naturally you put your IP address in there and you should be good to go.

For the picture to display in HA you can’t have the the GUI open in a browser window as there is only a single connection allowed but once displaying in HA you can have multiple devices viewing through HA.

I could not find a well explained guide on how to do this so I thought I’d share this for everyone else who has faced the same problem.

2 Likes

Hi wayne,
I’m spending a lot of time trying streaming esp32_cam on HA.
I have 2 esp32-cam with CameraWebServer on board the cams work great using browser and I only get video stream on broeser when I push “Start stream” .
I tried any possible solution on HA, like you did and another alternative:

but I see nothing. Just on browser… and I repet, I see video only if I hit “start stream”.
I tried too hit “start stream” and close browser but I had no fortune.
You cams still work?
Wait for reply and a little help i you can.
Thanks

Hi Jordan,

I had the same issue, if you press start stream in the browser that will be the only source that can view it so don’t press start stream, hit stop stream if you have. HA should be able to stream it after that, perhaps restart HA without starting the stream and see how you go.