小神123 发表于 2024-11-1 01:04

【2024 DigiKey创意大赛】环境智眼-可视化智能环境观测器

<div style="text-align: center;"><strong>环境智眼</strong><strong>-</strong><strong>可视化智能环境观测器</strong></div>

<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;作者:小神123</div>

<div><strong>一、作品简介</strong><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 环境智眼是一款革命性的智能环境观测器,它能够实时监测和分析各种环境参数,如温度、湿度、空气质量等。通过集成的高精度传感器阵列和强大的数据处理能力,环境智眼为用户提供了一个全面、实时的环境监测平台。核心特性:多参数监测: 能够同时监测多种环境参数,为用户提供全面的环境数据。智能数据分析: 利用先进的人工智能算法,对收集到的数据进行深入分析,识别模式和趋势。实时可视化: 通过直观的图形界面,用户可以实时查看环境数据的变化,包括动态图表、热图和趋势线。预警系统: 当环境参数超出预设的安全范围时,系统会自动发出预警,帮助用户及时采取措施。易于部署: 设计轻巧,安装简便,适用于室内外多种环境。应用场景:智能家居系统,提升居住舒适度和安全性。工业环境监测,确保生产环境符合安全标准。农业领域,优化作物生长条件,提高产量。城市环境管理,监测和改善城市空气质量和噪音污染。</div>

<div><strong></strong></div>

<div><strong>本次采用的物料清单有</strong><strong>E</strong><strong>SP32-S3-LCD-EV-B</strong><strong>oard</strong><strong>开发板以及气体传感器</strong><strong>B</strong><strong>ME680</strong><strong>,其中</strong><strong>E</strong><strong>SP32-S3-LCD-EV-B</strong><strong>oard</strong><strong>搭配一块</strong><strong>3</strong><strong>.95</strong><strong>英寸的屏幕,可以用来显示空气质量等。气体传感器</strong>BME680环境传感器是一款四合一MEMS环境传感器,可测量VOC(挥发性有机物)、温度、湿度、气压这四个参数,非常适用于监测空气质量。由于采用了MEMS技术,该传感器体积小、功耗低,因此也适用于低功耗场合,如可穿戴等。</div>

<div><strong>二、系统框图</strong><br />
<strong>整体设计思路如下:通过气体传感器</strong><strong>B</strong><strong>ME680</strong><strong>采集空气中的数据,然后将数据通过</strong><strong>I</strong><strong>2C</strong><strong>通讯或者</strong><strong>S</strong><strong>PI</strong><strong>通讯传输到</strong><strong>E</strong><strong>SP32-</strong><strong>s3</strong><strong>控制板上,进过数据处理,实时将其显示在显示屏上,实现狂徒如下所示:</strong></div>

<div> &nbsp;</div>

<div><strong>三、各部分功能说明</strong></div>

<div><strong>1</strong><strong>、读取空气质量部分</strong></div>

<div><strong>通过</strong><strong>S</strong><strong>PI</strong><strong>或者</strong><strong>I</strong><strong>2C</strong><strong>形式,均可以读取到气体传感器的信息,接线示意图按照官方给出的文档示意如下:</strong></div>

<div><strong></strong></div>

<div><strong></strong></div>

<div><strong>通过</strong><strong>Arduino</strong><strong> IDE</strong><strong>上编译代码,具体截图如下:</strong></div>

<div><strong></strong></div>

<div><strong></strong></div>

<div><strong></strong></div>

<div><strong>感觉读到的数据不太正确。</strong></div>

<div><strong></strong></div>

<div><strong>2</strong><strong>、显示数据部分</strong></div>

<div><strong>显示部分的话,需要用到</strong><strong>L</strong><strong>VGL</strong><strong>,这里的话,选择</strong><strong>square</strong><strong>line_studio,</strong><strong>其界面可以直接选择开发板</strong><strong>E</strong><strong>SP32-S3-LCD-EV-BOARD</strong><strong>,显示如下:</strong></div>

<div><strong></strong></div>

<div><strong>进入编辑界面后,根据自己的喜欢设计布局,通过拖拽的形式,非常方便,大大缩减了开发界面的时间。以下是我搭建的界面。</strong></div>

<div><strong></strong></div>

<div><strong></strong></div>

<div><strong>四、作品源码</strong></div>

<div><strong>作品代码如下所示:</strong>

<pre>
<code class="language-cpp">#include &lt;Wire.h&gt;
#include &lt;SPI.h&gt;
#include &lt;Adafruit_Sensor.h&gt;
#include "Adafruit_BME680.h"

#define BME_SCK 13
#define BME_MISO 12
#define BME_MOSI 11
#define BME_CS 10

#define SEALEVELPRESSURE_HPA (1013.25)

Adafruit_BME680 bme(&amp;Wire); // I2C
//Adafruit_BME680 bme(&amp;Wire1); // example of I2C on another bus
//Adafruit_BME680 bme(BME_CS); // hardware SPI
//Adafruit_BME680 bme(BME_CS, BME_MOSI, BME_MISO,BME_SCK);

void setup() {
Serial.begin(9600);
while (!Serial);
Serial.println(F("BME680 test"));

if (!bme.begin()) {
    Serial.println("Could not find a valid BME680 sensor, check wiring!");
    while (1);
}

// Set up oversampling and filter initialization
bme.setTemperatureOversampling(BME680_OS_8X);
bme.setHumidityOversampling(BME680_OS_2X);
bme.setPressureOversampling(BME680_OS_4X);
bme.setIIRFilterSize(BME680_FILTER_SIZE_3);
bme.setGasHeater(320, 150); // 320*C for 150 ms
}

void loop() {
if (! bme.performReading()) {
    Serial.println("Failed to perform reading :(");
    return;
}
Serial.print("Temperature = ");
Serial.print(bme.temperature);
Serial.println(" *C");

Serial.print("Pressure = ");
Serial.print(bme.pressure / 100.0);
Serial.println(" hPa");

Serial.print("Humidity = ");
Serial.print(bme.humidity);
Serial.println(" %");

Serial.print("Gas = ");
Serial.print(bme.gas_resistance / 1000.0);
Serial.println(" KOhms");

Serial.print("Approx. Altitude = ");
Serial.print(bme.readAltitude(SEALEVELPRESSURE_HPA));
Serial.println(" m");

Serial.println();
delay(2000);
}
</code></pre>

<p>&nbsp;</p>

<pre>
<code class="language-cpp">#include &lt;Arduino.h&gt;
#include &lt;ESP_Panel_Library.h&gt;
#include &lt;lvgl.h&gt;
#include "lvgl_port_v8.h"

/**
/* To use the built-in examples and demos of LVGL uncomment the includes below respectively.
* You also need to copy `lvgl/examples` to `lvgl/src/examples`. Similarly for the demos `lvgl/demos` to `lvgl/src/demos`.
*/
// #include &lt;demos/lv_demos.h&gt;
// #include &lt;examples/lv_examples.h&gt;

void setup()
{
    String title = "LVGL porting example";

    Serial.begin(115200);
    Serial.println(title + " start");

    Serial.println("Initialize panel device");
    ESP_Panel *panel = new ESP_Panel();
    panel-&gt;init();
#if LVGL_PORT_AVOID_TEAR
    // When avoid tearing function is enabled, configure the RGB bus according to the LVGL configuration
    ESP_PanelBus_RGB *rgb_bus = static_cast&lt;ESP_PanelBus_RGB *&gt;(panel-&gt;getLcd()-&gt;getBus());
    rgb_bus-&gt;configRgbFrameBufferNumber(LVGL_PORT_DISP_BUFFER_NUM);
    rgb_bus-&gt;configRgbBounceBufferSize(LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE);
#endif
    panel-&gt;begin();

    Serial.println("Initialize LVGL");
    lvgl_port_init(panel-&gt;getLcd(), panel-&gt;getTouch());

    Serial.println("Create UI");
    /* Lock the mutex due to the LVGL APIs are not thread-safe */
    lvgl_port_lock(-1);

    /* Create a simple label */
    lv_obj_t *label = lv_label_create(lv_scr_act());
    lv_label_set_text(label, title.c_str());
    lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);

    /**
   * Try an example. Don't forget to uncomment header.
   * See all the examples online: https://docs.lvgl.io/master/examples.html
   * source codes: https://github.com/lvgl/lvgl/tree/e7f88efa5853128bf871dde335c0ca8da9eb7731/examples
   */
    //lv_example_btn_1();

    /**
   * Or try out a demo.
   * Don't forget to uncomment header and enable the demos in `lv_conf.h`. E.g. `LV_USE_DEMO_WIDGETS`
   */
    // lv_demo_widgets();
    // lv_demo_benchmark();
    // lv_demo_music();
    // lv_demo_stress();

    /* Release the mutex */
    lvgl_port_unlock();

    Serial.println(title + " end");
}

void loop()
{
    Serial.println("IDLE loop");
    delay(1000);
}
</code></pre>

<p><strong>五、作品功能演示视频</strong></p>

<p>7e734e996152b061b55711e869fa3fd7<br />
&nbsp;</p>
</div>

<div><strong>六、项目总结</strong></div>

<div><strong>本次项目是一个很好的机会,再次感谢得捷电子以及</strong><strong>E</strong><strong>E</strong><strong>wo</strong><strong>rld</strong><strong>提供的平台与支持。但是由于个人原因(工作时间较忙以及对ESP32产品熟悉较少,与预期计划偏差较大),未能成功将全部功能实现,希望在后续的时间里自己可以将这个想法实现,并多多学习ESP32-s3的操作。</strong></div>

<div><strong>七、其他</strong></div>

<div>&nbsp;</div>

<p><!--importdoc--></p>

秦天qintian0303 发表于 2024-11-1 11:15

<p>我是被题目吸引进来的,以为会是个边缘计算的项目,有个摄像头进行显示呢</p>
页: [1]
查看完整版本: 【2024 DigiKey创意大赛】环境智眼-可视化智能环境观测器