# Robot

526

1

Posted

## Introduction: Robot

For our final project, we were told to build whatever we wanted. Using what we've learned, and what we could find online. I'm a huge fan of the Super Smash Bros series. I own all the games except the first one. So for my final project, I decided to build a robot based on the playable character R.O.B.

## Step 1: Materials

• 4 180 Degree Servo
• 13 Male - Male wires
• 8 Male - Female Wires
• 2 Joysticks
• 1 Arduino

## Step 2: The Wiring

Use a male-male wire to connect the negative side of the breadboard to ground (GND) on the Arduino. Then connect the Joystick's VR X to A0 and A2, and the VR Y to A1 and A3 on the Arduino. Then connect Joysticks 5v pin to the 3.5 and 5V pins on Arduino, and the GNDs to any GND on Arduino. Then for each of the 4 servos connect the white wire to pins 7 - 4 on the Arduino. Then connect the red wire on the servos to the positive side breadboard, and connect the black wire to the negative side of the breadboard. Then plug in the Battery Box to power the circuit.

## Step 3: Code - Declare Your Variables

```#include <servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
int joyX = 0;
int joyY = 1;
int joyX2 = 2;
int joyY2 = 3;
int joyVal;
int joyVal2;```

The Servo command creates a servo object to control a servo.

## Step 4: Code - Setup

```void setup (){

//Attaches each servo to a pin
servo1.attach(7);
servo2.attach(6);
servo3.attach(5);
servo4.attach(4);
}```

## Step 5:

void loop ()

```{
joyVal = map(joyVal, 0, 1023, 0, 180); //Converts Joystick values to degrees
servo1.write(joyVal); //Changes the position of servo to match the Joystick input

joyVal = map (joyVal, 0, 1023, 0, 180);
servo2.write(joyVal);
delay(15);

joyVal2 = map(joyVal2, 0, 1023, 0, 180);
servo3.write(joyVal2);

joyVal2 = map (joyVal2, 0, 1023, 0, 180);
servo4.write(joyVal2);
delay(15);

}```

## Step 6: The Base

So once you're done the circuit and code. You can start building the actual robot. For the base you want to make all the angles 45 degrees. The long sides are 18 cm and the shorts sides 6 cm. So just follow the picture and cut our the shape of the base. Then make 2 54 cm long and 5 cm wide strips to use as the walls. Leave the small 6 cm sides open. Then you want to duplicate the base to create the roof. now in this compartment, we're going to add the

## Step 7: Making the Body Spin

Get a paper towel roll and tape/hot glue gun it to the middle of the roof. Then create something 6 cm high rings around the base of the paper towel roll. Then create a large plate with a hole big enough to fit the paper towel roll through it. Place the plate on the ring, and then stick a servo into the top of the paper towel roll. We can't put all the weight on the servo. So we going to use dowel sticks and to make it spin. So create 2 holes in the plate big enough to fit some dowels. Stick the dowels into the hole, enough then it a bit is poking through the bottom of the hole. Tape/ hot glue gun the dowels to the hole so it doesn't move. Take an empty tissue box and create holes big enough to fit the other end of the dowels. Also make sure the spread out enough that both dowels can go through. Then tape the box to the servo, and stick the dowels into the tissue box holes. Tape / hot glue the dowels to the holes so it doesn't move.

## Recommendations

• ### Arduino Class

68,829 Enrolled

• ### Woodworking Contest

We have a be nice policy.