Notifications
Clear all
ESP32-S3 CAM
Dec 11, 2025 10:02 am
Member
Joined: 2 years ago
[#75]
Product Link: https://diycnc.ca/product/esp32-s3-cam-dev-board-with-ov5640/
CAM: OV5640
Test environment: Arduino IDE
- Select 'ESP32S3 Dev Module'
- Enable PSRAM (ODI PSRAM)
Sample code: (Refer: Exsamples -> ESP32 -> Camera -> CameraWebServer
#include <Arduino.h>
#include "esp_camera.h"
#include <WiFi.h>
const char *ssid = "wifi name";
const char *password = "wifi password";
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 15
#define SIOD_GPIO_NUM 4
#define SIOC_GPIO_NUM 5
#define Y9_GPIO_NUM 16
#define Y8_GPIO_NUM 17
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 12
#define Y5_GPIO_NUM 10
#define Y4_GPIO_NUM 8
#define Y3_GPIO_NUM 9
#define Y2_GPIO_NUM 11
#define VSYNC_GPIO_NUM 6
#define HREF_GPIO_NUM 7
#define PCLK_GPIO_NUM 13
void startCameraServer();
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
Serial.println();
Serial.println("=== ESP32-S3 Camera ===");
if (psramFound()) {
Serial.println("PSRAM: YES");
Serial.printf("PSRAM size: %u bytes\n", ESP.getPsramSize());
Serial.printf("Free PSRAM: %u bytes\n", ESP.getFreePsram());
} else {
Serial.println("PSRAM: NO");
}
camera_config_t config;
config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.frame_size = FRAMESIZE_XGA;
config.pixel_format = PIXFORMAT_JPEG;
config.jpeg_quality = 8;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST;
Serial.println("Initializing camera...");
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x\n", err);
return;
}
sensor_t *s = esp_camera_sensor_get();
if (s == NULL) {
Serial.println("ERROR: Camera sensor not found");
return;
}
Serial.printf("Camera PID: %u (0x%04X)\n", s->id.PID, s->id.PID);
if (s->id.PID == OV5640_PID) {
Serial.println("Camera: OV5640");
s->set_hmirror(s, 1);
s->set_brightness(s, 1);
s->set_saturation(s, -2);
}
Serial.printf("Frame size: %d\n", s->status.framesize);
Serial.printf("JPEG quality: %d\n", s->status.quality);
Serial.printf("Free PSRAM after camera init: %u bytes\n", ESP.getFreePsram());
WiFi.begin(ssid, password);
WiFi.setSleep(false);
Serial.print("WiFi connecting");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
Serial.println("WiFi connected");
startCameraServer();
Serial.print("Camera Ready! Use 'http://");
Serial.print(WiFi.localIP());
Serial.println("' to connect");
}
void loop() {
delay(10000);
}
This topic was modified 7 hours ago by Ray
Forum Information
Our newest member: marc montminy
Latest Post: ESP32-S3 CAM
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed
