This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com). The project requirement was to create a project that uses at least one 3-D printed part, and that by using the 3-D printed part it or the entire project will move or be able to work. Originally I was going to create a miniature person that kicks a ball, but after receiving advice from the courses TA's and thinking about it myself a little more I decided that it would be easier to make just the 3-D printed foot, that would pivot forward and kick the ping pong ball when it was detected.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Constructing the 3-D Printed Foot
The first part that I created in solidworks for the project was the actual foot, that would kick the ping pong ball. This was actually pretty simple to construct as the leg is just a circle that is wide at the top and then gets thinner as it was extruded downward. Then you have to create the foot, which is a slot shape. In order to get the rounded front like I did you had to extrude it regularly except at the front where you make it the shape of a semi-circle. In order for it be printed together you have to then mate the two parts together, otherwise the two pieces will be printed separately and then you will have to glue the two pieces together.
Step 2: Creating the Servo Support
The next component of the project that I created in solidworks was the servo support. The reason for this component of the project was to support the servo above the box, but also to hold the foot above the lid of the box. This was so that when pivoting forward to kick the ball the foot would not hit the lid of the box which would cause friction causing itself to slow down. The support structure is a square shape structure in solidworks which was approximately 2.75 inches total in height. Another reason for the servo support was to hide the wires that were connecting the servo to the arduino inside the box. We were able to do this by extruding a diamond shape hole in the top of the support structure which the servo sits on top of, the extrusion goes down to about 1.75 inches above the bottom of the support structure. You need to make sure that the exit hole for the wires to exit the support structure, is at a forty-five degree angle.
Step 3: Setting Up the Control System
In order for the entire project to work you need to somehow set everything up so that in some way it all goes back to the Arduino board, which is the brain of the control system. As you can see in the picture, the wires from the servo first go to the breadboard, but then their are a second pair of wires which go to the Arduino which give power back to the Servo. The control system was pretty simple to set up, as it only requires a proximity sensor and a servo to operate. In the picture shown you see that the proximity sensor is put straight into the breadboard, however in the final project we could not have any wires showing. In order to solve this problem I used four female jumper extension wires to connect the four prongs that represent, left to right: Vcc (power), trigger, echo ground; to the arduino board. Make sure that you plug whatever wire you choose to use for the ground wire into the blue rail on the breadboard otherwise the proximity sensor will not be able to operate, the same is necessary for the power wire except plug it into the red power rail. Use another wire to connect the ground wire to the Arduino from the breadboard, and plug it into the ground pin on the Arduino, and for the power plug your other wire into the pin above marked 5V. Also for the proximity sensor make sure to plug your second wire for the echo prong into pin number 8 on the arduino board, and the trigger into pin number 9. For the servo plug the wire into pin number 5.
Step 4: Code for Final Project
Next in the process is writing the code for the project so that the components can communicate with each other and know when to move. For example in my project without certain pieces of the code, the proximity sensor would detect an object in front of it but not communicate with the servo which would cause the foot to stay still and not pivot forward hitting the ball. The code in its entirety can be seen in the pictures above, but I will point out some of the important parts of the code. The first thing that I did when writing my code was including the header file for the Servo so that I would not need to rewrite the portion of the code. Next I defined all my variables (echo servo and trigger pin), as well as instantiating my servo. The line myservo.write(90), means that the origin point for the servo is set to be ninety degrees. Also "high" when discussing the pins of the proximity sensor means the pin is on, and "low" means that the pin is off. The last part of the code, with the lines myservo.write, the values are referring to angles not regular numbers. So its saying that if the proximity sensor detects an object, the ping pong ball, zero to five centimers away then it will tell the servo to pivot the foot to 120 degrees then pivot forward to fifty and then when the object is not detected pivot back to ninety degrees.
Step 5: Making Finishing Touches to Project
After all the code was written, and the 3-D printed parts were created and being prepared to be printed I made final touches to the project. One of the final touches was reprinting the lid of the box so that I could extrude holes. This was so that I could put the servo support structure through the lid and then feed the servo wires through so they would be hidden from our vision when presenting. Also I made a hole so that the proximity sensor would be able to be on the lid of the box and therefore be able to detect the ping pong ball. At first when feeding the wires through the support structure, this prevented the structure from fitting in the hole, so I decided to cut the jumper wires and then solder the wires to other wires and then I was able to fit the structure through the hole and also feed the wires through. The last two final touches I made to the project were screwing the servo into the support structure so that it would stand straight when operating, otherwise it would have kept falling over, and also I had a 9V battery inside the box in order to power the Arduino.