From d99d1c510f9b45ec8bd2e29082bc79c1ba794bb5 Mon Sep 17 00:00:00 2001 From: Rene Date: Sun, 10 Mar 2024 11:11:03 +0100 Subject: [PATCH] Merged from develop (Updated documentation) (#115) * Added seeed_xiao_esp32s3 * Fixed typo * Updating build system * Fixed typos * Renamed envirnment name to seeed_xiao_esp32s3 * Update README.md * Updated platformio definitions * Added cache * Updated README.md * - Default value for initResult if initialzation fails * constexpr camera_config_t m5stack_camera_settings * Added M5Stack UnitCamS3 * Work in progress * WIP * Work in progress * Removed OTA * Added unitcams3 * UnitcamS3 * Corrected HTML for ipv4 fixed Sewrial issue esp32s2 * USER_LED_ON_LEVEL=LOW * Added documentation pins for Mems/grove/led * Typo * Removed non required depencency * Removed non required depencency * Readded * Added sccb_i2c_port Retry 3 times camera init * Added Freenove wroom-1 n8r8 board (#112) Co-authored-by: Nick Eales * Fixing missing comma in xiao board json (#114) * Updated Markdown --------- Co-authored-by: absentwallaby <64674944+absentwallaby@users.noreply.github.com> Co-authored-by: Nick Eales Co-authored-by: Nick Volgas --- README.md | 58 +++++++++------ boards/esp32cam_ai_thinker.json | 3 +- .../esp32cam_espressif_esp32s2_cam_board.json | 7 +- ...esp32cam_espressif_esp32s2_cam_header.json | 8 ++- .../esp32cam_espressif_esp32s3_cam_lcd.json | 5 +- boards/esp32cam_espressif_esp32s3_eye.json | 5 +- boards/esp32cam_espressif_esp_eye.json | 5 +- boards/esp32cam_freenove_s3_wroom_n8r8.json | 70 +++++++++++++++++++ boards/esp32cam_freenove_wrover_kit.json | 5 +- boards/esp32cam_m5stack_camera.json | 3 +- boards/esp32cam_m5stack_camera_psram.json | 3 +- boards/esp32cam_m5stack_esp32cam.json | 3 +- boards/esp32cam_m5stack_unitcam.json | 5 +- boards/esp32cam_m5stack_unitcams3.json | 3 +- boards/esp32cam_m5stack_wide.json | 5 +- boards/esp32cam_seeed_xiao_esp32s3_sense.json | 3 +- boards/esp32cam_ttgo_t_camera.json | 1 + boards/esp32cam_ttgo_t_journal.json | 3 +- src/main.cpp | 22 +++--- 19 files changed, 164 insertions(+), 53 deletions(-) create mode 100644 boards/esp32cam_freenove_s3_wroom_n8r8.json diff --git a/README.md b/README.md index 4da7dc2..dff03fd 100644 --- a/README.md +++ b/README.md @@ -97,21 +97,21 @@ There are a lot of boards available that are all called ESP32-CAM. However, there are differences in CPU (type/speed/cores), how the camera is connected, presence of PSRAM or not... To select the right board use the table below and use the configuration that is listed below for your board: -| Board | Image | CPU | SRAM | Flash | PSRAM | Camera | | Site | -|--- |--- |--- |--- |--- | --- |--- |--- |--- | -| Espressif ESP32-Wrover CAM | ![img](assets/boards/esp32-wrover-cam.jpg) | ESP32 | 520KB | 4Mb | 4MB | OV2640 | | | -| AI-Thinker ESP32-CAM | ![img](assets/boards/ai-thinker-esp32-cam-ipex.jpg) ![img](assets/boards/ai-thinker-esp32-cam.jpg) | ESP32-S | 520KB | 4Mb | 4MB | OV2640 | | https://docs.ai-thinker.com/esp32-cam | -| Espressif ESP-EYE | ![img](assets/boards/espressif-esp-eye.jpg) | ESP32 | 520KB | 4Mb | 4MB | OV2640 | | | -| Espressif ESP-S3-EYE | ![img](assets/boards/espressif-esps3-eye.jpg) | ESP32-S3 | 520KB | 4Mb | 4MB | OV2640 | | https://www.espressif.com/en/products/devkits/esp-eye/overview | -| LilyGo camera module | ![img](assets/boards/lilygo-camera-module.jpg) | ESP32 Wrover | 520KB | 4Mb | 4MB | OV2640 / OV5640 | | | -| LilyGo Simcam | ![img](assets/boards/lilygo-simcam.jpg) | | | | | OV2640 | | | -| LilyGo TTGO-T Camera | ![img](assets/boards/lilygo-ttgo-t-camera.jpg) | | | | | OV2640 | | | -| M5Stack ESP32CAM | ![img](assets/boards/m5stack_esp32cam_02.webp) | ESP32 | 520Kb | 4Mb | - | OV2640 | Microphone | https://docs.m5stack.com/en/unit/esp32cam | -| M5Stack UnitCam | ![img](assets/boards/m5stack_unit_cam_02.webp) ![img](assets/boards/m5stack_unit_cam_03.webp) | ESP32-WROOM-32E | 520KB | 4Mb | - | OV2640 | | https://docs.m5stack.com/en/unit/unit_cam | -| M5Stack Camera | ![img](assets/boards/m5stack-esp32-camera.jpg) | ESP32 | 520Kb | 4Mb | - | OV2640 | | https://docs.m5stack.com/en/unit/m5camera | -| M5Stack Camera PSRAM | ![img](assets/boards/m5stack-esp32-camera.jpg) | ESP32 | 520Kb | 4Mb | 4Mb | OV2640 | | https://docs.m5stack.com/en/unit/m5camera | -| M5Stack UnitCamS3 | ![img](assets/boards//m5stack_Unitcams3.webp) ![img](assets/boards/m5stack_Unitcams32.webp) | ESP32-S3-WROOM-1-N16R8 | 520Kb | 16Mb | 8Mb | OV2640 | | https://docs.m5stack.com/en/unit/Unit-CamS3 | -| Seeed studio Xiao ESP32S3 Sense | ![img](assets/boards/seeed-studio-xiao-esp32s3-sense.jpg) | ESP32-S3R8 | 520KB | 8Mb | 8MB | OV2640 | Microphone | https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html | +| Board | Image | CPU | SRAM | Flash | PSRAM | Camera | | Site | +|--- |--- |--- |--- |--- | --- |--- |--- |--- | +| Espressif ESP32-Wrover CAM | ![img](assets/boards/esp32-wrover-cam.jpg) | ESP32 | 520KB | 4Mb | 4MB | OV2640 | | | +| AI-Thinker ESP32-CAM | ![img](assets/boards/ai-thinker-esp32-cam-ipex.jpg) ![img](assets/boards/ai-thinker-esp32-cam.jpg) | ESP32-S | 520KB | 4Mb | 4MB | OV2640 | | [https://docs.ai-thinker.com/esp32-cam](https://docs.ai-thinker.com/esp32-cam) | +| Espressif ESP-EYE | ![img](assets/boards/espressif-esp-eye.jpg) | ESP32 | 520KB | 4Mb | 4MB | OV2640 | | | +| Espressif ESP-S3-EYE | ![img](assets/boards/espressif-esps3-eye.jpg) | ESP32-S3 | 520KB | 4Mb | 4MB | OV2640 | | [https://www.espressif.com/en/products/devkits/esp-eye/overview](https://www.espressif.com/en/products/devkits/esp-eye/overview) | +| LilyGo camera module | ![img](assets/boards/lilygo-camera-module.jpg) | ESP32 Wrover | 520KB | 4Mb | 4MB | OV2640 / OV5640 | | | +| LilyGo Simcam | ![img](assets/boards/lilygo-simcam.jpg) | | | | | OV2640 | | | +| LilyGo TTGO-T Camera | ![img](assets/boards/lilygo-ttgo-t-camera.jpg) | | | | | OV2640 | | | +| M5Stack ESP32CAM | ![img](assets/boards/m5stack_esp32cam_02.webp) | ESP32 | 520Kb | 4Mb | - | OV2640 | Microphone | [https://docs.m5stack.com/en/unit/esp32cam](https://docs.m5stack.com/en/unit/esp32cam) | +| M5Stack UnitCam | ![img](assets/boards/m5stack_unit_cam_02.webp) ![img](assets/boards/m5stack_unit_cam_03.webp) | ESP32-WROOM-32E | 520KB | 4Mb | - | OV2640 | | [https://docs.m5stack.com/en/unit/unit_cam](https://docs.m5stack.com/en/unit/unit_cam) | +| M5Stack Camera | ![img](assets/boards/m5stack-esp32-camera.jpg) | ESP32 | 520Kb | 4Mb | - | OV2640 | | [https://docs.m5stack.com/en/unit/m5camera](https://docs.m5stack.com/en/unit/m5camera) | +| M5Stack Camera PSRAM | ![img](assets/boards/m5stack-esp32-camera.jpg) | ESP32 | 520Kb | 4Mb | 4Mb | OV2640 | | [https://docs.m5stack.com/en/unit/m5camera](https://docs.m5stack.com/en/unit/m5camera) | +| M5Stack UnitCamS3 | ![img](assets/boards//m5stack_Unitcams3.webp) ![img](assets/boards/m5stack_Unitcams32.webp) | ESP32-S3-WROOM-1-N16R8 | 520Kb | 16Mb | 8Mb | OV2640 | | [https://docs.m5stack.com/en/unit/Unit-CamS3](https://docs.m5stack.com/en/unit/Unit-CamS3) | +| Seeed studio Xiao ESP32S3 Sense | ![img](assets/boards/seeed-studio-xiao-esp32s3-sense.jpg) | ESP32-S3R8 | 520KB | 8Mb | 8MB | OV2640 | Microphone | [https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html](https://www.seeedstudio.com/XIAO-ESP32S3-Sense-p-5639.html) | ## Installing and running PlatformIO @@ -155,12 +155,24 @@ There are to flavours to do this; using the command line or the graphical interf ### Using the command line -First the source code has to be compiled. Type: +Make sure you have the latest version of the Espressif toolchain. + +```sh +pio pkg update -g -p espressif32 +``` + +First the source code has to be compiled to build all targets ```sh pio run ``` +if only a specific target is required, for example the ```esp32cam_ttgo_t_journal``` type: + +```sh +pio run -e esp32cam_ttgo_t_journal +``` + When finished, firmware has to be uploaded. Make sure the ESP32-CAM is in download mode (see previous section) and type: @@ -168,6 +180,12 @@ Make sure the ESP32-CAM is in download mode (see previous section) and type: pio run -t upload ``` +or, again, for a specific target, for example ```esp32cam_ai_thinker``` + +```sh +pio run -t upload -e esp32cam_ai_thinker +``` + When done remove the jumper when using a FTDI adapter or press the reset button on the ESP32-CAM. To monitor the output, start a terminal using: @@ -221,21 +239,21 @@ In case changes have been made to the configuration, this is shown and the possi Clicking on the ```change configuration``` button will open the configuration. It is possible that a password dialog is shown before entering. If this happens, for the user enter 'admin' and for the password the value that has been configured as the Access Point password. -## Connecting to the RTSP stream :video_camera: +## Connecting to the RTSP stream RTSP stream is available at: [rtsp://esp32cam-rtsp.local:554/mjpeg/1](rtsp://esp32cam-rtsp.local:554/mjpeg/1). This link can be opened with for example [VLC](https://www.videolan.org/vlc/). -## Connecting to the JPEG motion server :video_camera: +## Connecting to the JPEG motion server The JPEG motion server server is available using a normal web browser at: [http://esp32cam-rtsp.local:/stream](http://esp32cam-rtsp.local/stream). -## Connecting to the image server :camera: +## Connecting to the image server The image server server is available using a normal web browser at: [http://esp32cam-rtsp.local:/snapshot](http://esp32cam-rtsp.local/snapshot). :bangbang: **Please be aware that there is no password present!**. -Everybody with access to the device can see the streams or images! Beware of :trollface:! +Everybody with network access to the device can see the streams or images! Beware of :trollface:! ## API diff --git a/boards/esp32cam_ai_thinker.json b/boards/esp32cam_ai_thinker.json index 7db7f1d..5c5fa8c 100644 --- a/boards/esp32cam_ai_thinker.json +++ b/boards/esp32cam_ai_thinker.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/boards/esp32cam_espressif_esp32s2_cam_board.json b/boards/esp32cam_espressif_esp32s2_cam_board.json index 725fa48..7786c52 100644 --- a/boards/esp32cam_espressif_esp32s2_cam_board.json +++ b/boards/esp32cam_espressif_esp32s2_cam_board.json @@ -1,6 +1,6 @@ { "build": { - "arduino":{ + "arduino": { "ldscript": "esp32s2_out.ld" }, "core": "esp32", @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" ], + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", @@ -58,4 +59,4 @@ }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp-lyrap-cam-v1.1.html", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp32s2_cam_header.json b/boards/esp32cam_espressif_esp32s2_cam_header.json index 347264f..212d0a9 100644 --- a/boards/esp32cam_espressif_esp32s2_cam_header.json +++ b/boards/esp32cam_espressif_esp32s2_cam_header.json @@ -1,6 +1,6 @@ { "build": { - "arduino":{ + "arduino": { "ldscript": "esp32s2_out.ld" }, "core": "esp32", @@ -31,7 +31,9 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" ], + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" + ], "f_cpu": "240000000L", "f_flash": "80000000L", "flash_mode": "qio", @@ -58,4 +60,4 @@ }, "url": "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/hw-reference/esp32s2/user-guide-esp-lyrap-cam-v1.1.html", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp32s3_cam_lcd.json b/boards/esp32cam_espressif_esp32s3_cam_lcd.json index a847749..b07fd23 100644 --- a/boards/esp32cam_espressif_esp32s3_cam_lcd.json +++ b/boards/esp32cam_espressif_esp32s3_cam_lcd.json @@ -33,7 +33,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "80000000L", @@ -68,4 +69,4 @@ }, "url": "https://www.espressif.com/en/news/Maple_Eye_ESP32-S3", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp32s3_eye.json b/boards/esp32cam_espressif_esp32s3_eye.json index b67514d..a65ccbb 100644 --- a/boards/esp32cam_espressif_esp32s3_eye.json +++ b/boards/esp32cam_espressif_esp32s3_eye.json @@ -33,7 +33,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "80000000L", @@ -72,4 +73,4 @@ }, "url": "https://www.espressif.com/en/products/devkits/esp-eye/overview", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_espressif_esp_eye.json b/boards/esp32cam_espressif_esp_eye.json index c22f0e1..2b6a722 100644 --- a/boards/esp32cam_espressif_esp_eye.json +++ b/boards/esp32cam_espressif_esp_eye.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", @@ -62,4 +63,4 @@ }, "url": "https://www.espressif.com/en/products/devkits/esp-eye/overview", "vendor": "Espressif" -} +} \ No newline at end of file diff --git a/boards/esp32cam_freenove_s3_wroom_n8r8.json b/boards/esp32cam_freenove_s3_wroom_n8r8.json new file mode 100644 index 0000000..f924ca1 --- /dev/null +++ b/boards/esp32cam_freenove_s3_wroom_n8r8.json @@ -0,0 +1,70 @@ +{ + "build": { + "arduino": { + "ldscript": "esp32s3_out.ld", + "partitions": "default_8MB.csv", + "memory_type": "qio_opi" + }, + "core": "esp32", + "extra_flags": [ + "'-D ARDUINO_ESP32S3_DEV'", + "'-D ARDUINO_USB_MODE=1'", + "'-D BOARD_HAS_PSRAM'", + "'-D ARDUINO_RUNNING_CORE=1'", + "'-D ARDUINO_EVENT_RUNNING_CORE=1'", + "'-D ARDUINO_USB_CDC_ON_BOOT=1'", + "'-D CAMERA_CONFIG_PIN_PWDN=GPIO_NUM_NC'", + "'-D CAMERA_CONFIG_PIN_RESET=GPIO_NUM_NC'", + "'-D CAMERA_CONFIG_PIN_XCLK=15'", + "'-D CAMERA_CONFIG_PIN_SCCB_SDA=4'", + "'-D CAMERA_CONFIG_PIN_SCCB_SCL=5'", + "'-D CAMERA_CONFIG_PIN_Y9=16'", + "'-D CAMERA_CONFIG_PIN_Y8=17'", + "'-D CAMERA_CONFIG_PIN_Y7=18'", + "'-D CAMERA_CONFIG_PIN_Y6=12'", + "'-D CAMERA_CONFIG_PIN_Y5=10'", + "'-D CAMERA_CONFIG_PIN_Y4=8'", + "'-D CAMERA_CONFIG_PIN_Y3=9'", + "'-D CAMERA_CONFIG_PIN_Y2=11'", + "'-D CAMERA_CONFIG_PIN_VSYNC=6'", + "'-D CAMERA_CONFIG_PIN_HREF=7'", + "'-D CAMERA_CONFIG_PIN_PCLK=13'", + "'-D CAMERA_CONFIG_CLK_FREQ_HZ=20000000'", + "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", + "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", + "'-D CAMERA_CONFIG_FB_COUNT=2'", + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + ], + "f_cpu": "240000000L", + "f_flash": "80000000L", + "flash_mode": "dio", + "hwids": [ + [ + "0x303A", + "0x1001" + ] + ], + "mcu": "esp32s3", + "variant": "esp32s3" + }, + "connectivity": [ + "wifi" + ], + "debug": { + "openocd_target": "esp32s3.cfg" + }, + "frameworks": [ + "arduino", + "espidf" + ], + "name": "ESP32 FREENOVE S3 WROOM", + "upload": { + "flash_size": "4MB", + "maximum_ram_size": 327680, + "maximum_size": 4194304, + "require_upload_port": true, + "speed": 460800 + }, + "url": "https://github.com/Freenove/Freenove_ESP32_S3_WROOM_Board", + "vendor": "Freenove" +} diff --git a/boards/esp32cam_freenove_wrover_kit.json b/boards/esp32cam_freenove_wrover_kit.json index 14099ff..3c9b5dd 100644 --- a/boards/esp32cam_freenove_wrover_kit.json +++ b/boards/esp32cam_freenove_wrover_kit.json @@ -31,7 +31,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", @@ -62,4 +63,4 @@ }, "url": "https://www.aliexpress.com/item/1005004960637276.html", "vendor": "Freenove" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_camera.json b/boards/esp32cam_m5stack_camera.json index cc62530..3c242c2 100644 --- a/boards/esp32cam_m5stack_camera.json +++ b/boards/esp32cam_m5stack_camera.json @@ -28,6 +28,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" ], @@ -60,4 +61,4 @@ }, "url": "https://docs.m5stack.com/en/unit/m5camera", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_camera_psram.json b/boards/esp32cam_m5stack_camera_psram.json index 00f47de..155dfaf 100644 --- a/boards/esp32cam_m5stack_camera_psram.json +++ b/boards/esp32cam_m5stack_camera_psram.json @@ -30,6 +30,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" ], @@ -62,4 +63,4 @@ }, "url": "https://docs.m5stack.com/en/unit/m5camera", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_esp32cam.json b/boards/esp32cam_m5stack_esp32cam.json index 8d726dc..02f7130 100644 --- a/boards/esp32cam_m5stack_esp32cam.json +++ b/boards/esp32cam_m5stack_esp32cam.json @@ -32,6 +32,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D MICROPHONE_GPIO=32'", "'-D GROVE_SDA=13'", "'-D GROVE_SCL=4'" @@ -65,4 +66,4 @@ }, "url": "https://docs.m5stack.com/en/unit/esp32cam", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_unitcam.json b/boards/esp32cam_m5stack_unitcam.json index b11599e..92672be 100644 --- a/boards/esp32cam_m5stack_unitcam.json +++ b/boards/esp32cam_m5stack_unitcam.json @@ -29,7 +29,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", @@ -60,4 +61,4 @@ }, "url": "https://docs.m5stack.com/en/unit/unit_cam", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_unitcams3.json b/boards/esp32cam_m5stack_unitcams3.json index 7926893..c29cc6c 100644 --- a/boards/esp32cam_m5stack_unitcams3.json +++ b/boards/esp32cam_m5stack_unitcams3.json @@ -36,6 +36,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'", "'-D I2C_MEMS_SDA=48'", "'-D I2C_MEMS_SCL=47'", "'-D TF_CS=9'", @@ -80,4 +81,4 @@ }, "url": "https://docs.m5stack.com/en/unit/Unit-CamS3", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_m5stack_wide.json b/boards/esp32cam_m5stack_wide.json index df425dd..d502897 100644 --- a/boards/esp32cam_m5stack_wide.json +++ b/boards/esp32cam_m5stack_wide.json @@ -29,7 +29,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", @@ -60,4 +61,4 @@ }, "url": "https://shop.m5stack.com/collections/m5-cameras", "vendor": "M5STACK" -} +} \ No newline at end of file diff --git a/boards/esp32cam_seeed_xiao_esp32s3_sense.json b/boards/esp32cam_seeed_xiao_esp32s3_sense.json index fa36d88..ee742bc 100644 --- a/boards/esp32cam_seeed_xiao_esp32s3_sense.json +++ b/boards/esp32cam_seeed_xiao_esp32s3_sense.json @@ -36,6 +36,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=2'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_PSRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'", "'-D I2C_MEMS_SDA=41'", "'-D I2C_MEMS_SCL=42'", "'-D TF_CS=21'", @@ -80,4 +81,4 @@ }, "url": "https://www.seeedstudio.com/XIAO-ESP32S3-p-5627.html", "vendor": "Seeed Studio" -} +} \ No newline at end of file diff --git a/boards/esp32cam_ttgo_t_camera.json b/boards/esp32cam_ttgo_t_camera.json index 1f693f3..255d569 100644 --- a/boards/esp32cam_ttgo_t_camera.json +++ b/boards/esp32cam_ttgo_t_camera.json @@ -28,6 +28,7 @@ "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" "'-D LCD_SSD1306_PIN_SDA=21'", "'-D LCD_SSD1306_PIN_SCL=22'", "'-D BUTTON_RIGHT_PIN=34'", diff --git a/boards/esp32cam_ttgo_t_journal.json b/boards/esp32cam_ttgo_t_journal.json index 885d5c0..928ae27 100644 --- a/boards/esp32cam_ttgo_t_journal.json +++ b/boards/esp32cam_ttgo_t_journal.json @@ -27,7 +27,8 @@ "'-D CAMERA_CONFIG_LEDC_TIMER=LEDC_TIMER_0'", "'-D CAMERA_CONFIG_LEDC_CHANNEL=LEDC_CHANNEL_0'", "'-D CAMERA_CONFIG_FB_COUNT=1'", - "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'" + "'-D CAMERA_CONFIG_FB_LOCATION=CAMERA_FB_IN_DRAM'", + "'-D SCCB_I2C_PORT=I2C_NUM_0'" ], "f_cpu": "240000000L", "f_flash": "40000000L", diff --git a/src/main.cpp b/src/main.cpp index 9b95f41..6ce0471 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -219,8 +219,6 @@ esp_err_t initialize_camera() log_i("JPEG quality: %d", param_jpg_quality.value()); auto jpeg_quality = param_jpg_quality.value(); log_i("Frame duration: %d ms", param_frame_duration.value()); - constexpr auto i2c_port = I2C_NUM_0; - camera_config_t camera_config = { .pin_pwdn = CAMERA_CONFIG_PIN_PWDN, // GPIO pin for camera power down line .pin_reset = CAMERA_CONFIG_PIN_RESET, // GPIO pin for camera reset line @@ -250,7 +248,7 @@ esp_err_t initialize_camera() #if CONFIG_CAMERA_CONVERTER_ENABLED conv_mode = CONV_DISABLE, // RGB<->YUV Conversion mode #endif - .sccb_i2c_port = i2c_port // If pin_sccb_sda is -1, use the already configured I2C bus by number + .sccb_i2c_port = SCCB_I2C_PORT // If pin_sccb_sda is -1, use the already configured I2C bus by number }; return cam.init(camera_config); @@ -380,11 +378,19 @@ void setup() #endif iotWebConf.init(); - camera_init_result = initialize_camera(); - if (camera_init_result == ESP_OK) - update_camera_settings(); - else - log_e("Failed to initialize camera: 0x%0x. Frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value()); + // Try to initialize 3 times + for (auto i = 0; i < 3; i++) + { + camera_init_result = initialize_camera(); + if (camera_init_result == ESP_OK) + { + update_camera_settings(); + break; + } + + log_e("Failed to initialize camera. Error: 0x%0x. Frame size: %s, frame rate: %d ms, jpeg quality: %d", camera_init_result, param_frame_size.value(), param_frame_duration.value(), param_jpg_quality.value()); + delay(500); + } // Set up required URL handlers on the web server web_server.on("/", HTTP_GET, handle_root);