ESP32 Cam - working!

I have a M5stack ESP32cam (which I shall have in a totally dark rom snapshotting a meter periodically. This part of my set up work fine without Led on from Node Red).

The status Led on this board is probably enough for the dark room for getting a very close-up image - but I can not seem to get it configured or activated in ESPHome. I have managed to address the Pin (16) in Micropython - but since this perticular board is in a conflict in ESPHome the HA setup of the Led is not done yet.

  1. board listed in - ESP32 Camera Component — ESPHome - as compatible and

  2. is not accepted as board type, generic board type selected!!!

  3. and Pin addressing is not allowed for the M5 ESPCam boards led pin

I have been forced to use the generic board esp-wrover-kit as board reference and tailor the pins according to bullet 1 above. When following the guide under -GPIO Output — ESPHome -with my boards Led pin ESPHome report not able to do so for the generic board.

Puh. If anyone have been able to turn on the staus led for this M5stack ESP32cam in ESPHome could you please guide me - I feel lost…

I have no idea what this means, please provide your code and exactly what is not working.

Will do tomorrow morning :sleeping:

This code adapted from ESPHome ESP32 guide generic board type works. as is

esphome:
name: .,.,.,.,.,
platform: ESP32
board: esp-wrover-kit

wifi:
ssid: «.,.,…,.,»
password: «.,.,.,…,…,»

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: «,.,…,.,.,…,
password: «,…,.,.,.,…,.,.,»

captive_portal:

Enable logging

logger:

Enable Home Assistant API

api:
password: «.-.-.-«
ota:
password: «.-.-.-«

standard fra ESPHome.io

esp32_camera:
external_clock:
pin: GPIO27
frequency: 20MHz
i2c_pins:
sda: GPIO25
scl: GPIO23
data_pins: [GPIO17, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
vsync_pin: GPIO22
href_pin: GPIO26
pixel_clock_pin: GPIO21
reset_pin: GPIO15
resolution: 800x600
jpeg_quality: 10

Image settings

name: My Camera

When adding code as described in GPIO Output — ESPHome

Example configuration entry

output:

  • platform: gpio
    pin: D1
    id: gpio_d1

and tailor to this board:

Example configuration entry

output:
platform: gpio
pin: 16
id: gpio_16

I get this when saving the yaml I get this message.

The code looks like this:

It was in an earlier attempt a red x on the lines telling the pin 16 could not be addressed. Can not reproduce that.

this is the board by the way.

Please learn to post your code properly. See How to help us help you - or How to ask a good question

I have tested to setup esp32-cam Ai thinker variant using esphome and it was very slow. Then flashed it with Arduinoes example esp32 camera web server and streaming and that was very fast up to 0.8 sec delay at 1024 resolution.

I wonde why and if it is possible to tune esp32 components settings in esphome to get it faster?

When I was researching ESP32-Cam boards two years ago, I found the code from randomnerdtutorials.com was using only 64-byte bufffers to transfer the JPEG images. I increased their code from 64-byte buffers to 256-byte buffers and observed much better image throughput. It’s possible ESPHome may be using smaller buffers and working harder to move so many of them.

char * part_buf[256]

if(res == ESP_OK){
size_t hlen = snprintf((char *)part_buf, 256, _STREAM_PART, _jpg_buf_len);
res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);

Nope, reviewing the ESPHome code at Github shows that is not a problem with the ESPHome code.

I get m5stack v2 psram working with such config

esp32_camera:
  external_clock:
    pin: GPIO27
    frequency: 20MHz
  i2c_pins:
    sda: GPIO22
    scl: GPIO23
  data_pins: [GPIO32, GPIO35, GPIO34, GPIO5, GPIO39, GPIO18, GPIO36, GPIO19]
  vsync_pin: GPIO25
  href_pin: GPIO26
  pixel_clock_pin: GPIO21
  reset_pin: GPIO15

  # Image settings
  name: m5stack-cam-1
1 Like

I was updating the ESP32 Cam board (to ESPHOME v1.19.1) via HA and noticed these warnings. The update seems went ok. Nothing to worry about?

Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/esp32-hal-spi.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/esp32-hal-time.c.o
/root/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':

/root/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/root/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
uint8_t * last_data8 = &last_data;
                                        ^
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/esp32-hal-timer.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/esp32-hal-touch.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/esp32-hal-uart.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/libb64/cdecode.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/libb64/cencode.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/main.cpp.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/stdlib_noniso.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/wiring_pulse.c.o
Compiling /data/security_cam/.pioenvs/security_cam/FrameworkArduino/wiring_shift.c.o
Archiving /data/security_cam/.pioenvs/security_cam/libFrameworkArduino.a
Linking /data/security_cam/.pioenvs/security_cam/firmware.elf

Got myself a couple of ESP32-cams from Aliexpress to place in some birdhouses. At the pictures they did show as ESP32-S AI-thinker.

But I got ESP-32S Espressif. Must say they look very similar… But I can’t flash them in any way :frowning: They just won’t connect over my com-port at all.

Did try both 3.3 as 5V, also I’m sure my ftd does give 5V (cause that could also be a problem). Anyone has these Espressif ones and can help me out? Thank you in advance

All esp chips are made by espressif.

So you got a link?

The ftd most likely can’t supply enough current. Get 5V from a reasonably good USB charger and deliver it as directly as you can to the 5V and GND pins. It will be even better if you can place a 10uF electrolytic capacitor and a 100nF ceramic capacitor across those 2 pins (the closer to the pins the better).

Thank you both.

I did read about a couple of persons who also couln’t get it to work wit the ft232rl . It gives a steady 5.03V, but still no luck.

Seems I might have better luck with a CP2102 or even an arduino uno. Both devices I don’t have, so gonna order soon and hope this will do the trick indeed. In the meanwhile I’ll look around if I have some spare 5v adapter around somewhere (pretty sure I have one, but didn’t find it yet.)

Edit: did use an external adapter to power it up, still nothing. Will wait on CP2101/arduino uno to test some more…

My camera stopped connecting today. I have rebooted the host, restarted HA twice. Same error.
Where should I be looking next?

ESPHome Ver.

ESPHome
Current version: 1.19.4

Ha log:

Can't connect to ESPHome API for security_cam (192.168.1.94): Disconnected while waiting for API response!

esphome log:

[16:04:40][C][api:096]: Address: 192.168.1.94:6053
[16:04:40][C][wifi_signal.sensor:009]: WiFi Signal 'Security Cam WiFi Signal'
[16:04:40][C][wifi_signal.sensor:009]: Device Class: 'signal_strength'
[16:04:40][C][wifi_signal.sensor:009]: State Class: 'measurement'
[16:04:40][C][wifi_signal.sensor:009]: Unit of Measurement: 'dBm'
[16:04:40][C][wifi_signal.sensor:009]: Accuracy Decimals: 0
[16:04:48][D][esp32_camera:156]: Got Image: len=14777
[16:04:48][D][api:067]: Disconnecting Home Assistant 2021.7.0 (192.168.1.20)
[16:04:49][D][api.connection:630]: Client 'Home Assistant 2021.7.0 (192.168.1.20)' connected successfully!
[16:04:58][D][esp32_camera:156]: Got Image: len=14769
[16:04:59][D][api:067]: Disconnecting Home Assistant 2021.7.0 (192.168.1.20)
[16:04:59][D][api.connection:630]: Client 'Home Assistant 2021.7.0 (192.168.1.20)' connected successfully!
[16:05:02][D][sensor:117]: 'Security Cam WiFi Signal': Sending state -69.00000 dBm with 0 decimals of accuracy
[16:05:08][D][esp32_camera:156]: Got Image: len=14557
[16:05:08][D][api:067]: Disconnecting Home Assistant 2021.7.0 (192.168.1.20)
[16:05:09][D][api.connection:630]: Client 'Home Assistant 2021.7.0 (192.168.1.20)' connected successfully!
1 Like

Seems to be 2021.7. problem.

1 Like

Do you also get a “login attempt failed” notification every time you open the camera preview?

These are the ESPHome cameras after the HASS update:

Also, anybody getting a weird green tint/saturation from a month ago or so?

Do you also get a “login attempt failed” notification every time you open the camera preview?

yes, i do.

1 Like

If you are still trying, it took me 2 days to find out that pin 1 is not actually tied to GND on my 3 boars, it worked after using pin 7 or any other reliable GND connection.

1 Like

@PeatyPete has posted an issue on github

1 Like