描述
<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;"><span style="color: #000000;">入门版无刷电调</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;"><span style="color: #000000;">1、项目功能介绍</span></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: #000000;"><span style="font-size: 14px;">全自主设计的BLDC电调,包括反电动势检测,干扰消除,使用I2C接口与外界通信进行调速</span></span></p>
<h4 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: #000000;"><span style="font-size: 14px;">1.BLDC简介</span></span></h4>
<h5><span style="color: #000000;"><span style="font-size: 14px;"> 1.电机的</span></span><span style="color: #000000;"><span style="font-size: 14px;">机械结构</span></span></h5>
<p><span style="color: #000000;"><span style="font-size: 14px;"><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/ioaXPIEbWFNWr86NfoALzT9PnATBEELkji4ZmUoQ.png"></span></span></p>
<p style="text-align: center;"><span style="color: #000000;"><span style="font-size: 14px;">图1</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;">在简化模型中,BLDC由互成120°夹角的三组绕组ABC和中间的永磁体组成,假定永磁体在120°宽度内磁场恒定,在N-S间的60°角内磁场强度线性过渡。假定流入纸张的电流方向为正。</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;">以A相为例:当其通电时,在永磁体上产生的力矩为<span style="font-size: 16px;">τ=rⅹF=rⅹ(iLⅹB)</span>,方向垂直纸面向外</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;">当θ变化时,可以得到力矩为<img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/YB39EMrKyhKbk2w0WdvkhwNOMEN463XRvQTfrrVN.png"></span></span></p>
<p style="text-align: center;"><span style="color: #000000;"><span style="font-size: 14px;">图2</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;">那么,如果我们要获得最大力矩,便可以让A相在转子位置为0°~60°时通正电流,60°~120°不通电,120°~240°通负电流,240°~300°不通电,300°~360°通正电流。</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;">综合三相考虑时,便可以得到一个恒定的力矩<img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/ebVIx7qSlCzLKovxFLcJzGSJShteU7u0upR3gZqh.png"></span></span></p>
<p style="text-align: center;"><span style="color: #000000;"><span style="font-size: 14px;">图3</span></span></p>
<h4><span style="color: #000000;"><span style="font-size: 14px;"> 2.电机的数学模型</span></span></h4>
<p><span style="color: #000000;"><span style="font-size: 14px;">依然以A相为例,可以简化为如下模型,有线圈电阻R线圈电感L和由于转动而产生的反电动势e三部分构成</span></span></p>
<p><span style="color: #000000;"><span style="font-size: 14px;"><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/Zf3PKsrjTNFJ8h7jKCzSbtO8aiw85k1InZAbgoft.png"></span></span></p>
<p style="text-align: center;"><span style="color: #000000;"><span style="font-size: 14px;">图4</span></span></p>
<p><img src="//image.lceda.cn/pullimage/ghbp76ci8aOeIjYzFsJLRmIp2nvpvYEfpiv79hrD.png"></p>
<p><span style="color: #000000; font-size: 16px;">其中气隙磁链<img src="//image.lceda.cn/pullimage/1tND1CRLk0G2m5dPMic8FbokRuHIhThtPLiWyfAP.png"></span></p>
<p><span style="color: #000000; font-size: 16px;"><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/uiOyNc2FejfJtLUlASOhixsf0XSJqFbHU0IFBZYL.png"></span></p>
<p style="text-align: center;"><span style="color: #000000; font-size: 16px;"><span style="color: #000000;"><span style="font-size: 14px;">图5</span></span></span></p>
<p><span style="color: #000000; font-size: 16px;">假设以磁轴为参考,在α角处的磁通密度为B(α),在磁轴偏转θ角(如图1)时反电动势e(θ)为</span><img src="//image.lceda.cn/pullimage/HlmoK18pLXlNdm3Hr1DzyreyBrwOlDCuyqy0iF9k.png"></p>
<p>可见反电动势与磁通密度的形状相同,综上可得三相的控制电压与反电动势关系如下</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/KmyLVLS7MIag0xfAoUIvLxH7wPU0Z7ik81TXMfIT.png"></p>
<p style="text-align: center;"><span style="color: #000000; font-size: 16px;"><span style="color: #000000;"><span style="font-size: 14px;">图6</span></span></span></p>
<p>于是,我们便可以在某一相关断时检测其上产生的反电动势来获得转子位置</p>
<h4> 3.反电动势检测</h4>
<p>由图6可知:在每个角度总由两相通电,一相关断,且关断的一相上存在反电动势。考虑电机采用星形接法,假设AB相通电,可以得到如下关系:</p>
<p><img src="//image.lceda.cn/pullimage/mploA6Bio7V6XknDCwuF6N20h5qjShVNvYDCHHI1.png"></p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/309BXy1gscxSyNeT8i5I6viRjleZlxwsVrq9m5Q1.png"></p>
<p style="text-align: center;">图7</p>
<p style="text-align: left;">为进一步简化e的<span style="font-size: 16px;">获取难度,观察<span style="color: #000000;"><span style="color: #000000;">图6可知e在30°+<em>k∙</em>60°时过零点,也就是说只要判断ua+ub-2∙uc过零的时刻便可以知道转子的位置。</span></span><span style="color: #000000;"><span style="color: #000000;">为此,可以设计如下电阻网络:</span></span></span></p>
<p style="text-align: left;"><span style="color: #000000; font-size: 16px;"><span style="color: #000000;"><span style="font-size: 14px;"><img style="display: block; margin-left: auto; margin-right: auto;" src="//image.lceda.cn/pullimage/c7bM6XSw08OHD2ZLNoZsmqknyjME4z1f9EJXsoWS.png"></span></span></span></p>
<p style="text-align: center;"><span style="color: #000000; font-size: 16px;"><span style="color: #000000;"><span style="font-size: 14px;">图8</span></span></span></p>
<p style="text-align: left;"><span style="color: #000000; font-size: 16px;"><span style="color: #000000;">解得:</span></span></p>
<p><img src="//image.lceda.cn/pullimage/WR3Sl0ADAXgV4yBdTlpn7iZk4WZnb1ZgfroFcdTj.png"></p>
<p><span style="font-size: 16px;">可见um-uc'和<span style="color: #000000;"><span style="color: #000000;">ua+ub-2∙uc的正负关系是相同的,因此把um和ua',ub',uc‘送入比较器看比较器,观察何时发生跳变就获得了转子位置。还可以</span></span><span style="color: #000000;"><span style="color: #000000;">调整R1,R2的值以满足比较器输入电压范围</span></span></span></p>
<p> </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" 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;"><span style="color: #000000;">2、项目属性</span></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: #000000;"><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;"><span style="color: #000000;">3、开源协议</span></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: #000000; font-size: 14px;">GPL 3.0</span></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;"> </h3>
<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;"><span style="color: #000000;">4、硬件部分</span></h3>
<hr class="horizontal-splitline normal-bold-2">
<h4 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.电源</h4>
<p>为方便大家入门,免去额外的电源需求,这里使用了升压设计,可以使用单节锂电池或5v充电器直接供电,大家可以根据实际需要替换</p>
<p><img src="//image.lceda.cn/pullimage/7fETl6VbE3ZQlQSfjjTbCr6XMrDf72zkFOlieYfE.png"></p>
<h4>2.控制</h4>
<p>当然是用N32G430了</p>
<p><img src="//image.lceda.cn/pullimage/YzVlXdRGKOLAUuv5oHNmNNKuHd17RX0VIGSh7rWh.png"></p>
<h4>3.驱动</h4>
<p>使用FD6288三相栅极驱动器,可以防止由于软件失误带来的上下管同时导通,并使用WSD3056DN双NMOS以压缩成本</p>
<p><img src="//image.lceda.cn/pullimage/luWhBRjBMAab33Wd5O8ye0UhMtVLOZKJflDaz0u3.png"></p>
<h4>4.反电动势分压网络</h4>
<p>使用R1=10k,R2=2.7k,因为刚好有这两种电阻,且满足比较器输入条件,大家可以感觉实际输入电压范围选择合适的分压电阻</p>
<p><img src="//image.lceda.cn/pullimage/6cShKiBELVzHq8RW76QmESvtqWVEHcb1qpngcJfH.png"></p>
<h4>5.调试接口</h4>
<p>引出SWD和UART</p>
<p><img src="//image.lceda.cn/pullimage/7a9kn51JJpakXZz5s5vqxaBcn4BN1DxY24qmW7Qo.png"></p>
<h4>6.HALL接口</h4>
<p>留一个霍尔在初期调试时使用</p>
<p><img src="//image.lceda.cn/pullimage/wNljBiIDDtPxj9DfThxx21R3eeirzZKXeV7s3whp.png"></p>
<h4>7.I2C和引出IO</h4>
<p><img src="//image.lceda.cn/pullimage/IhcJneTdDTRJiAMoUZFZ9LliIWTVAo9tmnbVleV3.png"></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;"><span style="color: #000000;">5、软件部分</span></h3>
<hr class="horizontal-splitline normal-bold-2">
<p>软件非常简单,可以分为启动->检测反电动势->换相,</p>
<h4 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.启动</h4>
<p>一开始速度很低,并不能靠反电动势换相,因此使用一个小占空比PWM开环换相,强制电机转起来。这个转速是越来越快的,通过每次减小换相定时器的中断时间达到,直到达到一定速度后切换为闭环反电动势换相</p>
<p>启动时的最小油门量由<span style="color: #2dc26b;">MIN_DC</span>控制,每次速度增加值通过<span style="color: #2dc26b;">ACC_STEPS</span>控制</p>
<p><code>arr -= arr/ACC_STEPS;</code><br><code>TIM3->AR = arr;</code><br><code>sectorInc(§or);</code><br><code>setSector(sector);</code><br><code>TIM_Event_Generate(TIM1, TIM_EVT_SRC_COM);</code><br><code>setPWM(throttle);</code></p>
<div class="document">
<h4>2.反电动势检测</h4>
<p>由于干扰信号的存在,这里需要对比较器输出值进行滤波。</p>
<p>电机实际工作状况如下图,从上至下依次为A相电压,B相电压,滤波后比较器输出,比较器输出</p>
<p><img src="//image.lceda.cn/pullimage/HwAE3SldKtP0SxdhvLHGH1AhRNCkLSVIHX4yKye8.png"></p>
<p>进入比较器中断时,如果正确的比较器输出多于一定值,则认为检测到过零事件</p>
<p><img src="//image.lceda.cn/pullimage/hx4cz9BwjCsCpuvgUkhcb3RsY3REQs6DTojTEOfM.png"></p>
<div>
<p><code>if(sector & 0x01){</code><br><code> //1 3 5 Rising Edge</code><br><code> for (int i = 0; i < minContEdge; i++){</code><br><code> if(!(COMP->Cmp1.CTRL & COMP1_CTRL_OUT)){</code><br><code> errCnt++;</code><br><code> errContCnt++;</code><br><code> } else {</code><br><code> corrCnt++;</code><br><code> errContCnt = 0;</code><br><code> }</code></p>
<p><code> //太多错误连续出现直接跳出</code><br><code> if(errContCnt >= maxErrEdgeCnt){</code><br><code> corrCnt = 0;</code><br><code> break;</code><br><code> }</code><br><code> }</code><br><code>} else {</code><br><code> //2 4 6 Falling Edge</code><br><code> for (int i = 0; i < minContEdge; i++){</code><br><code> if(COMP->Cmp1.CTRL & COMP1_CTRL_OUT){</code><br><code> errCnt++;</code><br><code> errContCnt++;</code><br><code> } else {</code><br><code> corrCnt++;</code><br><code> errCnt = 0;</code><br><code> }</code></p>
<p><code> if(errContCnt >= maxErrEdgeCnt){</code><br><code> corrCnt = 0;</code><br><code> break;</code><br><code> }</code><br><code> }</code><br><code>}</code><br><code>if(corrCnt >= errCnt*2){</code><br><code> zc = 1;</code><br><code>}</code></p>
<h4>3.换相</h4>
</div>
<div>由上次换相到检测到过零事件的时间为参考进行换相。由于线圈的感性,还需要超前一定时间进行换相,这由<span style="color: #2dc26b;">advance</span>控制。还可以换相定时器的分频数以提高及时精度</div>
<div>
<p><code>uint16_t div = TIM3->PSC;</code></p>
<p><code>commInterval = (cntNow + commInterval)/2;</code></p>
<p><code>//自动缩放</code><br><code>if(commInterval < 10000 && div != 0){</code><br><code> div /= 2;</code><br><code> commInterval *= 2;</code><br><code> TIM3->PSC = div;</code><br><code>} else if(commInterval > 40000 && div != 0xFFFF){</code><br><code> div = div*2 + 1;</code><br><code> commInterval /= 2;</code><br><code> TIM3->PSC = div;</code><br><code>}</code></p>
<p><code>TIM3->CNT -= cntNow; //保证精度</code><br><code>TIM3->AR = commInterval - commInterval/ADV_SUBDIV*advance; //-超前换相</code></p>
</div>
<h4 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;">4.控制信号格式</h4>
<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;">由I<sup>2</sup>C接口输入油门值,I<sup>2</sup>C地址为0x52,频率最高为1MHz,输入数据有三个字节分别为油门高8位,油门第8位和1Byte校验位</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;"><code>if((uint8_t)(i2cRecData[0] + i2cRecData[1]) == i2cRecData[2]){</code><br><code> throttle = (i2cRecData[0] << 8) + i2cRecData[1];</code></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;"><span style="color: #000000;">6、BOM清单</span></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/qi214rtSvL0qGWl5hjwPZwNzf6uWNXMXHafri2yz.png"></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;"><span style="color: #000000;">7、大赛LOGO验证</span></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;">由于第一版没加LOGO,所以又做了一版加LOGO的,并改进了调试接口,增加了上拉电阻和滤波电容</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;"><img src="//image.lceda.cn/pullimage/fGpDnse3SrQTXEMJppj5HzNZLGxOZGDdOjUbaCQ8.jpeg"></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;"><img src="//image.lceda.cn/pullimage/JFOMPfYFIH5V4BNthBNFcTzZ0NzviXUabIYOsYqC.jpeg"></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;"><img src="//image.lceda.cn/pullimage/q1LahWgPrlcL7oM53emx5jsR0lwBijwTWn9yHlff.png"></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>
</div>
</div>
评论(5)