How to make a simple DIY dancing robot for school at home

How to make a simple DIY dancing robot for school at home

Hello, and welcome back. In this project, we will learn how to make a simple DIY dancing robot at home. It is a very simple and low-cost project. So we can easily make it. If you have an Arduino UNO board and two servo motors you can do it now. For that, I will give you step-by-step instructions.

The process of this robot

This robot is basically based on an Arduino UNO board. I also used two servo motors for the front legs of the robot. This robot uses a 9v battery to power it. I also used a few movement steps for this robot and you can change it as you like. that’s all. Let’s move on.

OK, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, cut pieces of foam board or cardboard to the size below.

Step 3

Thirdly, glue these pieces together using the pictures below.

Step 4

Then, mount the caster wheel and servo motor as follows.

Step 5

Now, glue the popsicle sticks for the servo motors. Yes, these are the legs of the robot.

Step 6

Next, attach the Arduino board and 9v battery to the top of the robot.

Step 7

Now, connect the servo motors to the Arduino board. For that, use the circuit diagram below.

How to make a simple DIY dancing robot for school at home

Step 8

Then, decorate the robot’s eyes. It depends on your skill.

Step 9

OK, now connect it to the computer.

Step 10

Let’s create the program for this robot. It is as follows.

The full program of this project — Download

/*Dancing robot with Arduino
  https://srituhobby.com
*/

//Include the servo motor library
#include <Servo.h>
//Create two objects for the servo motors
Servo servo1;
Servo servo2;

void setup() {
  //Enter the PIN number to which the servo motor is connected
  servo1.attach(3);
  servo2.attach(5);
}
void loop() {
  step1(1);
  step2(6);
  step3(2);
  step1(1);
  step4(2);
  step5(2);
}
void step1(byte C) {
  servo1.write(50);
  servo2.write(50);
  delay(1000);

  for (int a = 0; a < C; a++) {
    for (int S = 100; S > 50; S--) {
      servo1.write(S);
      servo2.write((S - 100) * -1);
      delay(30);
    }
    delay(1000);
    for (int S = 50; S < 100; S++) {
      servo1.write(S);
      servo2.write((S - 100) * -1);
      delay(30);
    }
    delay(1000);
  }
}

void step2(byte C) {
  servo1.write(50);
  servo2.write(50);
  delay(1000);
  for (int a = 0; a < C; a++) {
    for (int S = 40; S < 70; S++) {
      servo1.write(S);
      servo2.write(S);
      delay(20);
    }
    for (int S = 70; S > 40; S--) {
      servo1.write(S);
      servo2.write(S);
      delay(20);
    }
  }
}
void step3(byte C) {
  servo1.write(50);
  servo2.write(50);
  delay(1000);
  for (int a = 0; a < C; a++) {
    for (int S = 10; S < 50; S++) {
      servo1.write(S);
      servo2.write(90 - (S - 10));
      delay(30);
    }
    delay(1000);
    for (int S = 50; S > 10; S--) {
      servo1.write(S);
      servo2.write(50 - (S - 50));
      Serial.println(50 - (S - 50));
      delay(30);
    }
    delay(1000);
  }
}

void step4(byte C) {
  servo1.write(50);
  servo2.write(50);
  delay(1000);
  for (int a = 0; a < C; a++) {
    for (int S = 50; S < 100; S++) {
      servo1.write(S);
      delay(30);
    }
    delay(1000);
    for (int S = 100; S > 50; S--) {
      servo1.write(S);
      delay(30);
    }
    delay(1000);
  }
}

void step5(byte C) {
  servo1.write(50);
  servo2.write(50);
  delay(1000);
  for (int a = 0; a < C; a++) {
    for (int S = 50; S > 0; S--) {
      servo2.write(S);
      delay(30);
    }
    delay(1000);
    for (int S = 0; S < 50; S++) {
      servo2.write(S);
      delay(30);
    }
    delay(1000);
  }
}

The loop function includes 6 functions. Please read these functions one by one and change these values as you like.

Step 11

Now, select board and port. After, upload this code to the Arduino board.

Step 12

Finally, connect the external 9v power supply to the robot.

So, now you have a simple robot. Hurry up and enjoy. The full video guide is below. Ok, See you in the next project or tutorial.

How to make a simple DIY dancing robot for school at home

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *