Problem with ESP32-cam, SD & FTP

Posts: 8
Joined: Sun Jan 26, 2020 6:34 pm

Problem with ESP32-cam, SD & FTP

Postby Chuma87 » Mon Feb 17, 2020 10:40 am

Is it possible that uploading a file to FTP takes a long time?

The test I am doing is ... With a doppler sensor, save the image to the SD, and after that, upload it to an FTP. If I only save in the SD, it works perfectly, if I add it to upload to FTP, it doesn't work any more by movement, only every 30 seconds. Why does this happen?

Code: Select all

if (ex > 20)  { 
     // Init Camera
    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK) {
      Serial.printf("Camera init failed with error 0x%x", err);

    Serial.println("Starting SD Card");
    Serial.println("SD Card Mount Failed");
    uint8_t cardType = SD_MMC.cardType();
    if(cardType == CARD_NONE){
    Serial.println("No SD Card attached");
    camera_fb_t * fb = NULL;  
    // Take Picture with Camera
    fb = esp_camera_fb_get();  
    if(!fb) {
      Serial.println("Camera capture failed");
    // initialize EEPROM with predefined size
    pictureNumber = + 1;
   //Path where new picture will be saved in SD Card
    String nombre = "picture" + String(pictureNumber) + "_" + String(ex) + "kmh.jpg";
    String path = "/" + nombre;

    fs::FS &fs = SD_MMC;
    Serial.printf("Picture file name: %s\n", path.c_str());
    File file =, FILE_WRITE);
      Serial.println("Failed to open file in writing mode");
    else {
      file.write(fb->buf, fb->len); // payload (image), payload length
      Serial.printf("Saved file to path: %s\n", path.c_str());
      EEPROM.write(0, pictureNumber);
    WiFi.begin( WIFI_SSID, WIFI_PASS );
    Serial.println("Connecting Wifi...");
    while (WiFi.status() != WL_CONNECTED) {
    Serial.print("IP address: ");

    // Create the new file and send the image
    const char *web_nombre = nombre.c_str();  
    ftp.InitFile("Type I");
    ftp.WriteData(fb->buf, fb->len);
    // Turns off the ESP32-CAM white on-board LED (flash) connected to GPIO 4
    pinMode(4, OUTPUT);
    digitalWrite(4, LOW);
    esp_sleep_enable_ext0_wakeup(GPIO_NUM_13, 0);
    Serial.println("Going to sleep now");
    Serial.println("This will never be printed"); 

Video Here

Who is online

Users browsing this forum: No registered users and 34 guests