Robotic Arm Synopsis
Robotic Arm Synopsis
1 Motivation
The motivation for the DoodleBot stemmed from a MATLAB product demonstration given at
NYU-Poly on September 23, 2011 where they demonstrated closed loop control of a robotic arm
through MATLAB with a video game controller. When the final project guidelines included
“robotic manipulator” in the list of suggested projects, we decided to move forward with some
sort of robotic arm. Two of us had taken more than one robotics class, and all had experience in
control theory, but we had never implemented closed loop control on actual hardware. By
building a robotic arm from scratch - from hardware through software design - we were able to
not only meet project requirements but also provide ourselves with a learning platform.
After initial research, we realized that a generic robotic arm with modular parts and expandable
control software could have several potential uses. For example, the Meal Mate robotic feeder
[1] and the Meal Buddy Robotic Assistive Feeder [2]are both robotic arms designed to help those
with cerebral palsy, head/spinal injuries, rheumatoid arthritis, muscular dystrophy, upper limb
amputations etc, and many other persons with learning difficulties or neurological conditions eat
independently (Figure 1). A device like this would satisfy the “smart kitchen aids, smart home
appliances,” and “projects that respond to a societal need” sections in the list of suggested
projects.
Figure 1: The Meal Mate robotic feeder [1] (left) and the Meal Buddy Robotic Assistive
Feeder [2](right)
Another application of robotic arms can address two other sections in the suggested project
guidelines: “enhance laboratory education in grades K-12” and “mechatronics-enabled pre-
college level science experiments (physics)”. A generic robotic arm could be used as an
educational platform. LEGOs are already a popular way to teach mechatronics to this age group,
and LEGO robotic arms already exist (Figure 2). The company has also recently released new
sets aimed at encouraging young women to explore robotics.
Figure 2: LEGO robotic arm [3] (left) and a new LEGO kit [4] (right) targeted at
encouraging young women to explore robotics
Additionally, toy robotic arms are becoming increasingly affordable, with one particular example
from OWI Robotics retailing for just $40 (Figure 3). However, both the LEGO arm and toys like
the OWI Robot Edge obscure the actual motors and electronics that go into such a project. It is
difficult to make the leap from playing with LEGOs and toy robots to designing real world
robotic systems.
It follows from the above that a transparently designed real world robotic arm might serve as an
engaging platform for mechatronics learning. Robotics can be intimidating, but it’s clear from
numerous studies that the US needs to encourage interest in STEM education in order to
maintain a globally competitive work force [5]. One way to mask a seemingly intimidating
subject like robotics is to include familiar functionality. We chose drawing as our means of
making the robotic arm more interesting and engaging to those who might not otherwise be
drawn to explore robotics.
Several robots already exist that have been deployed in museums, galleries, and public outreach
events to engage audiences both young and old (Figure 4). We designed our robotic arm to work
in similar environments. This will help address a societal need to encourage students to pursue
STEM education.
Figure 4: (Left) SADbot at Maker Faire (Middle) SADbot in Eyebeam's window gallery [6]
(Right) Robotic Installation art [7]
2 Theory/Mathematical Background
=arcos
Φ = atan2 (y, x)
Ψ = atan2 (l2 sinθ2, l1 +l2cos θ2)
=Φ–Ψ
Where l1 and l2 are the link 1 and 2 lengths respectively and θ1 and θ2 are the angles
corresponding to each link.
In contrast to inverse kinematics, forward kinematics gives the position of the end point based on
the given joint angles. The equations for x and y coordinates of the end point are given below
based on the nomenclature in Figure 5:
x= l1 cosθ1 + l2 cos (θ1+ θ2)
y= l1 sinθ1 + l2 sin (θ1+ θ2)
By using these equations we can calculate the desired angles based on the desired location of the
end point and use that as the reference input.
where Jeq is the total load inertia reflected at the motor shaft, Kg is the gear ratio, Kb is the
motor speed constant ((Vs)/rad), KT is the motor torque constant ((Nm)/A), and bt is the
rotational viscous friction constant. The transfer function can be simplified in the following
form:
=
Where τ and K are the mechanical time constant and the dc-gain of the DC servomotor
respectively. To experimentally determine K and τ for the DC-motor, the transient and steady-
state angular velocity step response of the DC-motor can be obtained by applying a step input
voltage and measuring the angular velocity of the link. A plot of such a response is shown below
Figure 7:
ω=
FVT: = lims->0 =K
As the name implies the PID controller has three gains, a proportional (Kp ), derivative (KD )and
integral (KI) gain. A PID controller calculates an error value as the difference between a
measured process variable and a desired set point. The controller attempts to minimize the error
by adjusting the process control inputs. The proportional, the integral and derivative values,
denoted P, I, and D, can be interpreted in terms of time: P depends on the present error, I on the
accumulation of past errors, and D is a prediction of future errors, based on thecurrent rate of
change.
Once K and τ are determined, the PID controller gains can be determined after getting the closed
loop transfer function corresponding to the closed-loop feedback system shown in Figure 8.
Figure 8: Closed-Loop Feedback PID control of the DC Motor
The closed loop transfer function is:
3 Project Specifications
The DoodleBot complies with all of the following project specifications. Details are given in
subsequent sections.
Your device will be controlled by BS2 (or another microcontroller of your choice)
You must incorporate and document hardware and software features to prevent damage
to the BS2 IC and other components on your device. In addition, you must provide
guidelines for safe operation of your device.
Include a provision for instantaneous shutdown of your device in case of incorrect/unsafe
operation.
Your project must include some form of a user interface so that a human user can
monitor and control your device.
Your project must utilize at least one actuator.
Your project must utilize at least one analog and one digital sensor.
Your actuator must be controlled using sensory feedback. You can use any primitive to
advance control design methodology for this purpose.
4 Mechanical Design
In order to plan what parts to order and confirm everything would work as intended, all
mechanical systems were modeled in Solidworks before purchase and assembly. Off the shelf
parts were used whenever possible to keep the mechanical design and assembly time manageable
and provide a modular system that could be easily duplicated. Solid models of some of the parts
were already available online [8], and these were configured into a two degree of freedom (DOF)
planar robotic arm actuated by standard size servomotors (Figure 9). A solenoid was mounted at
a right angle to the planar arm to provide a way to extend and retract a drawing implement at the
end effector. This robotic arm is referred to as the slave arm, as opposed to the master arm,
which will be described later. A base was machined out of an aluminum u-channel to mount the
robotic arm as well as the electronics.
elbow
shoulder
Figure 9: Screenshot from Solidworks with details of slave arm hardware design
elbow
shoulder
Figure 10: Screenshot from Solidworks showing basic master arm design
5 Electrical Design
In order to determine the required torque in the shoulder motor, we assumed that all the weight
of the elbow motor, solenoid, and connecting components (approximately 5 ounces) was
concentrated at the end effector, 14 inches from the axis of rotation of the shoulder motor. If the
arm was fully extended horizontally, the shoulder model would need at least 70 in-oz of torque
to lift the arm. We had some HS-7950TH high torque servomotors (344 in-oz), but the control
boards had been destroyed by an accidental application of high voltage in a previous project. We
chose to remove the control boards, effectively making them direct current (DC) gearhead
motors with already integrated potentiometers to use as feedback (Figure 11). We left the
mechanical hard stops inside the gearboxes intact because we did not need more than 180°
rotation in either DOF. This step allowed us to lower the cost of procuring parts while recycling
otherwise useless motors. We then soldered wires from ribbon cable to each of the two DC
motor leads and each of the three existing potentiometer wires to allow us to interface with the
solenoid from down near the base of the robotic arm.
An single pole single throw switch was also incorporated into the design to kill power to both
motors with a single emergency cutoff switch (Figure 14).
Our control mechanism is a miniature model of the real arm, referred to as the master arm. The
slave robotic arm is programmed to follow the motions of the master robotic arm. We achieved
this by placing potentiometers at the joints of the master robotic arm. These provided us with
position feedback and we then programmed the robotic arm to attempt to achieve that same
position. The motors in the slave robotic arm provided position feedback using integrated
potentiometers as well.
To get position from the master robotic arm we read the input from the two potentiometers on
analog pins 4 and 5. These pins are capable of doing A2D conversion. After reading the input
from these pins, we constrained them to not exceed the physical limits of our slave robotic arm.
The motors have about 135 degrees of motion while the potentiometers have over 180 degrees. If
the reading exceeds the allowable region, it is changed to be at the upper or lower limit. The
elbow was constrained to operate only in 90 degrees because of the way the arm was
constructed. After constraining the input, it is then mapped from the potentiometer reading to a
degree reading. This is done using the built-in map command on the Arduino.
After getting the position of the master arm, the program retrieves the position of the slave arm.
The potentiometers of the slave arm are the inputs for analog pins 0 and 1. These pins can do
A2D input, and we constrain them to the physical maximum range. After that we map them to
the degrees in the same manner that we mapped the master arm.
At this point we now have the position of the master arm and the position of the slave arm. The
control mechanism needs to make these two positions the same as quickly as it can. To do this,
we implemented the proportional (P) and derivative (D) from PID control. Using the P and D
with appropriate gains, we used pulse width modulation to control the voltage sent to the motors.
This affects the speed with which the motors reacted. The maximum pulse width was 255 and we
found that our motors needed a minimum pulse width of 40 to move. After experimenting with
the PD control, we constrained our pulse width to be between 40 and 255 at all times. We
prevent the motor from trying to move when the slave and master are in the same position by
saying that if the positions were within 1 degree of each other, the motors are turned off.
Finally, to control the drawing mechanism there is a solenoid attached to the end of the slave
arm. This solenoid extends to draw and retracts to move without drawing. There is a button on
the end of the master arm that is linked to this motion. When this button is pressed, it sends a
high signal to the Arduino. The Arduino then sends a high signal out to the solenoid pin, attached
to the base of a transistor, and allows our power supply to extend the solenoid. When the button
is released, the solenoid retracts. See Appendix A for a full listing of the Arduino code.
7 Bill of Materials
In order to keep procurement costs down, we utilized as many existing parts as we could and
supplemented these with off the shelf hardware components. Our cost for one unit was
significantly lower than it would have been to buy just one of all the necessary parts since we did
not have to purchase motors or several of the components to breadboard the circuit (Table 1).
Table 1: Bill of Materials (our cost)
Vendor Part number Description # in pack Quantity Price (1) Subtotals (1)
Slave arm hardware Lynxmotion ASB‐04 Aluminum Multi‐Purpose Servo Bracket 2 1 $11.95 $11.95
Lynxmotion ASB‐09 Aluminum "C" Servo Bracket with Ball Bearings 2 1 $12.90 $12.90
Lynxmotion HUB‐08 Aluminum Tubing Connector Hub 2 2 $8.00 $16.00
Lynxmotion AT‐04 Aluminum Tubing ‐ 6" 1 2 $3.60 $7.20
Adafruit ID: 412 Solenoid 1 1 $9.95 $9.95
Servocity HS‐7950TH High Torque Digital Servo Motor 1 4 $119.99 $0.00
McMaster 1630T332 Aluminum c‐channel base 1 1 $15.06 $0.00
Slave arm electronics Adafruit ID: 81 Motorshield 1 1 $19.50 $19.50
Sparkfun COM‐00315 SN754410 h‐bridge 1 2 $2.35 $4.70
Adafruit ID: 50 Arduino UNO 1 1 $30.00 $30.00
Mouser 511‐TIP102 TIP102 (for solenoid) 1 1 $0.80 $0.80
Sparkfun COM‐08589 Diode 1N4001 1 1 $0.15 $0.15
McMaster 7395K44 Illuminated rocker switch 1 1 $7.02 $7.02
Master arm Sparkfun COM‐09288 Rotary Potentiometer ‐ Linear (10k ohm) 1 2 $0.95 $1.90
Sparkfun COM‐09190 Momentary pushbutton 1 1 $0.50 $0.50
SolidConcepts 3D printed parts 1 1 $0.00 $0.00
Other Sparkfun CAB‐10647 Ribbon Cable ‐ 10 wire (15ft) 1 1 $0.99 $0.99
Misc. jumper wire, resistors, connector,etc. $0.00 $0.00
Art Store Foam core, padding, sketch paper, marker $25.00 $25.00
Total $148.56
Total $195.92
8 Operation Guidelines
For general operation, use the master arm to position the slave arm in similar postures. The
button at the end of the master arm controls the solenoid at the end effector of the slave arm. To
extend the drawing implement press and hold the button on the master arm, and to retract the
drawing implement release the button.
8.1 Document hardware and software features to prevent damage to Arduino or other
components
The digital input/output pins on the Arduino can source 40mA and sink 50mA. Staying within
these limits prevents damage to the board. The two digital I/O pins we use are both protected by
safety resistors. There is a 220 ohm resistor from the master arm button to the Arduino, which
limits the current that can be sourced to 23mA. Another 1k ohm resistor is used to connect a
digital I/O pin to the base of the transistor, limiting the source current to 5mA. In software, the
arm's motion is limited to remain within the allowable range. This prevents the master from
sending commands to the slave arm that it cannot perform. Without the software limits, the
motors would attempt to push the arm beyond its limits causing structural failure or motor
burnout.
We plan to give back to the open hardware community we learned from in this project by
publishing a tutorial on the build on Instructables.com, and perhaps pursuing other goals such as
a completed robotic assistive feeder design. The Doodlebot will also be used as a research
platform in the Applied Dynamics & Optimization Lab at NYU-Poly, and can be used for
outreach activities both on and off campus such as Maker Faire and in open lab events.
Appendix A
/*
Robot arm control using hacked servos and a master arm with
pots as control in
master-slave system.
*/
#include <AFMotor.h>
// declare pins
int MasterElbowPin = A4; // the pot in the robot arm elbow
int MasterShoulderPin = A5; // the pot in the robot arm shoulder
int SlaveElbowPin = A1;
int SlaveShoulderPin = A0;
int SolenoidPin = 2; // pin solenoid transistor is attached to
int DrawPin = 13; // pin button for drawing is attached to
// initialize constants
const int P_Elbow = 15; // this is the proportional gain
const int P_Shoulder = 10;
const double difconstE = 60;
const double difconstS = 60;
const int lowL = 50; // the lower bound of speed below which
the motor won't move
// initialize variables
float range = 1; // use 1 to avoid any divide by 0 errors
// PID
double delT;
unsigned long lastT;
double deltaElbow;
double deltaShoulder;
double lastElbow, lastShoulder;
void setup() {
Serial.begin(9600); // set up Serial library at 9600
bps
pinMode(SolenoidPin, OUTPUT);
pinMode (DrawPin, INPUT);
void loop() {
// read the values from all the pots
masterElbowAngle = analogRead(MasterElbowPin);
slaveElbowAngle = analogRead(SlaveElbowPin);
masterShoulderAngle = analogRead(MasterShoulderPin);
slaveShoulderAngle = analogRead(SlaveShoulderPin);
// DRIVE ELBOW
unsigned long now=millis();
delT=double(now-lastT);
lastT=now;
elbowError = (slaveElbowAngle - masterElbowAngle);
deltaElbow = (elbowError-lastElbow)/delT;
pwmElbow = P_Elbow * elbowError + difconstE*deltaElbow;
lastElbow=elbowError;
pwmElbow = abs(pwmElbow);
pwmElbow = constrain(pwmElbow, lowL, 255);
// DRIVE SHOULDER
shoulderError = (slaveShoulderAngle - masterShoulderAngle);
deltaShoulder = (shoulderError-lastShoulder)/delT;
pwmShoulder = P_Shoulder * shoulderError;// +
difconstS*deltaShoulder;
lastShoulder=shoulderError;
pwmShoulder = abs(pwmShoulder);
pwmShoulder = constrain(pwmShoulder, lowL, 255);
// DRIVE SOLENOID
isPressed = digitalRead(DrawPin);
digitalWrite(SolenoidPin, isPressed);
}
References
[1] “Meal Mate Robotic Feeder | Arm Supports & Feeding | Medifab.” [Online]. Available:
http://www.medifab.co.nz/products/arm-supports-feeding/meal-mate-robotic-feeder.
[Accessed: 19-Dec-2011].
[2] “Richardson Products Incorporated - Meal Buddy.” [Online]. Available:
http://www.richardsonproducts.com/mealbuddy.html. [Accessed: 19-Dec-2011].
[3] “NXT Robot Arm.” [Online]. Available:
http://www.nxtprograms.com/robot_arm/steps.html. [Accessed: 19-Dec-2011].
[4] “LEGO 3933-1: Olivia’s Inventor’s Workshop | Brickset: LEGO set guide and database.”
[Online]. Available: http://www.brickset.com/detail/?set=3933-1. [Accessed: 19-Dec-2011].
[5] L. Darling-Hammond, “President Obama and education: The possibility for dramatic
improvements in teaching and learning,” Harvard Educational Review, vol. 79, no. 2, pp.
210–223, 2009.
[6] “The 10 Robots That Rocked in 2010 - The Next Web.” [Online]. Available:
http://thenextweb.com/shareables/2010/12/31/the-10-robots-that-rocked-in-2010/.
[Accessed: 19-Dec-2011].
[7] “Measuring Angst – Robotic installation « adafruit industries blog.” [Online]. Available:
http://www.adafruit.com/blog/2011/12/12/measuring-angst-robotic-installation. [Accessed:
19-Dec-2011].
[8] “Lynxmotion - SES 3D Models.” [Online]. Available: http://www.lynxmotion.com/s-5-ses-
3d-models.aspx. [Accessed: 19-Dec-2011].
[9] “Small push-pull solenoid ID: 412 - $9.95 : Adafruit Industries, Unique & fun DIY
electronics and kits.” [Online]. Available: https://www.adafruit.com/products/412.
[Accessed: 19-Dec-2011].
[10] “Arduino - HomePage.” [Online]. Available: http://www.arduino.cc/. [Accessed: 19-Dec-
2011].
[11] “Arduino motor/stepper/servo control - How to use.” [Online]. Available:
http://www.ladyada.net/make/mshield/use.html. [Accessed: 19-Dec-2011].
[12] Mark W.Spong, Robot Modeling And Control, John Wiley & sons, Inc. 2006
[13] S. Lee, Polytechnic. Experiment 2: System Identification and Control of an Electrical
Network, Institute of New York University, 2010.
[14] Richard C.Dorf , Modern Control systems, 7th edition, Addison-Wesley, 1995.