Arduino based Bluetooth Biped Bob (Walking & Dancing Robot) - Internet of Things

Arduino based Bluetooth Biped Bob (Walking & Dancing Robot)

Arduino based Bluetooth Biped Walking and Dancing Robot
Welcome to another project in which we will build a small Robot which can walk and dance. The project aims in teaching you how to make small hobby robots using Arduino and how to program your Servo motors for such applications. At the end of the project you will be able to make this walking and dancing robot that takes command from an Android Mobile Phone to perform some pre-defined actions. You can also use the program (given at the end of the tutorial) to easily manipulate the actions of your very own robot by controlling the position of the servo motors using the Serial monitor. Having a 3d printer will make this project more interesting and look cool. But, if you do not have one you can use any of the online services or just use some cardboard to build the same.

Materials Required:
The following are the materials required for building this robot:
  1. Arduino nano
  2. Servo SG90 4Nos
  3. Male berg sticks
  4. HC-05/HC-06 Bluetooth module
  5.  3D printer
As you can see this 3D printed robot requires very minimal electronics parts to build to keep the cost of the project as low as possible. This project is only for conceptual and fun purpose and does not have any real time application so far.

3D printing the required parts:
3D printing is an amazing tool that can contribute a lot when building prototype projects or experimenting with new mechanical designs. If you have not yet discovered the benefits of a 3D printer or how it works you can read The beginners Guide to 3D printing .
In this project the body of the Robot shown above is completely 3D printed. You can download the STL files from here. Load these files on your 3D printing software like Cura and directly print them. I have used a very basic printer of mine to print all the parts. The printer is FABX v1 from 3ding which comes at an affordable price with a print volume of 10 cubic cm. The cheap price comes with a trade off with low print resolution and no SD card or print resuming function. I am using software called Cura to print the STL files. The settings that I used to print the materials are given below you can use the same or change them based on your printer.
Once you print all the parts clean the supports (if any) and then make sure the holes on the leg and belly part are big enough to fit a screw. If not, use a needle to make the hole lightly bigger. Your 3D printed parts will look like something below.
Hardware and Schematics:
The Hardware for this Mobile Phone Controlled Biped Arduino Robot is really simple. The complete schematics is shown in the below image
I have used a Perf board to make the above connections. Make sure that your circuit will also fit inside the head of the robot. Once your Perf board is ready it should look something like below.

Assembling the robot:
Once the Hardware and the 3D printed parts are ready we can assemble the robot. Before fixing the motors make sure you place the motors in the below angles so that the program works flawlessly.
Motor Number
Motor place
Motor position
1
Left Hip motor
110
2
Right Hip motor
100
4
Right Ankle Motor
90
5
Right Hip motor
80

These angles can be set by using the program given at the end of the tutorial. Simply upload the program to your Arduino after making the above connections and type in the following in the serial monitor (Note: Baud rate is 57600).
1, 100, 110
2,90,100
4,80,90
5,70,80

Your Serial monitor should look something like this after placing all your motors in position.
Once the motors are set in the corresponding angles mount them as shown in above figure.

If you are confused on how to assemble the motors follow the video at the end of this tutorial.  Once the Robot is assembled it is time to program our dancing robot

Programming the Arduino for Biped Robot:
Programming the BBB Robot (Bluetooth Biped Bob) is the most interesting and fun part in this tutorial. If you are very good in programming servo motors with Arduino then I would recommend you to make your program. Bt, if you want learn how to use servo motors for robotic applications like this, then this program will be very helpful for. You can learn more about arduino programming in our arduino projects category.
The complete program is given at the end of this tutorial, or you can download the complete code from here. I will explain the segments of the same below. The program is capable of controlling the Robots actions through serial monitor or Bluetooth. You can also make your own moves by controlling every individual motor using the serial monitor.
   servo1.attach(3);
   servo2.attach(5);
   servo4.attach(9);
   servo5.attach(10);
The above lines of code it use to mention which servo motor is connected to which pin of the Arduino. Here in our case Servo 1,2,4 and 5 are connected to pins 3,5,9 and 10 respectively.

Bot_BT.begin(9600); //start the Bluetooth communication at 9600 baudrate

Serial.begin(57600);

As said earlier our walking robot can work on Bluetooth commands and also from commands from the serial monitor. Hence the Bluetooth serial communication works with a Baud Rate of 9600 and the serial communication works with Baud Rate of 57600. The name of our Bluetooth object here is Bot_BT”.

