## Introduction: 3D Printed Obstacle Avoiding R2D2 Using an Arduino Uno in 13 Steps

Every Star Wars fan in existence would love to live in a galaxy far, far away. They could wield a lightsaber, fly the Millennium Falcon, or in this case, take a walk in the park with R2D2. This Instructable will give detailed instructions on how to make your very own obstacle avoiding R2D2.

I decided to build an Obstacle Avoiding R2D2 for my Principles of Engineering SIDE Project because it seemed like a good challenge for my CAD skills. Guidance and materials were provided by my Principles of Engineering teacher Ms. Berbawy. The electronics section of R2D2 was given by user Nayantha KGD's very own Obstacle Avoiding Robot Instructable. I used a model made by Zefy93 on TurboSquid as a reference for R2's head and a replica made by Steven S. Pietrobon on Starship Modeler as a reference for the body.

## Step 1: Gather Materials and Tools

Before starting my design, I took into consideration how large R2 could possibly be. Obviously I wouldn't be able to make him as large as the real R2, but I also wanted to make him large enough to hide my electronics under. Additionally, I had to consider what 3D printer I wanted to use and the maximum volume that the printer could print. I decided to make R2's head nine inches in diameter and make his body slightly smaller so his head could fit on top of his body.

When I opened a new Fusion 360 file, I created a sphere with a diameter of 9 inches and removed the bottom half of the sphere, making it a semi-sphere. I shelled the semi-sphere with an inside thickness of 0.2 inches.

## Step 3: Sketch and Extrude Front Head Features

Based on the head reference mentioned in the introduction, I created a sketch resembling the front facial features of R2. In order to start the sketches, I constructed a plane tangent to the face of the head. I extruded these sketches to join the main head shell. The extrude extended the features into the inside of the head, so I used the shell tool to remove those excess parts.

## Step 4: CAD the Eye

When creating R2's eye, I found that it was easiest to create an entirely different file and join it onto the head.

First, I created a hole for the eye on the facial features created in step 3. This hole was based on the head reference mentioned in the introduction. This hole was around 75% through the facial feature it was constructed on.

I created a new Fusion 360 file and named it "Eye Lens". Then, I created a semi sphere with dimensions proportionate to the hole on the facial features. Once I saved the file, I moved it into the main head file. I used the join tool to join the bottom face of the semi sphere to the bottom face of the hole.

## Step 5: CAD R2D2's Three Cameras

R2 has three cameras: one on the front, back, and top of his head. I found that the easiest way to CAD these features was to first create lens bases on R2 and attach separate camera files onto those bases.

To create the bases, I sketched a circle on a plane tangent to the head's face. The position and size of the circle were made relative to the head reference in the introduction. I extruded the sketches to join the head and repeat this step for the two other bases.

I created a new file and title it "Camera Lens". Then I created a sketch similar to the sketch pictured in the third image on this step and revolved it. I sketched a circle on the bottom of the hole created by the revolve with the diameter of the hole and extruded it to the height of the first sketch. I constructed an offset plane above that newly extruded circle and sketched a circle half the size of the original circle. Then I lofted the face of the first circle to the new circle to create a cone. I created a hole through the cone reaching half the height of the cone and created a semi circle at the bottom of the hole to make the actual camera lens.

Once the camera lens was completed, I moved the "Camera Lens" file into the main head file and joined the bottom of the camera lens to the front of the base. I repeated this for the other two bases and camera lenses.

## Step 6: Printing the Head

After constructing the cameras, my head was complete. I exported the CAD file as an STL file and imported it into Lulzbot Cura (or any other 3D printing software). Most of the settings for the print were at default, but there were a few that I changed. I made sure to print in standard mode and chose the printer I was using in the printer selection tab. My build plate adhesion was skirt and my shell wall thickness was 1.0 mm with a wall count of one.

I also generated supports everywhere, but this also generated supports inside the head, which was unnecessary and would have been quite time-consuming in printing and removal. To avoid this, I created a support blocker with the dimensions and coordinates from images four and five of this step. Once my settings were set, I saved my Cura file to a USB and began printing using white PLA filament. When the print finished, I removed all supports with needle-nose pliers and sanded all uneven areas.

Challenge: My first three head prints actually failed due to the filament and the Cura settings. For the first two, the offset was incorrect for the infill. For the third print, the filament was too brittle and had to be dried. The lesson learned was to always check my filament and double check my printer settings are correct.

## Step 7: CAD the Body Shell

When designing the body, I took into consideration the printing limit of the Taz 6 as well as the assembly of the head and the body. I would need to make the body large enough to hide the electronics and small enough for the Taz 6 to print and for the head to fit on top of.

Challenge: I actually had a previous model that I did not design for printability. Rather than using a method of splitting bodies that will be shown in later steps, I cut extruded through the main body. This resulted in more supports being used in the print than necessary and a print time of over four days. The print ended up failing on the third day. The lesson I took away from this first print was that whenever designing a 3d print, always design for printability. If you don't, you're just wasting your time.

I constructed a cylinder with a diameter of 8.5 inches and a height of 8 inches. Then I created a hole all the way through the cylinder with a diameter of 7.5 inches.

## Step 8: CAD Body Features

In my first print, I tried extruding the features of R2 into the body as a cut. This not only made the model unappealing to look at, but also made the print longer and more difficult to remove supports. That print took four days and I was unable to remove the many supports without damaging the print. It also failed halfway through. The mistake I made was designing without taking printability into consideration. My solution to this problem was creating entirely new bodies for features and slicing them.

First, I created a new sketch (image one) on a plane tangent to the body's face on the front of the body. The sketch modeled the body reference mentioned in the introduction.

Before I did anything with this sketch, I completed features on R2 that didn't require body slicing. These features were all based on the body reference mentioned in the introduction. I sketched and join extruded a panel on R2's front on a plane tangent to the main body. This panel was in the large, empty area in the middle of the first sketch. Then I sketched vent holes and cut extruded them into the panel as seen in image two. I sketched and cut extruded rectangular holes into the bottom vent as seen in image three. I sketched and join extruded vent panels in the top vent as seen in images four and five. I sketched a new panel on the bottom right of R2D2's front on a plane tangent to the main body and join extruded it onto the main body. I sketched a rectangle in the top left hand corner of the panel and created a rectangular pattern of nine rectangles as seen in image seven. I cut extruded those rectangles about halfway into the panel. Below the vents, I sketched and cut extruded a rectangular hole as seen in image eight. Then I sketched a circle on the plane and lofted the back of the hole to the circle as seen in image nine. I sketched and cut extruded a small rectangular hole on the bottom middle of R2's back on a plane tangent to the main body as seen in image ten. I extruded a circular hole into the rectangular hole. This extrude was the same amount as the rectangular hole. I sketched a circle on the plane and lofted the back of the circular hole to the new circle as seen in image 11.

After creating those features, I extruded the first sketch into the main body as a new body as seen in image 12. I then split that extrude using the main body as the split tool as seen in image 13. I deleted the outer body and moved the inner body outwards so that it is clearly visible as seen in image 14. I repeated these steps for the sketches shown in images 15, 16 (which is positioned right above the feature from images six and seven), 17 (on the back of R2), 18 (on the right of 17), 19 (below 17), and 20 (on the left of 17). I mirrored the rectangle from image 17 across the back of R2 so it is on the right of 17. I filleted the bottom and top edges of these bodies by 0.1 inches so supports are not needed. I cut extruded a hole through the hole in the main body in order to get rid of any excess material left by the features and bodies.

## Step 9: CAD the Legs

Plenty of challenges arose when designing the legs. I wanted to print them with the body rather than having them be a separate part. This required me to make them small enough to fit the Taz 6.

On the right or left side of R2, I created a sketch for the top half of the leg on a plane tangent to the main body as seen in image one and join extruded it to the main body. I sketched the bottom of R2's foot on the XY plane as seen in image 2 and lofted the bottom of the top half of the leg to the sketch.

In order to make room for the wires for the electronics, R2 had to be elevated so the wires could connect from the electronics to components outside of the main body such as the DC motors and the ultrasonic sensor. To do this, I pulled the bottom of R2's foot down by one inch as seen in image three.

I completed one leg, but R2D2 obviously doesn't have just one leg (there actually isn't one character in the Star Wars universe with only one leg. Believe me, I looked it up just for this joke). I mirrored the features for the leg I created onto the other side of R2.

## Step 10: Print the Body

Congrats! If you're this far into my Instructable, you've completed the body, so that means it's printing time. The second time around printing the body was way easier and took about 1.5 days rather than the first design which took four.

I exported the body file as an STL file and imported it into Lulzbot Cura. I turned the model upside down, as less supports are needed in this orientation. My settings were be the same as R2's head, except I should printed on high detail rather than standard. I saved the gcode to a USB and began printing with white PLA filament. Once it finished, I removed all supports using needle-nose pliers and sanded any uneven areas.

## Step 11: Decorations and Print Assembly

It's time for the fun part: decorating R2D2.

I colored the main head as well as the 3D-printed features with oil paint pens based on the head reference. For the other panels on R2's head, I used a vinyl cutter to cut decals as the panels. If you don't have access to a vinyl cutter, draw them using oil paint pens.

Since R2's body is mainly white, I didn't have to do much work. I just colored the parts that are colored based on the body reference. The only area that had decals rather than being colored with the pens was the top two panels on R2's front. Again, if you don't have access to a vinyl cutter, draw them using oil paint pens.

Once both parts are decorated, I set the head on top of the body and combined them using super glue.

## Step 12: Electronics

This step regarding electronics was given by user Nayantha KGD's instructable as mentioned and linked in the introduction.

First, I soldered male-to-male wires to my DC motors and applied heat shrink tubing to cover the exposed wires. Then, I attached my wheels to my DC motors.

According to Nayantha KGD's circuit diagram (image 1) and an altered circuit diagram I based off his diagram (image 2), wires and components were connected as followed:

• Ultrasonic Sensor
• VCC - +5V on Arduino through breadboard relay 1
• Trig - Arduino A1
• Echo - Arduino A2
• Motor Driver
• +12V - LiPo battery positive through breadboard relay 3
• GND - LiPo battery negative through breadboard relay 4
• Ln 1 - Arduino digital pin 8
• Ln 2 - Arduino digital pin 6
• Ln 3 - Arduino digital pin 5
• Ln4 - Arduino digital pin 4
• Out 1 - Motor 1 through breadboard relay 5
• Out 2 - Motor 1 through breadboard relay 6
• Out 3 - Motor 2
• Out 4 - Motor 2
• Servo
• Orange wire - Arduino digital pin 10
• Red wire - Breadboard relay 1
• Brown wire - Breadboard relay 2

I used Arduino IDE to upload this code written by Nayantha KGD to my Arduino Uno as seen in images 3-7. I made sure to also add the NewPing library before I uploaded the code. The Arduino IDE code files are attached to this step

## Step 13: Base and Assembly

The last thing I had to construct was a wooden base for my electronics and R2.

I jig sawed a circle about 12 inches in diameter out of a wooden plank . Then, I drilled and cut four holes into the base within the inside boundaries of the body as seen in image 1. These holes allowed for wires from my DC motors, ultrasonic sensor, and servo to pass through the base. I sanded the edges of the base, but that is optional. I drilled a swivel ball caster wheel near the back of the bottom of the base as seen in image 2 so that R2 leaned back, just like in the movies.

I used #4 screws to drill the Arduino and motor driver into the base as seen in image 3. To attach the mini breadboard to the base, I removed the adhesive cover on the bottom of the breadboard and pressed the breadboard onto the base as if it were a sticker.

I screwed the wooden blocks mentioned in the material list into the right and left of the bottom of the base and attached the DC motors to the blocks using adhesive strips as seen in image 4.

I attached the servo and LiPo battery near the front of the base using adhesive strips as seen in image 5. I screwed the ultrasonic sensor mount onto the servo and attached the ultrasonic sensor to the mount using a velcro strip. I used velcro adhesive strips to mount R2D2 onto the base.

Viola! You've got your very own obstacle avoiding R2D2! Congratulations and may the Force be with you!

Runner Up in the
STEM Contest