Reputation: 3
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
#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();
}
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
Would I need to buy a new board with a memory card or is there still a way to do this one?
Upvotes: 0
Views: 399
Reputation: 89
Two things here: First, although the ESP32 Wrover module has 4Mb flash, by default 1.5Mb will be used for the SPIFFS partition and 1.2Mb or so will be kept for the APP partition. That's why it says "64.5% (used 845098 bytes from 1310720 bytes)". You have a few different partition schemes to choose from. Look at Tools > Partition Scheme
in the Arduino IDE. If you want you can even use a custom partition table as shown here.
Secondly, you don't actually need flash to hold your image. when you take images they are stored in RAM. The ESP32 has an option of having external PSRAM upto 8Mb. You'll have to select an ESP module that has enough PSRAM to accomodate your picture. You can find this setting in Tools > PSRAM
. If it doesn't show up for the Wrover module, select ESP32 Dev Module and it should be available.
Upvotes: 0