sinricpro / esp8266-esp32-sdk

Library for https://sinric.pro - simple way to connect your device to Alexa, Google Home, SmartThings and cloud
https://sinric.pro
Other
230 stars 124 forks source link

Door_Bell Upload Issue #87

Closed bakliwalp closed 3 years ago

bakliwalp commented 4 years ago

I am trying to upload Door Bell Sketch to ESP EYE using Arduino, but it continuously keeps showing an error, please help me with it.

error = Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA/1MB SPIFFS), QIO, 80MHz, 921600, None"

D:\BI\Smart Housia\Products List Smart Housia\6Smart Door Bell\Door_Bell\Door_Bell.ino: In function 'void setupCamera()':

Door_Bell:95:19: error: 'Y2_GPIO_NUM' was not declared in this scope

config.pin_d0 = Y2_GPIO_NUM;

               ^

Door_Bell:96:19: error: 'Y3_GPIO_NUM' was not declared in this scope

config.pin_d1 = Y3_GPIO_NUM;

               ^

Door_Bell:97:19: error: 'Y4_GPIO_NUM' was not declared in this scope

config.pin_d2 = Y4_GPIO_NUM;

               ^

Door_Bell:98:19: error: 'Y5_GPIO_NUM' was not declared in this scope

config.pin_d3 = Y5_GPIO_NUM;

               ^

Door_Bell:99:19: error: 'Y6_GPIO_NUM' was not declared in this scope

config.pin_d4 = Y6_GPIO_NUM;

               ^

Door_Bell:100:19: error: 'Y7_GPIO_NUM' was not declared in this scope

config.pin_d5 = Y7_GPIO_NUM;

               ^

Door_Bell:101:19: error: 'Y8_GPIO_NUM' was not declared in this scope

config.pin_d6 = Y8_GPIO_NUM;

               ^

Door_Bell:102:19: error: 'Y9_GPIO_NUM' was not declared in this scope

config.pin_d7 = Y9_GPIO_NUM;

               ^

Door_Bell:103:21: error: 'XCLK_GPIO_NUM' was not declared in this scope

config.pin_xclk = XCLK_GPIO_NUM;

                 ^

Door_Bell:104:21: error: 'PCLK_GPIO_NUM' was not declared in this scope

config.pin_pclk = PCLK_GPIO_NUM;

                 ^

Door_Bell:105:22: error: 'VSYNC_GPIO_NUM' was not declared in this scope

config.pin_vsync = VSYNC_GPIO_NUM;

                  ^

Door_Bell:106:21: error: 'HREF_GPIO_NUM' was not declared in this scope

config.pin_href = HREF_GPIO_NUM;

                 ^

Door_Bell:107:25: error: 'SIOD_GPIO_NUM' was not declared in this scope

config.pin_sscb_sda = SIOD_GPIO_NUM;

                     ^

Door_Bell:108:25: error: 'SIOC_GPIO_NUM' was not declared in this scope

config.pin_sscb_scl = SIOC_GPIO_NUM;

                     ^

Door_Bell:109:21: error: 'PWDN_GPIO_NUM' was not declared in this scope

config.pin_pwdn = PWDN_GPIO_NUM;

                 ^

Door_Bell:110:22: error: 'RESET_GPIO_NUM' was not declared in this scope

config.pin_reset = RESET_GPIO_NUM;

                  ^

Multiple libraries were found for "WiFi.h"

Used: C:\Users\bakli\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi

Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi

Not used: C:\Users\bakli\Documents\Arduino\libraries\WiFiNINA

Multiple libraries were found for "ArduinoJson.h"

Used: C:\Users\bakli\Documents\Arduino\libraries\ArduinoJson

Not used: C:\Users\bakli\Documents\Arduino\libraries\Antares_ESP8266_MQTT

Multiple libraries were found for "WebSocketsClient.h"

Used: C:\Users\bakli\Documents\Arduino\libraries\WebSockets

Not used: C:\Users\bakli\Documents\Arduino\libraries\arduinoWebSockets-2.1.4

exit status 1

'Y2_GPIO_NUM' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

kakopappa commented 4 years ago

Seems you are missing GPIO constants

Make sure you have

include “camera_pins.h” in the sketch

On Fri, 11 Sep 2020 at 11:12 AM bakliwalp notifications@github.com wrote:

I am trying to upload Door Bell Sketch to ESP EYE using Arduino, but it continuously keeps showing an error, please help me with it.

error = Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA/1MB SPIFFS), QIO, 80MHz, 921600, None"

D:\BI\Smart Housia\Products List Smart Housia\6Smart Door Bell\Door_Bell\Door_Bell.ino: In function 'void setupCamera()':

Door_Bell:95:19: error: 'Y2_GPIO_NUM' was not declared in this scope

