Adsense HTML/JavaScript

Friday, October 29, 2021

arduino-esp32 CameraWebServer example, run on ESP32-S2-Saola-1 with ov2640

This post show how to run arduino-esp32 CameraWebServer example on ESP32-S2-Saola-1 with ov2640 camera.


For convenience, I connect ov2640 pins all in one side of ESP32-S2-Saola-1:

Connection between ESP32-S2-Saola-1 and ov2640

	ov2640
	+-----------+
3V3	|3V3	GND |	GND
IO9	|SIOC	SIOD|	IO1
IO10	|VSYNC	HREF|	IO2
IO11	|PCLK	XCLK|	IO3
IO12	|D9	D8  |	IO4
IO13	|D7	D6  |	IO5
IO14	|D5	D4  |	IO6
IO15	|D3	D2  |	IO7
IO16	|RESET	PWDN|	-
-	|D1	D0  |	-
	+-----------+
		
ESP32-S2-Saola-1
------+
 GND  |	- cam.GND
 5V   |
 IO17 |
 IO16 | - cam.RESET
 IO15 |	- cam.D3
 IO14 |	- cam.D5
 IO13 |	- cam.D7
 IO12 |	- cam.D9
 IO11 |	- cam.PCLK
 IO10 |	- cam.VSYNC
 IO9  |	- cam.SIOC
 IO8  |
 IO7  |	- cam.D2
 IO6  |	- cam.D4
 IO5  |	- cam.D6
 IO4  |	- cam.D8
 IO3  |	- cam.XCLK
 IO2  | - cam.HREF
 IO1  |	- cam.SIOD
 IO0  |
 3V3  |	- cam.3V3
------+
 
*cam.SIOC/SIOD are I2C-like control pins, pull-up resistors are needed.
 I use 2K ohm resistor for it.

To program ESP32-S2 on Arduino IDE, arduino-esp32 2.0.0 is needed. Select board of "ESP32S2 Dev Module".

Load CameraServer example:
Click on Menu : File > Examples > ESP32 > Camera > CameraWebServer

Edit camera_pins.h, update pins definition to match connection:

// for ESP32-S2-Saola-1/ov2640
#define PWDN_GPIO_NUM    -1
#define RESET_GPIO_NUM   16
#define XCLK_GPIO_NUM    3
#define SIOD_GPIO_NUM    1
#define SIOC_GPIO_NUM    9

#define Y9_GPIO_NUM      12
#define Y8_GPIO_NUM      4
#define Y7_GPIO_NUM      13
#define Y6_GPIO_NUM      5
#define Y5_GPIO_NUM      14
#define Y4_GPIO_NUM      6
#define Y3_GPIO_NUM      15
#define Y2_GPIO_NUM      7
#define VSYNC_GPIO_NUM   10
#define HREF_GPIO_NUM    2
#define PCLK_GPIO_NUM    11


Update ssid/password in your main code for your WiFi network.


Upload to board, if fail with error of "frame buffer malloc failed", Select PSRAM option to "Enabled".


If success, you can open browser (in the same WiFi network) to visit the CameraServer.







No comments:

Post a Comment