Is it possibly to use the ESP32 CAM and Blynk Edgent together?

Clearly this is t your full Edgent .ino file as it’s missing the #define BLYNK_TEMPLATE_ID and #define BLYNK_TEMPLATE_NAME lines of code and won’t compile without them.

You are also missing a #define for your board type, so the custom (default) board type will be used. Have you checked the pin allocations in Settings.h for this board type to see if there are any pin conflicts? I suspect that the ISR message is because the Blynk reset pin defined in Settings.h (which has an ISR attached to it) is conflicting with an ISR that is being attached in the camera library you are using.

Agreed. Let Edgent handle this and the WiFi/Blynk connections.

Pete.

Oh that was just a typo I don’t know why I forgot here because it is in my sketch???
There is no problem compiling it.

Is it necessary when I manually have defined the pins in the beginning of the sketch?

Look at your compiler output. It will tell you that as you haven’t specified a board type then the custom board type will be used.
Bltnk Edgent needs to know which GPIO the indicator LED is attached to, and whether it’s active HIGH or LOW, and which pin the Blynk reset button is attached to, and whether that is active HIGH or LOW. Without this info you won’t be able to provision/re-provision your board, which is why Settings.h assigns a default (custom) set of values if you don’t define a board type.

Pete.

Okay so I should remove this:

#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

[/quote]

Then go to settings.h and find out which board matches the pinout.

Then #define AI_THINKER (or whatever it says)?

No, that’s needed for your cam library.
You just need to look at the custom settings in Settings.h and identify any conflicts, then change the Settings.h GPIOs to ones that don’t conflict.

Pete.

Okay I changed the sketch a bit, also to make more compact.
The camera pins is now defined in a camera_pins.h
Also I tried to disable all the wifi setup and I could setup Blynk from my phone, but when I type the ip address into my webbrowser is just say the page doesn’t exists:


#define BLYNK_TEMPLATE_ID           "TMPL5s-dGSebs"
#define BLYNK_TEMPLATE_NAME         "Webcam"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_ESP32_DEV_MODULE
//#define USE_ESP32C3_DEV_MODULE
//#define USE_ESP32S2_DEV_KIT
#define USE_WROVER_BOARD
//#define USE_TTGO_T7
//#define USE_TTGO_T_OI

#include "OV2640.h"
//#include <WiFi.h>
//#include <WebServer.h>
//#include <WiFiClient.h>
//#include <BlynkSimpleEsp32.h>
#include "BlynkEdgent.h"

// Uncomment your board, or configure a custom board in camera_pins.h
//#define CAMERA_MODEL_ESP_EYE
//#define CAMERA_MODEL_M5STACK_PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE
//#define CAMERA_MODEL_WROVER_KIT
#define CAMERA_MODEL_AI_THINKER

#include "camera_pins.h"

OV2640 cam;

const char HEADER[] = "HTTP/1.1 200 OK\r\n" \
                      "Access-Control-Allow-Origin: *\r\n" \
                      "Content-Type: multipart/x-mixed-replace; boundary=123456789000000000000987654321\r\n";
const char BOUNDARY[] = "\r\n--123456789000000000000987654321\r\n";
const char CTNTTYPE[] = "Content-Type: image/jpeg\r\nContent-Length: ";
const int hdrLen = strlen(HEADER);
const int bdrLen = strlen(BOUNDARY);
const int cntLen = strlen(CTNTTYPE);

void handle_jpg_stream(void)
{
  char buf[32];
  int s;

  WiFiClient client = server.client();

  client.write(HEADER, hdrLen);
  client.write(BOUNDARY, bdrLen);

  while (true)
  {
    if (!client.connected()) break;
    cam.run();
    s = cam.getSize();
    client.write(CTNTTYPE, cntLen);
    sprintf( buf, "%d\r\n\r\n", s );
    client.write(buf, strlen(buf));
    client.write((char *)cam.getfb(), s);
    client.write(BOUNDARY, bdrLen);
  }
}

const char JHEADER[] = "HTTP/1.1 200 OK\r\n" \
                       "Content-disposition: inline; filename=capture.jpg\r\n" \
                       "Content-type: image/jpeg\r\n\r\n";
const int jhdLen = strlen(JHEADER);

void handle_jpg(void)
{
  WiFiClient client = server.client();

  cam.run();
  if (!client.connected()) return;

  client.write(JHEADER, jhdLen);
  client.write((char *)cam.getfb(), cam.getSize());
}

void handleNotFound()
{
  String message = "Server is running!\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET) ? "GET" : "POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  server.send(200, "text / plain", message);
}

void setup()
{
  Serial.begin(115200);
  delay(100);
  BlynkEdgent.begin();

    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;

  // Frame parameters
  //  config.frame_size = FRAMESIZE_UXGA;
  config.frame_size = FRAMESIZE_QVGA;
  config.jpeg_quality = 12;
  config.fb_count = 2;

#if defined(CAMERA_MODEL_ESP_EYE)
  pinMode(13, INPUT_PULLUP);
  pinMode(14, INPUT_PULLUP);
#endif

  cam.init(config);
  IPAddress ip;

/*  WiFi.mode(WIFI_STA);
 // WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(F("."));
  }
  ip = WiFi.localIP();
  Serial.println(F("WiFi connected"));
  Serial.println("");
    // Configure Blynk
 // Blynk.config(auth);
  Serial.println("Connecting to Blynk");
  while (Blynk.connect() == false) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnected to Blynk");

  
  Serial.println(ip);
  Serial.print("Stream Link: http://");
  Serial.print(ip);
  Serial.println("/mjpeg/1");
  server.on("/mjpeg/1", HTTP_GET, handle_jpg_stream);
  server.on("/jpg", HTTP_GET, handle_jpg);
  server.onNotFound(handleNotFound);
  server.begin();*/
}

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


Also this is the message in the Serial Monitor:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.3.2 on ESP32

 #StandWithUkraine    https://bit.ly/swua


----------------------------------------------------
 Device:    Blynk Webcam-P3RA
 Firmware:  0.1.0 (build Jun 10 2024 19:14:38)
 Platform:  ESP32 @ 240MHz
 Chip rev:  3
 SDK:       v4.4.7-dirty
 Flash:     4096K
 Free mem:  224308
----------------------------------------------------

>[494] INIT => WAIT_CONFIG
E (470) gpio: gpio_install_isr_service(450): GPIO isr service already installed

[3339] AP URL:  blynk.setup
[47871] WAIT_CONFIG => CONFIGURING
[47871] Sending board info...
[53005] Applying configuration...
[53005] WiFi SSID: RUM Pass: ****
[53005] Blynk cloud: kFJxua-D5ZmL6GxE65663Uij8YYQVFFX @ blynk.cloud:443
[53018] CONFIGURING => SWITCH_TO_STA
[53021] Switching to STA...
[54179] SWITCH_TO_STA => CONNECTING_NET
[54180] Connecting to WiFi: ****
[58215] Using Dynamic IP: 192.168.0.133
[58215] CONNECTING_NET => CONNECTING_CLOUD
[58226] Connecting to blynk.cloud:443
[59922] Certificate OK
[60024] Redirecting to lon1.blynk.cloud:443
[60035] Connecting to lon1.blynk.cloud:443
[61665] Certificate OK
[61765] Ready (ping: 99ms).
[61833] CONNECTING_CLOUD => RUNNING
[61840] Configuration stored to flash

You haven’t said anything about checking the pin allocations in Settings.h for conflicts.
I’ve explained twice why you need to do this, but you seem to be in denial.

Pete.

camera_pins.h:

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

Settings.h:

defined(USE_WROVER_BOARD)

  #define BOARD_BUTTON_PIN            15
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN_R             0
  #define BOARD_LED_PIN_G             2
  #define BOARD_LED_PIN_B             4
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        128

Pin 4 is the only one I see has a conflict but it only controls the onboard LED.

Does your board have an RGB tricolour LED?

Pete.

No, I don’t think so. I think there should be a red led and a flash led. Flash led is on pin 4 I don’t know about the red LED I have never seen it light up.

EDIT
Okay I think I found the pinout. Also it seems to be an AI Thinker I have.
The red LED is on pin 33.

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

But it didn’t make a difference to use AI Thinker pinout.

You’ve totally lost me here.

You seem to be using two different pin assignments for your cam functuinality. In your early posts it was this…

And now you’re using this…

You can’t pick and choose these settings to suit yourself, you need to use the correct ones for your board. If you don’t know which ones are the correct ones then go back to the basic non-Blynk sketch and figure that out.

When you know which pins you are using then compare these to the custom board type settings in Blynk. These are the easiest ones to use if you don’t have a tri colour LED. There can be NO duplication of GPIOs between your cam settings an Edgent board settings.
You don’t have to use built-in LEDs and switches, you can add your own as needed if you don’t have ones that aren’t already being used by the cam module.
When using the custom settings, you need to delete this…

Do you understand this?
If not, please ask questions rather than going off at a tangent.

Pete.

This is the correct one which works with the non blynk sketch.

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

Yes I understand it, the reason I used WROVER is because I didn’t had AI Thinker, and to program the AI Thinker with Arduino IDE I select ESP32 WROVER because AI Thinker is not on the list so that’s what everyone does.

But I don’t understand why the wrong pinout would prevent the server host to be accessed through the browser, when I’m able to connect it to my WiFi and it shows up in Blynk as connected.

I would have expected if the pins were the problem that I would connect to the webpage for the camera but there would be no picture.

You have to start by

I have no idea whether you are talking about the cam setup or the Blynk board type here. You need to be more specific.

You need to start by fixing the ISR conflict message first.
Then, I suspect you need to allow Blynk to handle the WiFi connection then initialise the web server.

Pete.

Blynk board.

Okay but what is “GPIO isr service already installed” exactly?

Pete.

I found this statement:

