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 = "Mod edit credentials removed";
const char* password = "Mod edit credentials removed";
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
guix
June 7, 2023, 5:50pm
2
Hello
Look in menu Tools->Partition scheme
Most ESP32 cams come with 8MB of ram. 4MB used by the MCU and 4MB of PSRAM used to store the image.
I'm using VSCode with PlatformIO
PLATFORM: Espressif 32 (3.5.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 13.2% (used 43184 bytes from 327680 bytes)
Flash: [====== ] 64.5% (used 845098 bytes from 1310720 bytes)
Are you using a ESP32cam? or a regular ESP32? If you are using a ESP32CAM you may need to select a ESP32 cam option.
If you use the Arduino IDE, select an ESP32 board with the PSRAM option.
This tutorial is helpful: ESP32-CAM Video Streaming Web Server (works with Home Assistant) | Random Nerd Tutorials
Have you tried to select a ESP32cam board to upload to?
I haven't tried it because it's not my board, shouldn't I use the board I bought correctly?
Sounds like you have to enable the psram, the extra 4mb..
let's see if that's the case..
#include <WiFi.h>
#include <ESP_WiFiManager.h>
#include <esp_camera.h>
#include <WiFiServer.h>
const char* ssid = "Mod edit credentials removed";
const char* password = "Mod edit credentials removed";
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;
if(psramFound()){
//if we have additional ram
Serial.println("Using PSRAM..");
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
//no extra ram, lower res and 1 frame buffer
Serial.println("PSRAM not found..");
config.frame_size = FRAMESIZE_CIF;
config.jpeg_quality = 12;
config.fb_count = 1;
}
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();
}
small changes to camera config..
got mine going at the large res, just over 100k for each image, takes a bit to transfer too..
i am using Cam Viewer and the sketch in esptest..
have my board set to ESP32 Dev module as I wanted to be able to OTA it but also works as AI thinker..
When selecting ESP32 Dev module, the psram was disabled by default had to enable it..
good luck.. ~q
I managed to change the card, it was 4mb of flash.
I would like to know if there is a way to send the photo to the clipboard, that is, I access the ESP IP, it takes the photo and sends it to the clipbord, so I would just open the image editing program and give control + V?
system
Closed
December 5, 2023, 6:18pm
14
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.