R2D2

by masonrusf in Circuits > Arduino

1111 Views, 1 Favorites, 0 Comments

R2D2

IMG_0158.JPG

"This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)"

Are you a fan of Star Wars? Do you love Astromech Droids? Do you love making things? If you answered Yes to any or all of these questions then this Instructable is for YOU!

This guide is designed to help you with as much ease as possible to create your very own R2D2 astromech Droid!

Material List

Arduino uno.jpg
castor wheel.jpg
DC motor.jpg
m2f.jpg
m2m.jpg
Motordriver.jpg

Here is an extensive list of the Materials needed:

  • 1 Arduino Uno Microcontroller
  • 1 L298N Motor Driver Board
  • 2 6-9V DC motors (Optional Gearbox Set up)
  • 2 Wheels
  • 1 Small Castor Wheel assembly
  • 2 Battery Adapter
  • 6 AA Batteries
  • 1 9V Battery
  • An assortment of Male-to-male jumper cable
  • An Assortment of Male-to-female jumper cables
  • 2 Switches (optional)
  • 1 servo motor
  • 4" PVC Tube (7" long)
  • 4.5" diameter Acrylic dome
  • Foam board
  • Illustration Board
  • Hot Glue Gun
  • Hot Glue
  • Gorilla Glue
  • Acrylic Paint (Blue, Black, grey and White)
  • Paint brushes
  • Cutting tools

In addition to materials, these resources and tools are also needed/useful:

  • A 3D Printer / 3D Printing Lab
  • Soldering tools
  • Wire cutters and strippers
  • A computer or laptop

Required Software

The following are free to download if you are a student and are required for this project:

Autodesk Inventor

Arduino Software

Both pieces of software are compatible with Windows and Mac OSX.

Note: Any CAD program will work; Autodesk Inventor was utilized for this project.

The Arduino Sketch

L298-Pinout.jpg

This is the Arduino sketch in version 1.8.8.

  • To run the code, download the provided code and open it from your Arduino software.
  • Verify your Arduino board is connected to your computer by clicking "Tools" on your menu bar and verifying the correct "Port" is selected.
  • Click the blue upload arrow with your USB plugged into your computer and micro-controller.

The code for this project is a simple loop. The servo motor rotates the R2D2 head 180 degrees continuously. Simultaneously to the servo motor, both DC motors are run at the same time for a set time and then the right DC motor is only run for a set time to introduce a left hand turn, then the loop repeats until it is turned off.

Detailed explanations of what each line of code does is provided within the code itself.

Note: The servo.h library that is included in the code comes standard with the Arduino sketch.

Downloads

Assembling the Control System

Control System SS.PNG
IMG_7567.jpg

If it is your first time with circuits, it can be scary to look at, but with the schematic and pictures provided, the process should be easy enough to follow. With the inclusion of the L298N motor driver board, wiring has never been easier.

There are three main components to this control system:

  • The left foot DC motor (controlled by the L298N Motor Driver Board)
  • The right foot DC motor (controlled by the L298N Motor Driver Board)
  • The servo motor (controlled by the Arduino board)

In step 3, the motor driver board pins and terminals are labeled for your information. Positive and Negative wires go into their respective ports on the motor driver board. The 9V+ battery pack that powers the motors and motor driver board is wired to the left and middle pins on the 3 port terminal on the motor driver board and the right port is wired to the Arduino board.

Using 6 Male to Female jumper cables wire the 6 pins to the specified pins on the Arduino board. Note that the enable pins MUST go to the pins with a "~" in front of it. These are PWM pins that enable the Arduino to control the speed of the motor.

The servo motor is wired straight to the Arduino board. The Orange wire is wired to a "~" pin because it requires a PWM signal, while the red and brown wires are Positive and negative wires respectively. An additional 9V battery is used to power Arduino board through the battery port.

Note: To allow for ease of use, you can solder in switches in the positive wires for the battery packs. This is done by stripping the positive wire and soldering a switch in series with the wire.

If you are having trouble with your Motor driver board here is some additional help that I used when troubleshooting. L298N Motor Driver Board Tutorial

CAD Components

CAD SS.PNG

The goal of the design is to make something fun, functional and as close to movie quality as possible. For example, I wanted the R2D2 unit to sit at a slight incline. The legs are modeled separate from the body and head allowing an orientation of the R2D2 at any position.

These are the parts that I created using Autodesk Inventor. The Body, Head, Legs, Feet and Interior Structure are all made separate from each other. If you own your own 3D printer you can utilize that or if you have access to a 3D printing lab, that works as well. Printing labs are generally affordable so if you go that route, it should be cost effective. I went the route of fabricating each component out of various hobby materials which will later be discussed in detail.

A note about the design: The legs are made hollow to allow the wires from the DC motor to run through them.

Assembly

IMG_7540.jpg
IMG_7541.jpg
577330810.jpg
577421095.jpg
577423177.jpg
577421135.jpg
IMG_7542.jpg
IMG_7548.jpg
IMG_7549.jpg
IMG_7550.jpg
IMG_7551.jpg
IMG_7552.jpg
IMG_7553.jpg
IMG_7554.jpg
577418848.jpg

Preface: I chose to construct my R2D2 out of Foam board, Illustrator board, PVC and acrylic. These parts can also be easily 3D printed.

Throughout this whole construction I used the 3D modeled parts detailed in step 6 for dimensions.

I started off by constructing the interior structure of the PVC tube. The height of the tube is 7 inches so the height of the support structure should fit inside this. The Servo motor has a slot cut into the top circle foam board piece that the wires are guided into the body. The Arduino, L298N board and battery packs are mounted with hot glue to the support structure. Make note of the orientation of each component to allow the battery packs to be attached and the USB cable should have enough room to connect as well. Once the control system is mounted, insert the support structure into the body.

Next I created each separate panel for the legs. Detailed in the pictures above are the pieces you will need to cut. Support pieces of foam board are added for additional support. Do not attach the back panel on the legs until after the wires are run through them.

The feet are created separately before attaching to the legs. The DC motors that were used in this project came from an Arduino car kit and came with mounting screws that were used to attach to the foot wall. A small hole should be cut in the foot top to allow for the wire to run through. Two of these feet should be created and attached to their respective legs. Both finished products are detailed in a picture attached.

The middle foot is created in the same way the left and right feet are created. Noting the CAD drawing, there are multiple half circle pieces that are cut out and attached vertically from the foot and the bottom of the R2 unit. Later these will fit together and glue will be added to get the correct orientation of the middle foot. A small castor wheel is attached to this foot to add support and ease of steering for the R2 unit. I found it easiest to attach the middle foot first before attaching the left and right legs/feet.

The head is created by cutting an Acrylic dome and foam board to create the "dome" shape. Attach a servo arm to the bottom of the dome structure in the center. This will later attach to the servo motor.

Note: to get the curved shape in the legs and head, cut Illustrator board (cardboard) to length and bend into the curve of your choosing. I found it easiest to slightly bend the board first into shape and then glue into place immediately.

Lastly, you can paint this project to your liking. I went with a simple design to get the "R2D2" vibe but not be overly detailed and complicated.

Warning: If using foamboard, do not use spraypaint that has acetone in it or it will dissolve your foamboard.

Final Product and Use

IMG_0158.JPG
CustomR2D2 Testing

Here is the final product after a fresh paint job and assembly. Feel free to add even more details than I did.

The additions and possibilities for this project are endless! Bluetooth, sounds and flashing lights to name a few!

Enjoy and happy Making!