ESP32-CAM as doorbell with camera Topic is solved

Moderator: leecollings

stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: ESP32-CAM as doorbell with camera

Post by stack »

Nice project I have converted a old Chinese doorbell with this, but I cannot figure out how to connect the push button to the 32 cam. Can someone take a photo of this?
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

Try to connect you push button between the gnd and io12 on the esp32cam
This should be the input, of you didn't modified the input number in the code

Sorry, don't have a picture at the moment.
Try it and please post back what the result is.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

My friend finished the proto housing.
The product is not that great in finish, how it looks, but useable.
But better to know, the drawing is correct.

Some pictures from the housing:
Front:
Image
Back:
Image

Started to build it.
Have taken the ESP32-cam and removed the header pins.
Next soldered a few wires to it. I am going to use the RGB led in the button.
Image

I need to keep my wife happy, she wants to original chime to be played when doorbell is pushed.
She wants this without control from domoticz, just a button, wires and go.
Therefor mine will have a custom PCB inside. Where i will solder 2 optocouplers. 1 for triggering the ESP, the other one for the original chime.
Image

Not finished, but to get an idea how the ESP fits inside.
This is the last picture for now. On a other day i will go futher on building the doorbell
Image
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: ESP32-CAM as doorbell with camera

Post by stack »

what a great project I look forward to the end result
karlzre
Posts: 26
Joined: Sunday 06 August 2017 18:48
Target OS: -
Domoticz version:
Contact:

Re: ESP32-CAM as doorbell with camera

Post by karlzre »

Hi Hoeby,

I just uploaded the code to my espcam.

I changed the ip and idx for domoticz, but when i press the button nothing append in domoticz.

I tested the url from a pc, i can switch on/off.

M i missing a library or something ?

Thx
karlzre
Posts: 26
Joined: Sunday 06 August 2017 18:48
Target OS: -
Domoticz version:
Contact:

Re: ESP32-CAM as doorbell with camera

Post by karlzre »

ok found.

I need a auth to toggle switch.
i added 2 variables for user/password:

Code: Select all

String DomoticzUser = "User";
String DomoticzPSWD = "password";
and changed the 3 url string:

Code: Select all

String url="http://" + DomoticzUser + ":" + DomoticzPSWD + "@" + DomoticzIP + ":" + DomoticzPort + "/json.htm?type=command&param=switchlight&idx=" + DomoticzIDX + "&switchcmd=" + DomoticzSwitch + "";
here is the code with auth

Code: Select all

#include "esp_camera.h"
#include <WiFi.h>
#include "esp_timer.h"
#include "img_converters.h"
#include "Arduino.h"
#include "fb_gfx.h"
#include "soc/soc.h" //disable brownout problems
#include "soc/rtc_cntl_reg.h"  //disable brownout problems
#include "esp_http_server.h"
#include <HTTPClient.h>

//Invoeren van je network credentials
const char* ssid       = "wifi";             //Wifi SSID waarop ESP32-cam zich moet aanmelden.
const char* password   = "wpakey";      //Bijbehorend wachtwoord welke bij het gekozen SSID behoort.
//#define FixedIP                                   //Haal de // weg om fixed IP te gebruiken, anders staat deze op DHCP.
#define IPaddr            192,168,178,111        //Voer IP adres is, digits tussen komma's invoeren.
#define SubnetAddr        255,255,255,0           //Voer subnet mask in, digits tussen de komma's invoeren.
#define GatewayAddr       192,168,178,254         //Voer Gateway adres in, digits tussen de komma's invoeren. Er moet een gateway ingevoerd worden, of deze ook correct is, wordt niet gecontroleerd.    

