Skip to content

Commit

Permalink
Merge branch 'develop' into 106-create-new-rtsp-server
Browse files Browse the repository at this point in the history
  • Loading branch information
rzeldent committed Mar 19, 2024
2 parents 86ae9af + fe7195c commit c2dcd8b
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 48 deletions.
58 changes: 38 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -155,19 +155,37 @@ 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:

```sh
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:

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion boards/esp32cam_espressif_esp32s3_cam_lcd.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@
},
"url": "https://www.espressif.com/en/news/Maple_Eye_ESP32-S3",
"vendor": "Espressif"
}
}
2 changes: 1 addition & 1 deletion boards/esp32cam_espressif_esp32s3_eye.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
},
"url": "https://www.espressif.com/en/products/devkits/esp-eye/overview",
"vendor": "Espressif"
}
}
70 changes: 70 additions & 0 deletions boards/esp32cam_freenove_s3_wroom_n8r8.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion boards/esp32cam_freenove_wrover_kit.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
},
"url": "https://www.aliexpress.com/item/1005004960637276.html",
"vendor": "Freenove"
}
}
2 changes: 1 addition & 1 deletion boards/esp32cam_m5stack_camera_psram.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
},
"url": "https://docs.m5stack.com/en/unit/m5camera",
"vendor": "M5STACK"
}
}
26 changes: 13 additions & 13 deletions boards/esp32cam_m5stack_unitcams3.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
"'-D CAMERA_CONFIG_PIN_XCLK=11'",
"'-D CAMERA_CONFIG_PIN_SCCB_SDA=17'",
"'-D CAMERA_CONFIG_PIN_SCCB_SCL=41'",
"'-D CAMERA_CONFIG_PIN_Y9=35'",
"'-D CAMERA_CONFIG_PIN_Y8=34'",
"'-D CAMERA_CONFIG_PIN_Y7=39'",
"'-D CAMERA_CONFIG_PIN_Y6=36'",
"'-D CAMERA_CONFIG_PIN_Y5=19'",
"'-D CAMERA_CONFIG_PIN_Y4=18'",
"'-D CAMERA_CONFIG_PIN_Y3=5'",
"'-D CAMERA_CONFIG_PIN_Y2=4'",
"'-D CAMERA_CONFIG_PIN_VSYNC=25'",
"'-D CAMERA_CONFIG_PIN_HREF=23'",
"'-D CAMERA_CONFIG_PIN_PCLK=22'",
"'-D CAMERA_CONFIG_PIN_Y9=13'",
"'-D CAMERA_CONFIG_PIN_Y8=4'",
"'-D CAMERA_CONFIG_PIN_Y7=10'",
"'-D CAMERA_CONFIG_PIN_Y6=5'",
"'-D CAMERA_CONFIG_PIN_Y5=7'",
"'-D CAMERA_CONFIG_PIN_Y4=16'",
"'-D CAMERA_CONFIG_PIN_Y3=15'",
"'-D CAMERA_CONFIG_PIN_Y2=6'",
"'-D CAMERA_CONFIG_PIN_VSYNC=42'",
"'-D CAMERA_CONFIG_PIN_HREF=18'",
"'-D CAMERA_CONFIG_PIN_PCLK=12'",
"'-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_DRAM'",
"'-D CAMERA_CONFIG_SCCB_I2C_PORT=I2C_NUM_0'",
"'-D I2C_MEMS_SDA=48'",
"'-D I2C_MEMS_SCL=47'",
"'-D I2C_MEMS_SDA=17'",
"'-D I2C_MEMS_SCL=41'",
"'-D TF_CS=9'",
"'-D TF_MOSI=38'",
"'-D TF_CLK=39'",
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

###############################################################################
[platformio]
default_envs = esp32cam_ai_thinker
#default_envs = esp32cam_ai_thinker
#default_envs = esp32cam_espressif_esp_eye
#default_envs = esp32cam_espressif_esp32s2_cam_board
#default_envs = esp32cam_espressif_esp32s2_cam_header
Expand Down
16 changes: 6 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ esp_err_t initialize_camera()
{
log_v("initialize_camera");

constexpr auto pixformat = PIXFORMAT_JPEG;
log_i("Frame size: %s", param_frame_size.value());
auto frame_size = lookup_frame_size(param_frame_size.value());
log_i("JPEG quality: %d", param_jpg_quality.value());
Expand Down Expand Up @@ -250,7 +249,7 @@ esp_err_t initialize_camera()
.xclk_freq_hz = CAMERA_CONFIG_CLK_FREQ_HZ, // Frequency of XCLK signal, in Hz. EXPERIMENTAL: Set to 16MHz on ESP32-S2 or ESP32-S3 to enable EDMA mode
.ledc_timer = CAMERA_CONFIG_LEDC_TIMER, // LEDC timer to be used for generating XCLK
.ledc_channel = CAMERA_CONFIG_LEDC_CHANNEL, // LEDC channel to be used for generating XCLK
.pixel_format = pixformat, // Format of the pixel data: PIXFORMAT_ + YUV422|GRAYSCALE|RGB565|JPEG
.pixel_format = PIXFORMAT_JPEG, // Format of the pixel data: PIXFORMAT_ + YUV422|GRAYSCALE|RGB565|JPEG
.frame_size = frame_size, // Size of the output image: FRAMESIZE_ + QVGA|CIF|VGA|SVGA|XGA|SXGA|UXGA
.jpeg_quality = jpeg_quality, // Quality of JPEG output. 0-63 lower means higher quality
.fb_count = CAMERA_CONFIG_FB_COUNT, // Number of frame buffers to be allocated. If more than one, then each frame will be acquired (double speed)
Expand Down Expand Up @@ -351,11 +350,8 @@ void setup()
log_i("Board: %s", BOARD_NAME);
log_i("Starting " APP_TITLE "...");

if (CAMERA_CONFIG_FB_LOCATION == CAMERA_FB_IN_PSRAM)
{
if (!psramInit())
log_e("Failed to initialize PSRAM");
}
if (CAMERA_CONFIG_FB_LOCATION == CAMERA_FB_IN_PSRAM && !psramInit())
log_e("Failed to initialize PSRAM");

param_group_camera.addItem(&param_frame_duration);
param_group_camera.addItem(&param_frame_size);
Expand Down Expand Up @@ -403,6 +399,7 @@ void setup()
if (camera_init_result == ESP_OK)
break;

esp_camera_deinit();
log_e("Failed to initialize camera. Error: 0x%04x. 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);
}
Expand All @@ -426,7 +423,6 @@ void loop()
{
iotWebConf.doLoop();

server.loop();

sleep(0);
if (camera_server)
camera_server->doLoop();
}

0 comments on commit c2dcd8b

Please sign in to comment.