54454浏览
查看: 54454|回复: 0

[ESP8266/ESP32] FireBeetle 2 ESP32-S3初体验之教师投影辅助神器

[复制链接]
本帖最后由 _深蓝_ 于 2023-9-6 12:12 编辑

一、项目背景
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图8
    在各位老师教学过程当中经常会碰到一个问题,需要将学生的书写的答案投影到屏幕上面,而现在的大多数白板软件都有这样的功能,需要下载对应的app并连接与触摸一体机组成的局域网中,然后手机拍摄图片或视频上传到大屏电脑上,这样存着以下问题,上课必须要带手机;每次需要手动拍摄;经常由于手机的信息而打断上课的节奏;
有没有一个专门的工具让老师带着,他可以将图传到我们的屏幕上去呢?答案是肯定的。近期有幸获得FireBeetle 2 ESP32-S3的试用机会,特使用FireBeetle 2 ESP32-S3主控板制作教师投影辅助神器。


二、项目思路
1、使用Arduino 1.8.19编程。
2、Arduino环境配置。
3、编程以及图传的实现。
由于FireBeetle 2 ESP32-S3板载摄像头接口,附带了一个OV2640摄像头,可以直接使用该摄像头,如何把图像投屏呢,使用web服务器把拍摄的图像上传,可以看到实时图像。
4、制作一个便于携带的盒子,简单、易用。
以下是制作该项目的思维导图
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图9
三、制作步骤
1、Arduino环境配置
配置URL网址到Arduino IDE,具体步骤:
a)    打开Arduino IDE,点击File->Preferences,

b)    在新打开的界面中,点击红色圆圈中的按钮,将如下链接地址复制到新弹出的对话框中:https://raw.githubusercontent.co ... ge_esp32_index.json。如果您之前安装过其它的环境,那么您可以在上一个链接地址开头或末尾处直接回车并将上面链接粘贴在其上下任意一行

c)     打开Tools->Board:->Boards Manager...,BoardsManager会自动更新板卡,   更新完成后,您可以在上方输入esp32,出现如下情况时选择esp32点击安装即可(建议安装最新版本)
d)    等待进度条结束,列表会显示已经安装esp32主板,点击Tools->Board:,选择DFRobot FireBeetle 2 ESP32-S3,点击Port选择对应的串口




截止目前,Arduino环境配置已经完成,如果需要串口通信,需要进行以下操作:(当您选择 Disabled 时,串口为RX(44)、TX(43),如果您需要通过USB在Arduino监视器上打印,您需要选择Enable)


在这里踩了坑,由于没有打开串口通信,看不到web地址,傻傻的问群里的老师们,是不是串口没有数据还是程序出现了错误。
环境配置完后可以编写程序了,我呢,首先从例程开始学习,网址为https://wiki.dfrobot.com.cn/_SKU ... le_2_Board_ESP32_S3
这里有FireBeetle-ESP32-S3简介、硬件详情、基础教程等,初学小白可以看看这里。

2、编写代码

注意使用您家或者单位局域网中的无线连接,便于调试。
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图5

点击验证、上传,将程序烧录到主板上,并打开工具-》串口监视器(或按快捷键ctrl+shift+M)
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图6
打开网页192.168.97.90即可打开视频的设置界面,确认设置后可以打开视频。
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图7

拔下与电脑的接线到学生教室后给该板供电,稍等一会即可在浏览器打开视频界面。
3、外观设计
很简单的外观,使用订书钉的盒子,将板子粘贴到盒子内部,天线固定盒外,摄像头固定在盒子上

FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图4
四、效果展示
拍摄电脑画面清晰,有深邃的感脚。

FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图2
拍摄墙壁上五笔字根图与打卡

FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图1
拍摄教案的情景,完全可以满足授课时使用。
FireBeetle 2 ESP32-S3初体验之教师投影辅助神器图3
五、附件
使用摄像头的C代码如下:
  1. #include "esp_camera.h"
  2. #include <WiFi.h>
  3. //
  4. // WARNING!!! PSRAM IC required for UXGA resolution and high JPEG quality
  5. //            Ensure ESP32 Wrover Module or other board with PSRAM is selected
  6. //            Partial images will be transmitted if image exceeds buffer size
  7. //
  8. //            You must select partition scheme from the board menu that has at least 3MB APP space.
  9. //            Face Recognition is DISABLED for ESP32 and ESP32-S2, because it takes up from 15
  10. //            seconds to process single frame. Face Detection is ENABLED if PSRAM is enabled as well
  11. // ===================
  12. // Select camera model
  13. // ===================
  14. #define PWDN_GPIO_NUM     -1
  15. #define RESET_GPIO_NUM    -1
  16. #define XCLK_GPIO_NUM     45
  17. #define SIOD_GPIO_NUM     1
  18. #define SIOC_GPIO_NUM     2
  19. #define Y9_GPIO_NUM       48
  20. #define Y8_GPIO_NUM       46
  21. #define Y7_GPIO_NUM       8
  22. #define Y6_GPIO_NUM       7
  23. #define Y5_GPIO_NUM       4
  24. #define Y4_GPIO_NUM       41
  25. #define Y3_GPIO_NUM       40
  26. #define Y2_GPIO_NUM       39
  27. #define VSYNC_GPIO_NUM    6
  28. #define HREF_GPIO_NUM     42
  29. #define PCLK_GPIO_NUM     5
  30. #include "DFRobot_AXP313A.h"
  31. DFRobot_AXP313A axp;
  32. // ===========================
  33. // Enter your WiFi credentials
  34. // ===========================
  35. const char* ssid = "HHZX";
  36. const char* password = "123456789";
  37. void startCameraServer();
  38. void setup() {
  39.   Serial.begin(115200);
  40.   Serial.setDebugOutput(true);
  41.   Serial.println("waiting...");
  42.   while(axp.begin() != 0){
  43.     Serial.println("init error");
  44.     delay(1000);
  45.   }
  46.   axp.enableCameraPower(axp.eOV2640);//设置摄像头供电
  47.   camera_config_t config;
  48.   config.ledc_channel = LEDC_CHANNEL_0;
  49.   config.ledc_timer = LEDC_TIMER_0;
  50.   config.pin_d0 = Y2_GPIO_NUM;
  51.   config.pin_d1 = Y3_GPIO_NUM;
  52.   config.pin_d2 = Y4_GPIO_NUM;
  53.   config.pin_d3 = Y5_GPIO_NUM;
  54.   config.pin_d4 = Y6_GPIO_NUM;
  55.   config.pin_d5 = Y7_GPIO_NUM;
  56.   config.pin_d6 = Y8_GPIO_NUM;
  57.   config.pin_d7 = Y9_GPIO_NUM;
  58.   config.pin_xclk = XCLK_GPIO_NUM;
  59.   config.pin_pclk = PCLK_GPIO_NUM;
  60.   config.pin_vsync = VSYNC_GPIO_NUM;
  61.   config.pin_href = HREF_GPIO_NUM;
  62.   config.pin_sscb_sda = SIOD_GPIO_NUM;
  63.   config.pin_sscb_scl = SIOC_GPIO_NUM;
  64.   config.pin_pwdn = PWDN_GPIO_NUM;
  65.   config.pin_reset = RESET_GPIO_NUM;
  66.   config.xclk_freq_hz = 20000000;
  67.   config.frame_size = FRAMESIZE_UXGA;
  68.   config.pixel_format = PIXFORMAT_JPEG; // for streaming
  69.   //config.pixel_format = PIXFORMAT_RGB565; // for face detection/recognition
  70.   config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
  71.   config.fb_location = CAMERA_FB_IN_PSRAM;
  72.   config.jpeg_quality = 12;
  73.   config.fb_count = 1;
  74.   // if PSRAM IC present, init with UXGA resolution and higher JPEG quality
  75.   //                      for larger pre-allocated frame buffer.
  76.   if(config.pixel_format == PIXFORMAT_JPEG){
  77.     if(psramFound()){
  78.       config.jpeg_quality = 10;
  79.       config.fb_count = 2;
  80.       config.grab_mode = CAMERA_GRAB_LATEST;
  81.     } else {
  82.       // Limit the frame size when PSRAM is not available
  83.       config.frame_size = FRAMESIZE_SVGA;
  84.       config.fb_location = CAMERA_FB_IN_DRAM;
  85.     }
  86.   } else {
  87.     // Best option for face detection/recognition
  88.     config.frame_size = FRAMESIZE_240X240;
  89. #if CONFIG_IDF_TARGET_ESP32S3
  90.     config.fb_count = 2;
  91. #endif
  92.   }
  93. #if defined(CAMERA_MODEL_ESP_EYE)
  94.   pinMode(13, INPUT_PULLUP);
  95.   pinMode(14, INPUT_PULLUP);
  96. #endif
  97.   // camera init
  98.   esp_err_t err = esp_camera_init(&config);
  99.   if (err != ESP_OK) {
  100.     Serial.printf("Camera init failed with error 0x%x", err);
  101.     return;
  102.   }
  103.   sensor_t * s = esp_camera_sensor_get();
  104.   // initial sensors are flipped vertically and colors are a bit saturated
  105.   if (s->id.PID == OV3660_PID) {
  106.     s->set_vflip(s, 1); // flip it back
  107.     s->set_brightness(s, 1); // up the brightness just a bit
  108.     s->set_saturation(s, -2); // lower the saturation
  109.   }
  110.   // drop down frame size for higher initial frame rate
  111.   if(config.pixel_format == PIXFORMAT_JPEG){
  112.     s->set_framesize(s, FRAMESIZE_QVGA);
  113.   }
  114. #if defined(CAMERA_MODEL_M5STACK_WIDE) || defined(CAMERA_MODEL_M5STACK_ESP32CAM)
  115.   s->set_vflip(s, 1);
  116.   s->set_hmirror(s, 1);
  117. #endif
  118. #if defined(CAMERA_MODEL_ESP32S3_EYE)
  119.   s->set_vflip(s, 1);
  120. #endif
  121.   WiFi.begin(ssid, password);
  122.   WiFi.setSleep(false);
  123.   while (WiFi.status() != WL_CONNECTED) {
  124.     delay(500);
  125.     Serial.print(".");
  126.   }
  127.   Serial.println("");
  128.   Serial.println("WiFi connected");
  129.   startCameraServer();
  130.   Serial.print("Camera Ready! Use 'http://");
  131.   Serial.print(WiFi.localIP());
  132.   Serial.println("' to connect");
  133. }
  134. void loop() {
  135.   // Do nothing. Everything is done in another task by the web server
  136.   delay(10000);
  137. }
复制代码




QQ截图20230906103555.jpg
WedSeptember-202309066251..png

CameraWebServer.rar

49.24 KB, 下载次数: 25

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail