The Dancing Robot

169

2

1

Ever wanted to have a dance partner that wouldn't judge you for your horrible dancing? If so, then you’ve come to the right place! This Instructable will teach you how to create an arm waving robot on wheels, which was the project for two members of the Electronics class offered by the Pomona College Department of Physics and Astronomy in Spring 2019, in partnership with three Femineers™ at the Fremont Academy for Technology and Design. The Femineer Program was created by Cal Poly Pomona’s College of Engineering in 2013.

The robot consists of two main components, the “lower half” car and the “upper half” arms, which are both completely controlled by an Arduino Uno. As long as you have enough juice to your motors (two on the car and two stepper), you should be on your way to creating your dream dance partner!


PARTS LIST:

The “Lower Half”


The “Upper Half”

  • Two stepper motors
  • 4 Double A batteries
  • Small Breadboard
  • Velcro Body--ours was 3D printed to be 9’’ wide, 16’’long, 6’’ tall”. The body needs to be something that is rigid to avoid breaking, large enough (and hollow) in order to fit all of the electronics inside, and tall enough to make sure that the arms don’t hit the ground
  • Arms--again, these were 3D printed, but there are many possible substitutes. The arms need to be large enough to be impressive, but short enough so they won’t hit the ground when mounted on the car body.

Supplies:

Step 1: Making the Car!

Materials:

By starting with a ready-made RC car, putting the car together is fairly simple and can be customized with specific directions later. We replaced the inner control box with an Arduino and breadboard and then later coded our car to follow a loop of different directions.


A: Installing Your H-Bridge

An H-bridge, in simple terms is a circuit that allows you to control the forwards and backwards movement of a DC motor. H-bridges are particularly important when building autonomous cars that are controlled by a microcontroller (like an Arduino). Above is a picture of an H-bridge circuit arrangement, from https://www.build-electronic-circuits.com/h-bridge...

An H-bridge reverses the polarity and direction of the motor depending on which switches are closed and open. If two particular switches are activated at the same time, you can change the direction of the current flow and resultantly change the rotational direction of the motor. For instance, when the switches S1 and S4 are closed (and S2 and S3 are open), a positive voltage will be applied across the motor. If you close the S2 and S3 switches, you can reverse the voltage and thus, change the spinning direction of the motors.

In our project, we used H-Bridge (model number: SN754410): http://www.hobbytronics.co.uk/h-bridge-driver-sn7...

Now that you understand the functionality of an H-bridge, it’s time to get building!

First, place your H-bridge onto a breadboard. It is important to note the orientation of your H-bridge on the breadboard, which you can determine by locating the half circle as shown in the picture below. Starting left from the half circle you have pin 1. Pin 8 is the bottom left, Pin 9 is the bottom right, and the last pin, Pin 16 is on the top right. This orientation is shown up above, from http://www.breenoconnor.com/stmary/arduino/09_Moto...


B: Installing Your Car

We have attached detailed code and directions that explains which of the H-Bridge pins correspond to the Arduino pins. If you are following our code, it is important to place the wires in the right pins so that the motors will correctly align and perform functions such as moving forward, reverse, left and right.

  • We connected Pin 1 on the H-Bridge to Pin 4 on our Arduino to enable the left motor.
  • We connected Pin 2 on the H-Bridge to Pin 5 on our Arduino (The Arduino Pin 5 is a PWM that allows us to control the voltage supplied so that we can adjust the speed.)
  • We connected Pin 3 on the H-Bridge to one of the left motor wires.
  • We connected Pin 4 and Pin 5 on the H-Bridge to ground.
  • We connected Pin 6 to the other left motor wire.
  • We connected Pin 7 on the H-Bridge to Pin 3 on our Arduino to reverse the left motor.
  • We connected Pin 8 on the H-Bridge to the switch.
  • We connected Pin 9 on the H-Bridge to Pin 7 on our Arduino to enable the right motor.
  • We connected Pin 10 on the H-Bridge to Pin 9 on our Arduino (Pin 9 is also a PWM).
  • We connected Pin 11 on the H-Bridge to one of the right motor wires.
  • We connected Pin 12 and Pin 13 on the H-Bridge to ground.
  • We connected Pin 14 to the other right motor wire.
  • We connected Pin 15 on the H-Bridge to Pin 6 on our Arduino to reverse the right motor.
  • We connected Pin 16 to the +5V supply on the Arduino.

Your batteries for the motor go in a case that should come with the car--else, attach a 4AA battery case on the underbelly of the car. You also need a switch that connects the arduino to power. The positive and negative sides of the battery power should connect on two adjacent pins on the switch, and the third pin on the switch should be the pin that connects to pin 8 on the H bridge, thus powering the motors.


C: Car Code

// Pins allow for forward and reverse movement of motors

int leftEn = 4; //enable left motor

int leftFor = 5; //left motor forward

int leftRev = 3; //left motor reverse

int rightEn = 7; //enable right motor

int rightFor = 9; //right motor forward

int rightRev = 6; //right motor reverse

// Set up pins in output mode void setup() {

pinMode (leftEn, OUTPUT);

pinMode (leftFor, OUTPUT);

pinMode (leftRev, OUTPUT);

pinMode (rightEn, OUTPUT);

pinMode (rightFor, OUTPUT);

pinMode (rightRev, OUTPUT);

//A high on enable will allow it to run

}

// Loop of car movement. This can be changed depending on what type of movement you would like your car robot to exhibit!

void loop() {

goStraight();

delay (5000);

goStop();

delay(5000);

}

// Car movement that allows for the car to drive straight forward void

void goStraight() {

digitalWrite (rightEn, HIGH); //enables the right motor

digitalWrite (leftEn, HIGH); //enables the left motor

digitalWrite (rightRev, LOW); //makes sure the motor does not rotate reverse

digitalWrite (leftRev, LOW); //makes sure the motor does not rotate reverse

analogWrite (rightFor, 100); //using PWM allows for an adjustable speed

analogWrite (leftFor, 100); //for both left and right motors return;

}

// Stops the car movement by disabling different motors

void goStop() {

digitalWrite (rightEn, LOW); //disenables the right motor

digitalWrite (leftEn, LOW); //disenables the left motor

digitalWrite (rightRev, LOW); //makes sure the motor does not rotate reverse

digitalWrite (leftRev, LOW); //makes sure the motor does not rotate reverse

digitalWrite (rightFor, LOW); //makes sure the motor does not rotate forward

digitalWrite (leftFor, LOW); //makes sure the motor does not rotate forward return;

}

Step 2: Making the Upper Body (mechanics)!

Materials:

  • 3-D Printed body
  • 3-D printed arms
  • two servo motors
  • velcro
  • robot head

Body Constraints: The body needs to be tall enough such that the arms do not hit the ground, but is also small enough to easily fit atop of the car. We made ours a hollow 9’’ wide, 16’’long, 6’’ tall” rectangle with the lip of the base edge wide enough to attach velcro on it. This velcro was then used to bind the body with the car. In addition, the body needs to be rigid and strong enough to support the weight of the stepper motors and the arms. We essentially 3D printed an open box (face down), and had rectangular holes on the sides where the stepper motors would go. Then, we screwed the stepper motors to the sides of the box.

Our stepper motors came with a propeller attached, which was handy when attaching our arms to the motor. First, we screwed the propeller to the arms. Then, we used super-glue to bind the arms and the motor together. Before you attach the arms, you might want to test the range of the stepper motor to make sure that the arms are going the direction you want them to--after all, they only turn about 180 degrees! As we found over the course of this project, keeping our robot together is pretty hard, and one might have to experiment with different glues.

Finally, the robot needs to have a face! We just decorated a cardboard box to have two sides to it-- a happy side and an angry side, so its mood changes as it spins around!

Step 3: Making the Upper Body (electronics)!

Materials:

  • velcro
  • small breadboard
  • 4 double AA batteries
  • servo motors (from before)

As you, dear reader, may have figured out already, the 2WD RC car does not have that much space to put electronics. So, we found it convenient to velcro a breadboard and our batteries for the servo motors on the inside of the cavity, which is both accessible yet out of sight when the box is on top. The batteries for the Arduino can also be velcro-ed on the body

The servo motors have three wires--red power, black ground, and yellow PWM, and are connected in parallel to the power source, as illustrated in the circuit photo above. The servo motors are controlled through individual PWM pins in the Arduino. The ground should be shared with the Arduino, so connect a wire from ground to ground.

Step 4: Putting the Upper Body and Lower Body Together

Materials: velcro

All of the components from the previous steps must now fit both on your car and within the upper body box. To fit everything in, we velcroed a small breadboard in the middle of the car, and velcroed the arduino on the breadboard. Next, put velcro on the car where the upper body box will touch. Finally, just put the two parts together!

Step 5: Final Code!

The attached code works for

  • 1 Arduino
  • 2 servo motors
  • RC car motors

And has functionality for

  • Moving the car forwards and backwards
  • Stopping the car
  • Moving the robot arms forwards and backwards
  • The user to add more directional movements of the car and different loops of movement

See the comments in the code for more explanation.

Arduino Contest 2019

This is an entry in the
Arduino Contest 2019

Share

    Recommendations

    • Woodworking Contest

      Woodworking Contest
    • Arduino Contest 2019

      Arduino Contest 2019
    • Classroom Science Contest

      Classroom Science Contest

    Discussions

    0
    None
    JohnW839

    2 days ago

    Sure would like to see a video showing the robot in action. :-)