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.