0

$USD

$USD
PROJECTS Robotics

How To Build a Real Steel Robot? Lesson 2

DFRobot Jun 21 2017 1329

We have made some improvements based on the previous making of Real Steel. 


 

Previous Contents - How To Build a Real Steel Robot? Lesson 1


 

OK. Then, we will introduce the improvements. First of all, the appearance; you may notice that several parts in Figure 1—chest, back and hand are added on the robot. The small structural part of hand can replace the hand made of PVC materials previously. Both the chest and back wrap the control panel, to protect the control panel and also make the robot more beautiful.

 

Figure 1 Chest, Back and Hand



In addition to the more beautiful appearance, we also want the robot to make a sound during operation just as The King Of Fighters or Street Fighter. Therefore, the previous making needs to be modified to some extent. The structure diagram of robot completed in the previous text is as shown in Figure 2.
 

Figure 2 Control Diagram


To realize the function mentioned above, we shall not let the control signal of handle directly sent to the control panel of steering engine through the wireless module. Instead, we need a module which can send the instruction to the control panel of steering engine on the one hand and realize voice playing on the other hand after receiving the signal of handle.


There is limited space in the chest and back of robot, so we choose compact Flyduino as the intermediate signal processing board as shown in Figure 4. Flyduino, a type of microcontroller based on Arduino, has a size of only 40mmX24mm and integrates 12 digital ports, 8 analog interfaces and 1 XBee wireless data transmission interface which can be directly connected with our wireless module.


 

Figure 4 Flyduino
 


In addition, we choose the voice playing module DFRduino Player V2.0 as shown in Figure 5 as the voice module of the robot. Such module supports TTL level serial port. You just need to store the voice files into SD card, to play corresponding voice file by sending the file name through the serial port. Meanwhile, the module also provides a port for play-end reminder. When a song is played, it will output a high level.  
 

 

Figure 5 Voice Playing Module DFRduino Player V2.0


After devices are selected, we may start modifying. Step I, install the voice playing module. Before installation, we shall store the voice files into the SD card firstly. Based on the robot's operations, we have found voices for following operations, and name each file according the table below. You may also choose voices from The King of Fighters and Street Fighter, etc. according to your own hobbies. However, the files must be consistent.
 



After the voice files are copied, we will place the module and speaker in the chest (top right corner of Figure 1). The speaker is exactly locked by the screws for fixing the voice module. Then, as shown in Figure 6, the control pin and power of module are connected with the flat cable. It shall be noticed that there is no voice hole and module installation hole in the chest. You need to drill such holes by yourself.
 
 

 

Figure 6 Installation of Voice Module

 

The cables connected with the voice module need to pass through the chest of robot, to connect Flyduino in the rear.
 


 

Figure 7 Control Cables Passing through the Chest


At last, as shown in Figure 8, fix the chest on the robot.
 
 


 

Figure 8 Fixing of Robot Chest


Step II, install Flyduino. There is no installation hole on Flyduino, so we fix it on the back by use of XBee wireless data transmission port on its back. As shown in Figure 9, we build two slots on the back firstly with the size consistent with the wireless data transmission port.

 

Figure 9 Installation Slots on the Back


Then, as shown in Figure 10, Figure 11, fix Flyduino on the back, and insert the wireless module used before at last.

 


 

Figure 10 Flyduino Fixed

 


 

Figure 11 Insertion of Wireless Module


Step III, connect three parts: Flyduino, voice playing module and control panel of steering engine.




The communication between modules is achieved through TTL serial port, and serial port only has a hardware TTL serial port which is used for communication of wireless module, so two serial ports need to be simulated at the end of Flyduino. In Arduino database, there is a SoftwareSerial library which defines the category of a SoftwareSerial and can achieve the simulated serial port. In code, we define two objects of SoftwareSerial: mySerial1 and mySerial2. MySerial1 occupies pins 2, 3 for sending instruction to the voice playing module; mySerial2 occupies pins 4, 5, for sending instruction to the control panel of steering engine. The codes of objects defined are as follows.
 

SoftwareSerial mySerial1(2, 3);         SoftwareSerial mySerial2(4, 5);        In comparison of the previous operation table and the voice table herein, we can get a comparison table of voice and operation.

 


According to this table, the program in dao.mp3 can be easily completed. The source codes are as follows:

  #define MusicEnd 6                      SoftwareSerial mySerial1(2, 3);         SoftwareSerial mySerial2(4, 5);            char w;                                                 int flag=1;                                            void setup()     {     Serial.begin(57600);                         mySerial1.begin(19200);                     mySerial2.begin(9600);                   pinMode(MusicEnd, INPUT);         }      void loop()   {     if(Serial.available()>0)                       {       w = Serial.read();                           if(flag==1)                                     {               if(w==1||w==2||w==7||w==8||w==12||w==13||w==14||w==15)   {                          mySerial1.print("\\yidong\r\n");           }               else if(w==3||w==4)                 mySerial1.print("\\bai\r\n");                         else if(w==5||w==6)                 mySerial1.print("\\quan\r\n");                 else if(w==9||w==16)                 mySerial1.print("\\dao\r\n");                     }       if(w!=0)       {                     mySerial2.write(w);                                 flag=0;                                                     }               if(digitalRead(MusicEnd) == LOW)   flag=1;                                                 }
 


 

Figure 12 Connection of Each Part


After the codes are completed and downloaded into Flyduino, complete the connection of the parts as shown in Figure 12. The power source of both Flyduino and voice playing module is from the control panel of steering engine. Connect the flat cable of voice playing module to the pins 2, 3, 6 of Flyduino, and connect the TTL serial port of control panel of steering engine to the pins 4, 5 of Flyduino. Last step, install the back on the robot and replace with the small structural part of hand as shown in Figure 13. 
 

 

Figure 13 Installation of Back

So far, our robot is completed. Let's fight!!
To be continued...