ESP32 WROVER - Lack of Photo Memory
Posted: Wed Jun 07, 2023 5:49 pm
Good afternoon everyone, how are you?
I'm using an ESP32 WROVER
I just need to put it on the network and take a picture (good quality)
In the description it says that the card has 4mb flash memory, but when I go to record it appears as follows Flash: [====== ] 64.5% (used 845098 bytes from 1310720 bytes) that is, it has only 1.3mb
A high resolution photo needs 1mb, but as it has no memory, it gives an error.
Follow my program
I was disappointed because I thought that this board would be able to take only 1 photo in good resolution. Is there still a way to do this? or would I need to buy the card that comes with space to put a memory card?
Thanks
I'm using an ESP32 WROVER
I just need to put it on the network and take a picture (good quality)
In the description it says that the card has 4mb flash memory, but when I go to record it appears as follows Flash: [====== ] 64.5% (used 845098 bytes from 1310720 bytes) that is, it has only 1.3mb
A high resolution photo needs 1mb, but as it has no memory, it gives an error.
Follow my program
Code: Select all
#include <WiFi.h>
#include <ESP_WiFiManager.h>
#include <esp_camera.h>
#include <WiFiServer.h>
const char* ssid = "ESP_Laser";
const char* password = "Laser123";
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(10);
ESP_WiFiManager WiFiManager;
WiFiManager.setConfigPortalTimeout(240);
if (!WiFiManager.autoConnect(ssid, password)) {
Serial.println("Falha na conexao. Resetar e tentar novamente...");
delay(3000);
ESP.restart();
delay(5000);
}
Serial.println("Conectado na rede WiFi.");
Serial.print("Endereco IP: ");
Serial.println(WiFi.localIP());
camera_config_t config;
config.pin_pwdn = -1;
config.pin_reset = -1;
config.pin_xclk = 21;
config.pin_sscb_sda = 26;
config.pin_sscb_scl = 27;
config.pin_d7 = 35;
config.pin_d6 = 34;
config.pin_d5 = 39;
config.pin_d4 = 36;
config.pin_d3 = 19;
config.pin_d2 = 18;
config.pin_d1 = 5;
config.pin_d0 = 4;
config.pin_vsync = 25;
config.pin_href = 23;
config.pin_pclk = 22;
config.xclk_freq_hz = 20000000;
config.ledc_timer = LEDC_TIMER_0;
config.ledc_channel = LEDC_CHANNEL_0;
config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
esp_err_t cameraInitError = esp_camera_init(&config);
if (cameraInitError != ESP_OK) {
Serial.printf("Falha na inicialização da câmera! (erro 0x%x)\n", cameraInitError);
return;
}
server.begin();
Serial.println("Servidor iniciado.");
}
void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}
Serial.println("Novo cliente conectado.");
camera_fb_t* fb = esp_camera_fb_get();
if (!fb) {
client.println("HTTP/1.1 500 Internal Server Error");
client.println("Content-type:text/html");
client.println();
client.println("<html><body><h1>Erro ao capturar imagem</h1></body></html>");
delay(1);
client.stop();
return;
}
client.println("HTTP/1.1 200 OK");
client.println("Content-type:image/jpeg");
client.println("Connection: close");
client.println();
client.write(fb->buf, fb->len);
esp_camera_fb_return(fb);
delay(1);
client.stop();
}
Thanks