//Invoeren van je domoticz credentials
String DomoticzIP      = "Domoticzip";        //Domoticz Server IP adres.
String DomoticzPort    = "8080";                  //Domoticz Server poort adres.
String DomoticzIDX     = "1";                   //Domoticz IDX nummer welke geschakeld moet worden.
String DomoticzSwitch  = "On";                    //Domoticz IDX state. Bij activeren ingang, moet IDX dan On of Off gestuurd worden?.  
String DomoticzUser = "User";
String DomoticzPSWD = "password";
#define DomoticzResetSwitch                       //Domoticz, haal de // weg, dan wordt er een tegengesteld commando van DomoticzSwitch gestuurd nadat de ButtonTimer is verstreken.
                                                  //Voorbeeld als DomoticzResetSwitch defined is; Bij drukken gaat domoticz device op ON, na verstrijken ButtonTimer weer op OFF

//Invoeren van je push-button + LED credentials
const int buttonPin1 = 12;                        //GPIO nummer voor de ingang van drukknop.
const int ledPin1 =  13;                          //De tijd dat LED aangestuurd is. In deze tijd kan de ingang nog wel geactiveerd worden, maar programma doet er niets mee, totdat tijd verstreken is.
const int ledPin2 =  14;                          //De tijd dat LED aangestuurd is. In deze tijd kan de ingang nog wel geactiveerd worden, maar programma doet er niets mee, totdat tijd verstreken is.
const int ledPin3 =  15;                          //De tijd dat LED aangestuurd is. In deze tijd kan de ingang nog wel geactiveerd worden, maar programma doet er niets mee, totdat tijd verstreken is.
#define ButtonTimer      10000                    //De tijd dat LED aangestuurd is. In deze tijd kan de ingang nog wel geactiveerd worden, maar programma doet er niets mee, totdat tijd verstreken is.

int buttonState1 = 0;                              //Zet de ingang op 0, zodat deze niet direct actief is bij opstarten.

#define PART_BOUNDARY "123456789000000000000987654321"

// This project was tested with the AI Thinker Model, M5STACK PSRAM Model and M5STACK WITHOUT PSRAM
#define CAMERA_MODEL_AI_THINKER
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WITHOUT_PSRAM

// Not tested with this model
//#define CAMERA_MODEL_WROVER_KIT

typedef struct {
        httpd_req_t *req;
        size_t len;
} jpg_chunking_t;

static size_t jpg_encode_stream(void * arg, size_t index, const void* data, size_t len){
    jpg_chunking_t *j = (jpg_chunking_t *)arg;
    if(!index){
        j->len = 0;
    }
    if(httpd_resp_send_chunk(j->req, (const char *)data, len) != ESP_OK){
        return 0;
    }
    j->len += len;
    return len;
}

#if defined(CAMERA_MODEL_WROVER_KIT)
  #define PWDN_GPIO_NUM    -1
  #define RESET_GPIO_NUM   -1
  #define XCLK_GPIO_NUM    21
  #define SIOD_GPIO_NUM    26
  #define SIOC_GPIO_NUM    27
  
  #define Y9_GPIO_NUM      35
  #define Y8_GPIO_NUM      34
  #define Y7_GPIO_NUM      39
  #define Y6_GPIO_NUM      36
  #define Y5_GPIO_NUM      19
  #define Y4_GPIO_NUM      18
  #define Y3_GPIO_NUM       5
  #define Y2_GPIO_NUM       4
  #define VSYNC_GPIO_NUM   25
  #define HREF_GPIO_NUM    23
  #define PCLK_GPIO_NUM    22

#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       32
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_M5STACK_WITHOUT_PSRAM)
  #define PWDN_GPIO_NUM     -1
  #define RESET_GPIO_NUM    15
  #define XCLK_GPIO_NUM     27
  #define SIOD_GPIO_NUM     25
  #define SIOC_GPIO_NUM     23
  
  #define Y9_GPIO_NUM       19
  #define Y8_GPIO_NUM       36
  #define Y7_GPIO_NUM       18
  #define Y6_GPIO_NUM       39
  #define Y5_GPIO_NUM        5
  #define Y4_GPIO_NUM       34
  #define Y3_GPIO_NUM       35
  #define Y2_GPIO_NUM       17
  #define VSYNC_GPIO_NUM    22
  #define HREF_GPIO_NUM     26
  #define PCLK_GPIO_NUM     21

#elif defined(CAMERA_MODEL_AI_THINKER)
  #define PWDN_GPIO_NUM     32
  #define RESET_GPIO_NUM    -1
  #define XCLK_GPIO_NUM      0
  #define SIOD_GPIO_NUM     26
  #define SIOC_GPIO_NUM     27
  
  #define Y9_GPIO_NUM       35
  #define Y8_GPIO_NUM       34
  #define Y7_GPIO_NUM       39
  #define Y6_GPIO_NUM       36
  #define Y5_GPIO_NUM       21
  #define Y4_GPIO_NUM       19
  #define Y3_GPIO_NUM       18
  #define Y2_GPIO_NUM        5
  #define VSYNC_GPIO_NUM    25
  #define HREF_GPIO_NUM     23
  #define PCLK_GPIO_NUM     22
#else
  #error "Camera model not selected"
#endif

static const char* _STREAM_CONTENT_TYPE = "multipart/x-mixed-replace;boundary=" PART_BOUNDARY;
static const char* _STREAM_BOUNDARY = "\r\n--" PART_BOUNDARY "\r\n";
static const char* _STREAM_PART = "Content-Type: image/jpeg\r\nContent-Length: %u\r\n\r\n";

httpd_handle_t stream_httpd = NULL;

static esp_err_t stream_handler(httpd_req_t *req){
  camera_fb_t * fb = NULL;
  esp_err_t res = ESP_OK;
  size_t _jpg_buf_len = 0;
  uint8_t * _jpg_buf = NULL;
  char * part_buf[64];

  res = httpd_resp_set_type(req, _STREAM_CONTENT_TYPE);
  if(res != ESP_OK){
    return res;
  }

  while(true){
    fb = esp_camera_fb_get();
    if (!fb) {
      Serial.println("Camera capture failed");
      res = ESP_FAIL;
    } else {
      if(fb->width > 400){
        if(fb->format != PIXFORMAT_JPEG){
          bool jpeg_converted = frame2jpg(fb, 80, &_jpg_buf, &_jpg_buf_len);
          esp_camera_fb_return(fb);
          fb = NULL;
          if(!jpeg_converted){
            Serial.println("JPEG compression failed");
            res = ESP_FAIL;
          }
        } else {
          _jpg_buf_len = fb->len;
          _jpg_buf = fb->buf;
        }
      }
    }
    if(res == ESP_OK){
      size_t hlen = snprintf((char *)part_buf, 64, _STREAM_PART, _jpg_buf_len);
      res = httpd_resp_send_chunk(req, (const char *)part_buf, hlen);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, (const char *)_jpg_buf, _jpg_buf_len);
    }
    if(res == ESP_OK){
      res = httpd_resp_send_chunk(req, _STREAM_BOUNDARY, strlen(_STREAM_BOUNDARY));
    }
    if(fb){
      esp_camera_fb_return(fb);
      fb = NULL;
      _jpg_buf = NULL;
    } else if(_jpg_buf){
      free(_jpg_buf);
      _jpg_buf = NULL;
    }
    if(res != ESP_OK){
      break;
    }
    //Serial.printf("MJPG: %uB\n",(uint32_t)(_jpg_buf_len));
  }
  return res;
}


static esp_err_t ON_handler(httpd_req_t *req){
        #define OKon "HTTP/1.1 200 OK, Output On"
        httpd_resp_send(req, OKon, strlen(OKon));  // Response body can be empty
//        Serial.println("TEST ON"); 
        GpioVarOn();
        }  

static esp_err_t OFF_handler(httpd_req_t *req){
        #define OKoff "HTTP/1.1 200 OK, Output OFF"
        httpd_resp_send(req, OKoff, strlen(OKoff));  // Response body can be empty
//        Serial.println("TEST OFF"); 
        GpioVarOff();
        }  

static esp_err_t capture_handler(httpd_req_t *req){
    camera_fb_t * fb = NULL;
    esp_err_t res = ESP_OK;
    int64_t fr_start = esp_timer_get_time();

    fb = esp_camera_fb_get();
    if (!fb) {
        Serial.println("Camera capture failed");
        httpd_resp_send_500(req);
        return ESP_FAIL;
    }

    httpd_resp_set_type(req, "image/jpeg");
    httpd_resp_set_hdr(req, "Content-Disposition", "inline; filename=capture.jpg");

    size_t out_len, out_width, out_height;
    uint8_t * out_buf;
    bool s;
    {
        size_t fb_len = 0;
        if(fb->format == PIXFORMAT_JPEG){
            fb_len = fb->len;
            res = httpd_resp_send(req, (const char *)fb->buf, fb->len);
        } else {
            jpg_chunking_t jchunk = {req, 0};
            res = frame2jpg_cb(fb, 80, jpg_encode_stream, &jchunk)?ESP_OK:ESP_FAIL;
            httpd_resp_send_chunk(req, NULL, 0);
            fb_len = jchunk.len;
        }
        esp_camera_fb_return(fb);
        int64_t fr_end = esp_timer_get_time();
        Serial.printf("JPG: %uB %ums\n", (uint32_t)(fb_len), (uint32_t)((fr_end - fr_start)/1000));
        return res;
    }
}

void startCameraServer(){
  httpd_config_t config = HTTPD_DEFAULT_CONFIG();
  config.server_port = 80;

  httpd_uri_t index_uri = {
    .uri       = "/",
    .method    = HTTP_GET,
    .handler   = stream_handler,
    .user_ctx  = NULL
  };

  httpd_uri_t capture_uri = {
    .uri       = "/capture",
    .method    = HTTP_GET,
    .handler   = capture_handler,
    .user_ctx  = NULL
  };

  httpd_uri_t ON_uri = {
    .uri       = "/ON",
    .method    = HTTP_GET,
    .handler   = ON_handler,
    .user_ctx  = NULL
  };

  httpd_uri_t OFF_uri = {
    .uri       = "/OFF",
    .method    = HTTP_GET,
    .handler   = OFF_handler,
    .user_ctx  = NULL
  };

  //Serial.printf("Starting web server on port: '%d'\n", config.server_port);
  if (httpd_start(&stream_httpd, &config) == ESP_OK) {
    httpd_register_uri_handler(stream_httpd, &index_uri);
    httpd_register_uri_handler(stream_httpd, &ON_uri);  //voor LED ON
    httpd_register_uri_handler(stream_httpd, &OFF_uri); //voor LED OFF
    httpd_register_uri_handler(stream_httpd, &capture_uri); //Still image capture
  }
}

void setup() {
  WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0); //disable brownout detector

  // initialize the LED pin as an output:
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin1, INPUT_PULLUP);

  Serial.begin(115200);
  Serial.setDebugOutput(false);
  Serial.println();
 
  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 20000000;
  config.pixel_format = PIXFORMAT_JPEG; 
  
  if(psramFound()){
    config.frame_size = FRAMESIZE_SVGA;
    config.jpeg_quality = 10;
    config.fb_count = 2;
  } else {
    config.frame_size = FRAMESIZE_VGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }
  
  // Camera init
  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    Serial.printf("Camera init failed with error 0x%x", err);
    return;
  }
  // Wi-Fi connection
  WiFi.begin(ssid, password);
  
  #if defined(FixedIP)
    IPAddress ip(IPaddr);   
    IPAddress gateway(GatewayAddr);   
    IPAddress subnet(SubnetAddr);   
    WiFi.config(ip, gateway, subnet);
  #endif

  delay(5000);
  
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  
  Serial.print("Camera Stream Ready! Go to: http://");
  Serial.print(WiFi.localIP());
  
  // Start streaming web server
  startCameraServer();
}

void loop() {
  buttonState1 = digitalRead(buttonPin1);
    
  if (buttonState1 == LOW) {
    digitalWrite(ledPin1, HIGH);
    digitalWrite(ledPin2, HIGH);
    digitalWrite(ledPin3, HIGH);
    Serial.println("Start Button delay");   

    HTTPClient http;   
    String url="http://" + DomoticzUser + ":" + DomoticzPSWD + "@" + DomoticzIP + ":" + DomoticzPort + "/json.htm?type=command&param=switchlight&idx=" + DomoticzIDX + "&switchcmd=" + DomoticzSwitch + "";
    Serial.println(url);
    http.begin(url);  //Specify destination for HTTP request
    http.addHeader("Content-Type", "text/plain");             //Specify content-type header
    int httpResponseCode = http.POST("POSTING from ESP32");   //Send the actual POST request
   Serial.println(httpResponseCode);
    delay(ButtonTimer);

    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin3, LOW);
    Serial.println("Start Button end"); 

    #if defined(DomoticzResetSwitch)
        if (DomoticzSwitch == "On") { 
            String url="http://" + DomoticzUser + ":" + DomoticzPSWD + "@" + DomoticzIP + ":" + DomoticzPort + "/json.htm?type=command&param=switchlight&idx=" + DomoticzIDX + "&switchcmd=Off";
            http.begin(url);  //Specify destination for HTTP request
            http.addHeader("Content-Type", "text/plain");             //Specify content-type header
            int httpResponseCode = http.POST("POSTING from ESP32");   //Send the actual POST request
        } else {
            String url="http://" + DomoticzUser + ":" + DomoticzPSWD + "@" + DomoticzIP + ":" + DomoticzPort + "/json.htm?type=command&param=switchlight&idx=" + DomoticzIDX + "&switchcmd=On";
            http.begin(url);  //Specify destination for HTTP request
            http.addHeader("Content-Type", "text/plain");             //Specify content-type header
            int httpResponseCode = http.POST("POSTING from ESP32");   //Send the actual POST request
        }    
    #endif 
    
  }
}

// LED uitgang aan commando: http://ESP32-CAM-IP/ON
void GpioVarOn() {
   Serial.println("Output On");   
   digitalWrite(ledPin1, HIGH);
 }

// LED uitgang aan commando: http://ESP32-CAM-IP/OFF
void GpioVarOff() {
   Serial.println("Output Off");   
   digitalWrite(ledPin1, LOW);
 }
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

@Karlzre,
Great work

I have added my doorbell ip number to local networks in domoticz. Therefor it works without the auth.
Will take your input, for the future version.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

Made a little further today.
Had to stop, because the M2 screws are to long, but my little daughter is sleeping already. Has to wait, before i can run the machine to shorten them.

Made the PCB with the components.
This is only because the original chime has to work, without actions from domoticz
Image

Connected the PCB to the ESP
Image

Mounted the PCB inside the housing
Image

The ESP mounted, it still fits with all the wiring.
At the corners of the esp are the screws that are to long
Image

The front side. Also here screws that are to long.
These screws are front mounting the PCB
Image
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
karlzre
Posts: 26
Joined: Sunday 06 August 2017 18:48
Target OS: -
Domoticz version:
Contact:

Re: ESP32-CAM as doorbell with camera

Post by karlzre »

I just printed the 30 degree wedge.

How do you plan to use it ?
Do i need the main part also ?
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

The 30 degree wedge is only the wedge.
You need the other parts to make the doorbell housing
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
jake
Posts: 744
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: ESP32-CAM as doorbell with camera

Post by jake »

