1.ESP32-CAM 下使用 ESP-IDF 打开摄像头

news2024/9/21 0:40:40

主要资料:

  • 乐鑫官方编程指南 ESP-IDF 编程指南
  • 安信可官方模块页 安信可-ESP32-CAM摄像头开发板
  • 官方使用教程 安信可ESP32-CAM摄像头开发demo–局域网拍照、实时视频、人脸识别 (开发环境是Linux)

本文目标是在 Windows 下跑通摄像头 hello world 程序。之后再在Linux下跑程序。

ESP32-CAM 简介

ESP32-CAM是安信可最新发布小尺寸的摄像头模组。
本体:
image.png
可以用OV2640/OV7670摄像头。

管脚定义:

摄像头和SD卡管脚定义:

使用ESP-IDF

之前折腾过了,直接给结论:最简单的安装方法就是通过 vscode+espidf。
官方教程:vscode-esp-idf-extension/docs/tutorial/install.md。安装时自备梯子,如果没有,可以考虑下离线版的idf:ESP32 开发环境的搭建与详解。

基本使用

创建基本项目不赘述,basic_use.md, 或扩展首页的使用说明即可,翻译在这里。
需要注意的是,烧录时使用串口即可,JTAG太麻烦(RISC-V的JTAG还挺难找)。

如果需要JTAG调试,参考:配置其他 JTAG 接口。
image.png

我用ESP32-CAM 烧录的时候,一直不成功,便把 boot0 接地即可。参考:关于ESP32下载的几个小问题。

Windows下测试摄像头 (这节别看,放弃Win下的ESP-IDF了

  1. 克隆这个项目 Ai-Thinker-Open_ESP32-CAMERA_LAN

    克隆时需要拉取子模块,如果使用 git clone --recursive git@github.com:Ai-Thinker-Open/Ai-Thinker-Open_ESP32-CAMERA_LAN.git(recursive 递归拉取子模块)会超级慢,
    可以用 git clone --depth 1 git@github.com:Ai-Thinker-Open/Ai-Thinker-Open_ESP32-CAMERA_LAN.git depth=1 只拉取最新版本不拉取历史,这样的话主模块是浅拉取,但是子模块还是全拉取特别慢。
    先拉取单独的主模块
    git clone --depth 1 git@github.com:Ai-Thinker-Open/Ai-Thinker-Open_ESP32-CAMERA_LAN.git
    再拉取子模块 git submodule update --init --depth 1 --recursive 初始化、浅拉取、递归拉取。这样也得重试好几次才能成功。

    移动到examples 目录下,创建项目,
    配置时还会报错,mdns 模块不存在,因为esp who 项目再IDF V5.0中移除了mdns
    image.png
    手动下载 who-idfV5.0-mdns , 拉取或下载这个版本的 idf-who,然后复制 mdns到本地 Ai-Thinker-Open_ESP32-CAMERA_LAN\components 目录下。

  2. target 和 配置

    还需要修改项目下的 CMakeLists.txt 中的components路径
    image.png
    接着配置,即可成功。

  3. build

    编译时候一些函数不存在。
    error: 'portTICK_RATE_MS' undeclared 新版本中用 portTICK_PERIOD_MS 来替代了,要在配置中的 FreeRTOS下勾选 configENABLE_BACKWARD_COMPATIBILITY (兼容以前)配置。

    error: implicit declaration of function ‘periph_module_enable’

Two thousand years later …
总之,编译各种出错。遂放弃,后续Windows 下用Arduino开发。我决定去使用Linux版了

Linux 下 ESP-IDF 环境安装

参考 安信可ESP32-CAM摄像头开发demo–局域网拍照、实时视频、人脸识别 教程。
如果使用 ./install.sh 时 的 python 下载时慢,可以添加系统代理。

export http_proxy="http://127.0.0.1:1231"
export https_proxy="http://127.0.0.1:1231"

然后继续安装,出现了错误,好像是pip安装哪个库时出现了版本依赖错误

#python-2-support pip 21.0 will remove support for this functionality.
Requirement already satisfied: setuptools in /home/chad/.espressif/python_env/idf4.0_py2.7_env/lib/python2.7/site-packages (from -r /home/chad/data/ai-thinker/esp-idf/requirements.txt (line 4)) (44.1.1)
Collecting click>=5.0
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting pyserial>=3.0
  Using cached pyserial-3.5-py2.py3-none-any.whl (90 kB)
Collecting future>=0.15.2
  Using cached future-1.0.0.tar.gz (1.2 MB)
Collecting cryptography>=2.1.4
  Using cached cryptography-3.3.2-cp27-cp27mu-manylinux2010_x86_64.whl (2.6 MB)
Collecting pyparsing<2.4.0,>=2.0.3
  Using cached pyparsing-2.3.1-py2.py3-none-any.whl (61 kB)
Collecting pyelftools>=0.22
  Using cached pyelftools-0.31.tar.gz (14.1 MB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/chad/.espressif/python_env/idf4.0_py2.7_env/bin/python /home/chad/.espressif/python_env/idf4.0_py2.7_env/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-krjwBt/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools >= 46.4.0'
       cwd: None
  Complete output (3 lines):
  DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
  ERROR: Could not find a version that satisfies the requirement setuptools>=46.4.0 (from versions: 0.6b1, 0.6b2, 0.6b3, ..., 44.1.1)
  ERROR: No matching distribution found for setuptools>=46.4.0
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/chad/.espressif/python_env/idf4.0_py2.7_env/bin/python /home/chad/.espressif/python_env/idf4.0_py2.7_env/lib/python2.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-krjwBt/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools >= 46.4.0' Check the logs for full command output.
Traceback (most recent call last):
  File "/home/chad/data/ai-thinker/esp-idf/tools/idf_tools.py", line 1387, in <module>
    main(sys.argv[1:])
  File "/home/chad/data/ai-thinker/esp-idf/tools/idf_tools.py", line 1383, in main
    action_func(args)
  File "/home/chad/data/ai-thinker/esp-idf/tools/idf_tools.py", line 1196, in action_install_python_env
    subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr)
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/home/chad/.espressif/python_env/idf4.0_py2.7_env/bin/python', '-m', 'pip', 'install', '--no-warn-script-location', '-r', '/home/chad/data/ai-thinker/esp-idf/requirements.txt']' returned non-zero exit status 1

排查发现,这个包是Collecting pyelftools>=0.22,看到这张图中安装的是0.26

从之前的日志能看到依赖文件 /home/chad/data/ai-thinker/esp-idf/requirements.txt里面是:

  1 # This is a list of python packages needed for ESP-IDF. This file is used w    ith pip.                                                                   
  2 # Please see the Get Started section of the ESP-IDF Programming Guide for f    urther information.
  3 #
  4 setuptools
  5 # The setuptools package is required to install source distributions and on     some systems is not installed by default.
  6 # Please keep it as the first item of this list.
  7 #
  8 click>=5.0
  9 pyserial>=3.0
 10 future>=0.15.2
 11 cryptography>=2.1.4
 12 pyparsing>=2.0.3,<2.4.0
 13 pyelftools>=0.22 // 改成: pyelftools>=0.22,<0.28

pyelftools>=0.22 改为 pyelftools>=0.22,<0.28,安装即可。

make menuconfig 时出错

fatal error: ncurses.h: No such file or directory

因为缺少库,编译Busybox时,出现错误fatal error: curses.h: No such file or directory
使用 sudo apt-get install libncurses5-dev libncursesw5-dev安装即可。
再次运行,最后出错

b_server/sdkconfig.defaults...
Your display is too small to run Menuconfig!
It must be at least 19 lines by 80 columns.
make: *** No rule to make target 'menuconfig', needed by '/home/chad/data/ai-thinker/examples/single_chip/camera_web_server/sdkconfig'.  Stop.

这个不慌,界面太小了,放大即可。

编译:make
编译完成后提醒烧录指令

To flash all build output, run 'make flash' or:
python /home/chad/data/ai-thinker/esp-idf/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 230400 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0x1000 /home/chad/data/ai-thinker/examples/single_chip/camera_web_server/build/bootloader/bootloader.bin 0x10000 /home/chad/data/ai-thinker/examples/single_chip/camera_web_server/build/camera_web_server.bin 0x8000 /home/chad/data/ai-thinker/examples/single_chip/camera_web_server/build/partitions.bin

make flash, 或 xxxxx
我用 make flash 烧录时报错

: recipe for target 'flash' failed
make: *** [flash] Error 1

便试着用比较长的那个指令,可以~

打开串口监听 make monitor
如果报权限错误可以先 su root 再打开
image.png
没有显示连接成功,
但是在路由器界面可以看到连接了
image.png

访问:
image.png
手机端查看
image.png
成功了。后续需要使用Arduino在Windows下开发吧。

其他:
ESP32-CAM 故障排除指南:修复的最常见问题

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1951362.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

国衍科技——RFID技术的应用

在文物馆藏信息的记录与管理过程中&#xff0c;准确性和详细性是至关重要的。无论是大型博物馆还是私人收藏馆&#xff0c;都需要有效的方法来确保馆藏文物信息的可追溯性和可访问性&#xff0c;才能提供更好的服务和保护馆藏资源。而结合射频识别&#xff08;RFID&#xff09;…

2-46 基于matlab的声音信号的短时能量、短时过零率、端点检测

基于matlab的声音信号的短时能量、短时过零率、端点检测。通过计算计算短时能量、调整能量门限&#xff0c;然后开始端点检测。输出可视化结果。程序已调通&#xff0c;可直接运行。 2-46 短时能量 短时过零率 端点检测 - 小红书 (xiaohongshu.com)

未来的智能农业:智能合约如何提升农业生产效率和可持续性

随着全球人口的增长和资源的有限性&#xff0c;农业生产面临着越来越大的挑战。如何在提高生产效率的同时保障可持续发展成为全球农业发展的关键问题。智能合约作为一种基于区块链技术的自动化执行合约&#xff0c;正在逐渐应用于农业领域&#xff0c;为农业生产带来了新的机遇…

【MATLAB源码-第238期】基于simulink的三输出单端反激flyback仿真,通过PWM和PID控制能够得到稳定电压。

操作环境&#xff1a; MATLAB 2022a 1、算法描述 概述 反激变换器是一种广泛应用于电源管理的拓扑结构&#xff0c;特别是在需要隔离输入和输出的应用中。它的工作原理是利用变压器的储能和释放能量来实现电压转换和隔离。该图展示了一个通过脉宽调制&#xff08;PWM&#…

C++——QT:保姆级教程,从下载到安装到用QT写出第一个程序

登录官网&#xff0c;在官网选择合适的qt版本进行下载 这里选择5.12.9版本 点击exe文件下载&#xff0c;因为服务器在国外&#xff0c;国内不支持&#xff0c;所以可以从我的网盘下载 链接: https://pan.baidu.com/s/1XMILFS1uHTenH3mH_VlPLw 提取码: 1567 --来自百度网盘超级…

git merge VS git rebase VS git cherry-pick

git merge VS git rebase VS git cherry-pick 在Git中&#xff0c;git merge、git rebase和git cherry-pick都是用于整合不同分支中的更改到当前分支的命令。它们各有特点和适用场景。 Git Merge git merge 是一种将一个分支的更改合并到另一个分支的方法。它创建一个新的提…

用Postman Flows打造你的专属API:外部公开,轻松上手!

引言 Postman Flows 是一个使用 GUI 进行无代码 API 调用流程创建的服务。这篇文章我尝试使用 Flows 来构建将 Momento Topic 中的数据保存到 TiDB 的保存 API&#xff0c;因此想分享一些使用过程中的技巧等。 实现内容 将从 Momento Topics 配发的 JSON 数据保存到 TiDB 中。…

算法-BFS搜索

题目一 解题思路 比较标准的暴力搜索空间换时间的策略 二维数组map表示具体地图&#xff0c;far表示遍历过程中某点到起点的距离。 队列 q 表示在遍历过程中当前距离的所以节点坐标。 每次的节点寻找其上下左右四个方向可以继续前进的点&#xff08;这里在过程中会发生两个…

Java之多线程-同步代码块

线程同步 Java中提供了线程同步的机制&#xff0c;来解决上述的线程安全问题。 Java中实现线程同步&#xff0c;主要借助synchronized关键字实现。 线程同步方式&#xff1a; 同步代码块 同步方法 锁机制 1&#xff09;同步代码块 格式&#xff1a; //Object类及其子类…

Web网页端IM产品RainbowChat-Web的v7.1版已发布

一、关于RainbowChat-Web RainbowChat-Web是一套Web网页端IM系统&#xff0c;是RainbowChat的姊妹系统&#xff08;RainbowChat是一套基于开源IM聊天框架 MobileIMSDK (Github地址) 的产品级移动端IM系统&#xff09;。 ► 详细介绍&#xff1a;http://www.52im.net/thread-2…

研发(RD)注意事项 / 复杂项目规划、控制方法 PERT 和 CPM

注&#xff1a;机翻&#xff0c;未校对&#xff0c;去掉了原文中广告。 What Is Research and Development (R&D)? 什么是研发&#xff08;R&D&#xff09;&#xff1f; Investopedia / Ellen Lindner Research and Development An ongoing effort to develop or impr…

Spring Boot入门指南:留言板

一.留言板 1.输⼊留⾔信息,点击提交.后端把数据存储起来. 2.⻚⾯展⽰输⼊的表⽩墙的信息 规范&#xff1a; 1.写一个类MessageInfo对象&#xff0c;添加构造方法 虽然有快捷键&#xff0c;但是还是不够偷懒 项目添加Lombok。 Lombok是⼀个Java⼯具库&#xff0c;通过添加注…

Java | Leetcode Java题解之第283题移动零

题目&#xff1a; 题解&#xff1a; class Solution {public void moveZeroes(int[] nums) {int n nums.length, left 0, right 0;while (right < n) {if (nums[right] ! 0) {swap(nums, left, right);left;}right;}}public void swap(int[] nums, int left, int right)…

AI/机器学习(计算机视觉/NLP)方向面试复习3

1. Pooling 有哪些方式&#xff1f;pytorch的实现&#xff1f; Pooling可以分成&#xff1a;最大池化&#xff0c;平均池化&#xff0c;全局平均池化&#xff0c;随机池化&#xff0c;空间金字塔池化。 1. 最大池化&#xff08;Max Pooling&#xff09; 最大池化是最常用的池…

将Android Library项目发布到JitPack仓库

将项目代码导入Github 1.将本地项目目录初始化为 Git 仓库。 默认情况下&#xff0c;初始分支称为 main; 如果使用 Git 2.28.0 或更高版本&#xff0c;则可以使用 -b 设置默认分支的名称。 git init -b main 如果使用 Git 2.27.1 或更低版本&#xff0c;则可以使用 git symbo…

【Django】前端技术-网页样式表CSS

文章目录 一、申明规则CSS的导入方式行内样式内部样式外部样式 二、CSS的选择器1. 基本选择器标签选择器&#xff1a; 选择一类标签 标签{}类选择器 class&#xff1a; 选择所有class属性一致的表情&#xff0c;跨标签.类名{}ID选择器&#xff1a;全局唯一 #id名{} 2.层次选择器…

Element快速学习

博客主页&#xff1a;音符犹如代码系列专栏&#xff1a;JavaWeb关注博主&#xff0c;后期持续更新系列文章如果有错误感谢请大家批评指出&#xff0c;及时修改感谢大家点赞&#x1f44d;收藏⭐评论✍ 什么是Element&#xff1f; Element&#xff1a;它是由饿了么团队开发的一个…

cpp程序设计实践,类实现树链刨分以及计算几何类

程序设计要求 是某个cq高校期末程序设计实践作业&#xff0c;全部自己做的比较小众分值90。  试建立一个继承结构&#xff0c;以栈、队列为派生类&#xff0c;建立它们的抽象基类-Bag类&#xff0c;写出各个类的声明及定义&#xff0c;并实现如下功能&#xff1a;  统一命名…

华为高品质万兆园区体验保障技术白皮书

华为高品质万兆园区体验保障技术白皮书 - 华为企业业务 re 音视频会议已经成为企业办公的核心应用系统&#xff0c;尤其是高层会议的质量对企业的运营效率有很大影响&#xff0c;相 关的体验问题也是员工投诉的重灾区。但不同于传统的网络通断类问题,体验类问题涉及的范围大、…