Waveshare ESP32-S3-ETH PoE OV2640 CAM

Hello,

is somebody else using the Waveshare ESP32-S3-ETH Board?
I configure it under ESPHome, but the Camera will not work.
LAN PoE is working well, but the Camera show all time:

[esp32_camera:123]:   Setup Failed: ESP_ERR_NOT_FOUND
[component:082]:   Component esp32_camera is marked FAILED

i have two Boards, both the same issue.

Here my Code (without LAN):

esphome:
  name: doorbell1
  friendly_name: doorbell1
  platformio_options:
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    upload_speed: 921600
    monitor_speed: 115200

esp32:
  board: esp32-s3-devkitc-1
  flash_size: 16MB
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32_S3_BOX_BOARD: "y"
  
psram:
  mode: octal
  speed: 80MHz

logger:
api:
  encryption:
    key: "xxx"
ota:
  - platform: esphome
    password: "xxx"
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "Doorbell1 Fallback Hotspot"
    password: "y4CktG4W8gG6"
captive_portal:

web_server:
  version: 2
  port: 80
  auth:
    username: !secret web_user
    password: !secret web_password

i2c:
  sda: GPIO19
  scl: GPIO20

esp32_camera:
  name: camera-2
  external_clock:
    pin: GPIO3
    frequency: 20MHz
  i2c_pins:
    sda: GPIO48
    scl: GPIO47
  data_pins: [GPIO41, GPIO45, GPIO46, GPIO42, GPIO40, GPIO38, GPIO15, GPIO18]
  vsync_pin: GPIO1
  href_pin: GPIO2
  pixel_clock_pin: GPIO39
  vertical_flip: false
  horizontal_mirror: false
  resolution: 640X480

esp32_camera_web_server:
  - port: 8080
    mode: stream
  - port: 8081
    mode: snapshot

Hello, I am also trying to make the same board work with this camera. Been trying some permutations without any luck. My ethernet is quite unstable, are you able to share your ethernet config?

Here is the config that is working so far for me, I am not sure how much of the esp32: section is necessary, but the ethernet: GPIO pin settings were different than other posts I found, but correspond to the docs here: https://www.waveshare.com/wiki/ESP32-S3-ETH#ETH_Web_CAM

esphome:
  name: esp32-s3-poe-01
  friendly_name: esp32-s3-poe-01
  platformio_options:
    board_build.arduino.memory_type: qio_opi
    board_build.flash_mode: dio
    upload_speed: 921600
    monitor_speed: 115200  

esp32:
  board: esp32-s3-devkitc-1
  variant: esp32s3
  flash_size: 16MB
  framework:
    type: esp-idf
    sdkconfig_options:
      CONFIG_ESP32_S3_BOX_BOARD: "y"

psram:
  mode: octal
  speed: 80MHz

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "[key]"

ota:
  - platform: esphome
    password: "[pass]"

ethernet:
  type: W5500
  clk_pin: GPIO13
  mosi_pin: GPIO11
  miso_pin: GPIO12
  cs_pin: GPIO14
  interrupt_pin: GPIO10
  reset_pin: GPIO9

Here my config, ethernet works fine.
Only the CAM i can´t get running. I ask Waveshare, they don’t support ESPHome :frowning:

esphome:
  name: doorbell
  friendly_name: doorbell
esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf
  flash_size: 16MB
logger:
api:
  encryption:
    key: "x"
ota:
  - platform: esphome
    password: "x"
ethernet:
  type: W5500
  mosi_pin: GPIO11
  miso_pin: GPIO12
  clk_pin: GPIO13
  cs_pin: GPIO14
  reset_pin: GPIO9
  interrupt_pin: GPIO10
  clock_speed: 25MHz

esp32_camera:
  name: camera
  external_clock:
    pin: GPIO3
    frequency: 20MHz
  i2c_pins:
    sda: GPIO48
    scl: GPIO47
  data_pins: [GPIO41, GPIO45, GPIO46, GPIO42, GPIO40, GPIO38, GPIO15 , GPIO18]
  vsync_pin: GPIO1
  href_pin: GPIO2
  pixel_clock_pin: GPIO39
  resolution: 800x600

