描述
<div class="document">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">注:* 为必填项</p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><span style="color: #0093e6;">请在报名阶段填写 ↓</span></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 1、项目功能介绍</h3>
<hr class="horizontal-splitline normal-bold-2">
<p>这是一个能够将USB 手柄转为蓝牙手柄的设备。这样,你可以将有线的 USB 手柄变为无线的手柄进行游戏。</p>
<p> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*2、项目属性</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6;"><span style="font-size: 14px;">原创首次公开</span></span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 3、开源协议</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">Public Domain</p>
<p style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><strong><span style="color: #0093e6;">请在竞赛阶段填写 ↓</span></strong></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*4、硬件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<p>这次带来的方案是 ESP32 C3 配合 CH9350实现的。其中 ESP32 C3负责蓝牙,CH9350负责USB数据的解析。CH9350是 WCH (就是出品 Ch340 的那个公司)推出的USB键盘鼠标转串口通讯控制芯片。就是说USB 键盘鼠标连接到这个芯片之后,数据会转化为串口输出。关于这个芯片的功能介绍如下:</p>
<ul>
<li>支持12Mbps全速USB传输和1.5Mbps低速USB传输,兼容USB V2.0。</li>
<li>上位机端USB端口符合标准HID类协议,不需要额外安装驱动程序,支持内置HID类设备驱动的Windows、Linux、macOS等操作系统。</li>
<li>同一芯片可配置为上位机模式和下位机模式,分别连接USB-Host主机和USB键盘、鼠标。</li>
<li>支持USB键盘鼠标在BIOS界面使用,支持多媒体功能键,支持不同分辨率USB鼠标。</li>
<li>支持各种品牌的USB键盘鼠标、USB无线键盘鼠标、USB转PS2线等。</li>
<li>上位机端和下位机端支持热插拔。</li>
<li>提供发送状态引脚,支持485通讯。</li>
<li>串口支持115200/57600/38400串口通信波特率。</li>
<li>内置晶振和上电复位电路,外围电路简单。</li>
<li>支持5V、3.3V电源电压。</li>
<li>提供LQFP-48无铅封装,兼容RoHS。</li>
</ul>
<p>这次的方案优点是:成本比较低,体积比较小,容易DIY焊接(ESP32 C3 是我用过的最容易焊接的ESP32芯片)。能够同时支持2个USB设备,就是说你可以同时使用2个USB手柄,同时转化为蓝牙给主机使用。</p>
<p>首先进行电路的设计。</p>
<p>1. 主控 ESP32 C3 部分。这款主控内置了 USB 下载电路,我们设计一个 USB接口即可工作。此外,复位与下载按钮是必须的,当出现问题无法下载时,这两个按钮随时可以帮助恢复。</p>
<p> </p>
<p><img src="//image.lceda.cn/pullimage/bnqQMYwnGbtKRGtKj2YlxW7vxMTOZgHSXHOVHHp1.png" alt="" width="780" height="191"></p>
<p> </p>
<p>2. 接下来时CH9350部分,它外部电路非常简单,只需要一个 3.3uf和一个 0.1uf电容即可工作。外部的 LED1和 LED2用来指示USB工作状态,没有有效数据时会亮,有数据传输时会熄灭。其中的USB3 是一个双层USB座子,这样我们可以同时使用USB键盘鼠标。</p>
<p> <img src="//image.lceda.cn/pullimage/ckPqUlIteK1Mb95TEgbHH2EYfWAmqzlBJUECwrfE.png" alt="" width="779" height="386"></p>
<p> </p>
<p>3.我们使用 TLV1117将5V 转为3.3V,同时还预留一个假负载,用来避免在使用充电宝供电,输出小于50ma 一段时间后自动关机的问题。</p>
<p><img src="//image.lceda.cn/pullimage/H9XVxqw2Sb9wKgCNhC7uFD4psX0sEPlZ1XuPtHgb.png" alt="" width="252" height="225"><img src="//image.lceda.cn/pullimage/ucizCnznuGtrJUjvI61oJhpHTOnVYVnm5oKvorUJ.png" alt="" width="281" height="300"></p>
<p>电路比较简单PCB设计也相对简单:</p>
<p><img src="//image.lceda.cn/pullimage/WDit2q3bNv3hDiquKqtP0sXG13cJhvHepyCeBkAS.png" alt="" width="1430" height="949"></p>
<p>预览如下:</p>
<p><img src="//image.lceda.cn/pullimage/kJxR2V3CnIRdI4G65NsRnosJoQLF5oVGMPU68vWP.png" alt="" width="779" height="489"></p>
<p> </p>
<p> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt pap-left-indent-1.6em" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*5、软件部分</h3>
<hr class="horizontal-splitline normal-bold-2">
<p>上面就是硬件设计,接下来着手软件的设计。</p>
<p>这次的软件框架,可以看作是一个蓝牙HID多功能集合体的框架。蓝牙HID和USB HID 一样,都是通过 Report Descriptor告诉主机当前的数据格式。我们需要在描述符中声明2个USB手柄,实际上用到的蓝牙HID描述符就是USB 手柄的描述符,这样也能够让我们避免复杂的数据解析:当收到数据后,无需搞清楚哪一位对应什么按键,只要完整的转发出去基即可。</p>
<p> </p>
<p>要点如下:</p>
<p> </p>
<p>1. 声明2个USB 手柄描述符,为了避免解析USB手柄数据的麻烦,我们使用 USB 手柄的 HID Report 描述符,收到数据后直接转发即可无需解析</p>
<p>const uint8_t report[] ={......}</p>
<p> </p>
<p>2. 注册给设备</p>
<p> </p>
<p> hid = new BLEHIDDevice(pServer);</p>
<p> input = hid->inputReport(1); // <-- input REPORTID 1 from report map</p>
<p> input2 = hid->inputReport(2); // <-- input REPORTID 2 from report map</p>
<p> </p>
<p>3. 从Ch9350 串口数据中取出USB手柄数据</p>
<p> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*6、BOM清单</h3>
<p>本设计使用立创 EDA完成:</p>
<p> </p>
<hr class="horizontal-splitline normal-bold-2">
<table style="border-collapse: collapse; width: 480pt;" width="640">
<tr style="height: 14.4pt;">
<td style="height: 14.4pt; width: 48pt;" width="64" height="19">ID</td>
<td style="width: 48pt;" width="64">Name</td>
<td style="width: 48pt;" width="64">Designator</td>
<td style="width: 48pt;" width="64">
<p>Fo</p>
<p>otprint</p>
</td>
<td style="width: 48pt;" width="64">Quantity</td>
<td style="width: 48pt;" width="64">Manufacturer Part</td>
<td style="width: 48pt;" width="64">Manufacturer</td>
<td style="width: 48pt;" width="64">Supplier</td>
<td style="width: 48pt;" width="64">Supplier Part</td>
<td style="width: 48pt;" width="64">Price</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">1</td>
<td>BAU1</td>
<td>BAU1</td>
<td>HDR-TH_2P-P2.54-V</td>
<td align="right">1</td>
<td>826629-2</td>
<td>TE Connectivity</td>
<td>LCSC</td>
<td>C86471</td>
<td align="right">2.55</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">2</td>
<td>BAU0</td>
<td>BAU2</td>
<td>HDR-TH_2P-P2.54-V</td>
<td align="right">1</td>
<td>826629-2</td>
<td>TE Connectivity</td>
<td>LCSC</td>
<td>C86471</td>
<td align="right">2.55</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">3</td>
<td>0.1uf</td>
<td>C1,C8</td>
<td>C1206</td>
<td align="right">2</td>
<td>C1206X104K1RAC7800</td>
<td>KEMET(基美)</td>
<td>LCSC</td>
<td>C600091</td>
<td align="right">0.4961</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">4</td>
<td>3.3uf</td>
<td>C2</td>
<td>C1206</td>
<td align="right">1</td>
<td>TCC1206X7R561K501DT</td>
<td>CCTC</td>
<td>LCSC</td>
<td>C377112</td>
<td align="right">0.0764</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">5</td>
<td>0.1uf</td>
<td>C3</td>
<td>C1206</td>
<td align="right">1</td>
<td>TCC1206X7R561K501DT</td>
<td>CCTC</td>
<td>LCSC</td>
<td>C377112</td>
<td align="right">0.0764</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">6</td>
<td>1uf</td>
<td>C6,C7,C9,C10</td>
<td>C1206</td>
<td align="right">4</td>
<td>C1206X104K1RAC7800</td>
<td>KEMET(基美)</td>
<td>LCSC</td>
<td>C600091</td>
<td align="right">0.4961</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">7</td>
<td>EN</td>
<td>EN1</td>
<td>SW-SMD_L4.0-W2.9-LS5.0</td>
<td align="right">1</td>
<td>TS342A2P-WZ</td>
<td>SHOU HAN</td>
<td>LCSC</td>
<td>C557591</td>
<td align="right">0.2033</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">8</td>
<td>Header2.0*5</td>
<td>H1</td>
<td>HEADER2.0*5</td>
<td align="right">1</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">9</td>
<td>IO9</td>
<td>IO9</td>
<td>SW-SMD_L4.0-W2.9-LS5.0</td>
<td align="right">1</td>
<td>TS342A2P-WZ</td>
<td>SHOU HAN</td>
<td>LCSC</td>
<td>C557591</td>
<td align="right">0.2033</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">10</td>
<td>204-10SURD/S530-A3-L</td>
<td>LED1,LED2</td>
<td>LED-TH_BD3.0-P2.54-FD</td>
<td align="right">2</td>
<td>204-10SURD/S530-A3-L</td>
<td>EVERLIGHT(亿光)</td>
<td>LCSC</td>
<td>C99771</td>
<td align="right">0.1609</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">11</td>
<td>SS8050_C2150</td>
<td>Q1</td>
<td>SOT-23-3_L2.9-W1.3-P1.90-LS2.4-BR</td>
<td align="right">1</td>
<td>SS8050</td>
<td>CJ</td>
<td>LCSC</td>
<td>C2150</td>
<td align="right">0.0929</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">12</td>
<td>10K</td>
<td>R2</td>
<td>R1206</td>
<td align="right">1</td>
<td>CR1206J405R1G</td>
<td>LIZ(丽智电子)</td>
<td>LCSC</td>
<td>C102372</td>
<td align="right">0.02</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">13</td>
<td>1K</td>
<td>R3,R4</td>
<td>R1206</td>
<td align="right">2</td>
<td>R1206RXX102XJ04LTC</td>
<td>Shenzhen Eyang Tech Development</td>
<td>LCSC</td>
<td>C267247</td>
<td align="right">0.0243</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">14</td>
<td align="right">20</td>
<td>R5</td>
<td>R1206</td>
<td align="right">1</td>
<td>PTFR1206B10K0P9</td>
<td>ResistorToday</td>
<td>LCSC</td>
<td>C351536</td>
<td align="right">1.2904</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">15</td>
<td>1K</td>
<td>R6</td>
<td>R1206</td>
<td align="right">1</td>
<td>CR1206J405R1G</td>
<td>LIZ(丽智电子)</td>
<td>LCSC</td>
<td>C102372</td>
<td align="right">0.02</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">16</td>
<td align="right">100</td>
<td>R9</td>
<td>R1206</td>
<td align="right">1</td>
<td>PTFR1206B10K0P9</td>
<td>ResistorToday</td>
<td>LCSC</td>
<td>C351536</td>
<td align="right">1.2904</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">17</td>
<td>CH9350L</td>
<td>U1</td>
<td>LQFP-48_L7.0-W7.0-P0.50-LS9.0-BL</td>
<td align="right">1</td>
<td>CH9350L</td>
<td>WCH</td>
<td>LCSC</td>
<td>C109472</td>
<td align="right">24.5</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">18</td>
<td>ESP32-C3-WROOM-02 模组</td>
<td>U2</td>
<td>ESP32-C3-WROOM-02 模组</td>
<td align="right">1</td>
<td>ESP32-C3-WROOM-02-H4</td>
<td>espressif</td>
<td>LCSC</td>
<td>C2944070</td>
<td align="right">18.01</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">19</td>
<td>TLV1117LV33DCYR</td>
<td>U3</td>
<td>SOT-223_L6.7-W3.5-P2.30-BR</td>
<td align="right">1</td>
<td>TLV1117LV33DCYR</td>
<td>TI</td>
<td>LCSC</td>
<td>C15578</td>
<td align="right">0.9603</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">20</td>
<td>Double layer DIP 90° white</td>
<td>USB3</td>
<td>USB-A-TH_USB-M-51</td>
<td align="right">1</td>
<td>Double layer DIP 90° white</td>
<td>ValuePro</td>
<td>LCSC</td>
<td>C2341</td>
<td align="right">0.8867</td>
</tr>
<tr style="height: 14.4pt;">
<td style="height: 14.4pt;" align="right" height="19">21</td>
<td>USB-211-BCW</td>
<td>USB4</td>
<td>USB-A-TH_USB-211-BCW</td>
<td align="right">1</td>
<td>USB-211-BCW</td>
<td>XUNPU</td>
<td>LCSC</td>
<td>C720520</td>
<td align="right">0.4656</td>
</tr>
</table>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">*7、大赛LOGO验证</h3>
<hr class="horizontal-splitline normal-bold-2">
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><img src="//image.lceda.cn/pullimage/7uyRJCl7iWvxsw6CT7oqsOpDZ3NWMVwTgcb5sTZ9.jpeg" alt=""></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<h3 class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;">* 8、演示您的项目并录制成视频上传</h3>
<hr class="horizontal-splitline normal-bold-2">
<p style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">视频要求:请横屏拍摄,分辨率不低于1280×720,格式Mp4/Mov,单个视频大小限100M内;</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="color: #95a5a6; font-size: 14px;">视频标题:立创电赛:{项目名称}-{视频模块名称};如立创电赛:《自动驾驶》-团队介绍。</span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"><span style="font-size: 14px;">更多详情:<a href="/posts/15a52db9fd7d40c492eb505280278e45" target="_blank">https://diy.szlcsc.com/posts/15a52db9fd7d40c492eb505280278e45</a></span></p>
<p class="paragraph text-align-type-left pap-line-1.3 pap-line-rule-auto pap-spacing-before-3pt pap-spacing-after-3pt" style="line-height: 1.8;"> </p>
</div>
评论(3)