Disclaimer: This is an example of a student written essay.
Click here for sample essays written by our professional writers.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UKEssays.com.

Mobile Robotic Arm Motivation Computer Science Essay

Paper Type: Free Essay Subject: Computer Science
Wordcount: 5134 words Published: 1st Jan 2015

Reference this

Robotics is technology that deals with the design, construction and operation of robots that are used in numerous applications is called robotics. It has become an unstoppable force in the development of modern machinery as they make life easier. It is an interesting topic to dwell in as it is the future of mankind. Although we know them as recent inventions, the idea of automated or controlled machines has fascinated humans. With this fascination it motivated me to work on this project, building and programming a mobile robotic arm. It is my hunger to learn and attain knowledge that drives me towards this field of study for my project.


Figure 1.1.1 : Mobile Robotic Arm

1.2 Introduction to Robotics

Robotics is an interesting topic of research. Basically it is an engineering field that is concerned with research and creation of robots for various applications. Robots are machines that consist of electronic and mechanical parts such as gears and cogs put together for performing tasks in place of humans. They can be programmed to perform a whole range of tasks with ease. They are most desired for certain functions because they never tire, they can endure harsh physical conditions that is possibly life threatening and they never get bored or distracted from repetitious work. The number of robots has begun to increase in numbers everywhere as they make human labour almost non-existent with their efficiency and throughput.

Get Help With Your Essay

If you need assistance with writing your essay, our professional essay writing service is here to help!

Essay Writing Service

They can work with the simplest of materials to the most dangerous such as radioactive materials. They can be found more commonly in industrial use from production lines of factories to harvesting of fruits in orchards. In domestic use, from vacuum cleaning to lawn mowing where these domestic tasks have become boring for a human to undertake and would rather leave it to robots. In the more modern military use, robots play an important role to reduce human casualties from dangerous jobs such as bomb defusal and not forgetting space exploration where it might not be possible for humans to explore and for collecting terrain sample from foreign planets. For exploring enemy territories unmanned aerial vehicles are used from which these pilotless drones can search terrains for hostiles and fire on targets.

Robots are meant to complete tasks that it is programmed to do. Programs can always be altered to suit the task at hand. As robots become more advanced they gain more features such as sensors and artificial intelligence as they become more human like. Examples of sensors include motion sensors, temperature sensors, light and many more various types. For example, in pathfinder robots we usually find a motion sensor which aids a robot in avoiding obstacles.

In other applications for example in a water tank when the water has reached a certain level the sensor enables the robot to stop the flow of water. It can be used in industrial applications such as gripping objects from conveyor belts or it can be used in a more advanced role such as bomb defusal, where it would be dangerous for a human to interact. With camera attachments, humans can control these machines from a safe distance while completing the task at hand in a safe and efficient manner. In the medical field where a more delicate touch is required, a robotic arm can perform tiny incisions for a less invasive method. With a robotic arm jobs can be done with ease and efficiency and thus eliminate human errors and the costs that come with those errors.


Figure 1.2.1 : Mars Rover

1.3 Objectives

The aim of this project is to build a robotic arm for the purpose of lifting and moving small objects. It is just like a human arm with joints to facilitate movement. The end attachment features a gripper which is able to grab and hold objects and also a probe light in order to work in low light scenarios. The arm is controlled via wired remote. It is rested on a mobile base which is fitted with 2 rear wheels and 2 robot castors at the front. This allows the robot to move to the desired location where the object is.

The objectives of this project are:

To understand and develop core knowledge in robotics.

To apply the knowledge of robotics and design a prototype.

To implement the designs and build an actual prototype.

Figure 1.3.1 : Project Layout


Insert Instruction Codes into PIC

Test Prototype

Evaluate Coding in relation to hardware design

Write Codes

Discuss Movement Concept

Propose Objectives1.4 Design Stage

Figure 1.4.1 : Design Flow Chart

This simple flowchart can explain the overall process involved in this project. After the objectives have been proposed the robot movement and motion concept is discussed and after that the codes are written. It is downloaded into the microcontroller for testing. If testing fails we return to the code stage and evaluate the coding. The process reaches the end after testing passes.

