Introduction: Impatient Robotic Hand [Arduino, 3D Printing]
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Even robots get a little restless at times.
With the intention of being an introductory-level robotics project, this venture would do well to serve the up-and-coming robotics enthusiast as a Halloween prop, or merely a desktop companion.
This project was created by implementing CAD (Computer Aided Design) software to design and subsequently 3D print parts that could not be purchased through normal means. These components were later merged with Arduino hardware and software to create the desired tapping motion for the fingers.
Step 1: Gather the Required Materials, Tools and Software
- 1 x Arduino Uno R3
1 x Solderless Breadboard 400 Tie Point PCB BreadBoard for Arduino
1 x Lithium Ion Polymer Battery - 3.7v 500 mAh
1 x Adafruit Powerboost 500 charger
4 x Du-Bro 605 E-Z connectors
4 x RioRand MG90 Metal-Geared micro servos (servo horns included)
4 x #216 - 1/2 inch Screw Eyes
1 x Spool generic low-test fishing line
1 x HC-SR04 Proximity Sensor
1 x [5/64" by 5"] Aluminum Rod
20 x Male to Male jumper cables (assorted colors)
1 x Micro - USB cable
1 x Wall Charger
1x [8 by 1] segment of Header Pins
(recommended) 1 x RUST-OLEUM HAMMERED Black Spray-paint (for finishing)
(recommended) Generic zip-ties for cable management
Hot Glue Gun
#2 Phillips Head Screwdriver
Ruler or Calipers
120 Grit Sandpaper
Magic Sculpt 1 Lb. Epoxy Clay - Natural
Step 2: 3D Printing
The Hand base functions as a way to hold the fingers in place as they rotate about the central dowel rod. The extension panel is merely to provide more room for your Arduino and breadboard. The base cover is to simply to provide a cleaner look once all is said and done!
The overall aesthetic was an attempt at blending an organic (spider-like, in particular) and mechanical look into a single design.
Download and 3D print the attached STL part files.
1 x Base Cover Panel
1 x Base
1 x Base Panel Extension
3 x Finger tip
3 x Middle Joint
3 x Finger base
Recommended 3D printer settings:
Hexagonal pattern, 15% infill, 3 layers.
Step 3: Assembly
Now that you have your freshly printed parts, the real assembly can begin! Please adhere to all instructions on equipment labels. Safety first, as always.
- Use the epoxy clay to seal the fingertip, middle joint and finger base parts together. Repeat this process three more times for a total of four fingers.
- Use the epoxy clay once more to seal the base panel extension to the hand base.
- Allow 24 hours for the epoxy to properly cure.
- Use the 120 grit sandpaper to sand off any excess epoxy resin (be sure to wear a mask and eye protection!)
- Line up the holes of the finger base parts with the base and insert the 5/64" x 5" aluminum dowel rod.
In the event that the pieces do not fit together exactly do to tolerancing variance in the 3D printed parts, use the 120 grit sandpaper to widen the spacing. This is why 3 layers are recommended. Next, we will create the physical connection between the fingers and the servos.
- Cut four 10" fishing line segments and fold them in half.
- Measure approximately .5" from the top of the finger base segments and mark the center. Insert 1 screw eye into each finger segment as shown in the above picture, and place the bend of your folded fishing line through them.
- Attach the provided servo horns to your micro servos, and subsequently use the Du-Bro 605 E-Z connectors to attach the fishing line to the servo horns, taking careful note of the assembly directions for the connectors on the provided packaging.
- Center each micro servo relative to each finger, and pull the fishing line until no slack remains. Mark the location that this occurs, and use the hot glue gun to attach the servos to the hand base as shown above. Do not worry if they are not perfectly aligned relative to each other, all that matters is that the fishing line is taut at each location. For more detail, please refer to the above images.
Step 4: Setting Up the Control System
Hardware can look quite daunting at first glance, but the following images and instructions will help guide your way! It is important to color code your jumper wires to avoid confusion. Here, the following color coding rubric was used: Orange/White for 5V connections, Black/Green for Ground, and Yellow/Blue for Generic Pin connections. For further clarification, a circuit diagram sketch has been provided in the attached images.
For the purposes of readability and length, 5V connections jumper wires will be referred to as O/W, Ground connection jumper pins will be referred to as B/G, and Generic Pin connections will be referred to as Y/B.
- Identify the servo cable. Each servo comes attached to a ribbon cable with 3 pins: Ground , 5V, and attachment slot. As pictured, the servo ground pin will be brown, the power pin will be red, and the attachment pin will be orange.
- For each servo, attach an O/W jumper wire to each pin of the red portion of the ribbon, and attach a B/G jumper wire to each brown portion of the ribbon, as shown. Attach the O/W jumper wires to the row signified by the red (+) on the breadboard, and attach the B/G jumper wires to the row signified by the blue (-).
- Now you must create the pin connections from the so that the Arduino knows which pin is attached to which servo! Attach a Y/B jumper wire from each associated ribbon cable of each servo to the Arduino numbered pins as follows: Servo1 to pin 9, Servo2 to pin 6, Servo3 to pin 3, and Servo4 to pin 2. Servo 1 is the finger closest to the thumb-like structure, and servo 4 is the finger farthest from the thumb.
HC-SR04 Proximity Sensor
This is how the Arduino knows to execute the loop and create the finger motion! If it picks up stimulus within 20 cm, you can watch tap away! Look closely at the back panel of the sensor for the associated pin labels. Place the sensor on the breadboard in a location with plenty of room to work. Make sure that the pins are properly inserted into the breadboard.
- Attach an O/W jumper wire in the same row as the pin labeled "Vcc" on the sensor is placed. Attach the other end of this jumper wire to the same row of the breadboard labeled (+) from earlier.
- Attach a B/G jumper wire from the "Gnd" pin to the row labeled (-) from earlier.
- Route a Y/B jumper wire from the pin labeled "Trig" to pin 10 of the Arduino.
- Route a Y/B jumper wire from the pin labeled "Echo" to pin 8 of the Arduino.
Adafruit Powerboost 500 charger
This functions as the inlet for our portable power supply.
- Solder header pins to the Adafruit Powerboost 500 charger so that there are now pins in the slots labeled "GND" and "5V" and place it on the breadboard in a location with plenty of room to work. Make sure that the pins are properly inserted into the breadboard.
- Route an O/W jumper wire from the pin labeled "5V" to the row labeled (+) from earlier.
- Route a G/B jumper wire from the pin labeled "GND" to the row labeled (-) from earlier.
Route an O/W jumper wire from the pin labeled "5V" on the Arduino to the row labeled (+) from earlier.
Route a G/B jumper wire from the pin labeled "GND" On the Arduino to the row labeled (-) from earlier.
Once all connections have been made, merely attach the Lithium Ion Polymer Battery (make sure it is charged) to the Adafruit Powerboost and place the base cover over the hardware for a cleaner look!
The Adafruit Powerboost 500 acts as the power supply for the circuit, powering the HC-SR04 Proximity Sensor as well as the 4 RioRand MG90 Metal-Geared micro servos present. The breadboard functions as the pathway that the current travels though as it routes its way back to the Arduino. The Arduino microcontroller functions as the "brain" of the project, providing instructions for the other components to abide by.
Step 5: Uploading the Code
After your control system has been set up and attached, you are ready to upload the code! As a reminder, make sure that the Arduino IDE software is up to date. Download the attached files.
Once you are within the Arduino IDE, ensure than you have 3 separate tabs open in the software, labeled as Control_System_Deliv, HCSR04.cpp, and HCSR04.h, respectfully.
Plug in a micro USB cable from your computer to the Arduino microcontroller, and once you have downloaded the attached files, simply press the blue "Upload" button. Unplug it, and as long as power is supplied, the Arduino will operate with the last code that was uploaded.
How it works
The code is operated by reading stimuli within 20 cm with the proximity sensor, and if this requirement is met, will generate finger tapping motion!
The #include "HCSR04.h" #include "Servo.h" commands give us the header files supplied to us in the course for the proximity sensor and servos (included with the Arduino), respectively. The header file includes functions to be used in the main code. The .cpp file holds program source code. The #define function assigns each component to their respective pin, and the "HCSR04ProxSensor distanceSensor(echoPin,triggerPin)" command calls upon the constructor to instantiate a sensor named "distanceSensor" and assigns the echo pin to be receiver and the trigger pin to the output. The command "int pos = 0" issues a value of classification "integer" to be assigned to 0. This will be referenced throughout the rest of the code. The Attach and Write commands actually attach the servo objects to their respective pins and write them to the initial position defined by the int pos = 0 command above.
In the main loop of the program a float (digits on both sides of the decimal point) distance calls upon a "readSensor" method to determine the distance and read distance for the proximity sensor. An integer delay d is created for use throughout the rest of the code, as well as I being initialized to be 0. Int I is the angle position of the servos itself. If the Serial Monitor of the Arduino IDE is being used (located under Tools in the upper left-hand corner), you will notice the "serial.print" commands issuing the distance read by the sensor, as well notifying the user that it has been triggered. From this point on, a "for loop" is being used to iterate through a range of values (the angles by 1 degree in each increment). The first loop iterates downwards from 360 degrees to 45 degrees, and the second loop iterates upwards from 0 to 315 degrees by increments of 1.
A previous build has been "commented out" within the code itself to provide a different pattern of movement if desired, and all code has been commented for understanding and readability. If greater detail is desired, please refer to the code comments.
And that's all, folks! Thank you so much for reading. Good luck making, Makers!