"Actually, if you notice “Error:GPIO isr service already installed”, it usually
means you have at least 2 components calling gpio_install_isr_service().
Such component usually has a gpio_uninstall_isr_service() in deinit.
Which means if a component calls the deinit(), the other componet stop working.

esp_camera is an example that will call gpio_uninstall_isr_service() when deinit and this may cause problems."

Here is the full thread:

So I need to find out were that function is located.

“Such component usually has a gpio_uninstall_isr_service() in deinit.” What does “deinit” mean???

I assume it means de-initialise.

Pete.

“esp_camera is an example that will call gpio_uninstall_isr_service() when deinit and this may cause problems.”

Im not sure if I understand it???

I’d suggest that you post the cam pins and the Blynk pins you’re using in Settings.h

Pete.

This is the pinOut

OV2640 CAMERA ESP32 Variable name in code
D0 GPIO 5 Y2_GPIO_NUM
D1 GPIO 18 Y3_GPIO_NUM
D2 GPIO 19 Y4_GPIO_NUM
D3 GPIO 21 Y5_GPIO_NUM
D4 GPIO 36 Y6_GPIO_NUM
D5 GPIO 39 Y7_GPIO_NUM
D6 GPIO 34 Y8_GPIO_NUM
D7 GPIO 35 Y9_GPIO_NUM
XCLK GPIO 0 XCLK_GPIO_NUM
PCLK GPIO 22 PCLK_GPIO_NUM
VSYNC GPIO 25 VSYNC_GPIO_NUM
HREF GPIO 23 HREF_GPIO_NUM
SDA GPIO 26 SIOD_GPIO_NUM
SCL GPIO 27 SIOC_GPIO_NUM
POWER PIN GPIO 32 PWDN_GPIO_NUM
TX GPIO 1 Serial Write
RX GPIO 3 Serial Read
OnBoard LED GPIO33 Red LED
FLash LED GPIO 4 Flash

For SD CARD:

CLK GPIO 14
CMD GPIO 15
DATA0 GPIO 2
DATA1 / flashlight GPIO 4
DATA2 GPIO 12
DATA3 GPIO 13

From that information I use costume board

settings.h:



  #warning "Custom board configuration is used"

  #define BOARD_BUTTON_PIN            32                     // Pin where user button is attached
  #define BOARD_BUTTON_ACTIVE_LOW     true                  // true if button is "active-low"

  #define BOARD_LED_PIN               33                     // Set LED pin - if you have a single-color LED attached
  //#define BOARD_LED_PIN_R           15                    // Set R,G,B pins - if your LED is PWM RGB
  //#define BOARD_LED_PIN_G           12
  //#define BOARD_LED_PIN_B           13
  //#define BOARD_LED_PIN_WS2812      4                     // Set if your LED is WS2812 RGB
  #define BOARD_LED_INVERSE           false                 // true if LED is common anode, false if common cathode
  #define BOARD_LED_BRIGHTNESS        64                    // 0..255 brightness control

#endif


/*
 * Advanced options
 */

#define BUTTON_HOLD_TIME_INDICATION   3000
#define BUTTON_HOLD_TIME_ACTION       10000
#define BUTTON_PRESS_TIME_ACTION      50

#define BOARD_PWM_MAX                 1023

#define BOARD_LEDC_CHANNEL_1          1
#define BOARD_LEDC_CHANNEL_2          2
#define BOARD_LEDC_CHANNEL_3          3
#define BOARD_LEDC_TIMER_BITS         10
#define BOARD_LEDC_BASE_FREQ          12000

#if !defined(CONFIG_DEVICE_PREFIX)
#define CONFIG_DEVICE_PREFIX          "Blynk"
#endif
#if !defined(CONFIG_AP_URL)
#define CONFIG_AP_URL                 "blynk.setup"
#endif
#if !defined(CONFIG_DEFAULT_SERVER)
#define CONFIG_DEFAULT_SERVER         "blynk.cloud"
#endif
#if !defined(CONFIG_DEFAULT_PORT)
#define CONFIG_DEFAULT_PORT           443
#endif

#define WIFI_CLOUD_MAX_RETRIES        500
#define WIFI_NET_CONNECT_TIMEOUT      50000
#define WIFI_CLOUD_CONNECT_TIMEOUT    50000
#define WIFI_AP_IP                    IPAddress(192, 168, 4, 1)
#define WIFI_AP_Subnet                IPAddress(255, 255, 255, 0)
//#define WIFI_CAPTIVE_PORTAL_ENABLE

//#define USE_TICKER
//#define USE_TIMER_ONE
//#define USE_TIMER_THREE
//#define USE_TIMER_FIVE
#define USE_PTHREAD

#define BLYNK_NO_DEFAULT_BANNER

#if defined(APP_DEBUG)
  #define DEBUG_PRINT(...)  BLYNK_LOG1(__VA_ARGS__)
  #define DEBUG_PRINTF(...) BLYNK_LOG(__VA_ARGS__)
#else
  #define DEBUG_PRINT(...)
  #define DEBUG_PRINTF(...)
#endif

camera_pins.h



#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