【Gravity:AS7341测评】+ 驱动开发板的选择
<p>按厂家提供的标准驱动方案是:</p><ul>
<li style="text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#24292e"><span style="tab-stops:list 36.0pt"><span style="font-family:Calibri,sans-serif"><strong><span style="font-family:宋体">硬件</span></strong></span></span></span></span></span>
<ul style="list-style-type:circle">
<li style="text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#333333"><span style="tab-stops:list 72.0pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI","sans-serif""><span style="color:#24292e">1 x </span></span><span lang="EN-US" style="background:white"><span style="font-family:"微软雅黑","sans-serif"">Arduino UNO</span></span><span style="background:white"><span style="font-family:"微软雅黑","sans-serif"">控制板</span></span></span></span></span></span></span></li>
<li style="margin-top:4px; text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#333333"><span style="tab-stops:list 72.0pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI","sans-serif""><span style="color:#24292e">1 x Gravity:A</span></span><span lang="EN-US" style="background:white"><span style="font-family:"微软雅黑","sans-serif"">S7341</span></span><span style="background:white"><span style="font-family:"微软雅黑","sans-serif"">可见光传感器</span></span></span></span></span></span></span></li>
<li style="margin-top:4px; text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#333333"><span style="tab-stops:list 72.0pt"><span style="font-family:Calibri,sans-serif"><span style="background:white"><span style="font-family:"微软雅黑","sans-serif"">若干 杜邦线</span></span></span></span></span></span></span></li>
</ul>
</li>
<li style="margin-top:4px; text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#24292e"><span style="tab-stops:list 36.0pt"><span style="font-family:Calibri,sans-serif"><strong><span style="font-family:宋体">软件</span></strong></span></span></span></span></span>
<ul style="list-style-type:circle">
<li style="text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#24292e"><span style="tab-stops:list 72.0pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI","sans-serif"">Arduino IDE</span><span style="font-family:宋体">,</span> <a href="https://www.arduino.cc/en/Main/Software" style="color:blue; text-decoration:underline"><span lang="EN-US" style="font-family:宋体"><span style="color:#0366d6">点击下载</span></span><span style="font-family:"Segoe UI","sans-serif""><span style="color:#0366d6">Arduino IDE</span></span></a></span></span></span></span></span></li>
<li style="margin-top:4px; text-align:left"><span style="font-size:10.5pt"><span style="background:white"><span style="color:#24292e"><span style="tab-stops:list 72.0pt"><span style="font-family:Calibri,sans-serif"><a href="https://codeload.github.com/DFRobot/DFRobot_AS7341/zip/master" style="color:blue; text-decoration:underline"><span style="font-family:"Segoe UI","sans-serif""><span style="color:#0366d6">AS7341</span></span><span lang="EN-US" style="font-family:宋体"><span style="color:#0366d6">库文件和示例程序</span></span></a></span></span></span></span></span></li>
</ul>
</li>
</ul>
<p>其连线关系如图1所示,然而测评的是传感器而非整体驱动方案,因此我们就面临两种选择,要么配置一块Arduino UNO控制板;要么另选一块开发板,通过程序移植来解决问题。</p>
<p>对我来说当然首选的是后者,不到万不得已就避免做第一个方案的选择。</p>
<p><img alt="https://img.dfrobot.com.cn/wiki/none/ad55492f9fed6b565de89c0ab41ad054.png" src="https://img.dfrobot.com.cn/wiki/none/ad55492f9fed6b565de89c0ab41ad054.png" /></p>
<p>图1 控制板与传感器的连接关系</p>
<p>在后者的方案中,又分为2种:</p>
<p>1. 选取一块非DFROBOT出品的Arduino UNO控制板,然后适当的修改相应的函数和功能程序。</p>
<p>2. 选一块具备串口通信功能和I2C通讯函数的开发板,以便于程序的功能移植,否则原问题没解决,还会引来新的问题。</p>
<p>为了避免出现更多的问题,我选择的是手头的一块Arduino UNO R3开发板,两者的MCU均为ATmega328P-AU。</p>
<p></p>
<p>图2 DFRduino UNO R3开发板</p>
<p></p>
<p>图3 Arduino UNO R3开发板</p>
<p> </p>
<p>该开发板与厂家的标准驱动方案都是以Arduino IDE为开发工具,因此它便于程序的移植。</p>
<p>所安装的开发工具为Arduino 1.8.5,虚拟串口为COM3,见图4所示。</p>
<p></p>
<p>经Blink闪灯程序的下载测试,其效果如图7所示。后面的工作就是将可见光传感器的例程添加到程序中,以实现色彩值的检测。</p>
<p></p>
<p>图6 完成编译</p>
<p></p>
<p>图7 Blink运行效果</p>
<p style="text-align:justify"> </p>
<p>又见Arduino,感觉不少人在用这个做原型了。</p>
freebsder 发表于 2021-1-6 21:52
又见Arduino,感觉不少人在用这个做原型了。
<p>确实已经很久不用它了,若不是因为例程是基于该类开发板。</p>
页:
[1]