config.pin_d0 = Y2_GPIO_NUM;

           ^

Door_Bell:96:19: error: 'Y3_GPIO_NUM' was not declared in this scope

config.pin_d1 = Y3_GPIO_NUM;

           ^

Door_Bell:97:19: error: 'Y4_GPIO_NUM' was not declared in this scope

config.pin_d2 = Y4_GPIO_NUM;

           ^

Door_Bell:98:19: error: 'Y5_GPIO_NUM' was not declared in this scope

config.pin_d3 = Y5_GPIO_NUM;

           ^

Door_Bell:99:19: error: 'Y6_GPIO_NUM' was not declared in this scope

config.pin_d4 = Y6_GPIO_NUM;

           ^

Door_Bell💯19: error: 'Y7_GPIO_NUM' was not declared in this scope

config.pin_d5 = Y7_GPIO_NUM;

           ^

Door_Bell:101:19: error: 'Y8_GPIO_NUM' was not declared in this scope

config.pin_d6 = Y8_GPIO_NUM;

           ^

Door_Bell:102:19: error: 'Y9_GPIO_NUM' was not declared in this scope

config.pin_d7 = Y9_GPIO_NUM;

           ^

Door_Bell:103:21: error: 'XCLK_GPIO_NUM' was not declared in this scope

config.pin_xclk = XCLK_GPIO_NUM;

             ^

Door_Bell:104:21: error: 'PCLK_GPIO_NUM' was not declared in this scope

config.pin_pclk = PCLK_GPIO_NUM;

             ^

Door_Bell:105:22: error: 'VSYNC_GPIO_NUM' was not declared in this scope

config.pin_vsync = VSYNC_GPIO_NUM;

              ^

Door_Bell:106:21: error: 'HREF_GPIO_NUM' was not declared in this scope

config.pin_href = HREF_GPIO_NUM;

             ^

Door_Bell:107:25: error: 'SIOD_GPIO_NUM' was not declared in this scope

config.pin_sscb_sda = SIOD_GPIO_NUM;

                 ^

Door_Bell:108:25: error: 'SIOC_GPIO_NUM' was not declared in this scope

config.pin_sscb_scl = SIOC_GPIO_NUM;

                 ^

Door_Bell:109:21: error: 'PWDN_GPIO_NUM' was not declared in this scope

config.pin_pwdn = PWDN_GPIO_NUM;

             ^

Door_Bell:110:22: error: 'RESET_GPIO_NUM' was not declared in this scope

config.pin_reset = RESET_GPIO_NUM;

              ^

Multiple libraries were found for "WiFi.h"

Used: C:\Users\bakli\Documents\ArduinoData\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi

Not used: C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi

Not used: C:\Users\bakli\Documents\Arduino\libraries\WiFiNINA

Multiple libraries were found for "ArduinoJson.h"

Used: C:\Users\bakli\Documents\Arduino\libraries\ArduinoJson

Not used: C:\Users\bakli\Documents\Arduino\libraries\Antares_ESP8266_MQTT

Multiple libraries were found for "WebSocketsClient.h"

Used: C:\Users\bakli\Documents\Arduino\libraries\WebSockets

Not used: C:\Users\bakli\Documents\Arduino\libraries\arduinoWebSockets-2.1.4

exit status 1

'Y2_GPIO_NUM' was not declared in this scope

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/87, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZWWXQO2DSH3IZODNRTSFGPUTANCNFSM4RGRFVGQ .

bakliwalp commented 4 years ago

I have already included "camera_pins.h" in the sketch. I have attached the screenshot of this. Please take a look an let me know what I am doing Wrong. Thanks in advance.

Regards, Prathamesh Bakliwal.

Screenshot 1

sivar2311 commented 4 years ago

If you want to use ESP EYE module, you should have a look at this post

bakliwalp commented 4 years ago

I have got it to upload successfully, but now I cannot turn on the Camera, and get the Live Stream. What to do now. I have attached the output of Serial Monitor and Sinric Pro Dashboard. Sinric Pro Dashboard Serial Monitor

sivar2311 commented 4 years ago

Turn on / off must work and there should be something on the serial output. Otherwise something different is wrong with your sketch / setup.

Your mobilephone have to be connected to the same local network.

kakopappa commented 4 years ago

Device seems to be still not connected to the server. When it is connected, the top bar should be green and it should show the Camera IP address in the description

On Sat, 12 Sep 2020 at 8:07 PM Boris Jäger notifications@github.com wrote:

Turn on / off must work and there should be something on the serial output. Otherwise something different is wrong with your sketch / setup.

Your mobilephone have to be connected to the same local network.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/87#issuecomment-691485207, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZQWKHVSKQTBRDL3A2DSFNXBXANCNFSM4RGRFVGQ .

bakliwalp commented 4 years ago

I had connected the Camera to the Mobile Hotspot. I use all the Sinric Devices using Mobile Hotspot. So dies it mean that I cannot use Camera using Mobile Hotspot ?

sivar2311 commented 4 years ago

No, it does mean, that your ESP EYE is not connected to SinricPro server. Your screenshot shows clearly that the device is offline image

bakliwalp commented 4 years ago

I have checked the connections, everything seems to be working, even serial monitor shows the IP address as 192.168.1.124.

sivar2311 commented 4 years ago

Yes, but it doesnt show that connection to sinric pro server has been established! Do you call SinricPro.handle() in your loop?

bakliwalp commented 4 years ago

yes

sivar2311 commented 4 years ago

Anyways...something is wrong....there is no connection

bakliwalp commented 4 years ago
#define ENABLE_DEBUG

#ifdef ENABLE_DEBUG
       #define DEBUG_ESP_PORT Serial
       #define NODEBUG_WEBSOCKETS
       #define NDEBUG
#endif 

#include <WiFi.h>
#include <WebServer.h>
#include <WiFiClient.h>

#include "SinricPro.h"
#include "SinricProCamera.h"

// Micro-RTSP from https://github.com/geeksville/Micro-RTSP 
#include "SimStreamer.h"
#include "OV2640Streamer.h"
#include "CRtspSession.h"

// Select your camera model

//#define CAMERA_MODEL_WROVER_KIT
//#define T_Camera_V17_VERSION
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE
//#define CAMERA_MODEL_AI_THINKER
#define CAMERA_MODEL_AI_THINKER

#include "select_pins.h"

#define WIFI_SSID  "xx"
#define WIFI_PASSWD "xxx"

#define APP_KEY           "xx"
#define APP_SECRET        "xx"
#define CAMERA_ID         "xx"

OV2640 cam;
CStreamer *streamer;

WiFiServer rtspServer(8554);

// Optional but important for stability. 
IPAddress local_IP(192, 168, 1, 124);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8);   //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

bool onPowerState(const String &deviceId, bool &state) {
  Serial.printf("Device %s turned %s (via SinricPro) \r\n", deviceId.c_str(), state?"on":"off");
  return true; // request handled properly
}

// setup function for SinricPro
void setupSinricPro() {
  // add device to SinricPro
  SinricProCamera& mySwitch = SinricPro[CAMERA_ID];

  // set callback function to device
  mySwitch.onPowerState(onPowerState);

  // setup SinricPro
  SinricPro.onConnected([](){ Serial.printf("Connected to SinricPro\r\n"); }); 
  SinricPro.onDisconnected([](){ Serial.printf("Disconnected from SinricPro\r\n"); });
  SinricPro.begin(APP_KEY, APP_SECRET);
}

void setupWiFi() {
  IPAddress ip;

  // Configures static IP address
  if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) {
    Serial.println("Failed to configure IP");
  }

  WiFi.begin(WIFI_SSID, WIFI_PASSWD);
  while (WiFi.status() != WL_CONNECTED) {
      delay(500);
      Serial.print(".");
  }

  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void setupCamera() {
  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; //PIXFORMAT_YUV422 PIXFORMAT_GRAYSCALE PIXFORMAT_RGB565 PIXFORMAT_JPEG

  /*
  FRAMESIZE_UXGA (1600 x 1200)
  FRAMESIZE_QVGA (320 x 240)
  FRAMESIZE_CIF (352 x 288)
  FRAMESIZE_VGA (640 x 480)
  FRAMESIZE_SVGA (800 x 600)
  FRAMESIZE_XGA (1024 x 768)
  FRAMESIZE_SXGA (1280 x 1024)
  */

  if(psramFound()){
    Serial.println("psram found");
    config.frame_size = FRAMESIZE_UXGA;
    config.jpeg_quality = 40; //10-63 lower number means higher quality
    config.fb_count = 2;
  } else {
    Serial.println("psram not found");
    config.frame_size = FRAMESIZE_VGA;
    config.jpeg_quality = 12;
    config.fb_count = 1;
  }

  cam.init(config);
}

void setupStreaming() {
    rtspServer.begin();  
    //streamer = new SimStreamer(true);
    streamer = new OV2640Streamer(cam);
}

void handleStreaming() {
    uint32_t msecPerFrame = 100;
    static uint32_t lastimage = millis();

    // If we have an active client connection, just service that until gone
    streamer->handleRequests(0); // we don't use a timeout here,
    // instead we send only if we have new enough frames
    uint32_t now = millis();
    if(streamer->anySessions()) {
        if(now > lastimage + msecPerFrame || now < lastimage) { // handle clock rollover
            streamer->streamImage(now);
            lastimage = now;

            // check if we are overrunning our max frame rate
            now = millis();
            if(now > lastimage + msecPerFrame) {
                printf("warning exceeding max frame rate of %d ms\n", now - lastimage);
            }
        }
    }

    WiFiClient rtspClient = rtspServer.accept();
    if(rtspClient) {
        Serial.print("client: ");
        Serial.print(rtspClient.remoteIP());
        Serial.println();
        streamer->addSession(rtspClient);
    }
}

void setup()
{
  Serial.begin(115200);
  while (!Serial);

  setupCamera();
  setupWiFi();   
  setupSinricPro();
  setupStreaming();
}

void loop()
{ 
  SinricPro.handle();
  handleStreaming();
}
bakliwalp commented 4 years ago

This is the code I am using, is anything wrong in it??

sivar2311 commented 4 years ago

You're using static ip settings. Does this settings match to your network? Did you try using DHCP instead?

bakliwalp commented 4 years ago

I don't know anything about Static IP, sorry. how to use DHCP in the code??

sivar2311 commented 4 years ago

Use setupWiFi code from basic switch example.....they way you're usually connect your EPS to your wifi network.

bakliwalp commented 4 years ago

Well I got it to get Online by following your Advice. But I cant Stream the video from it?? Also when I open the app in Android, it crashes when I tap on the space above ON/OFF switch.

kakopappa commented 4 years ago

Does it show the IP address of the esp camera device in the dashboard?

On Sat, 12 Sep 2020 at 9:51 PM bakliwalp notifications@github.com wrote:

Well I got it to get Online by following your Advice. But I cant Stream the video from it?? Also when I open the app in Android, it crashes when I tap on the space above ON/OFF switch.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/87#issuecomment-691501722, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZVQJSRYBPJLQN2F6ATSFODI7ANCNFSM4RGRFVGQ .

bakliwalp commented 4 years ago

yes, but when I try the same IP address in the dashboard, the page does not load.

kakopappa commented 4 years ago

Install VLC player and check whether your camera stream is working correctly.

Open this URL in VLC Player -> Media ->Open Network Stream

rtsp://yourdevipaddr:8554/mjpeg/1

Eg: image

bakliwalp commented 4 years ago

i can now stream it over VLC Media player. Thanks. but I have one question that can I get the stream in the Sinric Pro app or not ? Also Sinric Pro app crashes each time I touch in the space between Door_Bell and ON/OFF options.

kakopappa commented 4 years ago

When you open the Camera, it tries to load "rtsp://lastIpAddress:8554/mjpeg/1" in the app. If it fails it seems to crash now. Make sure you are connected to the same WiFi

bakliwalp commented 4 years ago

I am connected to the same WiFi

kakopappa commented 4 years ago

Please let me know your:

App version and OS version SDK version

I will try to reproduce this issue here. My current setup works fine

On Tue, Sep 15, 2020 at 8:49 PM bakliwalp notifications@github.com wrote:

I am connected to the same WiFi

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/87#issuecomment-692727164, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABZAZZUPPXGFVVICPVNIQDTSF5WF7ANCNFSM4RGRFVGQ .

bakliwalp commented 4 years ago

App Version - 2.8.1 OS Version - Android (9) SDK Version - 2.6.1 ( I assume you are asking me the Version of Sinric Pro library that I am Using)

kakopappa commented 4 years ago

I tried again using a new sketch:

SDK: 2.6.1 OS Version - Android (9) On Emulator App Version - 2.8.1

I still cannot reproduce your issue. Do you mind trying on another Mobile phone?

image

image

bakliwalp commented 4 years ago

Will try again on the same mobile and on another and will let you know. Thanks for your support.🙏

On Thu, 17 Sep 2020, 5:10 am Aruna Tennakoon, notifications@github.com wrote:

I tried again using a new sketch:

SDK: 2.6.1 OS Version - Android (9) On Emulator App Version - 2.8.1

I still cannot reproduce your issue. Do you mind trying on another Mobile phone?

[image: image] https://user-images.githubusercontent.com/7474406/93402923-4bed5900-f8b0-11ea-9243-ef430e9e912d.png

[image: image] https://user-images.githubusercontent.com/7474406/93402872-21030500-f8b0-11ea-9e1e-863222d6207c.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sinricpro/esp8266-esp32-sdk/issues/87#issuecomment-693722784, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANAEM6VDR2SNPAX7GOFYFQTSGFEHDANCNFSM4RGRFVGQ .

sivar2311 commented 3 years ago

Due to inactivity I assume that the problem has been solved. For this reason, the issue will be closed now. If there are still errors or questions related to this topic, please reopen this issue.