专业版
#第九届立创电赛#便携式多功能助手

创建时间:3个月前

251 1

描述

<div> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">* 1、项目功能介绍</h3> <hr> <div><span style="font-size:12pt">      本项目旨在开发一套集成多种传感器的数据采集与显示系统,基于LVGL图形库实现用户界面,提供高效、直观的数据展示和操作体验。系统涵盖温湿度、方位角、气压、VOC浓度检测,并具备热成像功能,旨在为用户提供全面的环境监测与分析服务。</span></div> <h2>**  主要功能**</h2> <h3> 1. 温湿度测量</h3> <div><span style="font-size:12pt">传感器: SHT40温度湿度传感器</span></div> <div><span style="font-size:12pt">功能: 实时测量环境温度和湿度,提供精准的数据反馈。</span></div> <div><span style="font-size:12pt">界面展示: 通过LVGL绘制的界面,直观显示温度和湿度值。</span></div> <h3> 2. 方位角测量</h3> <div><span style="font-size:12pt">传感器: QML地磁传感器</span></div> <div><span style="font-size:12pt">功能: 测量当前方位角,支持多种方向的实时监测。</span></div> <div><span style="font-size:12pt">界面展示: 显示方位角数据,可以通过图形界面查看方位变化。</span></div> <h3> 3. 气压与海拔计算</h3> <div><span style="font-size:12pt">传感器: SQL气压传感器</span></div> <div><span style="font-size:12pt">功能: 测量环境气压,并通过算法计算当前海拔高度。</span></div> <div><span style="font-size:12pt">界面展示: 显示气压与海拔高度数据。</span></div> <h3> 4. <strong><span style="font-size:16px">VOC</span></strong>浓度检测</h3> <div><span style="font-size:12pt">传感器: SGP40气体传感器</span></div> <div><span style="font-size:12pt">功能: 检测空气中VOC,提供实时数据监测。</span></div> <div><span style="font-size:12pt">界面展示: 通过LVGL界面,显示VOC浓度指标,超标警告。</span></div> <h3> 5. 热成像功能</h3> <div><span style="font-size:12pt">传感器: 配合MLX热成像传感器</span></div> <div><span style="font-size:12pt">功能: 实时获取环境热图。</span></div> <div><span style="font-size:12pt">界面展示: 展示热成像图像,支持热图与其他传感器数据的叠加显示,便于用户快速识别温度异常区域。(尚未实现)</span></div> <h3> 用户界面设计</h3> <div><span style="font-size:12pt">界面风格: 采用现代化的界面设计,使用LVGL图形库实现流畅的用户交互体验。</span></div> <div><span style="font-size:12pt">数据展示: 直观的数据可视化,包括数字显示等,增强用户对数据的理解和分析能力。</span></div> <div><span style="font-size:12pt">操作便捷: 提供简洁的快捷操作按钮,用户可轻松切换各项功能,进行数据查看和设置。</span></div> <h3> 未来扩展功能</h3> <h3>热成像在LVGL显示功能(未来计划)</h3> <div><span style="font-size:12pt">因为本次训练营时间较短,且本人科研任务繁重,目前尚未有精力在此训练营期限内完成LVGL和热成像的结合。</span></div> <div><span style="font-size:12pt">思路:在LVGL中使用文件系统,来定时显示传递的图片</span></div> <div><span style="font-size:12pt">界面展示: 未来计划在LVGL界面中展示热成像图像,支持热图与其他传感器数据的叠加显示,便于用户快速识别温度异常区域。</span></div> <div><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/U1TVnf7oIo5zT14JNSIqzkMK9U6IcZaXoJRGOYwV.png" alt="" width="646" height="568"></div> <div> <p style="text-align:center"><span style="font-family:helvetica, arial, sans-serif;font-size:12pt">系统框图</span></p> </div> </div> <div> <h3 style="line-height:1.8">* 2、项目属性</h3> <hr> <p style="line-height:1.8"><span style="color:#95a5a6;font-size:14px">首次公开,未曾在比赛中获奖</span></p> <h3 style="line-height:1.8">* 3、开源协议</h3> <hr> <p style="line-height:1.8"><span style="color:#95a5a6;font-size:14px">GPL3.0开源</span></p> <h3 style="line-height:1.8">*4、硬件部分</h3> <hr> <div> <h2> **  硬件设计**</h2> <h3>MCU选型:</h3> <ul> <li><span style="font-family:helvetica, arial, sans-serif;font-size:12pt">明确项目需求:如时钟,内存等。</span><span style="font-family:helvetica, arial, sans-serif;font-size:16px">STM32F411CEU6作为主控芯片,其具备512KB Flash和128KB RAM</span></li> <li><span style="font-family:helvetica, arial, sans-serif;font-size:12pt">明确项目所需的IO和外设</span></li> </ul> <p><span style="font-family:helvetica, arial, sans-serif;font-size:12pt">因本项目界面采用LVGL来进行编写,因此对于主控的内存有一定要求,此次选取,完全满足需求,为了更好的适配热成像功能,本次采取增设外部FLASH来存储图片</span><span style="font-family:helvetica, arial, sans-serif;font-size:12pt">芯片选型为W25Q128</span></p> <p> </p> <h3>PCB设计:</h3> <p><span style="font-size:12pt">    对于本设计,没有高速信号,也没有高精度采样场合,更没有大电压的走线,因此对Layout,无需进行特殊的手段处理,满足基本走线规范即可。</span></p> </div> <div> <h3> 1.充电电路设计与选型</h3> <p><span style="font-size:12pt">    对于便携式设备来说,一直连接USB接口显然是不合适的,如果选取干电池,那么体积和重量无疑也会增加,并且无法充电,因此设计采用锂电池,并设计了电路选择和充电电路</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/O8axxGg3PBrjvxtGU7VuE4ZWfRjNr6hL22kDkAtU.png" alt=""></p> <p><span style="font-size:12pt">    对于充电电路,选取常见的TP4056,这款芯片设计简单,价格便宜非常适合与小型化设备的开发中,但是它也有一个非常明显的问题,就是发热比较严重,因此需要对充电电流进行限制和选择,经过多次的设计验证后发现,对于</span><span style="font-size:12pt">充电电流以0.2A为好,虽然会降低充电速度但是至少发热不在明显。</span></p> <h3> 2.电源选择设计</h3> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/aIgwoXPupkrnR7qythXNWPLFGIYWJxXunebwOIDC.png" alt=""></p> <p><span style="font-size:12pt">    采用MOS管来进行切换,一般锂电池电压为4.2V左右,当锂电池接入时usb没有接入时,锂电池流过Q1的体二极管压降,此时源极电压为3.5V,所以此时Pmos导通,体二极管短路,源极电压4.2V。</span></p> <p><span style="font-size:12pt">    当usb接入时,Q1的栅极为5V,此时漏极电压为4.2V,而USB经过二极管压降为4.7V也就是此时源极电压,Pmos不导通。对于Q2,Q2的源极此时可能是4.7或者4.2V,而此时的栅极接到了开关上,如果开关断开,那么此时Q2不导通,开关闭合则导通供电(为什么要采用两个二极管?看起来帅气)</span></p> <h3> 3.降压电路设计</h3> <p><span style="font-size:12pt">此为芯片整体3V3电源</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/52eF5PKzayKLUjvFR926lHSooVs0O8vNPdkqGlqB.png" alt=""></p> <p><span style="font-size:12pt">此为心率传感器1V8电源</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/yItn1JALKdc91pwuG9PML1xlQUDdDm8RXEWY8Nac.png" alt=""></p> </div> <p style="line-height:1.8"> </p> <h3 style="line-height:1.8">*5、软件部分</h3> <hr> <h2> ** 软件设计**</h2> <p><span style="font-size:12pt">软件架构如图所示:</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/VbzR07UDvtUKgzKXLVCXfiea4zSHSaR83jlErWIj.png" alt="" width="532" height="460"></p> <p><span style="font-size:12pt">系统流程框图如图所示:</span></p> <p><span style="font-size:12pt">    对于编写程序,需要养成良好习惯,而非是想到哪里写到哪里,全局变量满天飞,整篇代码中充满了0和1等定义,这样编写的代码,可读性极差且逻辑非常混乱,不易于维护和排错,因此在设计程序之前,设计好程序的流程以及架构才是代码水平提升的关键。</span></p> <p><img src="//image.lceda.cn/pullimage/Lw9PCykXWcISKThsdYxYCzspbFOKh2gtqG95eAjE.png" alt="" width="1255" height="1445"></p> <h2 style="line-height:1.8">传感器驱动:</h2> <p><span style="font-size:12pt">设计采用软件IIC驱动,对于传感器按照数据手册对应的时序和寄存器编写命令即可。如SGP40数据手册:</span></p> <p><img src="//image.lceda.cn/pullimage/ngQWQz66d2xn2ckFWeVS6uQuQqnwZtJ412b0MsVY.png" alt=""></p> <p><span style="font-size:12pt">对于软件IIC,在设计中将EEPROM和SERSOR的区分开了,因此在编写程序时候,采用结构体的框架来编写,这样只需要一份IIC的代码</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/MmEwj47U1eJOBo4ewqaNZ4a4pme8DeXPHsHkJAmc.png" alt=""></p> <p>在使用FreeRtos时,创建不同任务的信号量,需要注意优先级问题,对于执行任务时,IIC代码需要加入互斥锁,在每次执行时,调用互斥锁。</p> <h2 style="line-height:1.8">按键和WIFI:</h2> <p><span style="font-size:12pt">    对于按键检测,如果采用延时死等的方式,非常不可取,尤其是图形界面和多任务系统中,因此在此处介绍状态机,将按键的多种时态表述成为多种状态,对于每种状态进行处理.</span></p> <p><span style="font-size:12pt">   其中获取系统运行时间,在系统中断或者定时器中断中获取即可。wifi同理</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/ljFaJINif4oMJ83BLvR3tHztTRH9NppdmeMR9RyW.png" alt="" width="600" height="379"></p> <p> </p> <h2 style="line-height:1.8">LVGL:</h2> <p><span style="font-size:12pt">    因采用了FreeRtos,因此对于LVGL来说虽然支持操作系统,但是存在线程不安全问题,对于一些操作需要注意,而移植LVGL到Rtos中也非常简单,只需要将LVGL当成一个任务创建即可:</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/JfG9aKIORpLOdEE2YzCnlMhA8hFAogS1xaZd6beZ.png" alt=""></p> <p><span style="font-size:12pt">    在任务中创建while(1)循环,来调度LVGL计时器即可。</span></p> <p><span style="font-size:12pt">    如果遇到LVGL卡死的情况,基本就是内存泄露的问题,因此对于界面管理,采用栈的操作是不错的方式,入栈界面指针。</span></p> <h2 style="line-height:1.8">电池驱动:</h2> <p><span style="font-size:12pt">   电池电量通过ADC获取,然后数据进行软件滤波,滤波算法采用中位值滤波。</span></p> <p><span style="font-size:12pt">   电池开路电压的容量关系:如下所示,对于恒流放电,其对应关系相应减去0.15左右即可</span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">100%----4.20V                     </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">40%-----3.79V</span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">90%-----4.06V                      </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">30%-----3.77V</span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">80%-----3.98V                      </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">20%-----3.74V</span><span style="font-family:Calibri;font-size:10.5pt">  </span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">70%-----3.92V                    </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">10%-----3.68V</span><span style="font-family:Calibri;font-size:10.5pt"> </span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">60%-----3.87V                     </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">5%------3.45V</span><span style="font-family:Calibri;font-size:10.5pt">        </span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="mso-spacerun:'yes';font-family:宋体;mso-ascii-font-family:Calibri;mso-hansi-font-family:Calibri;mso-bidi-font-family:'Times New Roman';font-size:10.5000pt;mso-font-kerning:1.0000pt"><span style="font-family:宋体">  </span><span style="font-family:Calibri">50%-----3.82V                     </span></span><span style="font-family:'Times New Roman';font-size:10.5pt">0%------3.00V</span></p> <p> </p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="font-family:宋体;font-size:12pt"><span style="font-family:Calibri">     但对于电量采集,随着使用时间的增加,比例一定会失调,因此,采取分段设计充电状态,以设备的实际功耗,设置对应挡位</span></span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/B7k0MNDlW499mZ2fbmCHFg2pU1V06Z0ix5eAom47.png" alt=""><span style="font-size:12pt"><span style="font-family:宋体"><span style="font-family:Calibri"> 如何计算?对于片上ADC,采样最大3.3V,对应0xfff,所以计算公式:(3.3/0xfff)*V*(分压)。需要注意的是,采取中位值滤波,需要去掉头尾,因为要对数据不够三个的情况进行处理,</span></span><span style="font-family:宋体"><span style="font-family:Calibri">相应伪代码:if(</span></span><span style="font-family:Calibri">s_Num < 3</span><span style="font-family:Calibri">) { V = g_adcVal[0] }</span></span></p> <p style="line-height:150%;text-align:center"><span style="font-size:12pt"><span style="font-family:Calibri"><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/EX1r2P4nCcZ6n7XYOVJH19ZqLHkgIBJJ2WheNnVk.png" alt="">中位值平均滤波</span></span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"> </p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"><span style="font-size:12pt;font-family:Calibri">    最后电池管理分为两个状态,没有充电和正在充电的状态,需要分开处理,并且由于在非开路情况下,电池电压会有波动,因此我们需要控制电池上述的状态中不能回升,即未充电时,数值只可以下降不可以上升,反之同理。</span></p> <p style="mso-para-margin-left:0.0000gd;text-autospace:ideograph-numeric;mso-pagination:none;line-height:150%"> </p> <h2 style="line-height:1.8">总结:</h2> <p><span style="color:#000000;font-family:helvetica, arial, sans-serif;font-size:12pt;background-color:#fdfdfe">   参加了两期训练营了,分别是泰山派和示波器,感觉收获满满。立创的工程师们非常专业,整个学习和参加过程也清晰流畅。之前因为科研任务繁重,一直没时间进行独立的创造,基本上就是复刻,没进行独立的设计。这次趁着暑假的小假期,碰巧又遇到了训练营,这不的毫不犹豫地加入。</span></p> <p><span style="color:#000000;font-family:helvetica, arial, sans-serif;font-size:12pt;background-color:#fdfdfe">    本设计整体比较简单,但是有一些地方也有一定的难度,比如热成像的显示框架,和尚未实现的心率传感器,其数据需要进行FIR滤波算法的处理还需要各种舍弃和前移等操作,让人头大,暂且搁置。还有对于MQTT协议,虽然操作比较简单,但是本次训练营时间有限(我要放假了),准备对下一版在重新构造界面时,在完成这个模块的实现。</span></p> <p><span style="color:#000000;font-family:helvetica, arial, sans-serif;font-size:12pt;background-color:#fdfdfe">   问题:本以为使用SPI+DMA可以对热成像的刷新率进行一些提升,但是刷新还是比较慢,因此最好采用8080并口的屏幕。此外还没有成功实现LVGL和热城乡的结合,基本想法就是采用文件系统然后去刷新图片,不知道是否可行,待下段时间进行研究一下。</span></p> <p><span style="font-family:helvetica, arial, sans-serif;font-size:12pt;color:#000000"><span style="background-color:#fdfdfe">   最后,感谢立创提供的支持,和立创的工程师们提供的帮助,</span><span style="background-color:#fdfdfe">这次训练营让我学到了很多,未来,我会继续努力,不断提升自己的技能水平。</span></span></p> <h3 style="line-height:1.8">* 6、演示您的项目并录制成视频上传</h3> <hr> <h3 style="line-height:1.8"><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/JeunHJIFo18lGkdN3nu4KqLzq8Uu43RnejcVp0vS.jpeg" alt="" width="600" height="450"></h3> <p style="text-align:center"><span style="font-size:12pt">图1:插上电池后,电池指示变化</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/PvZwYGuxottXOs5KF1cvESQ93MIZIH2uZI5amrJx.png" alt="" width="600" height="464"></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/Z5PdmKcyBkF4UesRajL5VILEJopAxoED9PLpshvo.jpeg" alt="" width="600" height="450"></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/7Z8dAfONrXUIufxwEeI6eFeXX153ucfaXSmOl7H8.jpeg" alt="" width="600" height="450"></p> <p style="text-align:center"><span style="font-size:12pt">图2:热成像</span></p> <p><img style="display:block;margin-left:auto;margin-right:auto" src="//image.lceda.cn/pullimage/2JqqP9OYyq0sIiQnrCauQFJlw2MOkFZd60VbrOcq.jpeg" alt="" width="600" height="800"></p> <p style="text-align:center"><span style="font-size:12pt">图3:温湿度对比</span></p> <p> </p> <p style="line-height:1.8"><span style="color:#95a5a6;font-size:14px">视频要求:请横屏拍摄,分辨率不低于1280×720,格式Mp4/Mov,单个视频大小限100M内;</span></p> <p style="line-height:1.8"><span style="color:#95a5a6;font-size:14px">视频标题:立创电赛:{项目名称}-{视频模块名称};如立创电赛:《自动驾驶》-团队介绍。</span></p> <p style="line-height:1.8"><span style="font-size:14px"><a href="/posts/de460543d4cf4dacb5f0326612455578" target="_blank">前往查看更多详情 ></a></span></p> <p style="line-height:1.8"> </p> </div>

文档

BOM

暂无

附件

附件名 下载
09dbb6d8827ed4da84c41ed1e0c728e7.mp4

评论(0)

  • 表情
    emoji
    小嘉工作篇
    小嘉日常篇
  • 图片
成功
工程所有者当前已关闭评论
goToTop
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow