Microbit谈话机器人

14,651

47.

8.

Introduction: Microbit Talking Robot

关于:我喜欢设计,3D打印,计算,编程和工程。

众所周知,Tinkercad在TinkerCad电路中引入了一个新功能,它是微生物的。我们可以在使与微生物相关的东西中进行虚拟原型,甚至可以进行模拟。我们可以节省大量资金来构建实验,而无需损坏我们的电子元件。此外,我们可以添加一些代码来带来实验。

不幸的是,阅读后Tinkercad的博客那this launch has a drawback. When exporting the code, Tinkercad only transfers it into JavaScript language. You need to change the code by using a third-party like Microsoft Makecode, for it requires a hex file to work directly in Microbit.

最初,我在Tinkercad进行了模拟,建立并探索了这个实验。投票率,我的模拟不像我预期的那样。我的下一步是我准备了使用Microsoft MakeCode的代码,因为我将使用连续伺服而不是Micro Servos,TinkerCad仅在电路中提供了微伺服。

我决定使用微生物作为其大脑制作一个机器人。为了使机器人更令人愉悦和挑战,我使用伺服电机,LED,图像和谈话功能添加了一些动作。

对于那些不使用Microbit工作的人,请阅读此内容的概述指南link

For downloading the enclosure, click邪教3d.

I also attached the Microbit HEX Files.

Supplies:

您需要的材料:

tinkercad.

Microbit

Microsoft MakeCode和Python编辑器

3D打印机

PLA filament (Metal, blue, yellow, red, wood, and green)

扬声器

Alligator clip

电线

跳线电线

电工胶带

热胶

Makita钻

Dremel rotary tool

切割钳子

焊锡铁

焊接

2个LED

4个AA +支架电池

2个AAA +支架电池

Step 1: Make Simulation in Tinkercad

之前我们做一个原型,它是至关重要的a simulation in Tinkercad. By doing this simulation, we can play around with the electronic circuit, so we become aware and understand whether we make a mistake in our circuit or not. As I mentioned previously, Tinkercad only has micro servos in its library, while I would like to use continuous servos (because I have enough continuous servos in my inventory instead of micro servos). How to solve this problem? Well, I had to use another alternative, which is making the block code in another third party, such as Microsoft Makecode.

至少,TinkerCad在我的模拟中有很多帮助。在这里我截图我的电子电路。实际上,Microbit最多需要3V(两个AAA电池)作为其电源。但要操作两个伺服,它需要额外的四节AA(6V)。否则,伺服系统不会推动。

第2步:伺服

In this project, I used two continuous servos to rotate the hands.

伺服有三条线,其是信号线(橙色-1),电力线正(RED-2)和负/地线(Black-3)。

  • 信号线,其在上面的电路图中表示为蓝色和绿线,其伺服电路分别在微磁石中连接到引脚1和2。
  • The positive line in both servos should connect to the positive pole of the battery, and so the negative line (ground) should connect to the negative pole of the battery.
  • 两个伺服系统都连接到微生物中的地面(GND),也只有一个伺服连接到电池的负极。

第3步:LED

我为我的机器人使用了两个LED,我用了白色LED。这些LED用于机器人的眼睛。因此,我将第一LED的正腿连接到微磁石中的销1,第二LED在微磁石中的销2中。第一个LED应该是左眼,第二个LED是右眼。LED的两个负腿连接到微生物中的地面(GND)。

第4步:扬声器

将扬声器连接到Microbit,如下所示:

·正线连接到Microbit中的引脚0

· Negative wire connects to Pin GND in Microbit

Step 5: The Code

I made the block code inMicrosoft Makecode。The code should be like in the image. Also, I shared my code. Here is thelink

在此代码中,如果我们按下按钮A,它将首先显示一些图像,然后打开左眼的LED,然后旋转左手。如果我们按下按钮B,它将具有相同的条件,只有右侧的这次。

Step 6: Advance Code for Making the Robot Talks and Understand the Code

在制作机器人谈话时,无法使用编码块来完成。为了克服这个问题,我们需要将所有代码转换为Python。以下是python编辑器的链接onlineand离线(你需要先下载)。

在转换之前,尝试使用Python语言在MakeCode中转换所有代码。岔路突发,转换与Python编辑器不兼容。我们需要改变几个代码,因此Python可以理解代码。这里是偏好链接对于Python代码。

对于Python中的所有代码,请单击此内容link

以下是对代码的解释。

要在微生物中旋转伺服件,并暂停1000毫秒(1秒)

PIN1.WRITE_ANALOG(180)睡眠(1000)

打开PIN 1的LED眼睛在微生物中,暂停1000毫秒(1秒)

PIN1.WRITE_DIGITAL(0)睡眠(1000)

要使机器人谈话,首先导入语音模块。我使用了2种类型的讲命令,这些命令是“speed.ronouse”和“sexpool.say”。

使用“speem.say”时,我们需要在命令作为参数后添加一些单词。

speech.say("Let's play with me.", speed=92, pitch=60, throat=190, mouth=190)

我们希望机器人谈谈“让我们玩我”。速度,俯仰,喉咙和嘴巴,如我们所希望的。要了解更多有关这些参数,请单击此内容preference guide

当我们使用“speach.pronounce”时,我们将音素用作参数。有关音素的更多信息,请单击此列表link

演说。张力(“Woh5oh3t Ahahr Yuhuh Duhuhihhnx Nnahah3uh5uh8”,Speed = 92,间距= 60,咽喉= 190,口= 190)

In the code above, we make the robot to talk, "What are you doing now?"

只需根据需要与语音命令进行游戏。

保存并下载到十六进制文件中的代码。

第7步:外壳

要为机器人制作机器人,我在Tinkercad中制作它。

如下下载,请单击邪教3d.

第8步:Microbit案例

我们需要为微生物构建案例,因此微磁滴可以站在机器人体内。要制作它,我使用了一个盒子的简单形状:

Length: 66 mm

宽度:21毫米

身高:50毫米

用一些盒子孔切箱,如图片所示。为了使其更容易,请使用TinkerCAD电路的微生物功能。

Step 9: Body- Front Part

对于前面的身体,在工作区丢弃一个盒子。在顶部的圆筒上制作一个孔,与头部中的孔相同的测量。为扬声器制作一些洞,
microbit和伺服。为每个角落放置四个占位符。

Step 10: Body- Back Part

For the back part of the body, use two boxes, and stack them. The dimension should be the same as the front part of the body and the head. Group them together.

Step 11: Legs

对于腿,用盒子并将其与楔子结合起来。对于维度,请参阅图像。将它们分组在一起。

第12步:手

用于制作手,将两个屋顶拖放到工作区域。用盒子尖切割每个屋顶。将它们分组在一起。双手复制,所以你现在有两只手。

Step 13: Head

用一个盒子的头部。为头部的后部制作一些孔。为螺丝制作占位符。

第14步:嘴巴

对于嘴巴,使用球体并如图所示调整它的大小。

第15步:尾巴

Make the same shape as a mouth for the tail, only it is wider.

步骤16:原型和测试

在进行电子项目时,在组装电子电路之前使原型是至关重要的。通过构建原型,我们可以测试我们的代码和电路是否正确。测试非常成功。所有电气部件都在顺利工作。

Step 17: Printing

将3D模型的每个部分保存到.stl文件中。使用Cura Slicer,将.stl文件切片,并根据需要使用PLA灯丝的颜色打印。除微机器案例外,印刷设置是层高0.2 mm,填充20%,不受支撑。

第18步:打印后

Remove the support in the Microbit case after printing.

Step 19: Drilling After Printing

Make holes for the eyes to the head casing. I use a Makita drill to make the holes. Drill two holes in the head and measure the holes for LED about a diameter of 5 mm. Also, drill five holes for bolting the body and drill two more holes for bolting the hands.

第20步:整理扬声器

我用来自旧麦克风套装的扬声器。因为它,扬声器的边缘并不整洁。使用Dremel旋转工具切割过量的扬声器和文件。

步骤21:组装打印部件

将嘴粘在前面。将尾部粘贴到身体的后部。将腿部组装到身体,最后将头部粘在身体上。

步骤22:构建电路

  • 把微生物放在案件中。
  • Insert alligator clips to pin 0 (red), 1 (yellow), 2 (white), and Gnd (black).
  • 如图所示,将伺服系统放在每侧,并将它们粘贴到身体上。
  • 用电线焊接LED。红线连接到LED和黑线的正腿连接到负腿。将LED插入头部并用电动胶带固定它们。
  • 在以前的原型中连接所有的鳄鱼夹线。

Step 23: Construct the Robot

  • 将十六进制文件上传到Microbit。
  • 将微磁带和扬声器放入外壳内。用电池连接微生物。整理所有电线并用电工胶带固定它们。
  • 用螺丝关闭外壳。(我们需要5个小螺丝)。
  • 用servos附上手。

Step 24: Final Result and Test the Robot

这里是final result of the Microbit Talking Robot.

当我们按下按钮A时,它将首先显示一些心灵和微笑的图像,然后打开右眼的LED,并旋转右手。如果我们按下按钮B,它将具有相同的条件,只为左侧的此时间。

Note: I installed Microbit upside down due to the tight enclosure, so the result would be the opposite of my previous code.

有关更多项目理念,请访问我们的网站:
DIY 4 Pro3D打印中心那and学习和作业

阻止代码竞赛

一等奖
阻止代码竞赛

1人制作这个项目!

建议书

  • Self-Care Challenge

    Self-Care Challenge
  • Make it Glow Contest

    Make it Glow Contest
  • 第一次作家比赛

    第一次作家比赛

8评论

1
Ohm_s _lab

13天前

好,但很多步骤!
My advice is to make less steps for more views............but great project!mate

0.
7857625957

26天前

hi im new

0.
Mulia Wi

回复5周前

谢谢

0.
BrittLiv

7周前Step 24

哇,真的很可爱!我喜欢它!

0.
Mulia Wi

7周前回复

Thanks for your kind comment, Britt.