Did you ever get the camera to work?
Have a few of these boards as well, and cant get the camera to work.

No still no working camera.

I hope they will support. Why not? I feel cheated… =(

Did someone already had some luck getting it to work?

you should try with arduino ide

I try the sample code for arduino, but during compile i got many errors.
I also tried to flash the .bin file without success.
Currently i don’t have time to play with.
The Board itself would fit perfect to my projects, because i use everywhere PoE Modules. The Camera is only for a single Modul needed, my Doorbell.

I have got the webcam stream working via the Arduino IDE. I tried serval things to intergrate it with ESPHOME but so far did not get it working.

The thing is that you need to put pin 8 Low before starting the camera, Pin 8 is used to deactivate the power supply to the camera. Maybe someone can get more progress with the arduino code down below:

The arduino Code:

#include "esp_camera.h"
#include "WiFi.h"
#include "WebServer.h"

// Define GPIO pins for the camera module
#define PWDN_GPIO   -1 // Power-down pin (not used)
#define RESET_GPIO  -1 // Reset pin (not used)
#define XCLK_GPIO   3  // XCLK pin
#define SIOD_GPIO  48 // SCCB SDA pin
#define SIOC_GPIO   47 // SCCB SCL pin
#define Y9_GPIO     18 // Y9 pin
#define Y8_GPIO     15 // Y8 pin
#define Y7_GPIO    38 // Y7 pin
#define Y6_GPIO     40 // Y6 pin
#define Y5_GPIO     42 // Y5 pin
#define Y4_GPIO     46 // Y4 pin
#define Y3_GPIO    45 // Y3 pin
#define Y2_GPIO     41 // Y2 pin
#define VSYNC_GPIO  1  // VSYNC pin
#define HREF_GPIO  2  // HREF pin
#define PCLK_GPIO  39 // PCLK pin

const char* ssid = "SSID";
const char* password = "PW";

WebServer server(80);

void startCameraServer();

void setup() {
    Serial.begin(115200);
    
    // Connect to WiFi
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) {
        Serial.println("Connecting to WiFi...");
        delay(1000);
    }

    pinMode(8, OUTPUT);
    digitalWrite(8, LOW);


    Serial.println("WiFi Connected");
    Serial.print("IP Address: ");
    Serial.println(WiFi.localIP());

    // Configure camera settings
    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer = LEDC_TIMER_0;
    config.pin_d0 = Y2_GPIO;
    config.pin_d1 = Y3_GPIO;
    config.pin_d2 = Y4_GPIO;
    config.pin_d3 = Y5_GPIO;
    config.pin_d4 = Y6_GPIO;
    config.pin_d5 = Y7_GPIO;
    config.pin_d6 = Y8_GPIO;
    config.pin_d7 = Y9_GPIO;
    config.pin_xclk = XCLK_GPIO;
    config.pin_pclk = PCLK_GPIO;
    config.pin_vsync = VSYNC_GPIO;
    config.pin_href = HREF_GPIO;
    config.pin_sscb_sda = SIOD_GPIO;
    config.pin_sscb_scl = SIOC_GPIO;
    config.pin_pwdn = PWDN_GPIO;
    config.pin_reset = RESET_GPIO;
    config.xclk_freq_hz = 10000000;
    config.pixel_format = PIXFORMAT_JPEG;
    config.frame_size = FRAMESIZE_QHD;
    config.jpeg_quality = 10;
    config.fb_count = 3;
    
    // Initialize the camera
    if (esp_camera_init(&config) != ESP_OK) {
        Serial.println("Camera initialization failed");
        return;
    }
    startCameraServer();
    
}

void loop() {
    server.handleClient();
}

void handleStream() {
    WiFiClient client = server.client();
    String response = "HTTP/1.1 200 OK\r\n";
    response += "Content-Type: multipart/x-mixed-replace; boundary=frame\r\n\r\n";
    client.print(response);
    
    while (client.connected()) {
        camera_fb_t *fb = esp_camera_fb_get();
        if (!fb) {
            Serial.println("Camera capture failed");
            continue;
        }
        
        client.print("--frame\r\n");
        client.print("Content-Type: image/jpeg\r\n\r\n");
        client.write(fb->buf, fb->len);
        client.print("\r\n");
        
        esp_camera_fb_return(fb);
        delay(100);
    }
}

void startCameraServer() {
    server.on("/stream", HTTP_GET, handleStream);
    server.begin();
    Serial.println("Camera Stream Ready: Access http://" + WiFi.localIP().toString() + "/stream");
}

Got the stream working in ESPHome. The only problem left is that the camera is pretty dark, have not found a solution yet.

I hope it helps you

esphome:
  name: poe-esp32
  friendly_name: ESP CAM
  on_boot:
    priority: 700
    then:
      - switch.turn_off: relay1
      - lambda: |-        
          delay(1200);

psram:
  mode: octal
  speed: 80MHz


esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

  flash_size: 16MB

switch:
  - platform: gpio
    name: ${display_name} Relay1
    id: relay1
    pin: GPIO8
    restore_mode: ALWAYS_OFF
    setup_priority: 800

esp32_camera:
  setup_priority: 200
  name: "My Cam"
  external_clock:
    pin: GPIO3
    frequency: 20MHz
  i2c_pins:
    sda: GPIO48
    scl: GPIO47
  data_pins: [GPIO41, GPIO45, GPIO46, GPIO42, GPIO40, GPIO38, GPIO15, GPIO18]
  vsync_pin: GPIO1
  href_pin: GPIO2
  pixel_clock_pin: GPIO39
  max_framerate: 10 fps   
  idle_framerate: 0.01 fps 
  resolution: QHD
  jpeg_quality: 10
  frame_buffer_count: 2
  aec_mode: MANUAL
  aec_value: 1000

# Enable logging
logger:
  level: VERBOSE
  
api:
  encryption:
    key: "esy2KJzewoqObUbB3UqiekE92/rl4Kq5iG0UkwTaBK8="

ota:
  - platform: esphome
    password: "72ae6a612470a55b7efb13f04782cae0"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Poe-Esp32 Fallback Hotspot"
    password: "gj5cdVhFOmQX"

captive_portal:
    
1 Like

The Code is working for me too. I also the very dark pictures. I have used a OV2640 and also a DC5640 Camera.
Is it also so dark when you use the Arduino code?
I tried it with the Ethernet Connection, but the refresh time is very slow.

No, the camera works like normal with the arduino code, I thinks the auto exposure or auto white balance is not working as intended, and yes the refresh rate is pretty low, it improves if you lower the resolution or quality

with this settings it’s no so dark any more:

  aec_mode: MANUAL
  aec_value: 1200
  brightness: 2
  wb_mode: HOME
  agc_mode: AUTO
1 Like

Many thanks to all - I got it to work with these settings as well.

That was quite a journey!

Do you also have the issue the the cmaera is dark?

I did follow your idea with the brightness setting - last night, in the dark, that helped.
Today, in daylight, it seems too bright now. Perhaps back to auto setting. aec_mode auto or aec2. tried this:


picture black…

back with original setting and brightness1: pretty good.

The camera is getting pretty hot. Glued on a cooling.

Next: how to get the sd card to work… I wonder whether there are any pins left…

Have you tried that yet?

Tried Your way with switch - it working.

Then added following as described in docs - camera initialized with no issues.

  power_down_pin: GPIO08
  • power_down_pin (Optional, pin): The ESP pin to power down the camera. If set, this will power down the camera while it is inactive.

I have setup the camera and could successfully download a screenshot, but the camera is always in idle mode. So no picture in live streaming. Am I missing something?