witnessmenow / Universal-Arduino-Telegram-Bot

Use Telegram on your Arduino (ESP8266 or Wifi-101 boards)
MIT License
1.13k stars 312 forks source link

Send HIGH quality photo from ESP32-CAM #220

Open array81 opened 3 years ago

array81 commented 3 years ago

I tried official ESP32CAM example. This work only if framesize is set to FRAMESIZE_QVGA, in alternative I don't get error but message with image is not send. Try to change FRAMESIZE_QVGA to FRAMESIZE_VGA or any other resoltution.

Is there a way to send image with a big resolution?

espadrift commented 3 years ago

@array81 what example are you using? I found many use uint_16 types for the image buffer sizes. These need to be changed to uint_32.

array81 commented 3 years ago

@espadrift the official ESP32CAM example, you can find it in this repository.

anshchawla521 commented 3 years ago

i am also trying to to the same thing but the code just gets stuck when we change the resolution

diibify commented 3 years ago

I have a very similar problem. Many (all other) ESP32cam foto examples do work (CameraWebServer etc). In this example the flashing does work and the interaction in total, too. But the /photo action doesnt. I see in Serial Monitor that he is probably sending the photo and is also saying that it was successfull. But there is no message in telegram. Not a empty message - none. I also tried the hint in the first post changing the FRAMESIZE_UXGA to FRAMESIZE_QVGA. Even with other UniversalTelegram Bot examples I get no message in telegram. I tried very much the other days - I do not have an idea yet. I would be very happy if there is a tip from you (I am using the JZK ESP32 cam if it is useful to know). Git.zip

DaniDerBaer commented 3 years ago

@diibify I have exactly the same problem. In the Serial Monitor it says that it was successful, but there isn't a message in telegram. Edit: I got this error now: [E][ssl_client.cpp:36] _handle_error(): [send_ssl_data():301]: (-80) UNKNOWN ERROR CODE (0050)

FBMinis commented 3 years ago

After experiencing dificulties sending large resolution photos, I found an application that works. I have two of these units sending a photo every two minutes during the day to my bot, resolution is XGA:

https://github.com/robotzero1/esp32cam-telegram (thanks to robotzero1 for his work) IMG-20210312-WA0008

philicibine commented 3 years ago

This seems to work for me. Taken from robotzero1's example and used with this library.

bool isMoreDataAvailable() {
  return (fb_length - currentByte);
}

uint8_t photoNextByte() {
  currentByte++;
  return (fb_buffer[currentByte - 1]);
}

void take_send_photo() {
  camera_fb_t * fb = NULL;
  fb = esp_camera_fb_get();
  currentByte = 0;
  fb_length = fb->len;
  fb_buffer = fb->buf;

  // send the photo to the private channel
  myBot.sendPhotoByBinary(group_id, "image/jpeg", fb->len, isMoreDataAvailable, photoNextByte, nullptr, nullptr);

  esp_camera_fb_return(fb);
  fb_length = NULL;
  fb_buffer = NULL;

}