FastBond “你创意,我买单”活动已经结束了!来看看小伙伴们在这次活动中都设计了些什么吧!
下载编译好的二进制程序
安装CH340串口驱动
使用Arduino将二进制程序上传到开发开发板上
设置wifi账号密码const char* SSID = "sxxx";
const char* PASSWD = "xxx";
安装CH340串口驱动
使用Arduino编译烧录到开发板上
上位机软件安装
修改`main.py`, 将IP修改为ESP32-CAM的IP
上位机安装python3.8, 运行程序`python main.py`
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_sscb_sda = SIOD_GPIO_NUM;
config.pin_sscb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
// if PSRAM IC present, init with UXGA resolution and higher JPEG quality
// for larger pre-allocated frame buffer.
if(psramFound()){
config.frame_size = FRAMESIZE_UXGA;
config.jpeg_quality = 10;
config.fb_count = 2;
} else {
config.frame_size = FRAMESIZE_SVGA;
config.jpeg_quality = 12;
config.fb_count = 1;
}
上位机使用python连接ESP32
destination_path = './photo/'
def try_loop(fun):
while True:
try:
fun()
break
except Exception as e:
print(e)
time.sleep(1)
def on_light():
requests.get("http://192.168.8.143/on/")
time.sleep(4)
def off_light():
requests.get("http://192.168.8.143/off/")
def get_photo():
r = requests.get("http://192.168.1.143/capture")
with open("{}{}.jpg".format(destination_path,datetime.now().strftime("%Y%m%d_%H%M%S")),"wb") as f:
f.write(r.content)
def job():
print('take photo')
try_loop(on_light)
try_loop(get_photo)
try_loop(off_light)
#schedule.every(1).minutes.do(job)
schedule.every(10).seconds.do(job)
#schedule.every(30).seconds.do(job)
while True:
schedule.run_pending()
time.sleep(1)
开机时ESP-32会连接WIFI, 并在串口监视器中显示本机的IP
上位机中每分钟会下载一张图片, 以时间为文件名
ESP-32CAM 自带的接口无法准确地调整白平衡
解决方案:使用自动白平衡需要使用视频软件进行后期调整
以上就是今天项目分享的内容啦,更详细更精彩的部分,还得点击阅读原文观看哦~
END
硬禾学堂
硬禾团队一直致力于给电子工程师和相关专业的同学,带来规范的核心技能课程,帮助大家在学习和工作的各个阶段,都能有效地提升自己的职业能力。
硬禾学堂
我们一起在电子领域探索前进
关注硬禾服务号,随时直达课堂
点击阅读原文,获取完整代码~