Professional Documents
Culture Documents
Design and Control of A Robotic Arm
Design and Control of A Robotic Arm
Design and Control of A Robotic Arm
iv. Velocity , K
V
V +
6
6
v. Face width,
P V
t
MY K
W
F
.............
( )
,
_
,
_
,
_
1 1 1
2 1
....... ) (
m n m n
m n
n
n
n
d d
d
d
d
d d f ................ (1)
The following conditions must hold for equation (1) to be correct;
i) n must be even (because T
n
=T
n+1
)
ii) n-m = 2
iii) n>m
Recall : n = Factor of Safety,
41
T
n
Driven
Driven
Driver
3
2
3
4
5
6 7
n 1
m= Module of gear,
T = Developed Torque (Nm)
T
1
is always given as the motor torque and T
n
is the torque required to be generated by the
gear train to carry the load. This must be greater than the torque due to the load to be lifted
and torque due to self weight of the arm (this includes all its appendages). Motor gear must
be indicated as 1 in the diagram. Therefore motor gear diameter = d
1
.
T
n
= f(d)T
1
............................................................................................(2)
For instance,
If T
1
= 0.24Nm then
T
n
= 5Nm
Then f (d) = 5/ 0.24 = 20.83
( )
,
_
,
_
,
_
1 1 1
2 1
....... ) (
m n m n
m n
n
n
n
d d
d
d
d
d d f .............................................(3)
Each bracket represents gears on the same shaft. Diameter ratios as well as the number of
shafts affect the f(d). Angular velocity is also a factor to be considered. For example, given
that n = 6, d
1
= 14mm, d
2
=38mm, d
3
= 22mm, d
4
=40mm,
d
5
= 24mm and d
6
= 37mm, the torque on the 6
th
gear can be computed using equation 1 as
shown below:
T
n
= 37 * 40 * 38 * 0.155 / 24 * 22 * 14
= 1.18Nm
The torque requirements at the various links were obtained using equations 1, 2 and 3, the
results are in given in table 4.1.
Table 4.1 Result Of Torque Calculation
Joint
Calculated torque
(Nm)
Shoulde
r
5.82
Elbow 3.61
Wrist 0.48
42
Gripper 5.82
Table 4.2 Arm Dimensions
Body Part Length(mm) Height (mm)
Width
(mm)
The Waist (base)
The Shoulder
The Upper Arm 289 113.3 82.4
The Fore Arm 271 92.9 66.3
The Wrist 222 100.5 54.2
Table 4.3 Gear Dimensions
For The Waist Diameter(D) (Mm)
Bull Spur 252
Pinion 50.4
Bevel (Spur) 225
Bevel Pinion 45
For The
Shoulder
Diameter(D) (Mm)
Bull Spur (7) 19.5, 28.5, 56.4,
27.9, 43.4, 22.5&
42.8
Worm Gear 3 6.5
For The Elbow Diameter(D) (Mm)
Bull Spur(7) 16.6, 21.8, 45.5,
26.5, 40.9, 22.9&
42.8
Worm Gear (1) 7.4
For The Wrist Diameter(D) (Mm)
Bull Spur (7) 19.4, 20.5, 56.4,
37.2, 25.3, 42.5, &
24.6
Worm Gear (1) 7.5
43
4.2 ELECTRONIC HARDWARE DESIGN AND IMPLEMENTATION
The electronic hardware design consists of the following modules:
The Transmitter Unit
The Motor Controller
The Interrupt Controller
The Power Supply Unit
4.2.1 THE TRANSMITTER UNIT
The transmitter circuit consists of a DB-25 connector, a microcontroller (AT89S52), a
voltage regulator (7805), a timer IC (555), buffers, infrared LEDs, transistors and resistors.
The DB-25 connector links the transmitter circuit to the parallel port of the PC. User
commands from the robots user interface are sent to the transmitter microcontroller via the
DB-25 connector. The microcontroller is programmed to read the 8-bit command code and
use it to modulate the 38 kHz infrared carrier. The modulation (or encoding) is done with
the aid of a 555 timer configured in astable mode. The microcontroller pulses the reset pin
of the 555 timer in accordance with the logic level of each bit of the command code. For
instance if a command code 1000 1101 is read from the parallel port, the bits 1, 0, 1,
1, 0, etc are in turn sent to the reset pin of the 555 timer via the microcontroller serial
transmitter pin. Logic 0 at the reset pin will stop oscillation, and logic 1 will resume
oscillation. The IR receiver at the robot base senses the presence or absence of incident
carrier signal and interprets as logic 1 and logic 0 respectively.
Buffers were used to interface the parallel port with the transmitter circuit and transistors
were used for switching.
The transmitter and receiver serial baud rate have to be equal and the calculation is given
below. Also, the calculation for setting the 555 timer to oscillate at 38 kHz is given.
44
4.2.1.1 BAUD RATE CALCULATION
We used a baud rate of 1500 bps. To configure the microcontroller for this baud rate, a
specific value is loaded in its timer register (timer 0 or timer1, but we used timer 1 register)
and the calculation is as shown.
val = 256 ((System frequency / (12 * 32)) / baud)
Where:
baud = desired baud rate (1500)
System frequency = 24.00014MHz
Val = value to be loaded in to the timer register
( ) 1
]
1
,
_
1500
32 12
10 00014 . 24
256
6
val
= 214 approx.
4.2.1.2 CARRIER FREQUENCY CALCULATION
A frequency of 38 kHz implies a signal period of (1/38 kHz), that is 0.0000263s
For the 555 timer:
( ) C R R t
b a high
+ 693 . 0
( ) C R t
b low
693 . 0
low high
t t T +
Where:
R
a
= 4.7k (fixed resistor value)
R
b
= variable resistor value - to be calculated
C = 0.1uF (fixed capacitance value)
Making R
b
subject of formula and substituting fixed values gives
R
b
= 16.62k
4.2.2 THE MOTOR CONTROLLER
45
The motor interface is the core control circuitry for the robot. It consists of a
microcontroller, latches, Darlington transistor IC packages, diodes, and an L298 dual full-
bridge driver.
Two out of the four ports of the microcontroller were used to drive the motors. Five
stepper motors and one dc motor were used to control each of the six degrees of motion.
Each of the stepper motors required four control pins while the dc motor required three.
That is twenty-three pins in all. The microcontroller pins therefore, had to be
demultiplexed to control the motors in turn, hence latches were used. Control lines were
used to select the appropriate latch at any instant.
The latch (74HC373) is a TTL IC, and therefore requires a source voltage of 5V. But the
motors operate with 12V dc, hence the need for some sort of buffering between the latches
and the motors. A Darlington transistor IC package (ULN2803) was used to drive the
stepper motors. The dc motor requires a transistor H-bridge in order to drive it in both
directions (clockwise and counter clockwise) without changing the source polarity. This
was achieved with an L298 dual full-bridge driver.
The circuit diagram of the motor controller is shown in Appendix E
4.2.3 THE INTERRUPT CONTROLLER
The AT89S52 microcontroller has two external interrupt pins, INT0 and INT1. We used
INT0, which was configured such that a high-to-low transition at this pin will trigger an
interrupt and the corresponding interrupt service routine will be executed. But we have six
interrupt sources as feedback from the robot. Five optocouplers for the upper joints and
one switch for the gripper. Hence, an interrupt controller circuit was needed to connect
these six sources to one interrupt pin.
An array of AND gates is used as shown in Appendix E. The circuit is connected in such a
way that once any feedback input goes low (the motor feedbacks are active low) the output
of the AND array goes low. This is connected to the trigger pin of a 555 timer configured
in monostable mode. The output of the 555 timer is changed from high to low but it
46
returns to the high state after a while (monostable). The low-to-high transition is inverted
to a high-to-low transition by a schmitt trigger, thereby generating an interrupt on INT0.
47
4.2.4 THE POWER SUPPLY UNIT
The power supply unit provides four voltage levels for the robot control. The dc motor
requires 15Vdc, the stepper motor requires 12Vdc, the TTL ICs require 5Vdc, and -12Vdc
was provided in anticipation of possible need of signal amplification with an operational
amplifier.
The ac voltage from the mains is stepped down by a centre tapped transformer. The low
voltage ac is converted to dc by a bridge rectifier, filtered by capacitors and passed through
appropriate voltage regulator ICs to obtain the required dc voltage levels. The 7815, 7812,
7805 and 7912 voltage regulators were used to obtain regulated outputs of 15V, 12V, 5V
and -12V dc, respectively.
It was observed, during test, that on loading, the output of the voltage regulators
(especially the 7815) dropped significantly thereby posing a problem to the correct
functioning of the motors. To overcome this problem, a TIP125 power transistor was
connected across the voltage regulator as shown in fig. 4.8. Under normal loading, the
voltage regulator is able to provide the required current. But when the required current
exceeds what can be provided by the regulator, instead of a voltage drop at the output of
the regulator, the extra current is drawn directly from the unregulated dc source through
the TIP125, thereby preventing a voltage drop.
These circuits were all implemented using the printed circuit board (PCB) technology. This
process generally involves drawing the circuit diagram with the aid of a PCB design
software. The circuit is printed on paper using a laser jet printer. The printed circuit
diagram is placed on a copper-coated board known as the printed circuit board. An exact
impression of the circuit is made on the board by pressing the printed circuit unto the board
with hot iron. The impressed board is then placed in some fluid known as etching fluid,
and all the copper, apart from the parts coated by the printed circuit ink (which was
transferred by hot iron impression), is etched off leaving a copper trace that is an exact
reproduction of the printed circuit. Appropriate holes are then drilled and the components
soldered.
48
The PCB has the advantage of a neater circuitry (with basically no wires!) hence easier to
troubleshoot. Also, since one can have a multi-layered PCB, then larger circuits can be
compressed into a smaller space as compared to the conventional vero boards.
4.3 SOFTWARE DESIGN
Three separate pieces of software were developed for the robot system. The user interface
software, which was written in JAVA programming language and two pieces of software
for the transmitter microcontroller and the receiver/robot control microcontroller.
In all, the top-down design approach was adopted for the software design. JAVA being an
object oriented programming language, the universal modeling language specifications
were adopted as much as possible.
4.3.1 GUI SOFTWARE DESIGN AND IMPLEMENTATION
4.3.1.1 REQUIREMENTS SPECIFICATION
The GUI code is expected to capture the following functions:
At start up the user is offered the option of controlling the robot directly or
selecting complete pick and drop actions.
If the user chooses to use the pick and drop functionality, he is shown a display
panel with options on how fast to pick and drop and how many times. After
choosing from the available options and entering his choice using an OK button,
the GUI code takes note of the choices and encodes it as an 8-bit command code
which is sent to the transmitter through the parallel port for onward transmission to
the robot controller at the base of the robot.
If the user chooses the direct user control option, he is serviced with a display panel
which, when activated, responds to the appropriate key presses and generates
corresponding 8-bit command codes which are sent to the transmitter through the
parallel port.
49
4.3.1.2 USE CASE ANALYSIS
USE CASE PROPERTIES
USE CASE ID: M001
DESCRIPTION: Generates command code
that will control the robot
using predefined
behaviours already
assembled into complete
pick and drop tasks
ACTOR: User
NAME: Pick and drop
SCOPE: Subsystem
PRE-CONDITION(S): The user must select valid
options or combinations of
options
POST-CONDITION(S): The command code that
will carry out the pick and
drop task has been sent
through the parallel port
EVENT/TRIGGER: The user enters his choice
using the 'OK' button
CATEGORY: Main
AUTHOR: Robotic arm design group
MANAGEMENT: Project Supervisor
DATE: Apr-07
Table 4.4: Use Case Event Matrix (M001)
Event Action Response Remarks
The user
enters his
choice
using the
OK
button
System
generates an 8-
bit command
code that
corresponds to
the users choice
combination
System sends the 8-bit
command code through the
parallel port and triggers
transmission to the robot
controller at the base of the
robot
50
Table 4.5: Information Needs (M001)
WHO NEEDS
INFORMATION
WHAT
INFORMATION
WHERE IS
IT
NEEDED
WHEN IS IT
NEEDED
HOW IS THE
INFORMATION
NEEDED
System Users combination
of options for pick
and drop
Pick and
drop option
page
During pick
and drop
mode of
robot control
1) By data entry
2) By option
selection
3) By slider
positioning
USE CASE PROPERTIES
USE CASE ID: M002
DESCRIPTION: Generates command code
that will allow the user
control the robot directly
ACTOR: User
NAME: Direct user control
SCOPE: Subsystem
PRE-CONDITION(S): The user must activate this
mode of control
POST-CONDITION(S): The command code that
will carry out the direct
control task has been sent
through the parallel port
EVENT/TRIGGER: The user presses one of
the robot control buttons
on the keyboard
CATEGORY: Main
AUTHOR: Robotic arm design group
MANAGEMENT: Project Supervisor
DATE: Apr-07
51
Table 4.6: Use Case Event Matrix (M002)
Event Action Response Remarks
The user
presses one of
the robot
control buttons
on the
keyboard
System
generates an 8-
bit command
code that
corresponds to
the users choice
combination
System sends the 8-bit
command code through
the parallel port and
triggers transmission to
the robot controller at
the base of the robot
Table 4.7: Information Needs (M002)
WHO NEEDS
INFORMATION
WHAT
INFORMATION
WHERE IS
IT NEEDED
WHEN IS
IT
NEEDED
HOW IS THE
INFORMATION
NEEDED
Use Case Diagram of the system is shown in fig 4.6 below
Fig. 4.6: Use Case Diagram for Robot GUI
52
Direct User
Control
Pick and
Drop
System
Implementation
The code for the robot graphic user interface (GUI) is given in appendix B.
4.3.2 TRANSMITTER SOFTWARE DESIGN AND IMPLEMENTATION
4.3.2.1 Requirements Specification
The transmitter microcontroller code is expected to capture the following functions:
It should monitor the transmit activation control line from the parallel port
If the control line goes low, it should read the 8-bit data from the parallel port and
transmit it serially through its serial transmit pin
4.3.2.2 Program Flowchart
The flowchart showing how transmitter software is shown below in fig 4.7
START
INITIALIZE
SERIAL BAUD
RATE
READ
TRANSMIT
CONTROL
LINE
ISIT LOW ?
READBYTE
FROM
PARALLEL
PORT
TRANSMIT
SERIALLY
NO
YES
Fig. 4.7: Program Flowchart for Transmitter Software
53
Implementation
The code for the transmitter microcontroller is given in appendix B.
4.3.3 RECEIVER/ROBOT CONTROL SOFTWARE DESIGN AND IMPLEMENTATION
4.3.3.1 Requirements Specification
The receiver/robot microcontroller code is expected to capture the following functions:
It should monitor the command code register which is updated in the serial
interrupt service routine each time a command is sent by the user
Each time it reads the command code, it decodes it to determine the users request
and also extracts some parameters that are present in the command code. A code
map which is transparent to both the user interface (GUI) code and the robot
control code is used to ensure that the two pieces of software understand each other
with respect to the meaning of each 8-bit command code
Having determined the request, assuming the code is valid, it calls the appropriate
function(s) that will execute the users request by driving the motors appropriately
4.3.3.2 Program Flowchart
Fig 4.8 shows the flowchart for the receiver/robot control software design
54
START
INITIALIZESERIAL BAUD
RATEAND EXTERNAL
INTERRUPTS
READ THE
RECEIVED
COMMAND
CODE
ISCODE
VALID ?
NO
YES YES
DECODETOGET
THEREQUIRED
FUNCTION
CALL FUNCTION TO
HANDLETHEREQUEST BY
DRIVINGTHEMOTORS
APPROPRIATELY
Fig. 4.8: Program Flowchart for Transmitter Software
Implementation
The code for the receiver/robot control microcontroller is given in appendix B.
4.4 SYSTEM INTEGRATION AND TESTING
The robot arm design project was split into smaller tasks to reduce complexity and also to
facilitate parallel implementation of independent tasks. The tasks include robot arm
fabrication, gear design and assembly, control circuit design and implementation, design
55
and implementation of wireless communication module and software development for both
the GUI and microcontrollers. These tasks were allocated among the members of the group
and we constantly met to establish and update guidelines that will ensure the compatibility
of the various modules during system integration.
Most of the circuits were first implemented on bread boards before transferring to printed
circuit boards apart from the very simple ones. We tested the individual circuit boards for
basic errors and also for functionality where applicable. During testing, some components
were damaged and replaced.
The wireless communication module was implemented and tested with a sample circuit
and we were able to achieve a range of about 6 metres line-of-sight.
Having tested the various modules, the system integration was done in stages. All the
individual circuits were integrated and tested. Some power supply issues were
encountered, such as supply voltage dropping significantly when loaded and undue heating
of the voltage regulators, and we tried rectifying them but could not do so immediately.
We then decided to use an already tested power supply unit obtained from a scrap
computer. The gear systems for the joints were coupled with the motors and mounted on
the fabricated robot arm. Then control and power lines were drawn from the motors and
connected to the control circuitry.
A test code for testing the movement of each joint was developed in which we tested
control of each of the joint motors, and the system test was carried out. The results were as
follows:
The gripper motor turned satisfactorily, clockwise and counterclockwise. But the
grip force was observed to be quite low.
The wrist roll motor worked but we discovered that it was loosely coupled to the
gear train. That was rectified.
The wrist pitch motor was successfully controlled.
The wrist roll motor was successfully controlled.
56
The elbow motor was successfully controlled.
The waist or base motor was successfully controlled.
We also tested the wireless communication module (now integrated into the entire system).
Initially it did not respond but after troubleshooting, it worked.
57
CHAPTER FIVE
CONCLUSION AND RECOMMENDATIONS
This project was basically an analysis of an already existing work with a view to
improving on it and possibly adding new features. Some limitations in the original project,
apart from the fact that it was not completed, were
Insufficient motor torque and torque amplification with gears, to support the robot
and any added weight
Heavy weight of robot arm due to material used (steel)
Failure to achieve the required six degrees of freedom for the robot arm
Lack of flexibility in the entire system since a computer (PC) was directly attached
to the robot control circuitry, and a few others.
5.1 ACHIEVEMENTS
In spite of some of the limitations and due to the recommendations by the previous group,
we were able to achieve the required six-degrees of freedom.
The following improvements were made and some new features were added
A richer user interface with enhanced functionalities and user friendliness.
We used bigger and stronger gears to enable the arm carry its load without slipping.
Also a type of gear called the worm gear was also used because it has the
advantage of being almost impossible to slip. This is due to the fact that it only
turns in one direction.
58
The weights of all the motors were put into consideration when calculating the
torque at each joint. This is to make sure the gears are arranged in a way that will
produce enough torque to carry the succeeding load.
The use of printed circuit boards (PCB) to do the circuits. This reduces the errors
due to faulty connections and wiring usually found on other boards.
Perhaps one of the most important achievements is that we were able to change the
material used for arm fabrication. Due to expert advice from Engr. Mgbemena, we
settled for aluminum because of its light weight, strength and resilience.
Use of DC motor at the base. The output torque of the DC motor is higher than that
of the stepper motors. Using DC motor at this joint brought us a step closer to
solving the problem of insufficient torque to carry the arm.
We used a microcontroller which provides enough pins for selecting motors, hence
eliminating the need for decoders. Also, we used transistor driver ICs instead of
discrete transistors to simplify the circuit and make it less error-prone.
The motors are operated with a feedback mechanism, using optocouplers. This
feedback is connected to the gear box in such a fashion that it triggers when
specific positions of the output shaft of the motor are reached.
For the communication with the robot, we used an infrared circuit. This ensures
that the robot is unencumbered by wires running from the system to it. Although
the ST12 would have been the ideal choice, since it was not readily available, we
settled for a very efficiently designed microcontroller based infrared transmission
circuit.
The gripper is fitted with pressure sensors that make sure it does not place undue
pressure on whatever material it is picking. Since industrial robots are usually made
for a particular purpose, the amount of force exerted by the gripper can be preset
based on its function.
59
5.2 LIMITATIONS
We encountered a number of problems that hampered the fast completion of the project
and placed a limitation on the amount of improvements we were able to make. They
include:
Insufficient mechanical knowledge:
Engr. Mgbemene, who worked with the last group, was unavailable at the start of
our project. This resulted in a lot of mistakes, on our part, based on gear
arrangement and material selection. Thankfully, he came back and put us on the
right track- but by then, a lot of time and resources had been lost.
Unavailability of some integrated circuits
One of the improvements in the robot design was in the area of communication.
We were supposed to use an integrated encoder-decoder chip called ST12 for
infrared communication. Unfortunately, this chip is not available in Nigeria so we
had to order it. The time wasted before it arrived was proving to be too much, so
we had to search for other options.
Irregular power supply
The progress of both the mechanical and electronic parts of the project was greatly
hampered by the irregularity of the power supply.
Inadequate Machines for Fabrication
Due to outdated and inadequate machinery in the Mechanical Engineering
Laboratory the robotic arm could not be machined using the required lathe machine
but had to be built manually. This increased the total amount of time wasted.
Lack of well equipped electronics laboratory
60
Most of the work was done in inadequate make-shift laboratories (That is in our
room). This retarded the progress of the project because we had to source for
materials from other places.
5.3 ROBOTICS IN THE FUTURE
Today, robots are doing human labor in all kinds of places. Best of all, they are doing the
jobs that are unhealthy or impractical for people. This frees up workers to do the more
skilled jobs, including the programming, maintenance and operation of robots.
Robots that work on cars and trucks are used for welding and assembling parts, or lifting
heavy parts - the types of jobs that involve risks like injury to your back and arm or wrist,
or they work in environments filled with hazards like excessive heat, noise or fumes-
dangerous places for people. Robots that assemble and pack cookies or other foodstuff do
so without the risk of carpal tunnel injury, unlike their human counterparts. Robots that
make computer chips are working in such tiny dimensions that a person couldn't even do
some of the precision work required.
In the health industry, robots are helping to research and develop drugs, package them and
even assist doctors in complicated surgery such as hip replacement and open heart
procedures. And the main reason robots are used in any application is because they do the
work so much better that there is a vast improvement in quality and/or production, or costs
are brought down so that companies can be the best at what they do while keeping workers
safe.
The changes in future robots that will revolutionalize our way of living will occur in a
subtle fashion. It will happen when we wake up one morning thinking about the past and
realize that the things we take for granted are exceptionally different than they were when
61
we were younger. In time, just as innovations like the light bulb and telephone elevated
life, as we know it to new standards, so will robotics incorporate itself in our everyday
lives.
Discussed below are the various ways the field of robotics can affect our lives as proposed
by the Robotics Industries Association.
Virtual Travel - People will be able to visit each other without traveling. They will do this
by taking control of a robot at their desired vacation destination, and use the Internet to
transmit all the sensory information back and forth. What will this mean? Doctors will
make "house calls" again. Long distance relationships will never be the same. Families
spread across the globe can play games together. And perhaps most importantly, people
will think nothing of having a satisfying conversation with a mechanical contraption made
of aluminum, plastic, and silicon
Housekeeping by Choice - The physical environments we live in will take care of
themselves. Machines will do the routine chores around the house. We will choose when it
is time for the extraordinary. Our houses and apartments will keep themselves swept and
scrubbed clean. There will be no piles of laundry, and your basic dinner will be moments
away. Machines will not have replaced us. But they will give us the opportunity to build on
the routine and create the unusual, brilliant, or just different. Robots will raise the standard
upon which we will build. They will give us a chance to dream and the time to live life to
the fullest
Artificial Intelligence - Perhaps the most dramatic changes in future robots will arise from
their increasing ability to reason. The field of artificial intelligence is moving rapidly from
university laboratories to practical application in industry, and machines are being
developed that can perform cognitive tasks, such as strategic planning and learning from
experience. Increasingly, diagnosis of failures in aircraft or satellites, the management of a
battlefield, or the control of a large factory will be performed by intelligent computers.
Like the term "robot" itself, artificial intelligence is hard to define. Ultimate AI would be a
62
recreation of the human thought process -- a man-made machine with our intellectual
abilities. This would include the ability to learn just about anything, the ability to reason,
the ability to use language and the ability to formulate original ideas. Roboticists are
nowhere near achieving this level of artificial intelligence, but they have had made a lot of
progress with more limited AI. Today's AI machines can replicate some specific elements
of intellectual ability.
Despite the excitement about the development of this industry, questions about the
promises and peril concerned with our increased dependence on robots arise. Some of them
are discussed below.
Roboticists believe that humans will be more comfortable dealing with creatures physically
similar to themselves. ASIMO, the amazing Honda robot that can dance and climb stairs, is
four feet tall with arms, legs, fingers, and so forth. But ASIMO can be off-putting all
solid wire and plastic and aluminum; no warmth, no DNA. Should robots be designed in
mans image, or as something completely different?
If humanoid robots become integral to our daily lives, should they be expected to follow
the laws and norms of human society, or should a new set of guidelines be drawn up
especially for them? If so, what are the primary elements that need to be addressed to
protect robots from humans and humans from robots?
Robots are becoming nurse-bots and roboceptionists, jobs that have most often been
performed by women. Many Roboticists, the vast majority of whom are men, dismiss the
danger of anthropomorphism yet frequently refer to their creations as she. Should robots
be gender-specific? Have they already been categorized?
63
As robots become more pervasive in the workplace, what steps should be taken to
preserve the livelihood of the human beings they replace? Should a vulnerable labor force
be retrained in advance? Should protective legislation be passed?
In the near future there will be robots designed to assist surgeons replace heart valves and
knees (and possibly robots to perform surgery independently). Should a patient be able to
decline robot-assisted treatment, even if his insurance company considers it cost-effective?
What if the surgeon is a human using robotic remote-control technology from a hospital
1,000 miles away?
The Japanese believe that robots will be most useful as personal companions and
caretakers for the elderly. Already, robots can take certain vital measurements, such as
heart rates. As robots become more skilled and sophisticated, how can we ensure against a
future of old people confined to institutions serviced and supervised by machines?
Human environments are fundamentally chaotic, yet robots are sensitive precision
instruments that can become unreliable or agitated in unpredictable situations. How should
we control environments so that robots can function consistently, and who is responsible if
a destabilized robotic system damages personal property or injures a human being?
In any case, robots will certainly play a larger role in our daily lives in the future. In the
coming decades, robots will gradually move out of the industrial and scientific worlds and
into daily life, in the same way that computers spread to the home in the 1980s.
5.4 COST ANALYSIS
S/N DESCRIPTION QTY
UNIT
COST (N)
AMOUNT
(N)
1 Transformer 1 370 370
64
2 Rectifier 1 50 50
3 Regulator 5 50 250
4 Capacitor 17 20 340
5 Resistor 13 10 130
6 Transistor 6 70 420
7 SIL Connector 17 20 340
8 IR Receiver 7 30 210
9 IR LED 7 20 140
10 555 Timer 3 30 90
11 Buffer 4 80 320
12 OR Gate 1 80 80
13 IDE Cable and
Connector
2 100 200
14 Mica Capacitors 6 20 60
15 DB25-f 1 200 200
16 Microcontroller 2 300 600
17 24MHz Crystal 2 40 80
18 Switch 2 20 40
19 LED 2 10 20
20 Battery 2 50 100
21 Latch 3 100 300
22 Stepper Motor
Driver
3 280 840
23 DC Motor Driver 1 250 250
24 AND Gate 2 80 160
25 Schmitt Trigger 1 80 80
26 Diodes 7 10 70
27 Aluminium Sheet 1 2800 2800
28 Gears and Motor 8000
29 Transportation 3400
30 Research 2000
31 Printing and Binding 4000
32 Glass Reinforced Plastic
(GRP)
10000
33 Miscellaneous 2000
TOTAL 37940
5.5 CONCLUSION
The project was time-consuming, work-intensive and economically tasking. However, we
are proud as a group to have achieved for the first time, the control of a 6-degree of
freedom robotic arm, a pioneer in the department of Electronics Engineering, UNN.
65
From our experience, we recommend that for the future implementation of this project, the
following improvements can be made:
The robot can be fitted with wheels and adequate sensors to make movement
possible.
Control can be improved by using a remote control or joystick to manipulate the
robot instead of devoting a whole computer system to it.
The robot can be given added intelligence so that it can sense obstacles respond
appropriately.
Proper selection of integrated chips should be made and they should be thoroughly
tested before purchase to eliminate chances of faulty chips being purchased.
It is also advisable to have the arm fabrication done in a workshop with up to date
machinery to avoid errors in construction.
The possibilities are endless. Robotics is a relatively untapped field in Nigeria and it has
many prospects. Starting with our community, we can, step by step, create robots that will
ultimately be used to perform some pertinent tasks that are too bothersome for human
beings. The fact that it also combines various disciplines of engineering is also notable.
REFERENCES
Andersen, P. K., Bjedov, G. & Scarbrough, M. G., Essential C: An Introduction for
Scientists and Engineers. Florida: Saunders College Publishing, 1995.
Cormier, J. M.Robotics Training Systems Concepts and Applications. FirstEdition,.
Buck Engineering Co. Inc., 1985.
John, C. J., Introduction to Robotics: Mechanics and Control. Second Edition, India:
Pearson Education, Inc., 1989..
66
Kuo, B. C., Golnaraghi Farid, Automatic Control Systems. Eight Edition, John Wiley &
Sons, Inc., 2003..
Kafrissen, Edward, Stephans, and Mark, Industrial Robots and Robotics. (Virginia: Reston
Publishing company, Inc., 1984)
Kenjo, Takashi, Stepping Motors and their Microprocessor Controls Oxford University
Press, c1984. LC number: TK2785 .K4 1984
Vishay Semiconductor GmbH. TCST110. up to TCST230.
Lenarcic, j., Kinematics in The International Encyclopedia of Robotics. Wiley and Sons,
1988
Liang, Y. D., Introduction to Java Programming. 3
rd
Edition, New Jersey: Prentice-Hall
Inc., 2001.
Roth, B., Rasteger, J., and Scheinman, V., On the Design of Computer Controlled
Manipulators, Vol. 1, First CISM-IFToMM Symposium, Sept., 1973
Robotics Training Systems: Concepts and Applications First Edition, By the staff of Buck
Engineering. (USA: Buck Engineering Co. Inc., 1988)
5804 BiMOS II Unipolar Stepper Motor Translator/Driver datasheet. By Allegro
MicroSystems Inc. 115 Northeast Cuto_, Box 15036, Worcester, Massachussetts,
1998.
Scherz, Paul, Practical Electronics for Inventors. Second Edition, New York: Mc-Graw
Hill, Inc.,2000.
67
Theraja, B. L. & Theraja, A. K, A Text Book of Electrical Technology. New Delhi: S.
Chad & Company Ltd.,1959
Robotics Introduction. (2000). Definitions
http://www.ee.scu.edu/classes/2000winter/elen337/Lecture1/tsld003.htm;
Robot. (2001). History of Robotic
http://www.ukrobot.co.uk/html/main.htm
Robotics Introduction. (2001). Definitions, Etymology
http://www.ee.scu.edu/classes/2000winter/elen337/Lecture1/tsld002.htm;
The Robot Factory Inc. (2000). Education
http://www.robotfactory.com/edu.html, THOMSON Microelectronics
The Tech. (2001). Introduction to Robotics.
http://www.thetech.org/exhibits_events/online/robots/intro/
68
GLOSSARY
Accuracy - The accuracy of a robot is a measure of how the robot can reach a position at
which it was instructed to reach.
Artificial Intelligence - This can be defined as the branch of computer science that deals
with writing computer programs that can solve problems creatively.
Axis - A pivot point for a type of movement.
End-effectors - End-effectors are hand-like devices or special tools placed on the robots
arm used to perform work. They are designed to mimic the function and structure of the
human hand.
Industrial Robots - An industrial robot is officially defined by the International Standards
Organization as an automatically controlled, reprogrammable, multipurpose manipulator
programmable in three or more axes. The field of industrial robotics may be more
practically defined as the study, design and use of robot systems for manufacturing.
Number of axes - The number of axes of robot is the number of joints required to reach
any point in space.
Robot - A robot is simply defined as a device that connects sensing with actuation using a
suitable computer logic, which processes the inputs from the sensors and sends out outputs
to actuate devices.
It can also be defined as a computer-controlled machine that is programmed to move,
manipulate objects, and accomplish work while interacting with its environment.
69
Robot Controller - This refers to the computer logic that controls the robots actions. The
robot controller is a device that has, programmed in it, the instructions which are to be
performed by the robot. It is also referred to as the brain of the robot.
Robotics - This is the area of artificial intelligence that is concerned with the practical use
of robots i.e. robotics is the science and technology relating to use and design of computer-
controlled mechanical devices.
Work Envelope - This is the region of space a robot can reach.
70
APPENDIX A
PIN CONFIGURATIONS
Fig. A.1: Pin Configuration of AT89S52(MICROCONTROLLER)
71
1
40
2
39
3
38
4
37
5
36
6
35
7
34
8
33
9
32
10
31
11
30
12
29
13
28
14
27
15
26
16
25
17
24
18
23
19
22
20
21
AT89S52
VCC
P0.0
P0.1
P0.2
P0.3
P0.4
P0.5
P0.6
P0.7
EA/VPP
ALE/PROG
PSEN
P2.7
P2.6
P2.5
P2.4
P2.3
P2.2
P2.1
P2.0
P1.0
P1.1
P1.2
P1.3
P1.4
P1.5
P1.6
P1.7
RST
(RXD) 3.0
(TXD) 3.1
(INT0) 3.2
P3.3
P3.4
P3.5
P3.6
P3.7
XTAL2
XTAL1
GND
Fig.A.2: Pin Configuration of 555 (TIMER)
Fig. A.3: Pin Configuration of ULN2803A (DARLINGTON ARRAY)
72
1 18
2 17
3 16
4 15
5 14
6 13
7 12
8 11
9 10
ULN2803A
OUT 1
OUT 2
OUT 3
OUT 4
OUT 5
OUT 6
OUT 7
OUT 8
VSS
IN 1
IN 2
IN 3
IN 4
IN 5
IN 6
IN 7
IN 8
GND
1 8
2 7
3 6
4 5
555
+VCC
DISCHARGE
THRESHOLD
CONTROL
VOLTAGE
GND
TRIGGER
OUTPUT
RESET
Fig. A.4: Pin Configuration of the L298 Dual Full-Bridge Driver
Fig. A.5: Pin Configuration 74573 (LATCH)
73
1 20
2 19
3 18
4 17
5 16
6 15
7 14
8 13
9 12
10 11
74573
V
CC
O
0
O
1
O
2
O
3
O
4
O
5
O
6
O
7
G
OC
D
0
D
1
D
2
D
3
D
4
D
5
D
6
D
7
GND
Fig. A.6: Pin Configuration 74541 (BUFFER)
Fig. A.7: Pin Configuration of 7414 (SCHMITT TRIGGER)
74
1 20
2 19
3 18
4 17
5 16
6 15
7 14
8 13
9 12
10 11
74541
V
CC
OE
2
Y
0
Y
1
Y
2
Y
3
Y
4
Y
5
Y
6
Y
7
OE
1
A
0
A
1
A
2
A
3
A
4
A
5
A
6
A
7
GND
1 20
2 19
3 18
4 17
5 16
6 15
7 14
7414
VCC
6A
6Y
5A
5Y
4A
4Y
1A
1Y
2A
2Y
3A
3Y
GND
APPENDIX B
PROGRAM IMPLEMENTATION (CODES)
GUI CODE
/*
* Pioneer_Ware.java
* Created on 25 April 2007, 10:45
*/
package com.robot;
import javax.swing.Timer;
import java.awt.event.*;
/**
* @author Robotic Arm Design Group
*/
public class Pioneer_Ware extends javax.swing.JFrame {
static Timer welcomeTimer;
public final static int WAIT_TIME = 5000; //Time in millisecs
static Commands cmd;
static Pioneer_Ware pWare;
/** Creates new form Pioneer_Ware */
public Pioneer_Ware(){
initComponents();
}
/**
*Create the GUI and show it. For thread safety, this method should be
*invoked from the event-dispatching thread
*/
private static void createAndShowGUI(){
pWare = new Pioneer_Ware();
cmd = new Commands();
75
cmd.setVisible(true);
pWare.setVisible(true);
//Instantiate and start the welcome timer, giving it duration 'WAIT_TIME'
welcomeTimer = new Timer(WAIT_TIME, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
pWare.dispose();
//pWare = null;
}
});
welcomeTimer.setRepeats(false);
welcomeTimer.start();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel lblRoboPix;
// End of variables declaration
}
/*
* Commands.java
* Created on 25 April 2007, 12:13
*/
package com.robot;
import javax.swing.*;
import java.awt.Color;
76
import java.awt.event.*;
import jnpout32.*;
import java.applet.*;
import java.net.URL;
/**
*
* @author Robot Arm Design Group
*/
public class Commands extends javax.swing.JFrame {
//Variable declarations
static final short DATA_PORT_ADDRESS = 0x378;
static final short CONTROL_PORT_ADDRESS = 0x37A;
static final int CONTINUOUS = 0;
static final int NON_CONTINUOUS = 1;
static final int SLOW = 0;
static final int MEDIUM = 1;
static final int FAST = 2;
static final int MAX_NUM_OF_TIMES = 10; /*Max number one can enter for the 'No of times' option
in pick-and-drop*/
int selectedRadioButton = CONTINUOUS; //default selection
boolean isExecuting = false; //A flag used to determing the execution status of the arm
AudioClip[] song = new AudioClip[3]; //some audioclips
pPort port; //handle to the parallel port data
Action upAction, downAction, leftAction, rightAction;
Action gripAction, releaseAction, cwRollAction, acwRollAction;
/** Creates new form Commands */
public Commands() {
initComponents();
bindKeys();
initAudio();
initPorts();
}
77
/**
*Method called when user clicks the 'Stop/Reset' button
*@ param evt the ActionEvent object
*/
private void reset(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Timer resetTimer;
final int RESET_DURATION = 2000; //to be modified later
port.output(DATA_PORT_ADDRESS, (short)0xFF); //send 11111111 to parallel port
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter i.e. the
microcontroller code
//reads the LSB of this control byte to decide
//whether to move data on port 1 to transmit buffer
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
btnReset.setEnabled(false);
btnExecuteCmd.setEnabled(false);
//Instantiate and start reset timer with duration 'RESET_DURATION'
resetTimer = new Timer(RESET_DURATION, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
//Things that should happen at the end of the specified duration
btnReset.setEnabled(true);
btnExecuteCmd.setEnabled(true);
txtNoOfTimes.setEnabled(true);
rBtnSpecificNo.setEnabled(true);
isExecuting = false;
/*
*Change song
*Use a try-catch block for smooth program flow in case the sound file no longer exists
78
*/
try{
song[0].stop();
song[1].loop();
}catch(Exception e){
e.printStackTrace();
}
}
});
resetTimer.setRepeats(false);
resetTimer.start();
}
/**
* Method called when the 'OK' button on PickAndDrop tab window is clicked
* @ param evt the ActionEvent object
*/
private void executeCmd(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int noOfTimes = 1; //default
int speedVal = sldSpeed.getValue(); //Here we get to know the selected speed
int execution_duration = 0; //Default - to be modified later
int unit_exec_duration = 0; /*Time it takes for one pick-and-drop action in millisecs -
to be modified*/
String requestInfo = "";
String speed = "";
String mode = ""; //Either continuously or a specific number of times
//Determine unit execution duration based on speed
switch(speedVal){
case SLOW: speed = "slow"; unit_exec_duration = 2500; break;
case MEDIUM: speed = "medium"; unit_exec_duration = 2000; break;
case FAST: speed = "fast"; unit_exec_duration = 1500; break;
default: speed = "medium"; unit_exec_duration = 2000;
//All durations to be determined experimentally
79
}
if(rBtnContinuous.isSelected()){
selectedRadioButton = CONTINUOUS; //Here we get to know the selected mode
mode = "continuously.";
}else if (rBtnSpecificNo.isSelected()){
if(!verifyTextEntry()){
txtNoOfTimes.requestFocusInWindow();
return; //exit the method
}else{
selectedRadioButton = NON_CONTINUOUS; //Here we get to know the selected mode
noOfTimes = Integer.parseInt(txtNoOfTimes.getText()); /*Here we get to know the
selected no. of times*/
mode = noOfTimes + " times.";
}
}
requestInfo = "You want the robot arm to pick and drop at a \n" + speed + " speed " + mode;
int option = JOptionPane.showConfirmDialog(this, requestInfo, "Confirm",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if(option == JOptionPane.CANCEL_OPTION){
//terminate command
return;
}
//To generate the command code that will be sent to the microcontroller through the parallelport
int cmdCode = 0x00; //hexadecimal equivalent of 00000000. it's the default command
int tempSpeed = 0;
int tempNoOfTimes = 0;
switch(selectedRadioButton){
case CONTINUOUS:
switch(speedVal){
case SLOW:
cmdCode = 0x1B;
break;
case MEDIUM:
cmdCode = 0x0B;
break;
80
case FAST:
cmdCode = 0x2B;
break;
}
break;
case NON_CONTINUOUS:
switch(speedVal){
case SLOW:
tempSpeed = 0x10;
break;
case MEDIUM:
tempSpeed = 0x00;
break;
case FAST:
tempSpeed = 0x20;
break;
}
switch(noOfTimes){
case 1:
tempNoOfTimes = 0x01;
break;
case 2:
tempNoOfTimes = 0x02;
break;
case 3:
tempNoOfTimes = 0x03;
break;
case 4:
tempNoOfTimes = 0x04;
break;
case 5:
tempNoOfTimes = 0x05;
break;
case 6:
tempNoOfTimes = 0x06;
81
break;
case 7:
tempNoOfTimes = 0x07;
break;
case 8:
tempNoOfTimes = 0x08;
break;
case 9:
tempNoOfTimes = 0x09;
break;
case 10:
tempNoOfTimes = 0x0A;
break;
}
cmdCode = tempSpeed | tempNoOfTimes;
}
//Send the command code to the parallel port
port.output(DATA_PORT_ADDRESS, (short)cmdCode);
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter i.e. the
microcontroller code
//reads the LSB of this control byte to decide
//whether to move data on port 1 to transmit buffer
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
isExecuting = true;
/*
*Change song
*Use a try-catch block for smooth program flow in case the sound file no longer exists
*/
try{
song[1].stop();
song[0].loop();
82
}catch(Exception e){
e.printStackTrace();
}
//JOptionPane.showMessageDialog(this, "Parallel port value is " +
Integer.toHexString(port.input(DATA_PORT_ADDRESS)));
btnExecuteCmd.setEnabled(false);
if(selectedRadioButton == CONTINUOUS){
txtNoOfTimes.setEnabled(false);
rBtnSpecificNo.setEnabled(false);
}
/*
*Enable 'OK' and 'Stop/Reset' buttons after expected duration of action and set the isExecuting flag
*to false, to indicate that command has finished executing
*this should happen only for non-continuous pick-and-drop option
*/
if(selectedRadioButton == NON_CONTINUOUS){
execution_duration = unit_exec_duration * tempNoOfTimes;
Timer executeTimer;
executeTimer = new Timer(execution_duration, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnReset.setEnabled(true);
btnExecuteCmd.setEnabled(true);
isExecuting = false;
/*
*Change song
*Use a try-catch block for smooth program flow in case the sound file no longer exists
*/
try{
song[0].stop();
song[1].loop();
}catch(Exception e){
e.printStackTrace();
}
83
}
});
executeTimer.setRepeats(false);
executeTimer.start();
}
}
/*************************************************************************************
**
* Code to handle user control of the robot arm
***************************************************************************************/
/**
* action inner class - for action object that would be bound to the 'up' cursor key
*/
public class UpAction extends AbstractAction {
/** Creates a new instance of UpAction */
public UpAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF1); //send 11110001 to parallel port - command for
micro c to move robot up
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Up");
//May include a timer delay here to give the robot time to complete its task - just in case
84
//user holds down the key continuously, as this will keep the serial_isr() at receiver ucontroller
//busy, not allowing robot to move.
}
}
/**
* action inner class - for action object that would be bound to the 'down' cursor key
*/
public class DownAction extends AbstractAction {
/** Creates a new instance of DownAction */
public DownAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF2); //send 11110010 to parallel port - command for
micro c to move robot down
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Down");
}
}
/**
* action inner class - for action object that would be bound to the 'left' cursor key
*/
public class LeftAction extends AbstractAction {
/** Creates a new instance of LeftAction */
85
public LeftAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF3); //send 11110011 to parallel port
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Left");
}
}
/**
* action inner class - for action object that would be bound to the 'right' cursor key
*/
public class RightAction extends AbstractAction {
/** Creates a new instance of RightAction */
public RightAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF4); //send 11110100 to parallel port - command for
micro c to move robot right
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
86
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Right");
}
}
/**
* action inner class - for action object that would be bound to the 'G' key
*/
public class GripAction extends AbstractAction {
//pPort port = new pPort();
/** Creates a new instance of GripAction */
public GripAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF5); //send 11110101 to parallel port - command for
micro c to grip
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Grip");
}
}
87
/**
* action inner class - for action object that would be bound to the 'R' key
*/
public class ReleaseAction extends AbstractAction {
//pPort port = new pPort();
/** Creates a new instance of ReleaseAction */
public ReleaseAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF6); //send 11110110 to parallel port - command for
micro c to release robot gripper
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("Release");
}
}
/**
* action inner class - for action object that would be bound to the 'C'key
*/
public class CWRollAction extends AbstractAction {
/** Creates a new instance of CWRollAction */
public CWRollAction() {
super();
}
88
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF7); //send 11110111 to parallel port - command for
micro c to move robot wrist clockwise
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
lblMotion.setText("CWRoll");
}
}
/**
* action inner class - for action object that would be bound to the 'A' key
*/
public class ACWRollAction extends AbstractAction {
//pPort port = new pPort();
/** Creates a new instance of ACWRollAction */
public ACWRollAction() {
super();
}
public void actionPerformed(java.awt.event.ActionEvent evt) {
port.output(DATA_PORT_ADDRESS, (short)0xF8); //send 11111000 to parallel port - command for
micro c to move robot wrist anticlockwise
port.output(CONTROL_PORT_ADDRESS, (short)0xF0); //Activate IR transmitter
try{
Thread.sleep(1); //Delay 1ms
}catch(InterruptedException e){
System.err.println(e.getMessage());
}
port.output(CONTROL_PORT_ADDRESS, (short)0xFF); //Deactivate IR transmitter
89
lblMotion.setText("ACWRoll");
}
}
/**
* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Commands().setVisible(true);
}
});
} */
// Variables declaration - do not modify
private javax.swing.JButton btnActivate;
private javax.swing.JButton btnDeactivate;
private javax.swing.JButton btnExecuteCmd;
private javax.swing.JButton btnReset;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JTabbedPane jtpCommands;
private javax.swing.JLabel lblInstruction;
private javax.swing.JLabel lblMotion;
private javax.swing.JPanel panelNoOfTimes;
private javax.swing.JPanel panelPickAndDrop;
private javax.swing.JPanel panelSpeed;
private javax.swing.JPanel panelUserControl;
private javax.swing.JRadioButton rBtnContinuous;
private javax.swing.ButtonGroup rBtnGrpNoOfTimes;
private javax.swing.JRadioButton rBtnSpecificNo;
private javax.swing.JSlider sldSpeed;
90
private javax.swing.JTextField txtNoOfTimes;
// End of variables declaration
}
TRANSMITTER MICROCONTROLLER CODE
/***************************************************************************************
* Project : Design and Control of a Robot Arm
*
* Date : 2007 *
* Author : Project Group *
* Department : Electronic Engineering (UNN) *
* Programming Language: C *
* Chip type : AT89S52 *
* Program type : Application *
* Clock frequency : 24.00014MHz *
***************************************************************************************/
#include <AT89X52.H>
#define PARALLEL_PORT P1
#define NOT_SENT P3_2
#define TRUE 1
//function declarations
void init_serial();
void sendByte(unsigned char);
void delay(unsigned int);
unsigned char input;
/*
* Main function
*/
void main(void){
init_serial(); //call function to initialize serial port
//continuous loop
while(TRUE){
91
while(NOT_SENT){ //while send bit is high(deactivated)
//do nothing
}
//when send bit is low(activated)
delay(2); //wait 50ms for stabilization of activate signal
input = PARALLEL_PORT; //takes the input value from the parallel port
sendByte(input); //call function to send data
//after sending the byte, loop in order to wait for the next send command
}
}
/*
*function that transmits the byte received from the parallel port via the serial port
*/
void sendByte(unsigned char input){
SBUF = input; //send data down the serial line
}
//serial interrupt service routine using register bank 2
void serial_isr(void) interrupt 4 using 2{
ES = 0; //disable the serial interrupt to avoid data corruption
if(TI){ //if transmission caused the interrupt,
TI = 0; //clear the trnsmit interrupt flag
}else{
//*not so necessary since it is just a transmitter
if(RI){ //if reception caused the interrupt,
RI = 0; //clear the receive interrupt flag
ES = 1; //enable the serial interrupt
}
}
}
RECEIVER/ROBOT CONTROL MICROCONTROLLER CODE
92
#include <AT89X52.h>
//Define constants
#define TRUE 1
#define FALSE 0
#define FAST 8 //8ms delay
#define MEDIUM 10 //10ms delay
#define SLOW 12 //12ms delay
#define DC_FAST 15 //A t(HIGH) of 15ms in the 50Hz(20ms) pulse. The larger the t(HIGH)
wrt t(LOW), the faster the motor
#define DC_SLOW 5
#define USER_CONTROL 0 //mode - either usercontrol or pick&drop
#define PICK_AND_DROP 1
//declare and initialize global flags
volatile unsigned char command = 0x00; //default command code from user interface - "no action"
/**************************************************************************************
* Function Declarations *
***************************************************************************************/
void gripperOpen(unsigned char mode, unsigned char speed); //Done - but not tested
void gripperClose(unsigned char mode, unsigned char speed); //Done - but not tested
void wristRollCW(unsigned char mode, unsigned char speed); //Done - but not tested
void wristRollCCW(unsigned char mode, unsigned char speed); //Done - but not tested
void shoulderUp(unsigned char mode, unsigned char speed); //Done - but not tested
void shoulderDown(unsigned char mode, unsigned char speed); //Done - but not tested
void wristPitchUp(unsigned char mode, unsigned char speed);//Done - but not tested
void wristPitchDown(unsigned char mode, unsigned char speed); //Done - but not tested
void elbowUp(unsigned char mode, unsigned char speed); //Done - but not tested
void elbowDown(unsigned char mode, unsigned char speed); //Done - but not tested
void baseCW(unsigned char mode, unsigned char speed); //Done - but not tested
void baseCCW(unsigned char mode, unsigned char speed); //Done - but not tested
void pickAndDrop(unsigned char speed, unsigned char times);
void userControl(unsigned char lowNibble); //low nibble of command code which determines which motor to
move
93
void stepCW_1_3_5(unsigned char speed); //Rotate appropriate motor 1 clockwise revolution
void stepCCW_1_3_5(unsigned char speed);
void stepCW_2_4(unsigned char speed);
void stepCCW_2_4(unsigned char speed);
void delay(unsigned char speed);
void stopMotors(void);
void initialize(void); //General initialization function
void reset(void); // open gripper(can check both gripperlimit flag and gripperPos to determine if robot is
holding sth
//and to act appropriately - esp in usercontrol mode,,, raise shoulder ,,, raise elbow ,,,
//rotate base to home position,,,lower wrist ,,, make gripper horizontal,,, close gripper ,,, set
//'isReset' flag and other limit flags,,, initialize currentXXXPos.
/***************************************************************************************
* NOTES/ASSUMPTIONS *
***************************************************************************************
* The stepper motors have 7.5 degrees step angle i.e. 48 steps per rev
*/
void main(){
unsigned char currCommand;
unsigned char lowNibble;
unsigned char highNibble;
initialize();
reset();
while(TRUE){
//This is an endless loop
//Update the currCommand
currCommand = command; //command is updated by the serial interrupt
command = 0x00; //Refresh command
lowNibble = currCommand & 0x0F;
highNibble = currCommand & 0xF0;
if(currCommand == 0x00){
//no action
94
}else if(currCommand == 0xFF){
reset();
}else if(highNibble == 0xF0){
//User control command
userControl(lowNibble);
}else if(highNibble == 0x00){
//Means that the higher nibble is 0000 => pick&drop medium speed
//The lower nibble contains the no. of times and/or mode (i.e. continuous or not)
reset();
if(lowNibble == 0x0B){ //i.e xxxx1011 => continuous mode
while(command != 0x00){
//while stop/reset is not clicked on the UI
pickAndDrop(MEDIUM, 1); //pick and drop once
}
}else{
pickAndDrop(MEDIUM, lowNibble);
}
}else if(highNibble == 0x10){
//Means that the higher nibble is 0001 => pick&drop slow speed
reset();
if(lowNibble == 0x0B){ //i.e xxxx1011 => continuous mode
while(command != 0x00){
//while stop/reset is not clicked on the UI
pickAndDrop(SLOW, 1); //pick and drop once
}
}else{
pickAndDrop(SLOW, lowNibble);
}
}else if(highNibble == 0x20){
//Means that the higher nibble is 0010 => pick&drop fast speed
reset();
if(lowNibble == 0x0B){ //i.e xxxx1011 => continuous mode
while(command != 0x00){
//while 'stop/reset' is not clicked on the GUI
pickAndDrop(FAST, 1); //pick and drop once
}
}else{
95
pickAndDrop(FAST, lowNibble);
}
}else{
//do nothing
}
}
}
/*
* Function called to pick and drop an object
*/
void pickAndDrop(unsigned char speed, unsigned char times){
unsigned char i;
for(i = 0; i < times; i++){
//pick and drop sequence starting at default position
wristPitchUp(PICK_AND_DROP, speed); //raise wrist
gripperOpen(PICK_AND_DROP, speed); //open gripper
elbowDown(PICK_AND_DROP, speed); //lower elbow
gripperClose(PICK_AND_DROP, speed); //close gripper
elbowUp(PICK_AND_DROP, speed); //raise elbow
baseCCW(PICK_AND_DROP, speed); //move base to 'drop' position
elbowDown(PICK_AND_DROP, speed); //lower elbow
gripperOpen(PICK_AND_DROP, speed); //open gripper
elbowUp(PICK_AND_DROP, speed); //raise elbow
baseCW(PICK_AND_DROP, speed); //return base to default position
if(command == 0x00){
//if reset was requested by user
reset();
break;
}
}
}
void userControl(unsigned char lowNibble){
switch(lowNibble){
//Decode the 4 LSBs of command code for info on what to move and how
96
case 1:
//arm up - controls elbow and wrist only
if(currentPitchPos < MAX_WRIST_PITCH_REV){
wristPitchUp(USER_CONTROL, MEDIUM); //raise wrist
}else{
elbowUp(USER_CONTROL, MEDIUM);
}
break;
case 2:
//down - controls elbow and wrist only
if(isWristPitchLimitTripped == FALSE){
wristPitchDown(USER_CONTROL, MEDIUM);
}else{
elbowDown(USER_CONTROL, MEDIUM);
}
break;
case 3:
//left
baseCCW(USER_CONTROL, MEDIUM);
break;
case 4:
//right
baseCW(USER_CONTROL, MEDIUM);
break;
case 5:
//grip
gripperClose(USER_CONTROL, MEDIUM);
break;
case 6:
//release
gripperOpen(USER_CONTROL, MEDIUM);
break;
case 7:
//CWRoll
wristRollCW(USER_CONTROL, MEDIUM);
break;
case 8:
97
//ACWRoll
wristRollCCW(USER_CONTROL, MEDIUM);
break;
default:
//do nothing
}
}
98
APPENDIX C
STEPPER MOTOR DATASHEETS
99
100
101
APPENDIX D
THE ROBOTS BODY DIAGRAM
THE ROBOTS BODY DIAGRAM
SPECIFICATIONS TABLE
102
*Note: Some of the dimensions above were adjusted during fabrication.
APPENDIX E
103
J 1 WRIST JOINT MOTOR Stepper motor 87mNm
H 1 ELBOW JOINT MOTOR Stepper motor 155mNm
G 1 SHOULDER JOINT MOTOR Stepper motor 155mNm
F 1 THE GRIPPER STEEL 100150
E 1 THE WRIST STEEL 250440
D 1 THE FORE ARM STEEL 250500
C 1 THE UPPER ARM STEEL 400500
B 1 THE SHOULDER STEEL 480550
A 1 THE WAIST STEEL 310710
ITEM
NO OF DESCRIPTION SYMBOL
OF STD
MATERIAL OVERALL
DIMENSION
NOTES
NAME DATE THE DESIGN OF A ROBOT
MANIPULOR ARM
SCALES
1:5
DRAWN BY MGBEMENE C.A. 6:8:91
CHECKED BY DR O. ONUBA
APPROVED BY DR O. ONUBA
DEPARTMENT OF MECHANICAL
ENGINEERING UNN
B.ENG PROJECT REG.
86/44740
CIRCUIT DIAGRAMS
MOTOR CONTROLLER CIRCUIT
M O T O R _ D I R
M O T O R _ P W M
M O T O R 6
M O T O R 1 _ 2
M O T O R 3 _ 4
M O T O R 5
P 1 . 0 / T 2
1
P 1 . 1 / T 2 E X
2
P 1 . 2
3
P 1 . 3
4
P 1 . 4
5
P 1 . 5 / M O S I
6
P 1 . 6 / M I S O
7
P 1 . 7 / S C K
8
R ST
9
P 3 . 0 / R X D
1 0
P 3 . 1 / T X D
1 1
P 3 . 2 / ~ I N T 0
1 2
P 3 . 3 / ~ I N T 1
1 3
P 3 . 4 / T 0
1 4
P 3 . 5 / T 1
1 5
P 3 . 6 / ~ W R
1 6
P 3 . 7 / ~ R D
1 7
X T A L2
1 8
X T A L1
1 9
G N D
2 0
V C C
4 0
P 0 . 0 / A D 0
3 9
P 0 . 1 / A D 1
3 8
P 0 . 2 / A D 2
3 7
P 0 . 3 / A D 3
3 6
P 0 . 4 / A D 4
3 5
P 0 . 5 / A D 5
3 4
P 0 . 6 / A D 6
3 3
P 0 . 7 / A D 7
3 2
~ E A / V P P
3 1
A L E / ~ P R O G
3 0
~ P S E N
2 9
P 2 . 7 / A 1 5
2 8
P 2 . 6 / A 1 4
2 7
P 2 . 5 / A 1 3
2 6
P 2 . 4 / A 1 2
2 5
P 2 . 3 / A 1 1
2 4
P 2 . 2 / A 1 0
2 3
P 2 . 1 / A 9
2 2
P 2 . 0 / A 8
2 1
U 1
A T 8 9 S 5 2
1 A
1
2 A
2
3 A
3
4 A
4
5 A
5
6 A
6
7 A
7
8 A
8
G N D
9
1 Y
1 8
2 Y
1 7
3 Y
1 6
4 Y
1 5
5 Y
1 4
6 Y
1 3
7 Y
1 2
8 Y
1 1
Vs
1 0
U 3
U L N 2 8 0 3
1 A
1
2 A
2
3 A
3
4 A
4
5 A
5
6 A
6
7 A
7
8 A
8
G N D
9
1 Y
1 8
2 Y
1 7
3 Y
1 6
4 Y
1 5
5 Y
1 4
6 Y
1 3
7 Y
1 2
8 Y
1 1
Vs
1 0
U 5
U L N 2 8 0 3
A 1
B 1
C 1
D 1
A 2
B 2
C 2
D 2
A 3
B 3
C 3
D 3
A 4
B 4
C 4
D 4
5 V
5 V
D 1
Z E N E R ( 1 2 V )
D 2
Z E N E R (1 2 V )
1 2V 5 V
I N 1
5
I N 2
7
E N A
6
O U T 1
2
O U T 2
3
E N B
1 1
O U T 3
1 3
O U T 4
1 4
I N 3
1 0
I N 4
1 2
S E N S A
1
S E N S B
1 5
G N D
8
V S
4
V C C
9
U 8
L 2 9 8
5 V 1 2 V - 2 4 V
A 5
B 5
A 6
B 6
C 1 4 7 u F
R 1
1 0 k
F D B K 1
F D B K 2
F D B K 3
F D B K 4
F D B K 5
F D B K 6
I N T E R R U PT
X 1
2 4 M H z
C 2
3 3 p F C 3
3 3 p F
~ O E
1
D 0
3
D 1
4
D 2
7
D 3
8
D 4
1 3
D 5
1 4
D 6
1 7
D 7
1 8
G N D
1 0
L E
1 1
Q 7
1 9
Q 6
1 6
Q 5
1 5
Q 4
1 2
Q 3
9
Q 2
6
Q 1
5
Q 0
2
V C C
2 0
U 2
7 4 H C 3 7 3
~ O E
1
D 0
3
D 1
4
D 2
7
D 3
8
D 4
1 3
D 5
1 4
D 6
1 7
D 7
1 8
G N D
1 0
L E
1 1
Q 7
1 9
Q 6
1 6
Q 5
1 5
Q 4
1 2
Q 3
9
Q 2
6
Q 1
5
Q 0
2
V C C
2 0
U 4
7 4 H C 3 7 3
C 4
1 0 0 n F
C 5
1 0 0 n F
D 4
1 N 4 0 0 4
D 5
1 N 4 0 0 4
D 7
1 N 4 0 0 4
D 6
1 N 4 0 0 4
B U S Y
R E AD Y
5 V
I R I N P U T
~ O E
1
D 0
3
D 1
4
D 2
7
D 3
8
D 4
1 3
D 5
1 4
D 6
1 7
D 7
1 8
G N D
1 0
L E
1 1
Q 7
1 9
Q 6
1 6
Q 5
1 5
Q 4
1 2
Q 3
9
Q 2
6
Q 1
5
Q 0
2
V C C
2 0
U 6
7 4 H C 3 7 3
1 A
1
2 A
2
3 A
3
4 A
4
5 A
5
6 A
6
7 A
7
8 A
8
G N D
9
1 Y
1 8
2 Y
1 7
3 Y
1 6
4 Y
1 5
5 Y
1 4
6 Y
1 3
7 Y
1 2
8 Y
1 1
Vs
1 0
U 7
U L N 2 8 0 3
D 3
Z E N E R (1 2 V )
C 5
D 5
F i g . 4 . 7 : T h e M o t o r C o n t r o l l e r C i r c u it
THE TRANSMITTER CIRCUIT
104
R
4
D C
7
Q
3
G
N
D
1
V
C
C
8
T R
2
T H
6
C V
5
U 1 5
5 5 5
D 1 1
I R L E D
R 5
1 0 0
Q 3
B C 5 4 7
C 1 1
0 . 1 n F
C 1 0
1 n F
R 4
5 k
R V 15 0 K
D 1 2
I R L E D
X T A L 2
1 8
X T A L 1
1 9
A L E
3 0
E A
3 1
P S E N
2 9
R S T
9
P 0 . 0 / A D 0
3 9
P 0 . 1 / A D 1
3 8
P 0 . 2 / A D 2
3 7
P 0 . 3 / A D 3
3 6
P 0 . 4 / A D 4
3 5
P 0 . 5 / A D 5
3 4
P 0 . 6 / A D 6
3 3
P 0 . 7 / A D 7
3 2
P 1 . 0 / T 2
1
P 1 . 1 / T 2 E X
2
P 1 . 2
3
P 1 . 3
4
P 1 . 4
5
P 1 . 5
6
P 1 . 6
7
P 1 . 7
8
P 3 . 0 / R X D
1 0
P 3 . 1 / T X D
1 1
P 3 . 2 / I N T 0
1 2
P 3 . 3 / I N T 1
1 3
P 3 . 4 / T 0
1 4
P 3 . 7 / R D
1 7
P 3 . 6 / W R
1 6
P 3 . 5 / T 1
1 5
P 2 . 7 / A 1 5
2 8
P 2 . 0 / A 8
2 1
P 2 . 1 / A 9
2 2
P 2 . 2 / A 1 0
2 3
P 2 . 3 / A 1 1
2 4
P 2 . 4 / A 1 2
2 5
P 2 . 5 / A 1 3
2 6
P 2 . 6 / A 1 4
2 7
U 1 3
A T 8 9 S 5 2
( 1 0 2 )
( 1 0 4 )
F i g . 4 . 6 : T h e T r a n s m i t t e r C i r c u i t
D 0
2
D 1
3
D 2
4
D 3
5
D 4
6
D 5
7
D 6
8
D 7
9
Q 0
1 8
Q 1
1 7
Q 2
1 6
Q 3
1 5
Q 4
1 4
Q 5
1 3
Q 6
1 2
Q 7
1 1
O E 1
1
O E 2
1 9
U 1 4
7 4 H C T 5 4 1
D 1 0
L E D - R E D
X 2
C R Y S T A L
C 7
3 3 p F
C 8
3 3 p F
2 4 M H z
C 9
4 7 u F
R 3
1 0 k
( 1 0 V )
V C C = P I N 4 0 , G N D = P I N 2 0
V C C = P I N 2 0
G N D = P I N 1 0
I n i t i a l i z e ( 1 6 )
1
1 4
2
1 5
3
1 6
4
1 7
5
1 8
6
1 9
7
2 0
8
2 1
9
2 2
1 0
2 3
1 1
2 4
1 2
2 5
1 3
J 3
C O N N - D 2 5 F
D 0
2
D 1
3
D 2
4
D 3
5
D 4
6
D 5
7
D 6
8
D 7
9
Q 0
1 8
Q 1
1 7
Q 2
1 6
Q 3
1 5
Q 4
1 4
Q 5
1 3
Q 6
1 2
Q 7
1 1
O E 1
1
O E 2
1 9
U 2 1
7 4 H C T 5 4 1
1
2
3
4
J 4
C O N N - S I L 4
V I
1
V O
3
G
N
D
2
U 2 2
7 8 0 5
POWER SUPPLY CIRCUIT
105
T R 1
T R A N - 2 P 3 S
V I
1
V O
3
G
N
D
2
U 1 7
7 8 1 5
V I
1
V O
3
G
N
D
2
U 1 8
7 8 1 2
V I
1
V O
3
G
N
D
2
U 1 9
7 8 0 5
Q 4
T I P 1 2 5
R 8
1 0 k
C 1 2
1 0 0 u F
B R 1
K B P 2 0 8 6
( 3 5 V )
C 1 3
1 0 0 u F
( 2 5 V )
C 1 4
1 0 0 u F
( 1 6 V )
C 1 5
1 0 0 u F
( 1 0 V )
A
B
C
O U T P U T S P E C I F I C A T I O N S
A : + 1 5 V , 3 . 7 5 A
B : + 1 2 V , 1 . 3 5 A
C : + 5 V , 1 . 3 5 A
( D . C . M o t o r L i n e )
( S t e p p e r M o t o r L i n e )
( I C L i n e )
2 2 0 V / 2 4 0 V
5 0 / 6 0 H z
M A I N S
V I
2
V O
3
G
N
D
1
U 2 0
7 9 1 2
C 1 6
1 0 0 u F
( 3 5 V )
C 1 7
1 0 0 u F
1 6 V
( - v e V o l t a g e L i n e )
D : - 1 2 V , 1 . 3 5 A
1
2
3
4
J 1
C O N N - S I L 4
1
2
3
4
J 2
C O N N - S I L 4
D
G N D
F i g . 4 . 9 : T h e P o w e r S u p p l y U n it
THE INTERRUPT CONTROLLER CIRCUIT
106
1
2
3
U 9 : A
7 4 H C 0 8
4
5
6
U 9 : B
7 4 H C 0 8
9
1 0
8
U 9 : C
7 4 H C 0 8
1 2
1 3
1 1
U 9 : D
7 4 H C 0 8
1
2
3
U 1 0 : A
7 4 H C 0 8
4
5
6
U 1 0 : B
7 4 H C 0 8
F D B K 6 ( P 1 . 6 ) F D B K 5 ( P 1 . 5 ) F D B K 4 ( P 1 . 4 ) F D B K 3 ( P 1 . 3 ) F D B K 2 ( P 1 . 1 ) F D B K 1 ( P 1 . 0 )
F R O M E N C O D E R 1 F R O M E N C O D E R 2 F R O M E N C O D E R 3 F R O M E N C O D E R 4 F R O M E N C O D E R 5 F R O M E N C O D E R 6
R
4
D C
7
Q
3
G
N
D
1
V
C
C
8
T R
2
T H
6
C V
5
U 1 1
N E 5 5 5
R 2
1 k
C 6
1 0 u F
1 2
U 1 2 : A
7 4 H C 1 4
I N T E R R U P T ( P 3 . 2 )
F i g . 4 . 8 : T h e I n t e r r u p t C o n t r o l l e r C i r c u it
107