switch (motor)
  {
    case 1:            // For motor one
      { Serial.println("Executing motor one");
        if(num1<num2) // Clock wise rotation
  { for ( pos =num1; pos<=num2; pos+=1)
  {
    servo1.write(pos);
    delay( 20);
  }}
if(num1>num2) // Anti-Clock wise rotation
  {
  for ( pos =num1; pos>=num2; pos-=1)
  {
    servo1.write(pos);
    delay( 20);
  }}
      break;
      }   
       ////////JUST  DUPLICATE FOR OTHER SERVOS////
    case 2:    // For motor 2
      {
        Serial.println("Executing motor two");
        if(num1<num2)
  {
  for ( pos =num1; pos<=num2; pos+=1)
  {
    servo2.write(pos);
    delay( 20);
  }}
if(num1>num2)
  {
  for ( pos =num1; pos>=num2; pos-=1)
  {
    servo2.write(pos);
    delay( 20);
  }}
      break;
      }   

    case 4:    // for motor four
      {
        Serial.println("Executing motor four");
        if(num1<num2)
  {
  for ( pos =num1; pos<=num2; pos+=1)
  {
    servo4.write(pos);
    delay (20);
  }}
if(num1>num2)
  {
  for ( pos =num1; pos>=num2; pos-=1)
  {
    servo4.write(pos);
    delay (20);
  }}
      break;
      }

      case 5:    // for motor five
      {
        Serial.println("Executing motor five");
  {
  for ( pos =num1; pos<=num2; pos+=1)
        if(num1<num2)
  {
    servo5.write(pos);
    delay (20);
  }}
if(num1>num2)
  {
  for ( pos =num1; pos>=num2; pos-=1)
  {
    servo5.write(pos);
    delay (20);
  }}
      break;
      }
The switch case shown above is used to control the servo motors individually. This will help in making your own creative moves with your robot. With this segment of code you can simply tell the motor number, from angle and to angle to make a particular motor move to a desired location.
For example if we want to move the motor number 1 which is the left hip motor from its default location of 110 degree to 60 degree. We can simply write 1,110,60in the serial monitor of Arduino and hit enter. This will come in handy to make your own complex moves with your Robot. Once you experiment with all the from angel and to angle you can then make your own moves and repeat them by making it as a function.
 if(Serial.available()>0) //Read whats coming in through Serial
  {
  gmotor= Serial.parseInt();
  Serial.print(" selected Number-> ");
  Serial.print(gmotor);
  Serial.print(" , ");  
  gnum1= Serial.parseInt()
  Serial.print(gnum1);
  Serial.print(" degree , ");
  gnum2= Serial.parseInt()
  Serial.print(gnum2);
  Serial.println(" degree ");
   flag=1;
   }

If a Serial data is available the number before the first ,is considered as gmotor and then  the number before the second ,is considered as gnum1 and the number after the second ,is considered as gnum2.
if (Bot_BT.available()) //Read whats coming in through Bluetooth
   {
BluetoothData=Bot_BT.read();
Serial.print("Incoming from BT:");
Serial.println(BluetoothData);
}
If the Bluetooth receives some information, the received information is stored in the variable BluetoothData”. This variable is then compared to the pre-defined values to execute a particular action.

if (flag ==1 )
call(gmotor,gnum1,gnum2); //call the respective motor for action
    //Execute the functions as per the commond received through the Serial monitor or Bluetooth//
if (gmotor ==10)
left_leg_up();
if (gmotor ==11)
right_leg_up();
if (gmotor ==12)
move_left_front();
if (gmotor ==13)
move_right_front();
if (BluetoothData ==49 || gmotor ==49)
say_hi();
if (BluetoothData ==50 || gmotor ==50)
walk1();
if (BluetoothData ==51 || gmotor ==51)
walk2();
if (BluetoothData ==52 || gmotor ==52)
dance1();
if (BluetoothData ==53 || gmotor ==53)
dance2();
if (BluetoothData ==54 || gmotor ==54)
{test();test();test();}

This is where the functions are called based on the values received from the serial monitor or the Bluetooth. As shown above the variable gmotor will have the value of serial monitor and BluetoothData will have the value from Bluetooth device.  The numbers 10,11,12 upto 53,54 are pre-defined numbers.
For example if you enter the number 49 in the serial monitor. The say_hi() function will be executed where the robot will wave you a hi.
All the functions are defined inside the page Bot_Functions”. You can open it and see what actually happens inside each function.  All these functions were created by experimenting th e from angel and to angel of every motor using the switch case explained above. If you have any doubt you can use the comment section to post them and I will be happy to help you out.

Processing based Android Application:
The Android application to control the Robot was build using the Processing Android mode. If you want to make some changes to the Application you can download the complete Processing program from here.
If you simply want to use the application you can download it from here as an APK file and directly install it on your mobile phone.

Note: Your Bluetooth module should be named HC-06 else the application will not be able to connect to your Bluetooth Module.

Once the application is installed, you can pair the Bluetooth module with your Phone and then launch the application. It should look something like this below.
If you want to make your app more attractive or connect to any other device other than Hc-06. You can use the processing code and make some changes to it and then upload the code directly to your phone.

Working of Bluetooth Controlled Biped Robot:
Once your Hardware, Android Application and Arduino Sketch is ready it is time to have some fun with our robot. You can control the Robot from Bluetooth Application by using the buttons in the application or directly from Serial monitor by using as of the following commands as shown in the image below.
Each command will make the robot perform some peculiar tasks and you can also add on more actions based on your creativity.
The Robot can also be powered by a 12V adapter or can also be powered by using a 9V battery. This battery can be easily positioned below the Perf board and can also be covered with the Head of the Robot.


      Demo & Code




Arduino based Bluetooth Biped Bob (Walking & Dancing Robot) Arduino based Bluetooth Biped Bob (Walking & Dancing Robot) Reviewed by XXX on สิงหาคม 27, 2560 Rating: 5

ไม่มีความคิดเห็น