1、安装arduino
https://www.arduino.cc/en/Main/Software?setlang=cn
根据需要下载所需版本并安装;
运行下;
只有默认的arduino配套的开发板;
2、配置esp32
打开首选项
配置esp库url
https://dl.espressif.com/dl/package_esp32_index.json
配置开发板
根据esp32搜索选中安装;
文件比较大下载比较慢,如果有需要请翻墙处理;
安装完成就可以选择esp32开发板了。
3、配置编译tools
C:\Program Files (x86)\Arduino\hardware
建立目录espressif/esp32
https://github.com/espressif/arduino-esp32
下载文件然后复制到目录;
然后找到执行下,机器需要python环境;
下载需要时间;
4、体验测试;
选择开发板类型
选择sample程序
修改摄像头类型;改成安信可esp32-cam
// Select camera model
//#define CAMERA_MODEL_WROVER_KIT
//#define CAMERA_MODEL_M5STACK_PSRAM
#define CAMERA_MODEL_AI_THINKER
配置wifi
const char* ssid = "HI-WOOYA_471D";
const char* password = "12345678";
编译
选择项目菜单,编译/验证试试看;
运行成功;
烧录固件;
选择esp32-cam对应的串口;
选择菜单上传;
需要把烧录的接口接gnd,然后触发reset下;然后就看到编译后开始烧录了;
出现下面提示烧录完成;
5、测试效果;
arduino的串口调试不够方便,推荐友善调试助手;
把烧录的 杜邦线拿掉;
reset下;
[17:36:35.541] ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4
[17:36:37.594]
[17:36:39.044] .
[17:36:39.551] .
WiFi connected
Starting web server on port: '80'
Starting stream server on port: '81'
Camera Ready! Use 'http://192.168.1.126' to connect
根据提示的ip地址访问下,要连接同一个wifi;
视频就是连接输出更多的图片;图片越大延时越大;
[17:40:29.055] MJPG: 45493B 168ms (6.0fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:29.211] MJPG: 45793B 155ms (6.5fps), AVG: 253ms (4.0fps), 0+0+0+0=0 0
[17:40:29.370] MJPG: 46325B 159ms (6.3fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:29.567] MJPG: 46507B 196ms (5.1fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:29.681] MJPG: 46692B 116ms (8.6fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:29.860] MJPG: 47077B 176ms (5.7fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:30.010] MJPG: 47449B 149ms (6.7fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:30.168] MJPG: 47684B 157ms (6.4fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:30.330] MJPG: 48014B 166ms (6.0fps), AVG: 256ms (3.9fps), 0+0+0+0=0 0
[17:40:30.488] MJPG: 48215B 157ms (6.4fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:30.648] MJPG: 48396B 160ms (6.2fps), AVG: 256ms (3.9fps), 0+0+0+0=0 0
[17:40:30.811] MJPG: 48359B 159ms (6.3fps), AVG: 255ms (3.9fps), 0+0+0+0=0 0
[17:40:30.970] MJPG: 48432B 163ms (6.1fps), AVG: 254ms (3.9fps), 0+0+0+0=0 0
[17:40:31.139] MJPG: 48454B 168ms (6.0fps), AVG: 256ms (3.9fps), 0+0+0+0=0 0
[17:40:31.296] MJPG: 48644B 154ms (6.5fps), AVG: 256ms (3.9fps), 0+0+0+0=0 0
[17:40:31.451] MJPG: 48676B 153ms (6.5fps), AVG: 160ms (6.2fps), 0+0+0+0=0 0
[17:40:31.610] MJPG: 48759B 162ms (6.2fps), AVG: 165ms (6.1fps), 0+0+0+0=0 0
[17:40:31.797] MJPG: 48763B 183ms (5.5fps), AVG: 161ms (6.2fps), 0+0+0+0=0 0
[17:40:31.928] MJPG: 48757B 131ms (7.6fps), AVG: 159ms (6.3fps), 0+0+0+0=0 0
[17:40:32.100] MJPG: 48791B 175ms (5.7fps), AVG: 160ms (6.2fps), 0+0+0+0=0 0
[17:40:32.249] MJPG: 48805B 144ms (6.9fps), AVG: 159ms (6.3fps), 0+0+0+0=0 0
[17:40:32.418] MJPG: 48861B 167ms (6.0fps), AVG: 159ms (6.3fps), 0+0+0+0=0 0
[17:40:32.569] MJPG: 48839B 156ms (6.4fps), AVG: 159ms (6.3fps), 0+0+0+0=0 0
[17:40:32.747] MJPG: 48830B 173ms (5.8fps), AVG: 158ms (6.3fps), 0+0+0+0=0 0
[17:40:34.268] MJPG: 48848B 1526ms (0.7fps), AVG: 228ms (4.4fps), 0+0+0+0=0 0
[17:40:34.348] MJPG: 48822B 75ms (13.3fps), AVG: 223ms (4.5fps), 0+0+0+0=0 0
[17:40:34.660] MJPG: 48825B 311ms (3.2fps), AVG: 232ms (4.3fps), 0+0+0+0=0 0
[17:40:34.817] MJPG: 49600B 158ms (6.3fps), AVG: 232ms (4.3fps), 0+0+0+0=0 0
[17:40:34.978] MJPG: 48805B 160ms (6.2fps), AVG: 231ms (4.3fps), 0+0+0+0=0 0
可以调节各种参数,亮度、白平衡。
esp32-cam竟然还能人脸识别,超厉害;
6、扩展
可以抓图或者人脸识别传送后台服务器;
比如采用sim800l类似的透传芯片;
https://github.com/carrascoacd/ArduinoSIM800L
通过at指令发送数据亦可;
https://github.com/erdemarslan/GSMSim
也可以跑mqtt;
https://github.com/martinhol221/SIM800L_MQTT
nb-iot arduino开发,sim7020芯片
https://github.com/pornpol/NB_Meter_SIM7020E
https://create.arduino.cc/projecthub/voske65/arduino-nb-iot-with-sim7020-and-t-mobile-027f8f
图片上报参考
https://github.com/raphaelbs/esp32-cam-ai-thinker
https://github.com/yoursunny/ESP32-CAM-OV2640/blob/master/examples/WiFiCam/WifiCam.ino
7、批量烧录方式补充
arduino烧录后找到临时目录,如下类似;
C:\Users\3doyen\AppData\Local\Temp\arduino_build_810217
复制红框文件出来;
下载bootloader
https://github.com/espressif/arduino-esp32/tree/master/tools/sdk/bin
用esp download tools烧录
更适合批量方式;
全文完;