Chapter 2: Robot Overview

2.1 Hardware Design

This aim of this project is to design a mobile robotic arm. The arm part consists of two joints which enable 2 degree of movement and at the end of the top joint is a gripper which enables objects to be gripped by the attachment. The base has two wheels at the back and at the front two robot castors which has ball bearings underneath. This project involves two parts which is hardware and software. However both parts are intricately connected and it is hard to actually separate them completely. This report will focus more on the software aspect. There will be some minor hardware introduction as understanding of the hardware is required to work with the software. Here is the component list for the hardware:



Microcontroller PIC18F4520


Motor Driver SN754410


4.7k Ohm Resistor


1uF Capacitor


0.33uF Capacitor


0.1uF Capacitor


L7805 Voltage Regulator


20MHz Oscillator


9 Volt Battery


C40R Servo Motor


C55R Servo Motor


Servo Holder


Servo U Bracket


SPG10 Geared Motor


42mm Wheels


Robot Castors


Table 2.1.1 : Hardware Components

To write the software one must be familiar with the hardware functionality, configuration and settings. The hardware of significant importance would be the microcontroller as the program is stored there. It sends the signal to the pins where other devices are connected. One of those devices is the servo motor. It is what controls the arm and base. Actual control of the servos is by buttons. Those buttons are connected to the microcontroller and is able to control the servo thru programming of the microcontroller. It is done by generating and manipulating PWM signals which will be discussed later.


20.0 cm

24.0 cm

10.0 cm

25.6 cmTOP PROFILE.jpg

Figure 2.1.1 : Robot Layout

2.2 Software Design

After the purpose and specifications are determined it is time to plan and design the software. Most modern robots are controlled by sophisticated software. Creation and modification of the software is crucial to make machines work the way we want it to. There are many ways a machine can be programmed. The software is usually stored in the heart of the machine which is either a microprocessor or a microcontroller depending on what the machine does and how it works. That device is the brains of the robot as all the instructions are stored there. The software is the link for the user to the hardware as the program relays the instructions to the robot in machine code.

The user writes the program in computer language which will then be converted into machine code by the compiler. There are many computer languages available to write programs such assembly, C, Pascal, BASIC and FORTH. For this project the microcontroller that is used is Microchip’s PIC18F4520. The language used to program the microcontroller is C. C is a simple and procedural language and it has influenced many later languages such Java. It is generally variable and function based. Values are stored in variables for easy access and it is structured by defining and calling functions to perform tasks. C allows precise control of the input and output. The input and output can be easily directed to the microcontroller terminals.

The IDE (integrated development environment) that is used for this project is MPLAB which is a 32bit program used for the software development of this project along with the MPLAB C18 compiler add-on to allow the codes to be written in C .

This is the screenshot of the development environment:

C:UsersDanDesktopFYP ReportimagesUntitled.jpg

Figure 2.2.1: MPLAB IDE

The general idea of writing the program is to control the pins of the microcontroller. The robot arm mechanism and the base mechanism will be separated for easier explanation. The arm is made up of the 1st stage, 2nd stage, the left gripper and the right gripper. Control of the servos is by generating PWM signals which will be discussed in detail in chapter 4. By manipulation of these PWM signals we can control the servo movement to a certain angle with great precision. For the DC motors in the base, it is controlled via motor controller. By manipulating logic combinations we will be able to control the movement and direction of the base.

Infinite loop to check for button press

A button is pressed

Necessary routine or function is called to move servo/ DC motor


Figure 2.2.2 : General Software Flowchart

This is a general flowchart to represent the program flow. A while loop with an infinite condition is used to continuously check if a button has been pressed. If a button is pressed it will call the necessary function to run the specific device whether it is the servo or the DC motor.

Chapter 3: Hardware Information

3.1 Microcontroller

This project makes use of Microchip Technology’s PIC18F4520 microcontroller. Let’s discuss in detail what is a microcontroller and how it makes this project work. Notice that a microcontroller is chosen instead of a microprocessor for this project for a number of reasons. To make the choice, one must know the difference between a microcontroller and a microprocessor in terms of functionality and application. Both are typically a small computer in the form of an integrated circuit which contains things like registers, memory, I/O, interrupts and timers. They vary in terms of number of I/O, registers, clock speed and memory size.

Microcontrollers are usually for cases that involve a lot of input output devices in contrast to a microprocessor which is usually used for heavy data applications. So that means microcontrollers dominate the robotics and automation industry. Let’s examine closely what it looks like and the detailed features for this particular microcontroller, the PIC18F4520. Its versatility, robust nature and features contributed to the choosing of this IC. The detailed features along with its operation can be found in the datasheet for the microcontroller.

C:UsersDanDesktopFYP ReportimagesPIC18F4520IP.jpg

Figure 3.1.1 : PIC18F4250

Parameter Name


 Program Memory Type


 Program Memory (KB)


 CPU Speed (MIPS)


 RAM Bytes


 Data EEPROM (bytes)


 Digital Communication Peripherals


 Capture/Compare/PWM Peripherals

 1 CCP, 1 ECCP


 1 x 8-bit, 3 x 16-bit


 13 ch, 10-bit



 Temperature Range (C)

 -40 to 125

 Operating Voltage Range (V)

 2 to 5.5

 Pin Count


Table 3.1.1 : PIC18F4250 Specifications

Peripheral Highlights:

• High-current sink/source 25 mA/25 mA

• Three programmable external interrupts

• Four input change interrupts

• Up to 2 Capture/Compare/PWM (CCP) modules,

one with Auto-Shutdown (28-pin devices)

• Enhanced Capture/Compare/PWM (ECCP)

module (40/44-pin devices only):

– One, two or four PWM outputs

– Selectable polarity

– Programmable dead time

– Auto-Shutdown and Auto-Restart

• Master Synchronous Serial Port (MSSP) module

supporting 3-wire SPIâ„¢ (all 4 modes) and I2Câ„¢

Master and Slave Modes

• Enhanced Addressable USART module:

– Supports RS-485, RS-232 and LIN 1.2

– RS-232 operation using internal oscillator

block (no external crystal required)

– Auto-Wake-up on Start bit

– Auto-Baud Detect

• 10-bit, up to 13-channel Analog-to-Digital

Converter module (A/D):

– Auto-acquisition capability

– Conversion available during Sleep

• Dual analog comparators with input multiplexing)

Power Managed Modes:

• Run: CPU on, peripherals on

• Idle: CPU off, peripherals on

• Sleep: CPU off, peripherals off

• Idle mode currents down to 5.8 μA typical

• Sleep mode current down to 0.1 μA typical

• Timer1 Oscillator: 1.8 μA, 32 kHz, 2V

• Watchdog Timer: 2.1 μA

• Two-Speed Oscillator Start-up

Flexible Oscillator Structure:

• Four Crystal modes, up to 40 MHz

• 4X Phase Lock Loop (available for crystal and

internal oscillators)

• Two External RC modes, up to 4 MHz

• Two External Clock modes, up to 40 MHz

• Internal oscillator block:

– 8 user selectable frequencies, from 31 kHz to 8 MHz

– Provides a complete range of clock speeds

from 31 kHz to 32 MHz when used with PLL

– User tuneable to compensate for frequency drift

• Secondary oscillator using Timer1 @ 32 kHz

• Fail-Safe Clock Monitor:

– Allows for safe shutdown if peripheral clock stops

Special Microcontroller Features:

• C compiler optimized architecture:

– Optional extended instruction set designed to

optimize re-entrant code

• 100,000 erase/write cycle Enhanced Flash

program memory typical

• 1,000,000 erase/write cycle Data EEPROM

memory typical

• Flash/Data EEPROM Retention: 100 years typical

• Self-programmable under software control

• Priority levels for interrupts

• 8 x 8 Single-Cycle Hardware Multiplier

• Extended Watchdog Timer (WDT):

– Programmable period from 4 ms to 131s

• Single-supply 5V In-Circuit Serial

Programmingâ„¢ (ICSPâ„¢) via two pins

• In-Circuit Debug (ICD) via two pins

• Wide operating voltage range: 2.0V to 5.5V

• Programmable 16-level High/Low-Voltage

Detection (HLVD) module:

– Supports interrupt on High/Low-Voltage


• Programmable Brown-out Reset (BOR

– With software enable option

Here is a list of pins and how they are connected in the circuit.

Pin Name

Pin Number (PDIP)







Servo PWM Input



Servo PWM Input



Servo PWM Input



Servo PWM Input









Oscillator Crystal/External Clock Input



Oscillator Crystal/External Clock Input



IN2 of Motor Driver



IN1 of Motor Driver



IN4 of Motor Driver



IN3 of Motor Driver









Motor Push Button



Motor Push Button



Motor Push Button



Motor Push Button



Servo Arm Push Button



Servo Arm Push Button



Servo Arm Push Button



Servo Arm Push Button

Table 3.1.2 : Pin Connections

C:UsersDanialDesktopFull Schem.JPG

Figure 3.1.2 : Full Schematics

3.2 Motor Driver

Figure 3.2.1 : SN754410 Motor Driver

The SN754410NE is a quadruple half-H driver. The SN754410 can operate a pair of DC motors at the same time. It gives the robot bidirectional movements. It carries the peak output currents up to 1 ampere at a voltage range of 4.5 to 36V. The SN754410 has a minimum logic voltage of 4.5V and a maximum logic voltage of 5.5V. This driver is made to operate from a -400C to 850C. Drivers are enabled in pairs. Driver 1 and driver 2 are enabled by 1,2EN. Driver 3 and driver 4 are enabled by 3,4EN. When the input is low, the drivers are disabled and the outputs are off. If the input is high, the drivers are enabled and the outputs are on.

Figure 3.2.2 : SN754410 Motor Driver Pinout

Pin 1 (1,2EN) enables/ disables the motor

Pin 2 (1A) is a logic pin for the motor

Pin 3 (1Y) is for Motor A

Pin 4, 5 are for grounding

Pin 6 (2Y) is for Motor A

Pin 7 (2A) connected to the motor

Pin 8 (VCC2) connected to source for motor power

Pin 9 (3,4EN) enables/ disables the motor

Pin 10 (3A) connected to the motor

Pin 11 (3Y) is for Motor B

Pin 12, 13 are for grounding

Pin 14 (4Y) is for Motor B

Pin 15 (4A) connected to the motor



H = High Level

L = Low Level

X = Do Not Matter













Table 3.2.1 : SN754410 Function Table


Figure 3.2.3 : Motor Schematics

3.3 DC Motor

This project will use the SPG10 Geared Motor that has 1.3 kg/cm torque. This motor is light enough to not weigh down the robot and only weighs 10 grams. It runs at 45 rpm.

Figure 3.3.1 : SPG10 Motor


Figure 3.3.2 : Motor & Wheel

3.4 Servo Motor

A servo is a mechanism used in robotic control systems. It is a mechanism that the user can set and forget. This is because of its ability to make corrections to return to its preset state if any changes occur. This is thanks to feedback operations. A servo is a casing that contains a DC motor, some gears with an output shaft, a variable resister that is connected to the output shaft, and a control board.

Find Out How UKEssays.com Can Help You!

Our academic experts are ready and waiting to assist with any writing project you may have. From simple essay plans, through to full dissertations, you can guarantee we have a service perfectly matched to your needs.

View our services

The sensor mechanism allows the control circuit to monitor the current. The motor, through a series of gears, turns the output. The control circuit calculates the difference from the intended position from the current position the shaft is in. This makes the motor turn to its new position. If the control circuit senses that the position is accurate, it brings to a halt the motor.

There are three connections to a servo; the power line, the ground line and finally the control signal. The servo needs to be told when to move and won’t do so even if power is provided directly. The servo utilizes pulse width modulation (PWM) stream to indicate its position.


Servo Motor Model

At 5 Volts

Speed (s/60o)


Torque (Kg.cm)


Signal To Control Angle


PWM At Min Angle (ms)


PWM At Max Angle (ms)


Operating Voltage (VDC)


Operating Frequency (Hz)


Moving Range(degree)


Wiring (Black/Brown Wire)


Wiring (Red Wire)

4.8-6.0 Volts

Wiring (Orange/Other Wire)

PWM Signal

Table 3.4.1 : Servo Specifications


Figure 3.4.1 : Servo Motor


Figure 3.4.2 : Servo Schematic

Chapter 4: Software Coding

4.1 PWM Generation

PWM is simply the short form for pulse-width modulation. It is an efficient way to provide intermediate amounts of electrical power between fully on and fully off. This means PWM signals are digital, because at any instant given instant of time, the full DC supply is either fully on or fully off. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion.

Many microcontrollers include on-chip PWM controllers, like the one which is used this project, which makes this easy for controlling the servos for this project. One of the advantages of PWM is that the signal remains digital all the way from the processor to the controlled system and no digital-to-analog conversion is necessary. By keeping the signal digital, noise effects are minimized. Noise can only affect a digital signal if it is strong enough to change logic 1 to logic 0, or vice versa. PWM is the basis of controlling the servos in this project. Let’s examine some basic theory.

C:UsersDanDesktopFYP Reportimagespwm.gif

Figure 4.1.1 : PWM Square Wave

The diagram above shows a PWM signal that changes between 0 and 5 volts which is equivalent as digital logic 0 and 1. Notice that the waves are symmetrical. The uptime and downtime is 10ms when added together we get the period which is 20ms. Now that the basics are out of the way, let’s look at how a normal servo signal input looks like.

C:UsersDanDesktopFYP Reportimagespwm_servo.gif

Figure 4.1.2 : PWM Wave

Note that the servo runs at 50Hz frequency and therefore the period is 20ms. The uptime is what determines the angle of which the servo motor moves to. In simple words, we can tell the servo where to move with great precision.

These are some examples for 180° servos.

t = 0.9ms

T = 20ms

Angle = 0°

t = 1.5ms

T = 20ms

Angle = 90°

t = 2.1ms

T = 20ms

Angle = 180°

The next step is to create these PWM signals using the PIC microcontroller. The PWM’s is in this switch statement:

switch(count){ //Choose which servo to modify

case 1: PORTA = 0x02; // First Stage

WriteTimer1( servo3 );


case 2: PORTA = 0x04; // Left Gripper

WriteTimer1( servo1 );


case 3: PORTA = 0x08; //Right Gripper

WriteTimer1( servo0 );


case 4: PORTA = 0x10; // Second Stage

WriteTimer1( servo2 );



Figure 4.1.3 : Switch Statement

The operations for the timers are split in to 4 possible cases of how to generate PWM signal to the pins to power the servos.

This is what the statement does:


#pragma code InterruptVectorHigh=0x08

void InterruptVectorHigh (void)


_asm      //assembly code starts

goto InterruptHandlerHigh

          //interrupt control

_endasm   //assembly code ends


#pragma code

#pragma interrupt InterruptHandlerHigh

          //end interrupt controlCase 1 turns PortA1 On and resets the timer1. 

Case 2 turns PortA1 Off, PortA2 on and resets the timer1. Case 3 turns PortA2 Off, PortA3 on and resets the timer1. Case 4 turns PortA3 Off, PortA4 on and resets the timer1.

Figure 4.1.4 : Interrupt Handler

The switch statement is nested in the interrupt handler function. The interrupt handler handles the timer operations. The interrupt control runs assembly code and then calls the go-to function which is “InterruptHandlerHigh”. The interrupt controller is set at high priority 0x08. Once the interrupt control is correctly implemented interrupts is sent to the interrupt handler where we can do whatever operation necessary depending on the type of interrupt. 

4.2 Arm Control

void move(int one,int two,int three,int four, int five)



servo0 = one; // Right Gripper


servo1 = two; // Left Gripper


servo2 = three; // Second Stage Link


servo3 = four; // First Stage Link

}A move function is declared to make things easier when linking with buttons. The arguments of the move function are the respective position the servo moves to when it is called upon.

Figure 4.2.1 : Move Function

After the move function is declared it can be called when the specific button is pressed.

//Arm Control


move(0xF03B,0xF477,0,0,0); //GRIP!


move(0,0,(servo2-0x0250),(servo3+0x0100),0); //MOVE AWAY


move(0,0,(servo2+0x0250),(servo3-0x0100),0); //MOVE TOWARDS


move(0xFA77,0xEE07,0,0,0); //UNGRIP!

Figure 4.2.2 : Arm Button Check

There are 4 buttons that control the movement of the arm.

PortB pin 0: Close the gripper

PortB pin 1: Move arm away

PortB pin 2: Move arm towards

PortB pin 3: Open the gripper

C:UsersVictorDesktopImagesClose Gripper.jpg

Figure 4.2.3 : Close Gripper

This picture depicts a closed gripper state that is triggered by the button. The following figure is how the robotic arm will look when it is triggered to open both grippers.


Figure 4.2.3 : Open Gripper

4.3 Base Control

The only thing that needs to be controlled in the base is the 2 DC geared motors. It is linked with the microcontroller through the H-bridge. The motors rotational direction is determined by a combinational logic code as seen in the data sheet of the motor driver. It is the same with the servo, when a button is pressed certain commands will be executed.

//Base Control



//Forward control








//Reverse control






Figure 4.3.1 : Base Button Check (Forward/Reverse)



//Left control








//Right Control






Figure 4.3.2 : Base Button Check (Left/Right)

There are 4 buttons that control the movement of the base.

PortB pin 4: Forward

PortB pin 5: Reverse

PortB pin 6: Move right

PortB pin 7: Move left

4.4 Simulation


Figure 4.4.1 : Watch Simulation

The MPLAB software allows a minimal amount of simulation to show that the program is written correctly. Due to software limitation on the PIC18F4520 it is unable to correctly show port activities. However it does show variable activity like in the figure by using the watch feature in the MPLAB.

This screenshot shows the stepping when reaching the “OpenTimer1” function. A separate window opens to show the function and it will continue to step through the function until it is done.


Figure 4.4.2 : Program Stepping

The stepping continues while opening the necessary functions in a separate window and steps though it until it is done. It reaches the while loop and it keeps looping as it waits for a button to be pressed. Figure 4.4.3 shows the final stage of the program stepping.


Figure 4.4.3 : Final Stepping

Chapter 5: Conclusions and Recommendation

5.1 Summary

This project has further expanded my interest and knowledge in the field of robotics. A project that is very hands on like this helps with the development of certain skills that would certainly help when I go on to become a professional engineer. The most important skill would be planning the stages of the project.

To conclude, this project involved two phases which is the hardware design and software design. This report covered the software aspect in detail. In the early stages of this project different methods was planned for the outcome. At the start, the use of a PLC (programmable logic controller) was planned. However it proved to be infeasible in terms of cost and size. In the end it was decided that a PIC microcontroller was to be use as it is easier to implement with respect to the project and provides a great deal of functionality. The programming was made easier with the addition of the C compiler thus enabling the use of a higher level language which is C. With the use of a language of higher level it would be easier to implement features that were not possible using the PLC.

5.2 Recommendations

In this project, certain improvements can be made in order to make things work more efficiently. For example, the quick movements seen in the arm is because of the incrementer seen in the codes and lack true control software. By revising the software and introducing more control oriented design it is possible to fine tune the speed. Instead of the 2 robot castors that make up the front motion it could be replaced with wheels and a servo in between them to make the movement and control similar to remote controlled cars. The wired controller could be replaced with a wireless RF controller to allow more freedom to the user. The body work could be improved by using sturdier and lightweight materials such as aluminium. Some sensors could be added to enhance the normal usage of the arm.


Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: