版本协议

Public Domain

标签
专业版
#第十届立创电赛#lpy音响

创建时间:4周前

36 0

描述

<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 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;">使用瑞萨开发板实现载波采集和D类功放高效调参,以及实时反向波消音<br><strong>主控芯片</strong>:<strong>瑞萨 RA4M2-Sensor</strong><br></span></p> <ul class="auto-hide-last-sibling-br"> <li> <ul class="auto-hide-last-sibling-br"> <li>优势:8 位 / 16 位混合架构,性价比极高(单芯片成本约 5-8 元);内置 12 位 SAR-ADC(满足 AD 采集精度需求)、定时器(生成三角载波)、PWM 模块(驱动 D 类功放),无需额外扩展芯片,降低硬件成本。</li> <li>资源匹配:12 位 ADC(支持多通道采集)、4 路 16 位定时器(生成三角波 + PWM)、UART(调试)、足够 GPIO(控制功放使能 / 模式)。</li> </ul> </li> <li><strong>D 类功放芯片</strong>:<strong>TI TPA3116D2(单声道版本)</strong> <ul class="auto-hide-last-sibling-br"> <li>优势:低成本(约 8-12 元)、高效率(≥90%),支持 5-26V 供电,输出功率可达 15W(适配小型音频场景),内置过流 / 过热保护,通过 PWM 信号即可调节增益(匹配主控 PWM 输出)。</li> </ul> </li> <li><strong>辅助芯片</strong>: <ul class="auto-hide-last-sibling-br"> <li>麦克风(AD 采集声源):<strong>SGM3770(模拟麦克风放大芯片,成本约 2 元)</strong> + 普通驻极体麦克风(成本约 1 元),放大麦克风微弱信号,提升 AD 采集精度。</li> <li>电源芯片:<strong>AMS1117-3.3(成本约 1 元)</strong> ,为 RL78 主控提供 3.3V 稳定供电;若 D 类功放需更高电压,可搭配 LM1117-5V(成本约 1 元)。</li> </ul> </li> </ul> <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;"><br><br></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;"> </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; font-size: 14px;">项目是首次公开,为原创;项目未曾经在其他比赛中获奖<br></span></p> <ul class="auto-hide-last-sibling-br"> <li><strong>核心目标</strong>:基于低成本瑞萨芯片,实现三角载波高精度 AD 采集,同步完成 D 类功放参数动态调节,并通过实时生成反向声波抵消环境 / 特定噪音。</li> <li><strong>应用场景</strong>:低成本消费类音频设备(如迷你音箱、降噪耳机)、小型工业降噪模块、教学实验平台。</li> <li><strong>关键指标</strong>:AD 采集精度≥10 位,采样率≥10kHz;D 类功放调参响应延迟≤1ms;反向波消音降噪量≥15dB(特定频段,200-2000Hz)。</li> </ul> <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> <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><span style="color: #95a5a6; font-size: 14px;">GPL3.0开源协议</span></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"> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(1)三角载波生成与 AD 采集模块</h4> <ul class="auto-hide-last-sibling-br"> <li>三角载波生成:利用 RL78/G14 的 16 位定时器(如 Timer A),配置为 “向上 / 向下计数模式”,输出周期性三角波(频率可通过定时器初值调节,默认 10kHz),通过 GPIO 引脚(如 P100)输出至 AD 采集输入引脚(如 AN000)。</li> <li>AD 采集电路: <ol class="auto-hide-last-sibling-br"> <li>麦克风输出信号经 SGM3770 放大(增益可调至 20-40dB),滤波后接入 AD 通道 AN001(采集噪音信号)。</li> <li>定时器生成的三角波直接接入 AD 通道 AN000(采集三角载波)。</li> <li>AD 采集配置:12 位精度,采样率 10kHz(与三角波频率同步),采用 “多通道扫描模式”,同时采集三角波和噪音信号。</li> </ol> </li> </ul> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(2)D 类功放调参模块</h4> <ul class="auto-hide-last-sibling-br"> <li>主控与 TPA3116D2 连接:RL78 的 PWM 输出引脚(如 Timer B 输出 PWM1,引脚 P200)接入 TPA3116D2 的增益控制引脚(GAIN),通过调节 PWM 占空比(0-100%)控制功放增益(对应输出功率 0-15W)。</li> <li>功放供电:若需 5V 供电,由 LM1117-5V 提供;若需更高电压(如 12V),可外接直流电源(需匹配功放规格),并通过二极管防反接。</li> <li>输出滤波:TPA3116D2 输出端接 LC 低通滤波器(电感 10μH + 电容 100nF),滤除 PWM 高频分量,还原音频信号,连接至扬声器。</li> </ul> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(3)实时反向波消音模块</h4> <ul class="auto-hide-last-sibling-br"> <li>信号处理链路:麦克风采集噪音信号→AD 转换(AN001)→主控实时计算反向波(相位反转 + 幅度匹配)→通过 PWM 模块(Timer C,引脚 P201)输出反向波→叠加至 D 类功放输入信号(与原噪音信号抵消)。</li> <li>硬件叠加:反向波 PWM 信号与原音频信号(若有)通过电阻网络(如 1kΩ 电阻分压)叠加后,接入 TPA3116D2 的音频输入引脚(IN+),确保反向波与噪音信号在扬声器端实时抵消。</li> </ul> <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"> <h3 class="header-vfC6AV auto-hide-last-sibling-br">1. 开发环境与工具</h3> <ul class="auto-hide-last-sibling-br"> <li>开发 IDE:<strong>瑞萨 e2studio(免费)</strong> ,支持 RL78 系列芯片的代码编写、编译、调试。</li> <li>调试工具:<strong>瑞萨 E1 仿真器(低成本版本约 50 元)</strong> ,用于程序下载和在线调试。</li> <li>驱动库:使用瑞萨提供的 “RL78/G14 外设驱动库(RL78G14_Driver)”,简化 ADC、定时器、PWM 的配置。</li> </ul> <h3 class="header-vfC6AV auto-hide-last-sibling-br">2. 软件核心流程</h3> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(1)初始化配置(主函数初始化)</h4> <ol class="auto-hide-last-sibling-br"> <li><strong>时钟配置</strong>:将 RL78/G14 的系统时钟配置为 16MHz(内部高速振荡器),确保定时器、ADC 工作稳定。</li> <li><strong>ADC 初始化</strong>: <ul class="auto-hide-last-sibling-br"> <li>通道选择:AN000(三角波)、AN001(噪音信号)。</li> <li>精度与采样率:12 位,采样时钟分频系数设为 16,采样率 10kHz。</li> <li>中断使能:AD 转换完成后触发中断(ADI 中断),进入中断服务函数处理数据。</li> </ul> </li> <li><strong>定时器初始化</strong>: <ul class="auto-hide-last-sibling-br"> <li>Timer A(三角波生成):16 位,向上 / 向下计数,输出频率 10kHz,GPIO 引脚 P100 输出三角波。</li> <li>Timer B(D 类功放调参 PWM):16 位,边缘对齐模式,PWM 频率 20kHz(高于人耳听觉上限),占空比初始值 50%(对应功放中等增益)。</li> <li>Timer C(反向波 PWM):16 位,边缘对齐模式,PWM 频率与噪音信号频率同步(由 AD 采集的噪音频率动态调整)。</li> </ul> </li> <li><strong>UART 初始化</strong>:波特率 115200bps,用于输出 AD 采集数据、PWM 参数(调试用)。</li> </ol> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(2)AD 采集与数据处理(中断服务函数)</h4> <ol class="auto-hide-last-sibling-br"> <li>触发 ADI 中断后,读取 AN000(三角波)和 AN001(噪音信号)的 AD 转换值(12 位,范围 0-4095)。</li> <li>三角波数据处理:判断三角波的 “上升沿 / 下降沿”,确认周期完整性,若数据异常(如超出 0-4095 范围),丢弃并标记错误。</li> <li>噪音信号数据处理:对连续 5 次采集的噪音 AD 值取平均值(滤波,减少干扰),转换为实际电压值(公式:电压 = AD 值 ×3.3V/4095),再通过 “傅里叶变换简化算法(如 Goertzel 算法,低成本场景替代 FFT)” 提取噪音的频率和幅度。</li> </ol> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(3)D 类功放动态调参(主循环)</h4> <ol class="auto-hide-last-sibling-br"> <li>根据 AD 采集的三角波数据,计算当前三角波频率(通过周期时长反推),若频率偏离目标值(10kHz),动态调整 Timer A 的计数初值,修正三角波频率。</li> <li>根据噪音信号的幅度:若噪音幅度>阈值(如 1V,可通过调试设定),增加 Timer B 的 PWM 占空比(提升功放增益,增强反向波输出功率);若噪音幅度<阈值,降低占空比(节省功耗)。</li> <li>调参限制:PWM 占空比范围限制在 10%-90%,避免功放增益过高导致失真或过低导致消音效果不足。</li> </ol> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(4)实时反向波生成(Timer C 中断)</h4> <ol class="auto-hide-last-sibling-br"> <li>基于噪音信号的频率和幅度,计算反向波的参数:频率与噪音一致,幅度与噪音匹配(误差≤5%),相位与噪音相差 180°。</li> <li>动态调整 Timer C 的 PWM 参数: <ul class="auto-hide-last-sibling-br"> <li>频率:根据噪音频率设置 Timer C 的计数周期(如噪音频率 500Hz,PWM 周期设为 2ms)。</li> <li>占空比:根据噪音幅度设置(如噪音幅度 1V,对应 PWM 占空比 50%;幅度 0.5V,对应占空比 25%)。</li> </ul> </li> <li>反向波 PWM 信号通过电阻网络叠加至功放输入,与原噪音信号在扬声器端抵消,实现消音。</li> </ol> <h4 class="header-vfC6AV auto-hide-last-sibling-br">(5)调试与监控(主循环)</h4> <ul class="auto-hide-last-sibling-br"> <li>每 100ms 通过 UART 输出一次关键数据:三角波 AD 值、噪音 AD 值、功放 PWM 占空比、反向波频率 / 幅度,便于上位机(如串口助手)监控系统状态。</li> <li>若连续 10 次 AD 采集数据异常,触发 GPIO 引脚(如 P300)输出低电平,驱动 LED 报警(故障提示)</li> </ul> <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 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;">6、BOM清单</h3> <hr class="horizontal-splitline normal-bold-2"> <table> <tr> <td>主控芯片</td> <td>RL78/G14(R5F104PJAFB)</td> <td>6 元</td> <td>1</td> <td>6 元</td> </tr> <tr> <td>D 类功放芯片</td> <td>TPA3116D2</td> <td>10 元</td> <td>1</td> <td>10 元</td> </tr> <tr> <td>麦克风放大芯片</td> <td>SGM3770</td> <td>2 元</td> <td>1</td> <td>2 元</td> </tr> <tr> <td>驻极体麦克风</td> <td>普通</td> <td>1 元</td> <td>1</td> <td>1 元</td> </tr> <tr> <td>3.3V 电源芯片</td> <td>AMS1117-3.3</td> <td>1 元</td> <td>1</td> <td>1 元</td> </tr> <tr> <td>5V 电源芯片(可选)</td> <td>LM1117-5V</td> <td>1 元</td> <td>1</td> <td>1 元</td> </tr> <tr> <td>电阻、电容、电感</td> <td>普通贴片</td> <td>0.5 元</td> <td>若干</td> <td>0.5 元</td> </tr> <tr> <td>仿真器(调试用)</td> <td>瑞萨 E1(低成本)</td> <td>50 元</td> <td>1</td> <td>50 元(一次性投入)</td> </tr> <tr> <td><strong>核心硬件成本</strong></td> <td>-</td> <td>-</td> <td>-</td> <td><strong>21.5 元(不含仿真器)</strong></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 style="line-height: 1.8;"><span style="color: #95a5a6;"><span style="font-size: 14px;">TODO</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;"><span style="color: #95a5a6; font-size: 14px;">请上传包含大赛logo的项目图片,logo以丝印形式印刷在PCB上面。</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;">点击zip下载大赛logo标识! <span style="text-decoration: underline;"><a href="https://image.lceda.cn/easyedaResource/images/d1bbfd69f9404f56901a0e7b849b7245.rar" target="_blank">(大赛标识).zip</a></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;">8、演示您的项目并录制成视频上传</h3> <hr class="horizontal-splitline normal-bold-2"> <p style="line-height: 1.8;"><span style="color: #95a5a6;"><span style="font-size: 14px;">TODO</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;"><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/42551e8f2f2548cabc1c36626a42da94" target="_blank">前往查看更多详情 ></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>

文档

BOM

暂无

附件

暂无

评论(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