I think your wife made a valid point that the doorbell has to work without domoticz. I try to keep that principle as well, by only influencing signals or overriding them from domoticz. When domoticz is down, everything still works in the house except that you have to do it old fashioned by hand. Therefore I am hesitant to start using zigbee lights, because without domoticz I can't control them since they are hooked up to the live wire and not behind a physical switch. I should probably buy some zigbee switches to let them also control the lights without domoticz, but then domoticz and zigbee are running on the same RPI :-(

Keep up the good work with your project! A particular reason that you want to put all your electronics in the bell housing? This increases the risk of corrosion since it is difficult to get the IP-grade on a good level.
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

Thanks Jake,

My domoticz works exactly like you have written.
When domoticz is down, everything needs to work without domoticz. I use the philips hue lights with a hue controller.
If domoticz is down, the lights keep working with the hue controller. Of course it is not 100% sure comparing it with a normal switch, but until now i haven't having problems (for 3 years now).

The IP-grade is not that great with this device.
When wanting an IP-grade, then the housing needs to made bigger, so there is place for O-rings. When people are asking for a version that needs to have an IP-grade, maybe it is something to put on the road-map. How much bigger it would be, that i don't know. Biggest problem would be the cable going inside the housing. Unfortunally i can't get everything in the housing, there was a question to have a 8vac to 5vdc converter inside. Point 1 is, that a normal chime supply is not made for giving 24x7 power supply. Point 2, the components to give a good 5vdc will take to much space.
Also for going with the original chime control, the cable from the power supply to the doorbell needs the have 4 wires inside. 2 for powersupply and 2 for the chime. All these things make it not that easy to replace a normal doorbell with this one. But that doesn't hold me up to share and learn things from this project. I love it to see, that there are people who like this project.
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
HvdW
Posts: 617
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: ESP32-CAM as doorbell with camera

Post by HvdW »

I need to keep my wife happy, she wants to original chime to be played when doorbell is pushed.
She wants this without control from domoticz, just a button, wires and go.
Therefor mine will have a custom PCB inside. Where i will solder 2 optocouplers. 1 for triggering the ESP, the other one for the original chime.
When domoticz is down, everything needs to work without domoticz.
and @jake's post as well.

Home automation should add something to the existing plus that a simple button or remote control is so very logic.
Home automation should not deprive people from simple straightforward handling.
Let the software in the background be your own problem and challenge.

Today I reduced switching the lights from 2 to 1 remote controls after asking my wife about her preferred configuration.
She's happy and I changed some software in the background.
Now we're both happy.
Bugs bug me.
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

@HvdW, Nice words

I noticed one thing we all have.
We all have a great wife, which let us do our hobby
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: ESP32-CAM as doorbell with camera

Post by stack »

hoeby wrote: Saturday 18 July 2020 9:35 Try to connect you push button between the gnd and io12 on the esp32cam
This should be the input, of you didn't modified the input number in the code

Sorry, don't have a picture at the moment.
Try it and please post back what the result is.
Thanks, its works.
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

Today i finished to solder work.
The 2 white wires which can seen, are for the original chime.

Everything is in. Now going to test if everything still works how it needs to work

Image
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: ESP32-CAM as doorbell with camera

Post by stack »

Is it possible to adjust the dark and light of the camera?
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

Do you mean manual control light settings?
Automatic light settings i don't know, this could be a problem. The esp is maybe not that powerfull enough to do that
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
stack
Posts: 36
Joined: Friday 17 July 2020 15:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.11794
Contact:

Re: ESP32-CAM as doorbell with camera

Post by stack »

hoeby wrote: Saturday 25 July 2020 19:56 Do you mean manual control light settings?
Automatic light settings i don't know, this could be a problem. The esp is maybe not that powerfull enough to do that
Yes mean manually.
hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: ESP32-CAM as doorbell with camera

Post by hoeby »

It is not available in the code.
But i can look over it, if it can be added.

If i can add i will upload the beta code. You have to test it yourself, i don't have the time at the moment to do a full check of the code
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest