专业版
#第九届立创电赛#mini桌面宠物狗

创建时间:4周前

202 2

视频

  • lv_0_20241023165219.mp4

  • VID20241018135915.mp4

描述

<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;">        通过STM32微控制器与SG90舵机结合,打造一款迷你桌面宠物狗。该宠物狗具备坐下、行走、撒娇、摇摆等不同的动作姿态表演,增加互动乐趣。通过红外遥控器对宠物狗进行控制,用户可以方便地操控宠物狗进行动作表演。采用可充电锂电池供电,使用方便,具备一定的续航能力,确保长时间的使用。<img src="//image.lceda.cn/pullimage/jY8wQfkk5K6Oip7XCxBRShoV63KnITkOBFUCi7rf.jpeg" alt="" width="194" height="259"></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;">       这个简单有趣的入门小项目,不仅可以提高电子diy的乐趣,也可以作为入门教育项目,帮助小白了解单片机开发、舵机控制和红外传感技术等相关知识。</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;">首次公开,原创</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>GPL3.0</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 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;"><strong>4.1 系统框架<img src="//image.lceda.cn/pullimage/gcPR1wqxuvy3jt22LD6LNhTX2Nx6l8JnSDhkw9Kp.png" alt="" width="342" height="155"></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 pap-left-indent-1.6em" style="line-height: 1.8;">从图中可以看出该项目并不复杂,只需会使用红外通信技术,单片机定时器产生pwm波,舵机的驱动和oled图像显示,就可以制作这个简单的迷你桌面宠物狗。</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> <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;"><strong>4.2 主要构成</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 pap-left-indent-1.6em" style="line-height: 1.8;">stm32单片机作为主控单元</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;">sg90舵机作为运动控制单元</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;">oled屏幕作为显示单元</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> <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> <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;"><strong>4.3 3D部件</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 pap-left-indent-1.6em" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/Qxbp8IuN57tH5ygLwByetj4scz8UQvba6aLao9No.png" alt="" width="229" height="192"></strong>用来给舵机装载oled屏幕</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> <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;"><strong><img src="//image.lceda.cn/pullimage/XGxGTukWJXpHTXRDrrTXsZmLCKcqg9ZPfLvYIvk1.png" alt="" width="400" height="257"></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 pap-left-indent-1.6em" 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> <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;"><strong><img src="//image.lceda.cn/pullimage/hTrzfR0IcqNg8FC8cEd5jxL0as3Lto4K5BfyHhx9.jpeg" alt="" width="300" height="348"></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 pap-left-indent-1.6em" 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;"><strong>4.4 原理图</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 pap-left-indent-1.6em" style="line-height: 1.8;"><strong><img src="//image.lceda.cn/pullimage/suu7u0unTeYJYydgQTrUqAajwgYc2P0lBAKWfAHs.png" alt="" width="666" height="406"></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 pap-left-indent-1.6em" style="line-height: 1.8;">只有五个舵机接口引出和一个红外接收头插口以及oled屏幕插口。</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;">使用sg90舵机以及5v电源供电的话不需要加降压模块,用焊锡短路连接就行,添加一个可调降压模块是考虑到电源电压和舵机工作电压的多样性。</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 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>5.1 程序流程图</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;"><strong><img src="//image.lceda.cn/pullimage/teFghEShJmHY5Z0UCksY3kxk9tPUWhejp35Ayf02.png" alt="" width="136" height="369">5.2 源码部分<br></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;"><strong>  5.2.1 主要文件<img src="//image.lceda.cn/pullimage/QA8zrKhnypAsJK03smkEcGI9ccqvGcbK1BKeXNRF.png" alt="" width="129" height="304"></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> <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>5.2.3 舵机驱动</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> <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><img src="//image.lceda.cn/pullimage/ZUZtvOcML3e7shd8c9N1DhTkPRsBgSMnTb7ayUkK.png" alt="" width="300" height="69"></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;">PWM输出配置</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><img src="//image.lceda.cn/pullimage/1Aa26qvqO0nfejzMXWhxxIvdb2pyY7n10AriBPfG.png" alt="" width="300" height="66"></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> <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><img src="//image.lceda.cn/pullimage/9at4ovm10Xn9Ok3a2a4KfZQxPvB2W33ZevPn6qy0.png" width="266" height="114"></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> <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/9sQ3wwyTpp0PxtCxyKmos4zPYAxopHnukbgDbnJZ.jpeg" alt="" width="600" height="883"></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> <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>5.2.2 红外通信</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;">使用的正点原子红外遥控代码,定时读取Remote_Scan()函数获得键值,再做出相应的动作处理</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>void TIM3_IRQHandler(void)</div> <div>{ </div> <div> </div> <div>if(TIM_GetITStatus(TIM3,TIM_IT_Update)!=RESET)</div> <div>{</div> <div>if(RmtSta&0x80)//上次有数据被接收到了</div> <div>{</div> <div>RmtSta&=~0X10;//取消上升沿已经被捕获标记</div> <div>if((RmtSta&0X0F)==0X00)RmtSta|=1<<6;//标记已经完成一次按键的键值信息采集</div> <div>if((RmtSta&0X0F)<14)RmtSta++;</div> <div>else</div> <div>{</div> <div>RmtSta&=~(1<<7);//清空引导标识</div> <div>RmtSta&=0XF0;//清空计数器</div> <div>}   </div> <div>}    </div> <div>}</div> <div>    </div> <div>if(TIM_GetITStatus(TIM3,TIM_IT_CC3)!=RESET)</div> <div>{  </div> <div>if(RDATA)//上升沿捕获</div> <div>{</div> <div>  TIM_OC3PolarityConfig(TIM3,TIM_ICPolarity_Falling); //CC4P=1 设置为下降沿捕获</div> <div>TIM_SetCounter(TIM3,0);//清空定时器值</div> <div>RmtSta|=0X10;//标记上升沿已经被捕获</div> <div>}else //下降沿捕获</div> <div>{</div> <div>Dval=TIM_GetCapture3(TIM3);//读取CCR4也可以清CC4IF标志位</div> <div>            TIM_OC3PolarityConfig(TIM3,TIM_ICPolarity_Rising); //CC4P=0 设置为上升沿捕获</div> <div>if(RmtSta&0X10)//完成一次高电平捕获 </div> <div>{</div> <div>  if(RmtSta&0X80)//接收到了引导码</div> <div>{</div> <div> </div> <div>if(Dval>300&&Dval<800)//560为标准值,560us</div> <div>{</div> <div>RmtRec<<=1;//左移一位.</div> <div>RmtRec|=0;//接收到0   </div> <div>}else if(Dval>1400&&Dval<1800)//1680为标准值,1680us</div> <div>{</div> <div>RmtRec<<=1;//左移一位.</div> <div>RmtRec|=1;//接收到1</div> <div>}else if(Dval>2200&&Dval<2600)//得到按键键值增加的信息 2500为标准值2.5ms</div> <div>{</div> <div>RmtCnt++; //按键次数增加1次</div> <div>RmtSta&=0XF0;//清空计时器</div> <div>}</div> <div>  }else if(Dval>4200&&Dval<4700) //4500为标准值4.5ms</div> <div>{</div> <div>RmtSta|=1<<7;//标记成功接收到了引导码</div> <div>RmtCnt=0;//清除按键次数计数器</div> <div>} </div> <div>}</div> <div>RmtSta&=~(1<<4);</div> <div>}            </div> <div>}</div> <div>TIM_ClearITPendingBit(TIM3,TIM_IT_Update|TIM_IT_CC3);    </div> <div>}</div> <div> </div> <div>//处理红外键盘</div> <div>//返回值:</div> <div>// 0,没有任何按键按下</div> <div>//其他,按下的按键键值.</div> <div>u8 sta;</div> <div>u8 Remote_Scan(void)</div> <div>{        </div> <div> </div> <div>    u8 t1,t2;  </div> <div>if(RmtSta&(1<<6))//得到一个按键的所有信息了</div> <div>{ </div> <div>    t1=RmtRec>>24;//得到地址码</div> <div>    t2=(RmtRec>>16)&0xff;//得到地址反码 </div> <div>      if((t1==(u8)~t2)&&t1==REMOTE_ID)//检验遥控识别码(ID)及地址 </div> <div>    { </div> <div>        t1=RmtRec>>8;</div> <div>        t2=RmtRec;</div> <div>        if(t1==(u8)~t2)sta=t1;//键值正确 </div> <div>}   </div> <div>if((sta==0)||((RmtSta&0X80)==0))//按键数据错误/遥控已经没有按下了</div> <div>{</div> <div>RmtSta&=~(1<<6);//清除接收到有效按键标识</div> <div>RmtCnt=0;//清除按键次数计数器</div> <div>}</div> <div>}  </div> <div>    return sta;</div> <div>}</div> <div> </div> <div> </div> <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"> <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/SxudA0H4I9QZRKkpUJCou3xmaFmbBV2vb10ok0Jz.png" alt="" width="1169" height="153"></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;">*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;"> </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/RTWLMo3cjsekLlQFosCs7s04XxzZn3kziwWSJC7K.png" alt="" width="402" height="412"></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> <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

暂无

附件

附件名 下载
源码.zip
四足舵机.stl
四足机器人_oled固定.stl
BOM.xlsx

成员

评论(1)

  • 表情
    emoji
    小嘉工作篇
    小嘉日常篇
  • 图片
成功
工程所有者当前已关闭评论
立创电赛 回复
<p>恭喜您的作品获得了“盛思锐传感器”第九届立创电子设计开源大赛优胜奖~奖金将在2025年1月31日前联系发放</p>
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