Project on Robotics

82
PROJECT REPORT PSOC BASED ROBOTIC ARM INTRODUCTION A DC motor is an electromechanical device which converts electrical signal into mechanical movements. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied. DC motor can be a good choice whenever controlled movement is required. They can be used to advantage in applications where you need to control rotation angle, speed, position and synchronism. Because of the inherent advantages, The project aims at the developing a robot arm which moves according to the rotation of the stepper which can be used in a wide variety of applications. Project supports the control of DC motor by using glove interpreter .The glove, used as hand covering and flex sensors will be attached on the glove which senses the hand movement. Flex sensors are sensors that change the resistance depending on the amount of bend on the sensor. It converts the change in bend to electrical resistance. They are usually in the form of a thin strip from1”- 5” long that vary in resistance. The resistance value of the sensor will be converted into voltage value by using voltage divider. PSoC 5 is a true system-level solution providing microcontroller unit (MCU), memory, analog, and digital peripheral functions in a DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 1

Transcript of Project on Robotics

PROJECT REPORT PSOC BASED ROBOTIC ARM

INTRODUCTION

A DC motor is an electromechanical device which

converts electrical signal into mechanical movements. The

motors rotation has several direct relationships to these

applied input pulses. The sequence of the applied pulses is

directly related to the direction of motor shafts rotation.

The speed of the motor shafts rotation is directly related to

the frequency of the input pulses and the length of rotation

is directly related to the number of input pulses applied.

DC motor can be a good choice whenever controlled

movement is required. They can be used to advantage in

applications where you need to control rotation angle, speed,

position and synchronism. Because of the inherent advantages,

The project aims at the developing a robot arm which moves

according to the rotation of the stepper which can be used in

a wide variety of applications.

Project supports the control of DC motor by using

glove interpreter .The glove, used as hand covering and flex

sensors will be attached on the glove which senses the hand

movement. Flex sensors are sensors that change the resistance

depending on the amount of bend on the sensor. It converts the

change in bend to electrical resistance. They are usually in

the form of a thin strip from1”- 5” long that vary in

resistance. The resistance value of the sensor will be

converted into voltage value by using voltage divider. PSoC 5

is a true system-level solution providing microcontroller unit

(MCU), memory, analog, and digital peripheral functions in a

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 1

PROJECT REPORT PSOC BASED ROBOTIC ARM

single chip. In PSoC the component used are ADC and UART.

Necessary program is done in the PSoC Creator.

The Delta Sigma Analog to Digital Converter

(ADC_DelSig) provides a low-power, low-noise front end for

precision measurement applications. It is used in a wide range

of applications, depending on resolution, sample rate, and

operating mode. They can produce 16- bit audio; high speed and

low resolution for communications processing; and high-

precision 20-bit low-speed conversions for sensors such as

strain gauges, thermocouples, and other high precision

sensors. When processing audio information, the ADC_DelSig is

used in a continuous operation mode. When used for scanning

multiple sensors, the ADC_DelSig is used in one of the multi

sample modes. When used for single-point high-resolution

measurements, the ADC_DelSig is used in single-sample mode.

The UART provides asynchronous communications

commonly refered to as RS232 or RS485.The UART component can

be configured for Full Duplex, Half Duplex, RX only, or TX

only versions. All versions provide the same basic

functionality. They differ only in the amount of resources

used. To assist with processing of the UART receive and

transmit data, independent size configurable buffers are

provided. The independent circular receive and transit buffers

in SRAM and hardware FIFOs help to ensure that data will not

be missed. This allows the CPU to spend more time on critical

real time tasks rather than servicing the UART. For most use

cases, you can easily configure the UART by choosing the baud

rate, parity, number of data bits, and number of start bits.

The most common configuration for RS232 is often listed as

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 2

PROJECT REPORT PSOC BASED ROBOTIC ARM

“8N1,” which is shorthand for eight data bits, no parity, and

one stop bit. This is the default configuration for the UART

component. The UART component supports 9-bit addressing mode

with hardware address detect, as well as a TX output enable

signal to enable the TX transceiver during transmissions. The

analog signal is converted to digital in PSoC. The output is

serially transmitted to PIC Microcontroller.

PIC microcontrollers are popular processors

developed by Microchip Technology with built-in RAM, memory,

internal bus, and peripherals that can be used for many

applications.PIC originally stood for “Programmable

Intelligent Computer” but is now generally regarded as a

“Peripheral Interface Controller”. The project deals with

microcontroller PIC18F452 which is programmed to run the

stepper motor drive for this purpose IC ULN2003A is being used

which control the rotation of stepper which in turn produce

the corresponding movement on the robot arm.

1.2 OBJECTIVE Robot is any machine that does work on its own,

automatically after it is programmed by humans. The first

robot's name was Electro and his dog's name was Sparko .They

appeared at the New York world's fair in 1939. While plugged

in, Elektro could say 77 words and move backwards and

forwards.In1920's, Karl Capek from Czechoslovakia introduced

the words first robot on stage.

We are going to design & implement a small model of pick

and place robot, which pick and place object any where around

it. The reason for choosing project is, the most extensively

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 3

PROJECT REPORT PSOC BASED ROBOTIC ARM

form of machine is used in most of the industries like car

manufacturing, shipyards, assembling machine

etc.Microprocessors and microcontroller are widely used in

embedded system products.An embedded system is a system which

is dedicated for a single purpose remains unchanged through

out its entire life time. An embedded product uses a

microcontroller to do one task and one task only.

Automation is the use of control system and information

technologies to reduce the need for human work in the

production of goods and services. Auto-motion first opened its

doors in 1967 as a distributor of conveyors and conveyor

accessories In the scope of industilization automation is a

step beyond mechanisation. Whereas mechanization provided

human operators with machinery to assist them with the

muscular requirements of work, automation greatly decreases

the need for human sensory and mental requirements as well.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 4

PROJECT REPORT PSOC BASED ROBOTIC ARM

SCOPE OF THE WORK The Mechanics of the robot uses the actuatorswhich is the one that activates especially a device

responsible for actuating a mechanical device, such as one

connected to a computer by a sensor link. The Robotic Arm that

delivers fast accurate and repeatable movement .The robot

features base rotation, shoulder, elbow and wrist motion, with

a functional gripper to make five independent axis of

movement.

The Small lightweight gripper are added to hold the

objects, Mobile base are used to enable the robot with the

facility of free movement and Light sensors able to identify

the objects and their colors .The electronics behind this is

Micro controller once programmed with a set of predefined

instructions will issue simple positioning commands for

movement. The intelligent control software, which has been

developed using high-level graphical programming language of

visual basic.In other word the Micro controller will provide

the control pulses to the servos. It is also noticeable that

these commands could be issued from the PSoC and it is to our

intention to design a user friendly software able to do so.

The robot was fully controlled by the PSoC and the

commands from the PSoC were received by the microcontroller A

man from a remote place of about ten to fifteen metres can

operate the robot. All are based on the microprocessor

technology that enables manufacturers to put an entire CPU on

one chip.PSoC will send the commands to ZIGBEE module.It

provides facilities for carrying out secure communications.The

microcontroller used here is pic16F452 which has a harvard

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 5

PROJECT REPORT PSOC BASED ROBOTIC ARM

architecture. Microprocessors and microcontroller are widely

used in embedded system products.An embedded system is a

system which is dedicated for a single purpose remains

unchanged through out its entire life time. A complete

solution of a robot control solution is presented in this

project.

2.1. SYSTEM OVERVIEW The advent of new high-speed technology and the

growing computer capacity provided realistic opportunity for

new robot controls and realization of new methods of control

theory. This technical improvement together with the need for

high performance robots created faster, more accurate and more

intelligent robots using new robots control devices, new

drives and advanced control algorithms. This project describes

a new economical solution of robot control systems. The

presented robot control system can be used for different

sophisticated robot applications. The control system consists

of a glove,PSoC module, a microcontroller that collects data

from the PSOC and control the robot.

2.1.1. PREVIOUS WORKS

Our Robot implementation is a combination of a set

robot designs. The 5 Axis Arm was designed before targeting

the Towers of Hanoi game simulation. The three axis arm was

used for industial application earlier,which was used for pick

and place operation.stationary pick and place robot was

developed for picking and placing the stationary

object.Telephone operated pick and place robot was used for

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 6

PROJECT REPORT PSOC BASED ROBOTIC ARM

operating the telephone calls. The robot was fully controlled

by the PC and the commands from the PC were received by the

microcontroller A man from a remote place of about ten to

fifteen metres can operate the robot.All are based on the

microprocessor technology that enables manufacturers to put an

entire CPU on one chip.PC will send the commands to personal

computer.It provides facilities for carrying out secure

communications.

2.1.2. PROPOSED WORKS

Our addition to the past made arm, is the addition tothe free mobility set that’s going to have set of different

sensors to help it identify its way, facing objects, and

accordingly be able to move freely anywhere to execute the

commands issues to it by the user, either on the micro

controller, from the manual computer interface.

The Micro controller will issue necessary commands so

that the Robot is able to move identify the color of a

required object grip that object and perform the required

command using the 5 axis arm ability. It was made of 3 main

components, Brain - usually a PSoC module, Actuators and

mechanical parts: motor, pistons, grippers, wheels, and

gears .

The robot featured base rotation, shoulder, elbow and

wrist motion, with a functional gripper to make five

independent axis of movement. No soldering was required for

the electronics. With the exception of some basic

construction supplies, all of the components are included to

assemble a functional robot. A microcontroller is required to

issue simple positioning commands for movement. As an example

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 7

PROJECT REPORT PSOC BASED ROBOTIC ARM

the Robot could prepare a cup of tea. We intend to let the

robot move grip a spoon, serves a required quantity of sugar

and put it in a cup. Even though it have advantage it have

some disadvantage too because of the use .

The exception of some basic construction supplies, all

of the components are included to assemble a functional. The

servomotor because it is high cost due to its lack of demand

and also the price of rare earth magnets. The other main

drawback is that the controlling the speed of a servomotor is

more complex than controlling a DC motor. Where as the speed

of an DC motor can be controlled by changing the applied DC

voltage.This drawbacks can be overcome in future by the use of

advanced technology. The DC motor cannot be damaged by

mechanical overload.It has high output power relative to motor

size and weight.

2.1.3. FUTURE WORKS

Once equipped with an ultrasonic range finder an

RF data communication system, between the robot and a PC for

sending and receiving information from sensors and actuators

the robot will be able to select objects if object identifying

form sensors are used and move avoiding obstacles. The DC

motor is replaced by servomotor we can have a system which is

more flexible in movement.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 8

PROJECT REPORT PSOC BASED ROBOTIC ARM

3. BLOCK DIAGRAM

Fig.3.1 Block diagram

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 9

PSOC

PROJECT REPORT PSOC BASED ROBOTIC ARM

4. BLOCK DIAGRAM EXPLANATION

4.1 FLEX SENSORS

Flex sensors are passive resistive devices that can be

used to detect bending or flexing. The flex sensor is a sensor

that decreases its resistance in proportion to the amount it

is bent in either direction. The sensor we are building is

about 3/8" wide by 5" long. Sensor can be made wider and

longer depending upon your application. Flex sensors are

analog resistors. They work as variable analog voltage

dividers. Inside the flex sensor are carbon resistive elements

within a thin flexible substrate. More carbon means less

resistance. When the substrate is bent the sensor produces a

resistance output relative to the bend radius. With a typical

flex sensor, a flex of 0 degrees will give 10K resistance will

a flex of 90 will give 30-40K ohms. The Bend Sensor lists

resistance of 30-250K ohms.

Fig 4.1 Flex sensor

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 10

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.1.1 COMPONENTS

The materials needed for the construction of the bi-

direction flex sensor is shown in figure 1 and listed below.

The size of the materials listed is only a guideline to the

sensor we are constructing in this article. These types of

sensors can be manufactured to larger widths and lengths.

1. Copper foil laminate 1/4" x 4.5"

2. Acetate 1/4" x 4.5" x .010 thick

3. Heat shrink tubing 3/8" dia x 5"

4. Resistive material 5/16" x 5"

Fig 4.2 Flex sensor components

Copper foil laminate is used in the electronics

industry to make flexible circuits. It is thin copper cladding

on a plastic material substrate like acetate. The material we

are using is single sided copper. Copper on one side and the

substrate (plastic) on the other, the copper cladding material

is cut into two pieces 1/4" wide x 4.5" long strips. The

material is easily cut with a scissors. Solder about 6" of

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 11

PROJECT REPORT PSOC BASED ROBOTIC ARM

wire to one end of each strip. You may find it easier to

solder the wire to the strip if you tin the bottom 3/8" of

each strip. Solder each wire to one corner side of the strip.

It doesn’t matter which side you choose, just make sure you

solder both strips on the same side.

Fig 4.3 Variable resistance in

Flex sensor

4.1.2 RESISTIVE MATERIALS

There are a variety of resistive materials

available; cloth, plastic and paper. The common elements of

all the appropriate materials are that the material is

somewhat conductive or resistive. The degree to which the

material is resistive will determine the scale at which your

flex sensor operates. For the example here I am constructing

here, I using conductive black plastic poly bags conductive

bags used in the electrical industry. These bags are used to

store components that are static sensitive. The bags are made

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 12

PROJECT REPORT PSOC BASED ROBOTIC ARM

from single layer of carbon-loaded polyethylene and its

conductivity does not depend on humidity. I cut the bags into

the 3/8 " wide by 5" long strips.

4.1.3 FEATURES

· Angle Displacement Measurement

· Bends and Flexes physically with motion device

· Possible Uses

· Robotics

· Gaming (Virtual Motion)

· Medical Devices

· Computer Peripherals

· Musical Instruments

· Physical Therapy

· Simple Construction

· Low Profile

4.1.4 MECHANICAL SPECIFICATIONS

· Life Cycle: >1 million

· Height: 0.43mm (0.017")

· Temperature Range: -35°C to +80°C

4.1.5 ELECTRICAL SPECIFICATIONS

· Flat Resistance: 10K Ohms

· Resistance Tolerance: ±30%

· Bend Resistance Range: 60K to 110K Ohms

· Power Rating : 0.50 Watts continuous.1 Watt Peak

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 13

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.2 PSoC TECHNOLOGY

Cypress's PSoC Programmable System-on-Chip is the

most complete solution for embedded systems, combining an 8-

bit microcontroller, flash memory, and SRAM with customizable

analog and digital blocks. PSoC is a software configured,

mixed-signal array with a built-in Microcontroller unit core.

The core is a Cypress proprietary, 8bit harward design called

the M8C. PSoC has three separate memory spaces: paged SRAM for

data, flash memory for instructions and fixed data, and I/O

Registers for controlling and accessing the configurable logic

blocks and functions.

4.2.1 PSOC: PROGRAMMABLE SYSTEM ON CHIP

PSoC (Programmable System on Chip) represents a

whole new concept in microcontroller development. In addition

to all the standard elements of 8-bit microcontrollers, PSoC

chips feature digital and analog programmable blocks, which

themselves allow implementation of large number of

peripherals. Digital blocks consist of smaller programmable

blocks that can be configured to allow different development

options. Analog blocks are used for development of analog

elements, such as analog filters, comparators, instrumentation

(non) inverting amplifiers, as well as AD and DA convertors.

There is a number of different PSoC families you can base your

project upon, depending on the project requirements. Basic

difference between PSoC families is the number of available

programmable blocks and the number of input/output pins.

Number of components that can be devised is primarily a

function of the available programmable blocks. Depending on

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 14

PROJECT REPORT PSOC BASED ROBOTIC ARM

the microcontroller family, PSoC chips have 4–16 digital

blocks, and 3–12 analog programmable blocks.

Fig: 4.2.1 PSoC module

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 15

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.2.2 CHARACTERISTICS OF PSOC

Some of the most prominent features of PSoC are:

· MAC unit, hardware 8x8 multiplication, with result stored in

32-bit accumulator,

· Changeable working voltage, 3.3V or 5V.

· Possibility of small voltage supply, to 1V.

· Programmable frequency choice.

Programmable blocks allow you to device:

· 16K bytes of programmable memory.

· 256 bytes of RAM.

· AD convertors with maximum resolution af 14 bits.

· DA convertors with maximum resolution of 9 bits.

· Programmable voltage amplifier.

· Programmable filters and comparators.

· Timers and counters of 8, 16, and 32 bits.

· Pseudorandom sequences and CRC code generators.

· Two Full-Duplex UART’s.

· Multiple SPI devices.

· Option for connection on all output pins.

· Option for block combining.

· Option for programming only the specified memory regions and

write protection.

· For every pin there is an option of Pull up, Pull down, High

Z, Strong, or Open pin state.

· Possibility of interrupt generation during change of state

on any input/output pin.

· I²C Slave or Master and Multi-Master up to speed of 400 KHz.

· Integrated Supervisory Circuit.

· Built-in precise voltage reference.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 16

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.2.3 MAJOR ADVANTAGES:

·There is no other microcontroller that has programmable

voltage, instrumentational, inverting, and non-inverting

amplifiers

·Hardware generators of pseudorandom and CRC code, as well as

analog modulators, are unique to PSoC families;

·MAC (Multiply-accumulate) is an essential part of digital

signal processors,

which allows implementation of digital signal processing

algorithms. It’s worth noting that hardware accumulator

multiplication is not a common feature of 8-bit

microcontrollers.

·Having the advantage of changeable working voltage doesn’t

really need a comment. This feature is particularly important

for development of new devices as it· eliminates the need for

redesigning the PCB and implementing the level translator.

· Timers, counters, and PWM units are more flexible than the

usual implementation;

· Automatic code writing for accessing all the peripherals in

use;

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 17

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.2.4 SYSTEM OVERVIEW

PSoC microcontrollers are based on 8-bit CISC architecture.

Their general

structure with basic blocks is presented in the following

image:

Fig:4.4 PSoC

Architecture

Analog CPU unit is the main part of a microcontroller

whose purpose is to execute program instructions and control

workflow of other blocks.Frequency generator facilitates

signals necessary for CPU to work, as well as an array of

frequencies that are used by programmable blocks. These

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 18

PROJECT REPORT PSOC BASED ROBOTIC ARM

signals could be based on internal or external referent

oscillator.Reset controller enables microcontroller start

action and brings a microcontroller to regular state in the

case of irregular events.Watch Dog timer is used to detect

software dead-loops.Sleep timer can periodically wake up

microcontroller from power saving modes. It could be also used

as a regular timer.Analog programmable blocks are used to

configure analog components, like AD and DA converters,

filters, DTMF receivers, programmable, instrumental,

inverting, non-inverting and operational amplifiers.Input-

Output pins enable communication between the CPU unit, digital

programmable blocks and outside world.Digital programmable

blocks are used to configure digital programmable components

which are selected by user operations in the case of

interrupts.I2C controller Enables hardware realization of an

I2C communication.Voltage reference is vital for the work of

analog components that reside inside of analog programmable

blocks.MAC unit is used for operations of hardware signed

multiplication of 8-bit numbers.SMP is a system which can be

used as a part of a voltage regulator. For example, it is

possible to supply power to a PSoC microcontroller from a

single 1.5V battery.

4.2.5 PSOC SUBSYSTEMS:

The following is a high level view of the hardware subsystems

of a PSoC.

The Core

The PSoC® 1 core includes:

· The M8C MCU

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 19

PROJECT REPORT PSOC BASED ROBOTIC ARM

· Flash memory

· SRAM

· Sleep and watchdog timers

· Multiple clock sources that include a PLL PSoC 1 devices can

have up to two multiply–accumulate modules (MACs), which

provide fast 8-bit multipliers or fast 8-bit multipliers with

32-bit accumulate, up to two decimators for

digital signal processing applications, I2C functionality for

implementing either I I2C slave master, and availability of a

full-speed USB interface

4.3. PIC18F452 (MICROCONTROLLER)

The name PIC initially referred to "Peripheral

Interface Controller". PICs are popular with both industrial

developers and hobbyists alike due to their low cost, wide

availability, large user base, and extensive collection of

application notes, availability of low cost or free

development tools, and serial programming and re-programming

with flash memory capability. The PIC Processor has a Harvard

architecture that is separate instruction memory and data

memory.

A PIC's instructions vary from about 35

instructions for the low-end PICs to over 80 instructions for

the high-end PICs. The instruction set includes instructions

to perform a variety of operations on registers directly, the

accumulator and a literal constant or the accumulator and a

register, as well as for conditional execution, and program

branching.Some operations, such as bit setting and testing,

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 20

PROJECT REPORT PSOC BASED ROBOTIC ARM

can be performed on any numbered register, but bi-operand

arithmetic operations always involve W the accumulator,

writing the result back to either W or the other operand

register. To load a constant, it is necessary to load it into

W before it can be moved into another register.

On the older cores, all register moves needed

to pass through W, but this changed on the "high end"

cores.PIC cores have skip instructions which are used for

conditional execution and branching. The skip instructions are

'skip if bit set' and 'skip if bit not set'. Because cores

before PIC18 had only unconditional branch instructions,

conditional jumps are implemented by a conditional skip with

the opposite condition followed by an unconditional branch.

Skips are also of utility for conditional execution of any

immediate single following instruction.PIC has two stage

pipelie they run simultaneously to improve speed.The

instruction fetch stage gets the next instruction machine code

from program memory.The execution stage does whatever the

machine code calls.

4.3.1 PERIPHERAL FEATURES

The peripheral features of pic18f452 microcontroller are:

• High current sink/source 25 mA/25 mA

• Three external interrupt pins

• Timer0 module: 8-bit/16-bit timer/counter with 8-bit

programmable prescaler

• Timer1 module: 16-bit timer/counter

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 21

PROJECT REPORT PSOC BASED ROBOTIC ARM

• Timer2 module: 8-bit timer/counter with 8-bit period

register (time-base for PWM)

• Timer3 module: 16-bit timer/counter

• Secondary oscillator clock option - Timer1/Timer3

• Addressable USART module:

- Supports RS-485 and RS-232

• Two Capture/Compare/PWM (CCP) modules.

CCP pins that can be configured as:

- Capture input: capture is 16-bit,max. resolution

6.25 ns (TCY/16)

- Compare is 16-bit, max. resolution 100 ns (TCY)

- PWM output: PWM resolution is 1- to 10-bit,max.

10-bit resolution = 39 kHz

• Master Synchronous Serial Port (MSSP) module.

Two modes of operation:

- 3-wire SPI™ (supports all 4 SPI modes)

- I2C™ Master and Slave mode

4.3.2 ANALOG FEATURES

• Compatible 10-bit Analog-to-Digital Convertermodule (A/D)

with:

- Fast sampling rate

- Conversion available during SLEEP

- Linearity ≤ 1 LSb

• Programmable Low Voltage Detection (PLVD)

- Supports interrupt on-Low Voltage Detection

• Programmable Brown-out Reset (BOR)

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 22

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.3.3. SPECIAL MICROCONTROLLER FEATURES

• 100,000 erase/write cycle Enhanced FLASH program memory

typical

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

• FLASH/Data EEPROM Retention: > 40 years

• Self-reprogrammable under software control

• Power-on Reset (POR), Power-up Timer (PWRT) and Oscillator

Start-up Timer (OST)

• Watchdog Timer (WDT) with its own On-Chip RC Oscillator for

reliable operation

• Programmable code protection

• Power saving SLEEP mode

• Selectable oscillator options including:

- 4X Phase Lock Loop (of primary oscillator)

- Secondary Oscillator (32 kHz) clock input

• Single supply 5V In-Circuit Serial Programming™(ICSP™) via

two pins

• In-Circuit Debug (ICD) via two pins

4.3.4. CMOS TECHNOLOGY

• Low power, high speed FLASH/EEPROM technology

• Fully static design

• Wide operating voltage range (2.0V to 5.5V)

• Industrial and Extended temperature ranges

• Low power consumption:

- < 1.6 mA typical @ 5V, 4 MHz

- 25 μA typical @ 3V, 32 kHz

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 23

PROJECT REPORT PSOC BASED ROBOTIC ARM

- < 0.2 μA typical standby current

- < 2mA typical @ 7V, 5 MHz

• Flexible in nature

• Wide applications

4.3.5. BLOCK DIAGRAM OF PIC 18F452

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 24

PROJECT REPORT PSOC BASED ROBOTIC ARM

Fig no 4.5. Block diagram of pic

18f452

4.3.6. PIC18F452 HIGH END CORE DEVICES

Microchip introduced the PIC18 architecture in

2000. Unlike the 17 series, it has proven to be very popular,

with a large number of device variants presently in

manufacture. In contrast to earlier devices, which were more

often than not programmed in assembly, C has become the

predominant development language .

The 18 series inherits most of the features and

instructions of the 17 series, while adding a number of

important new features are given like much deeper call stack

31 levels deep, the call stack may be read and

written ,conditional branch instructions, indexed addressing

mode ,extending the FSR registers to 12 bits, allowing them to

linearly address the entire data address space,the addition of

another FSR register bringing the number up to 3 number. The

auto increment/decrement feature was improved by removing the

control bits and adding four new indirect registers per FSR.

Depending on which indirect file register is being accessed it

is possible to postdecrement, postincrement, or preincrement

FSR or form the effective address by adding W to FSR.

In more advanced PIC18 devices, an "extended

mode" is available which makes the addressing even more

favorable to compiled code include a new offset addressing

mode; some addresses which were relative to the access bank

are now interpreted relative to the FSR2 register, the

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 25

PROJECT REPORT PSOC BASED ROBOTIC ARM

addition of several new instructions, notable for manipulating

the FSR registers.

These changes were primarily aimed at improving

the efficiency of a data stack implementation. If FSR2 is used

either as the stack pointer or frame pointer, stack items may

be easily indexed—allowing more efficient re-entrant code.

Microchip's MPLAB C18 C compiler chooses to use FSR2 as a

frame pointer. In contrast to earlier devices, which were more

often than not programmed in assembly, C has become the

predominant development language .The series inherits most of

the features and instructions of the 17 series, while adding a

number of important new features are given like much deeper

call stack 31 levels deep, the call stack may be read and

written ,conditional branch instructions, indexed addressing

mode ,extending the FSR registers to 12 bits, allowing them to

linearly address the entire data address space, the addition

of another FSR register bringing the number up to 3 number and

allowing them to linearly address the entire data address

space to the additional bit in the system to have a dynamic

series.

Part

Numbe

r

Progr

am

memor

y

(16

bit

words

)

RAM

byt

es

Tot

al

Pin

s

I/

O

pi

ns

40-

pin

DIP

44-

pin

PLCC

44-

pin

TQFP

28-

pin

DIP

28-

pin

SOIC

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 26

PROJECT REPORT PSOC BASED ROBOTIC ARM

PIC

18F45

2

16384 153

6

40/

4433

2.058

*0.60

0”

0.690

*

0.690

0.472

*

0.472

PIC

18F44

28192 768 40/

4433

2.058

*0.60

0”

0.690

”*

0.690

0.472

”*

0.472

”PIC

18F25

216384 153

6

28 22

1.345

”*

0.300

0.704

*

0.407

PIC

18F24

2

8192 768 28 22

1.345

”*

0.300

0.704

”*

0.407

Table no 4.3.2:

Alternative family member parts

4.3.7 CHARACTERISTICS

Robustness: I/O pins can drive loads of up to 25 mA as

outputs and are protected against static electricity

damage as inputs.

Error recovery:The built-in watchdog timer, brown-out

reset circuitry, and low-voltage detect circuitry provide

alternative means for detecting an actual or impending

malfunction and dealing with it.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 27

PROJECT REPORT PSOC BASED ROBOTIC ARM

Support of low-power operation: In addition to being an

exceedingly power-stingy part, the PIC18F452

microcontroller can greatly extend battery life by

alternating intervals of low-power sleep mode with

intervals of normal operation. The watchdog timer can be

used to produce a low duty cycle and, thereby, a low

average power dissipation.

I/O expansion: The built-in serial peripheral interface

can make use of standard 16 pin shift-register parts to

add any number of I/O pins. The built-in I2C interface

supports the addition of specialty peripheral parts.

Math support: Microchip supports the PIC18F452

microcontroller with a variety of multiplication and

division subroutines for multiple-byte, fixed-point

numbers and for floating-point numbers.

Mail-order support: Digi-Key Corporation and Newark

Electronics provide both on-line and telephone purchasing

of PIC18FXXX.

Free software tools: To encourage new users and to support

upgrades to veteran users, Microchip makes its MPLAB®

Integrated Development Package application notes

available at no cost from their Web

Development tool versatility: The PIC18F452

microcontroller’s flash program memory supports not only

a standard emulator that includes the ability to capture

trace information, it also supports a low-cost in-circuit

debugger and a zero-cost QwikBug monitor program. .

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 28

PROJECT REPORT PSOC BASED ROBOTIC ARM

Fig no 4.7: family member partsof 18fxxx

4.4 DC MOTOR

A DC motor is an electric motor that runs

on direct current (DC) electricity. DC motors were used to run

machinery, often eliminating the need for a local steam engine

or internal combustion engine. DC motors can operate directly

from rechargeable batteries, providing the motive power for

the first electric vehicles. Today DC motors are still found

in applications as small as toys and disk drives, or in large

sizes to operate steel rolling mills and paper machines.

Modern DC motors are nearly always operated in conjunction

with power electronic devices.

Like all electric motors or generators, torque is

produced by the principle of Lorentz force, which states that

any current-carrying conductor placed within an external

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 29

PROJECT REPORT PSOC BASED ROBOTIC ARM

magnetic field experiences a torque or force known as Lorentz

force. Advantages of a brushed DC motor include low initial

cost, high reliability, and simple control of motor speed.

Disadvantages are high maintenance and low life-span for high

intensity uses. Maintenance involves regularly replacing the

brushes and springs which carry the electric current, as well

as cleaning or replacing the commutator.

Fig 4.8: DC motor

4.4.1. SERIES CONNECTION

A series DC motor connects the armature and field

windings in series with a common D.C. power source. This motor

has poor speed regulation since its speed varies approximately

inversely to load. However, a series DC motor has very high

starting torque and is commonly used for starting high inertia

loads, such as trains, elevators or hoists. With no mechanical

load on the series motor, the current is low, the magnetic

field produced by the field winding is weak, and so the

armature must turn faster to produce sufficient counter-EMF to

balance the supply voltage.

For some types of motor, the speed may be higher

than can be safely sustained by the motor. In a no-load

condition, the motor may increase its speed until the motor

mechanically destroys itself. This is called a runaway

condition. The speed/torque characteristic is also useful in

applications such as dragline excavators, where the digging

tool moves rapidly when unloaded but slowly when carrying a

heavy load.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 30

PROJECT REPORT PSOC BASED ROBOTIC ARM

Series motors called "universal motors" can be

used on alternating current. Since the armature voltage and

the field direction reverse at (substantially) the same time,

torque continues to be produced in the same direction. Since

the speed is not related to the line frequency, universal

motors can develop higher-than-synchronous speeds, making them

lighter than induction motors of the same rated mechanical

output.The valuable characteristic for hand-held power tools.

Universal motors for commercial power frequency are usually

small, However, much larger universal motors were used, fed by

special low-frequency traction power networks to avoid

problems with commutation under heavy and varying loads.

4.4.2. SHUNT CONNECTION

A shunt DC motor connects the armature and

field windings in parallel or shunt with a common D.C. power

source. This type of motor has good speed regulation even as

the load varies, but does not have as high of starting torque

as a series DC motor. It is

typically used for industrial, adjustable applications, such

as machine toolswinding/unwinding machines and tensioners.

4.4.3. COMPOUND CONNECTION

A compound DC motor connects the armature and

fields windings in a shunt and a series combination to give it

characteristics of both a shunt and a series DC motor. This

motor is used when both a high starting torque and good speed

regulation is needed. The motor can be connected in two

arrangements: cumulatively or differentially. Cumulative

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 31

PROJECT REPORT PSOC BASED ROBOTIC ARM

compound motors connect the series field to aid the shunt

field, which provides higher starting torque but less speed

regulation.

This motor is used when both a high starting

torque and good speed regulation is needed. The motor can be

connected in two arrangements: cumulatively or differentially.

Cumulative compound motors connect the series field to aid the

shunt field, which provides higher starting torque but less

speed regulation. Differential compound DC motors have good

speed regulation and are typically operated at constant speed.

Fig4.9: Dc motoroperation

4.5. ROBOTIC ARM

4.5.1 DESCRIPTION

A robotic arm is a robotic manipulator, usually

programmable, with similar functions to a human arm .Servo

motor is used for joint rotation. It has about same number of

degree of freedom as in human arm. Humans pick things up

without thinking about the steps involved. In order for a

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 32

PROJECT REPORT PSOC BASED ROBOTIC ARM

robot or a robotic arm to pick up or move something, someone

has to tell it to perform several actions in a particular

order — from moving the arm, to rotating the “wrist” to

opening and closing the “hand” or “fingers.” .So, we can

control each joint through computer interface

4.5.2 OVERVIEW

Degree of Freedom:4

Payload Capacity(Fully Extended) : 150gm

Maximum Reach(Fully Extended) : 35cm

Rated speed(Adjustable) : 0-0.3 m/s

Joint speed(Adjustable) : 0-60 rpm

Hardware interface : USB

Control Software : computer interface(GUI)

Shoulder Base Spin : 180°

Shoulder Pitch : 180°

Elbow Pitch : 180°

Wrist Pitch : 180°

Gripper Opening(Max) : 8cm

4.5.3 SAILENT FEATURES / INNOVATIONS

1. The arm has five servos which are controlled through

the use of only one microcontroller ATmega 16.

2. The arm could grab things approximately in a

hemisphere of 50cm and is robust made completely with an

aluminium sheet of 2.5mm.

3. The arm is very user friendly because of the

computer interface developed by us, even layman could

operate it.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 33

PROJECT REPORT PSOC BASED ROBOTIC ARM

4. That could lift objects upto weight of 200 gm.

5. Enabling the base rotation without the help of any

gears or ball bearing, also using only low torque servo

motors and three castor wheels for rotating the whole body.

6. Developing the graphical user interface using only

the functions, Instead of previously used matlab.

7. Keeping the design of robotic arm gripper simple, as

well as implementing the gripping mechanism without using

gears and with one servo motors.

What are Servo Motors?

Servo refers to an error sensing feedback control which is

used to correct the performance of a system. Servo or RC Servo

Motors are DC motors equipped with a servo mechanism for

precise control of angular position. The RC servo motors

usually have a rotation limit from 90° to 180°. But servos do

not rotate continually. Their rotation is restricted in

between the fixed angles.

Where are Servos used?

The Servos are used for precision positioning. They are used

in robotic arms and legs, sensor scanners and in RC toys like

RC helicopter, airplanes and cars.Servo Motor wiring and plugs

The Servo Motors come with three wires or leads. Two of these

wires are to provide ground and positive supply to the servo

DC motor. The third wire is for the control signal. These

wires of a servo motor are colour coded. The red wire is the

DC supply lead and must be connected to a DC voltage supply in

the range of 4.8 V to 6V. The black wire is to provide ground.

The colour for the third wire (to provide control signal)

varies for different manufacturers. It can be yellow (in case

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 34

PROJECT REPORT PSOC BASED ROBOTIC ARM

of Hitec), white (in case of Futaba), brown etc. Futaba

provides a J-type plug with an extra flange for proper

connection of the servo. Hitec has an S-type connector. A

Futaba connector can be used with a Hitec servo by clipping of

the extra flange. Also a Hitec connector can be used with a

Futaba servo just by filing off the extra width so that it

fits in well. Hitec splines have 24 teeth while Futaba splines

are of 25 teeth. Therefore splines made for one servo type

cannot be used with another. Spline is the place where a servo

arm is connected. It is analogous to the shaft of a common DC

motor. Unlike DC motors, reversing the ground and positive

supply connections does not change the direction (of rotation)

of a servo. This may, in fact, damage the servo motor. That is

why it is important to properly account for the order of wires

in a servo motor.

Servo Control

A servo motor mainly consists of a DC motor, gear system, a

position sensor which is mostly a potentiometer, and control

electronics. The DC motor is connected with a gear mechanism

which provides feedback to a position sensor which is mostly a

potentiometer. From the gear box, the output of the motor is

delivered via servo spline to the servo arm. The potentiometer

changes position corresponding to the current position of the

motor. So the change in resistance produces an equivalent

change in voltage from the potentiometer. A pulse width

modulated signal is fed through the control wire. The pulse

width is converted into an equivalent voltage that is compared

with that of signal from the potentiometer in an error

amplifier. The servo motor can be moved to a desired angular

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 35

PROJECT REPORT PSOC BASED ROBOTIC ARM

position by sending PWM (pulse width modulated) signals on the

control wire. The servo understands the language of pulse

position modulation. A pulse of width varying from 1

millisecond to 2 milliseconds in a repeated time frame is sent

to the servo for around 50 times in a second. The width of the

pulse determines the angular position. For example, a pulse of

1 millisecond moves the servo towards 0°, while a 2

milliseconds wide pulse would take it to 180°. The pulse width

for in between angular positions can be interpolated

accordingly. Thus a pulse of width 1.5 milliseconds will shift

the servo to 90°. It must be noted that these values are only

the approximations. The actual behavior of the servos differs

based on their manufacturer. A sequence of such pulses (50 in

one second) is required to be passed to the servo to sustain a

particular angular position. When the servo receives a pulse,

it can retain the corresponding angular position for next 20

milliseconds. So a pulse in every 20 millisecond time frame

must be fed to the servo. The required pulse train for

controlling the servo motor can be generated by a timer IC

such as 555 or a microcontroller can be programmed to generate

the required waveform. Refer Servo Motor interfacing with 8051

microcontroller and Servo control using AVR ATmega16.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 36

PROJECT REPORT PSOC BASED ROBOTIC ARM

Fig:4.10 Robotic Arm

Dexter ER1 Robotic Arm is a 5 Axis robotic Arm + Servo

Gripper. It uses 4 metal gear servo motors with 15Kg/cm torque

and two servo motors with 7Kg/cm torque. Robot Arm has 5

degrees of freedom which includes: Base rotation, Shoulder

rotation, Elbow rotation, Wrist pitch and roll. Robotic arm

comes preassembled along with versatile servo motor controller

which can simultaneously control 32 servo motors with velocity

trajectory profile at the same time, an advanced GUI with

Interface for robotic ARM motion profiling, and 5V-25A, 12V-5A

SMPS.

The Robotic arm is made up of high grade machined / injection

moulded aluminium alloy. The arm uses 4 x NRS-995 17Kg/cm dual

bearing, metal gear servo motors and light weight 2 x micro

servo motors.

Robotic Arm comes with 32 channel universal servo motor

controller board and GUI. Servo control board can control 32

servo motors simultaneously. Using the GUI, all axis of the

arm can be controlled. Using this GUI arm can also be taught

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 37

PROJECT REPORT PSOC BASED ROBOTIC ARM

sequences of motion using mouse. Robotic Arm is interfaced

with the PC using USB port. Arm can be programmed to execute

different types of motion profiles using any of the 5 servo

channels simultaneously.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 38

PROJECT REPORT PSOC BASED ROBOTIC ARM

4.5.4 SPECIFICATIONS

Mechanical Structure Vertical articulated

Number of Axes 5 axes plus servo gripper

Axis Movement

Axis 1: Base

rotation

Axis 2: Shoulder

rotation

Axis 3: Elbow

rotation

Axis 4: Wrist pitch

Axis 5: Wrist roll

180°

180°

180°

180°

180°

Maximum Operating

Radius300mm

End EffecterDC servo gripper with Parallel

finger motion

Maximum Gripper

Opening50mm

Hard Home Yes

Feedback Servo

Actuators 5VDC servo motors

Motor Capacity (axes

1–4)

Motor Capacity (axes

5)

Motor Capacity

17Kg/cm

7Kg/cm

7Kg/cm

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 39

PROJECT REPORT PSOC BASED ROBOTIC ARM

(gripper)

Maximum Payload 200gms (including gripper)

Weight 1.250Kgs

Ambient Operating

conditions

2°–40°C (36°–104°F) 10% to 90%

relative humidity

Power 5V-10Amp; 12V-2Amp (SMPS)

  Table 4.5.1 Speceficationsof Robotic Arm

4.5.5 STRUCTURE

Dexter ER1 Robotic Arm is a vertical articulated robot, with

five revolute joints. This design permits the end effectors to

be positioned and oriented arbitrarily with in a large work

space.

Fig:4.12 Structure of Robotic arm

Axis

No.

Joint

NameMotion

Motor

No.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 40

PROJECT REPORT PSOC BASED ROBOTIC ARM

1 Base Rotates the body 1

2 Shoulder Raises and lowers the upper arm 2

3 Elbow Raises and lowers the forearm 3

4Wrist

Pitch

Raises and lowers the end

effector (gripper)4 + 5

5Wrist

Roll

Rotates the end effector

(gripper)4 + 5

- Gripper Grips the object 6

Table:4.5.2 Working of Robotic Arm

4.5.6. BASIC SYSTEM COMPONENT AND FUNCTIONALITIES

4.5.6.1. The mechanics

Actuators: 5 Axis Robotic Arm that delivers fast

accurate and repeatable movement .The robot features base

rotation, shoulder, elbow and wrist motion, with a functional

gripper to make five independent axis of movement. Here it can

move in it’s axis and there by it can do it’s function. Hence

the five axis robot is doing the function in basis of the

axis.

5 Axis Arm

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 41

PROJECT REPORT PSOC BASED ROBOTIC ARM

Fig no. 4.13: 5 Axis arm

Small lightweight gripper: To hold objects

Mobile base: To enable the robot with the facility of free

movement.

4.5.6. STEP DOWN TRANSFORMER Step down transformers are designed to reduceelectrical voltage. Their primary voltage is greater than

their secondary voltage. This kind of transformer "steps down"

the voltage applied to it. For instance, a step down

transformer is needed to use a 110v product in a country with

a 220v supply.

Step down transformers convert electrical voltage from

one level or phase configuration usually down to a lower

level. They can include features for electrical isolation,

power distribution, and control and instrumentation

applications. Step down transformers typically rely on the

principle of magnetic induction between coils to convert

voltage and/or current levels.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 42

PROJECT REPORT PSOC BASED ROBOTIC ARM

Step down transformers are made from two or more coils

of insulated wire wound around a core made of iron. When

voltage is applied to one coil (frequently called the primary

or input) it magnetizes the iron core, which induces a voltage

in the other coil,frequently called the secondary or output.

The turn’s ratio of the two sets of windings determines the

amount of voltage transformation.

An example of this would be: 100 turns on the primary

and 50 turns on the secondary, a ratio of 2 to 1. The ratio

between input and output voltage will stay constant.

Transformers should not be operated at voltages higher than

the nameplate rating, but may be operated at lower voltages

than rated. They can include features for electrical

isolation, power distribution, and control and instrumentation

applications.

Step down transformers can be considered nothing more

than a voltage ratio device. With step down transformers the

voltage ratio between primary and secondary will mirror the

"turn’s ratio" except for single phase smaller than 1 kva

which have compensated secondary’s. A practical application of

this 2 to 1 turn’s ratio would be a 480 to 240 voltage step

down. Note that if the input were 440 volts then the output

would be 220 volts. The ratio between input and output voltage

will stay constant. Transformers should not be operated at

voltages higher than the nameplate rating, but may be operated

at lower voltages than rated. Because of this it is possible

to do some non-standard applications using standard

transformers.Single phase step down transformers 1 kva and

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 43

PROJECT REPORT PSOC BASED ROBOTIC ARM

larger may also be reverse connected to step-down or step-up

voltages. Note: single phase step up or step down transformers

sized less than 1 KVA should not be reverse connected.

If reverse connected, the output voltage will be less

than desired. They can include features for electrical

isolation, power distribution, and control and instrumentation

applications. Step down transformers typically rely on the

principle of magnetic induction between coils to convert

voltage and/or current levels.

Fig 4.14. Step Down

Transformer

5. FUNCTIONAL DESCRIPTION OF THE CONTROLLER IC

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 44

PROJECT REPORT PSOC BASED ROBOTIC ARM

5.1. REGISTERS

The controller IC has two 8 bit registers, an

instruction register (IR) and a data register (DR). The IR

stores the instruction codes and address information for

display data RAM (DD RAM) and character generator RAM (CG

RAM). The IR can be written, but not read by the MPU. The DR

temporally stores data to be written to /read from the DD RAM

or CG RAM. The data written to DR by the MPU is automatically

written to the DD RAM or CG RAM as an internal operation.

When an address code is written to IR, the data is

automatically transferred from the DD RAM or CG RAM to the DR.

data transfer between the MPU is then completed when the MPU

reads the DR. likewise, for the next MPU read of the DR, data

in DD RAM or CG RAM at the address is sent to the DR

automatically. The MPU write of the DR, the next DD RAM or CG

RAM address is selected for the write operation.

The register selection table is as shown below: RS R/W

Operation 0 0 IR write as an internal operation 0 1 Read busy

flag (DB7) and address counter (DB0 to DB6) 1 0 DR write as an

internal operation (DR to DD RAM or CG RAM) 1 1 DR read as an

internal operation (DD RAM or CG RAM to DR).

5.2. BUSY FLAG

When the busy flag is1, the controller is in theinternal operation mode, and the next instruction will not be

accepted. When RS = 0 and R/W = 1, the busy flag is output to

DB7. The next instruction must be written after ensuring that

the busy flag is 0.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 45

PROJECT REPORT PSOC BASED ROBOTIC ARM

5.3. ADDRESS COUNTER

The address counter allocates the address for the DDRAM and CG RAM read/write operation when the instruction code

for DD RAM address or CG RAM address setting, is input to IR,

the address code is transferred from IR to the address

counter. After writing/reading the display data to/from the DD

RAM or CG RAM, the address counters increments/decrements by

one the address, as an internal operation. The data of the

address counter is output to DB0 to DB6 while R/W = 1 and RS =

0.

5.4. DISPLAY DATA RAM (DD RAM)

The characters to be displayed are written into the

display data RAM (DD RAM), in the form of 8 bit character

codes present in the character font table. The extended

capacity of the DD RAM is 80 x 8 bits i.e. 80 characters.

5.5. CHARATCER GENERATOR ROM (CG ROM)

The character generator ROM generates 5 x 8 dot

5 x 10 dot character patterns from 8 bit character codes. It

generates 208, 5 x 8 dot character patterns and 32, 5 x 10 dot

character patterns.Here it can be either of this type and om

generates 64,5 x 10 dot in the form of 8 bit character pattern

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 46

PROJECT REPORT PSOC BASED ROBOTIC ARM

by program, four character can be written. If the is developed

with a microprocessor, the designer has to go for external

memory.

5.6. CHARACTER GENERATOR RAM (CG RAM)

In the character generator RAM, the user canrewrite character patterns by program. For 5 x 8 dots, eight

character patterns can be written, and for 5 x 10 dots, four

character patterns can be written.

5.7 ADVANTAGES

If a system is developed with a microprocessor,

the designer has to go for external memory such as RAM, ROM or

EPROM and peripherals and hence the size of the PCB will be

large enough to hold all the required peripherals. But, the

micro controller has got all these peripheral facilities on a

single chip so development of a similar system with a micro

controller reduces PCB size and cost of the design.

One of the major differences between a micro

controller and a microprocessor is that a controller often

deals with bits , not bytes as in the real world application,

for example switch contacts can only be open or close,

indicators should be lit or dark and motors can be either

turned on or off an so forth.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 47

PROJECT REPORT PSOC BASED ROBOTIC ARM

5.8. APPLICATIONS

Microcontrollers we you use today is a kind of

miniature computer that you can find in all kinds of Gizmos.

Some examples of common, every-day products that have

microcontrollers are built-in. If it has buttons and a digital

display, chances are it also has a programmable

microcontroller brain. Every-Day the devices used by ourselves

that contain Microcontrollers. Here are some examples:

1. If your clock radio goes off, and you hit the snooze

button a few times in the morning, the first thing you do in

your day is interact with a microcontroller. Here with the

many examples in our day today live we can clearly understand

it the importance of the microcontroller in our life. As we

said before our action starts with the use of microcontroller

in a day

2. Heating up some food in the microwave oven and making a

call on a cell phone also involve operating microcontrollers.

Similarly many examples are there to illustrate the need of

microcontroller in day to day life.

3. Turning on the Television with a handheld remote,

playing a hand held game, using a calculator, and checking

your digital wrist watch.

All those devices have microcontrollers inside them,

which interact with you. Consumer appliances aren't the only

things that contain microcontrollers. Robots, machinery,

aerospace designs and other high-tech devices are also built

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 48

PROJECT REPORT PSOC BASED ROBOTIC ARM

with microcontrollers. Microcontrollers are designed for use

in sophisticated real time applications such as

1. Industrial Control.

2. Instrumentation.

They are used in industrial applications to control

1. Motor

2. Robotics

3. Discrete and continuous process control

4. In missile guidance and control

5. Telecommunication

6. Automobiles

7. For Scanning a keyboard

6. DATA MEMORY ORGANISATION

The data memory is implemented as static RAM.

Each register in the data memory has a 12-bit address,

allowing up to 4096 bytes of data memory. Figure 4-6and Figure

4-7 show the data memory organization forthe PIC18FXX2

devices.The data memory map is divided into as many as 16

banks that contain 256 bytes each. The lower 4 bits of the

Bank Select Register (BSR<3:0>) select which bank will be

accessed. The upper 4 bits for the BSR are not implemented.

The data memory contains Special Function

Registers (SFR) and General Purpose Registers (GPR). The SFRs

are used for control and status of the controller and

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 49

PROJECT REPORT PSOC BASED ROBOTIC ARM

peripheral functions, while GPRs are used for data storage and

scratch pad operations in the user’s application.

The SFRs start at the last location of Bank 15 (0xFFF)

and extend downwards. Any remaining space beyond the SFRs in

the Bank may be implemented as GPRs. GPRs start at the first

location of Bank 0 and grow upwards. Any read of an

unimplemented location will read as ’0’s.The entire data

memory may be accessed directly or indirectly. Direct

addressing may require the use of the BSR register. Indirect

addressing requires the use of a File Select Register (FS Rn)

and a corresponding Indirect File Operand (IND Fn). Each FSR

holds a 12-bit address value that can be used to access any

location in the Data Memory map without banking.

The instruction set and architecture allow operations

across all banks. This may be accomplished by indirect

addressing or by the use of the MOVFF instruction. The MOVFF

instruction is a two-word/two-cycle instruction that moves a

value from one register to another. To ensure that commonly

used registers (SFRs and select GPRs) can be accessed in a

single cycle, regardless of the current BSR values, an Access

Bank is implemented. A segment of Bank 0 and a segment of Bank

15 comprise the Access RAM. Section provides a detailed

description of the Access RAM. . To ensure that commonly used

registers (SFRs and select GPRs) can be accessed in a single

cycle, regardless of the current BSR values.

6.1. GENERAL PURPOSE REGISTER

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 50

PROJECT REPORT PSOC BASED ROBOTIC ARM

The register file can be accessed either directly or

indirectly. Indirect addressing operates using a File Select

Register and corresponding Indirect File Operand. The

operation of indirect addressing is shown .Enhanced MCU

devices may have banked memory in GPR area. GPRs are not

initialized by a Power-on Reset and are unchanged on all other

RESETS. Data RAM is available for use as GPR registers by all

instructions. The top half of Bank 15 (0xF80 to 0xFFF)

contains SFRs. All other banks of data memory contain GPR

registers, starting with Bank 0.

6.2. SPECIAL FUNCTION REGISTERS

The Special Function Registers (SFRs) are registers used

by the CPU and Peripheral Modules for controlling the desired

operation of the device. These registers are implemented as

static RAM. A list of these registers is given in Table 4-1

and Table 4-The SFRs can be classified into two sets; those

associated with the “core” function and those related to the

peripheral functions. Those registers related to the “core”

are described in this section, while those related to the

operation of the peripheral features are described in the

section of that peripheral feature.

The SFRs are typically distributed among the peripherals

whose functions they control. The unused SFR locations will be

unimplemented an dread as '0's. See Table for addresses for

the SFRs.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 51

PROJECT REPORT PSOC BASED ROBOTIC ARM

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 52

PROJECT REPORT PSOC BASED ROBOTIC ARM

7. SOFTWARE USED

7.1 EMBEDDED C

Looking around, we find ourselves to be surrounded by various

types of embedded systems. Be it a digital camera or a mobile

phone or a washing machine, all of them has some kind of

processor functioning inside it. Associated with each

processor is the embedded software. If hardware forms the body

of an embedded system, embedded processor acts as the brain,

and embedded software forms its soul. It is the embedded

software which primarily governs the functioning of embedded

systems. During infancy years of microprocessor based systems,

programs were developed using assemblers and fused into the

EPROMs. There used to be no mechanism to find what the program

was doing. LEDs, switches, etc. were used to check correct

execution of the program. Some ‘very fortunate’ developers had

In-circuit Simulators (ICEs), but they were too costly and

were not quite reliable as well.

As time progressed, use of

microprocessor-specific assembly-only as the programming

language reduced and embedded systems moved onto C as

the embedded programming language of choice. C is the most

widely used programming language for embedded

processors/controllers. Assembly is also used but mainly to

implement those portions of the code where very high timing

accuracy, code size efficiency, etc. are prime requirements.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 53

PROJECT REPORT PSOC BASED ROBOTIC ARM

Initially C was developed by Kernighan and Ritchie to fit into

the space of 8K and to write (portable) operating systems.

Originally it was implemented on UNIX operating systems. As it

was intended for operating systems development, it can

manipulate memory addresses. Also, it allowed programmers to

write very compact codes. This has given it the reputation as

the language of choice for hackers too. As assembly language

programs are specific to a processor, assembly language didn’t

offer portability across systems. To overcome this

disadvantage, several high level languages, including C, came

up. Some other languages like PLM, Modula-2, Pascal, etc. also

came but couldn’t find wide acceptance. Amongst those, C got

wide acceptance for not only embedded systems, but also for

desktop applications. Even though C might have lost its sheen

as mainstream language for general purpose applications, it

still is having a strong-hold in embedded programming. Due to

the wide acceptance of C in the embedded systems, various

kinds of support tools like compilers & cross-compilers, ICE,

etc. came up and all this facilitated development of embedded

systems using C.

Embedded systems programming is different from developing

applications on a desktop computers. Key characteristics of an

embedded system, when compared to PCs, are as follows:

Embedded devices have resource constraints (limited

ROM, limited RAM, limited stack space, less processing

power)

Components used in embedded system and PCs are

different; embedded systems typically uses smaller,

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 54

PROJECT REPORT PSOC BASED ROBOTIC ARM

less power consuming components.·         Embedded

systems are more tied to the hardware.

Two salient features of Embedded Programming are code speed

and code size. Code speed is governed by the processing power,

timing constraints, whereas code size is governed by available

program memory and use of programming language.  Goal of

embedded system programming is to get maximum features in

minimum space and minimum time.

Embedded systems are programmed using different type of

languages:

Machine Code

Low level language, i.e., assembly

High level language like C, C++, Java, etc.

Application level language like Visual Basic, scripts,

Access, etc.

 Assembly language maps mnemonic words with the binary machine

codes that the processor uses to code the instructions.

Assembly language seems to be an obvious choice for

programming embedded devices. However, use of assembly

language is restricted to developing efficient codes in terms

of size and speed. Also, assembly codes lead to higher

software development costs and code portability is not there.

Developing small codes are not much of a problem, but large

programs/projects become increasingly difficult to manage in

assembly language. Finding good assembly programmers has also

become difficult nowadays. Hence high level languages are

preferred for embedded systems programming.

Use of C in embedded systems is driven by following advantages

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 55

PROJECT REPORT PSOC BASED ROBOTIC ARM

It is small and reasonably simpler to learn, understand,

program and debug.

C Compilers are available for almost all embedded devices

in use today, and there is a large pool of experienced C

programmers.

Unlike assembly, C has advantage of processor-independence

and is not specific to any particular microprocessor/

microcontroller or any system. This makes it convenient

for a user to develop programs that can run on most of the

systems.

As C combines functionality of assembly language and

features of high level languages, C is treated as a

‘middle-level computer language’ or ‘high level assembly

language’

It is fairly efficient

It supports access to I/O and provides ease of management

of large embedded projects.

 Many of these advantages are offered by other languages also,

but what sets C apart from others like Pascal, FORTRAN, etc.

is the fact that it is a middle level language; it provides

direct hardware control without sacrificing benefits of high

level languages.Compared to other high level languages, C

offers more flexibility because C is relatively small,

structured language; it supports low-level bit-wise data

manipulation.

 Compared to assembly language, C Code written is more

reliable and scalable, more portable between different

platforms (with some changes). Moreover, programs developed in

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 56

PROJECT REPORT PSOC BASED ROBOTIC ARM

C are much easier to understand, maintain and debug. Also, as

they can be developed more quickly, codes written in C offers

better productivity. C is based on the philosophy ‘programmers

know what they are doing’; only the intentions are to be

stated explicitly. It is easier to write good code in C &

convert it to an efficient assembly code (using high quality

compilers) rather than writing an efficient code in assembly

itself. Benefits of assembly language programming over C are

negligible when we compare the ease with which C programs are

developed by programmers. Objected oriented language, C++ is

not apt for developing efficient programs in resource

constrained environments like embedded devices. Virtual

functions & exception handling of C++ are some specific

features that are not efficient in terms of space and speed in

embedded systems. Sometimes C++ is used only with very few

features, very much as C. Ada, also an object-oriented

language, is different than C++. Originally designed by the

U.S. DOD, it didn’t gain popularity despite being accepted as

an international standard twice (Ada83 and Ada95). However,

Ada language has many features that would simplify embedded

software development. Java is another language used for

embedded systems programming. It primarily finds usage in

high-end mobile phones as it offers portability across systems

and is also useful for browsing applications. Java programs

require Java Virtual Machine (JVM), which consume lot of

resources. Hence it is not used for smaller embedded devices.

Dynamic C and B# are some proprietary languages which are also

being used in embedded applications. Efficient embedded C

programs must be kept small and efficient; they must be

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 57

PROJECT REPORT PSOC BASED ROBOTIC ARM

optimized for code speed and code size. Good understanding of

processor architecture embedded C programming and debugging

tools facilitate this. So, what basically is different while

programming with embedded C is the mindset; for embedded

applications, we need to optimally use the resources, make the

program code efficient, and satisfy real time constraints, if

any. All this is done using the basic constructs, syntaxes,

and function libraries of ‘C’.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 58

PROJECT REPORT PSOC BASED ROBOTIC ARM

8. SCHEMATIC DIAGRAM AND PCB LAYOUT

8.1 SCHEMATIC DIAGRAM

8.2. PCB LAYOUT

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 59

PROJECT REPORT PSOC BASED ROBOTIC ARM

8.2.1 STEPS TO PCB DESIGN USING ORCAD

1.Design circuit using schematic entry package (Capture).

2.Generate netlist for PCB package.

3.Import netlist into PCB package(Layout Plus).

4.Place components,route signals.

5.Generate machining(Gerber) files for PCB plant.

6.Generate the diagram on the board.

7.hence the design is finished.

8.2.1. PCB LAYOUT DESIGN STEP

Run Layout. Choose File/New.

1)Select a “technology file” appropriate for your design.These

are in Program Files\Orcad\Layout Plus\data and set defaults

for things like track spacing.hole sizes etc.

2)Choose your netlist file (.mnl extension). If the

units(English/metric)are not the same

You wont be able to load it.Just go back to Capture and

generate the netlist again with the right units.

3)If some of your components chosen from the Orcad Capture

libraries did not have PCB

footprints.

8.3. DRAW BOARD OUTLINE

1)Click obstacle toolbar button.

2)Somewhere in design,right click,select new.

3)Right click again, select properties.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 60

PROJECT REPORT PSOC BASED ROBOTIC ARM

4)Left click to place one corner of board, and then right

click on successive corners.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 61

PROJECT REPORT PSOC BASED ROBOTIC ARM

9.MP LAB

MPLAB (IDE) is a free, integrated toolset for the

dev The current version of MPLAB IDE is version 8. It is a 32-

bit application on microsoft window and includes several free

software components  and MPLAB IDE also serves as a single,

unified graphical user interface for additional Microchip and

third-party software and hardware development tools.

The MPLAB X IDE is the new graphical, integrated debugging

tool set for all Based on the open-source NetBeans

platform, MPLAB X runs on Windows .Both

assembly and C programming languages can be used with MPLAB

IDE v8. Others may be supported through the use of third-party

programs.

Support for MPLAB IDE, along with sample code,

tutorials, and drivers can be found on Microchip's website.

MPLAB IDE v8 does not support Linux, Unix or Macintosh

operating systems.Developmentof and pic microcontroller.

9.1. MPLAB X IDE

MPLAB X is not a new version of the current

MPLAB IDE v8 framework but is instead based oracle's open-

source NetBeans platform. In addition to its predecessor's

functionalities and compatibility with Microchip's existing

development tools, the new IDE utilises many NetBeans features

allowing for user-interface improvements and performance

upgrades. This also includes highly-anticipated cross-platform

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 62

PROJECT REPORT PSOC BASED ROBOTIC ARM

support in MPLAB IDE, allowing development for PIC

microcontrollers on Mac OS X and Linux operating systems, in

addition to Windows. The MPLAB X IDE is the new graphical,

integrated debugging tool set for all Based on the open-source

NetBeans platform, MPLAB X runs on Windows .Both

assembly and C programming languages can be used with MPLAB

IDE v8.

10. ZIG BEE

While connecting computers through networks we need to

have set of rules/standards for the data to travel from one

computer to other computer. The right example for this can be

road traffic rules. It's self understood, why we need traffic

rules while driving, in same sense for the data packets to

travel from one computer terminal to other terminal they

should also follow set of rules and regulations. One such set

of rules for the networking traffic to follow is IEEE802

standards. It is developed by IEEE. The IEEE is the world's

leading professional association for the advancement of

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 63

PROJECT REPORT PSOC BASED ROBOTIC ARM

technology. It's a non- profit organization offering its

members immense benefits. The standards such as IEEE 802 helps

industry provide advantages such as, interoperability, low

product cost, and easy to manage standards. IEEE standards

deal with only LAN and MAN.

When a message is sent over a

communication network, the message is sent as a packet. The

packets are pieces of data which are sent over communication

networks. These packets are sent with information concerning

the sender’s and receiver’s unique address, information which

tells the network how many packets are being sent and the

number of the particular packet. These packets travel via the

wireless protocol used by the network. For our purposes, the

packets will be sent directly between the monitor units and

the master controller. The protocol is able to incorporate

more complicated routing procedures which could be available

in future projects. When the packets are sent wirelessly, the

wireless network must adhere to a set of standards, or

protocol, which governs data representation, signaling,

authentication and error detection. ZigBee is a type of

protocol which allows for communication networks to transmit

in an unlicensed frequency band and serves mostly for

monitoring and controlling communication network.

ZigBee builds upon the 802.15-4

standard to define application profiles that can be shared

among different manufacturers. It is the suite of high level

communication protocol using small, low power digital radios

based on an IEEE 802 standard for personal area network. It is

for transmitting data over long distance.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 64

PROJECT REPORT PSOC BASED ROBOTIC ARM

10.ADVANTAGES AND APPLICATION

10.1 ADVANTAGES

High degree of accuracy.

Can be control from distant lengths.

Simplifying human efforts.

Need of labours can be reduced.

10.2 APPLICATION

The robotic arm can be designed to perform any desired task

such as welding, gripping, spinning etc., depending on the

application. For example robot arms in automotive assembly

line perform a variety of tasks such as wielding and parts

rotation and placement during assembly.

In space the space shuttle Remote Manipulator System have

multi degree of freedom robotic arms that have been used

to perform a variety of tasks such as inspections of the

Space Shuttle using a specially deployed boom with

cameras and sensors attached at the end effector.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 65

PROJECT REPORT PSOC BASED ROBOTIC ARM

The robot arms can be autonomous or controlled manually

and can be used to perform a variety of tasks with great

accuracy. The robotic arm can be fixed or mobile (i.e.

wheeled) and can be designed for industrial or home

applications. Robotic hands often have built-in pressure

sensors that tell the computer how hard the robot is

gripping a particular object. This keeps the robot from

dropping or breaking whatever it's carrying. Other end

effectors include blowtorches, drills and spray painters

this improves their performance.

In medical science: "Neuroarm" uses miniaturized tools

such as laser scalpels with pinpoin1t accuracy and it can

also perform soft tissue manipulation, needle insertion,

suturing, and cauterization.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 66

PROJECT REPORT PSOC BASED ROBOTIC ARM

11. CONCLUTION

We developed a robotic arm capable of working according to hand gesture of the user with remote access using flux sensor and PSoC module.

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 67

PROJECT REPORT PSOC BASED ROBOTIC ARM

PROGRAM CODE

11.1 PROGRAM CODE FOR PIC 18F452

//PROGRAM FOR BASE AND ELBOW ROTATION

#include<htc.h>#define _XTAL_FREQ 12000000#define base1 RC0#define base2 RC1#define move1 RD2#define move2 RD3#define elbow1 RC2#define elbow2 RC3#define grip1 RD0#define grip2 RD1char buffer[10];unsigned char count=0;bit rcve_flag=0,baseclockwise=0,elbowdwn=0,elbowup=0,baseanticlockwise=0,basestop=0,pick=0,place=0,moveforward=0,movebackward=0,timer_bit=0,wriststop=0,elbostop=0;//unsigned char *c;bit flag=0;void puts_serial2(unsigned char *c);void put_serial2(unsigned char c);void my_delay(int del){ while(--del) { __delay_ms(10); }}void puts_serial2(unsigned char *c){

while(*c)put_serial2(*c++);

}

void put_serial2(unsigned char c){

while(!TRMT);TXREG=c;

}

void contol_arms()

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 68

PROJECT REPORT PSOC BASED ROBOTIC ARM

{ if(baseclockwise) { baseclockwise=0; base1=1; base2=0; }else if(baseanticlockwise){ baseanticlockwise=0; base1=0; base2=1;}else if(basestop){basestop=0;base1=0;base2=0;}

else if(pick){ pick=0; grip1=1; grip2=0; T0CON=0b00000011; TMR0ON=1;}else if(place){ place=0; grip1=0; grip2=1; T0CON=0b00000011; TMR0ON=1;}else if(moveforward){ moveforward=0; move1=1; move2=0; //T0CON=0b00000100; //TMR0ON=1;}else if(wriststop){ wriststop=0; move1=0;

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 69

PROJECT REPORT PSOC BASED ROBOTIC ARM

move2=0;} else if(movebackward){ movebackward=0; move1=0; move2=1; //T0CON=0b00000100; //TMR0ON=1;}else if(elbowup){ elbowup=0; elbow1=1; elbow2=0; //T0CON=0b00000100; //TMR0ON=1;}

else if(elbowdwn) { elbowdwn=0; elbow1=0; elbow2=1; //T0CON=0b00000100; //TMR0ON=1; }else if(elbostop){elbostop=0;elbow1=0;elbow2=0;//T0CON=0b00000100;//TMR0ON=1;}}void interrupt rec(){

if(RCIF){

RCIF=0;buffer[count]=RCREG;

if(buffer[count-1]==0x0D&& buffer[count]==0x0A) { rcve_flag=1; count=0; }

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 70

PROJECT REPORT PSOC BASED ROBOTIC ARM

count++; }

if(INT0IF){

INT0IF=0;flag=1;

}if(TMR0IF){ TMR0IF=0;

timer_bit=1; TMR0ON=0; } }

main(){ GIE=1; PEIE=1; INT0IE=1; TMR0IE=1; T0CON=0b00000100; SYNC=0; RCIE=1; SPEN=1; BRGH=0;// ***change made*** SPBRG=19;// ***change made*** CREN=1; TRISC=0; TRISC7=1; TRISD=0; TRISB0=1; TRISC6=0; TXEN=1; base1=0; base2=0; move1=0; move2=0; elbow1=0; elbow2=0; grip1=0; grip2=0; while(!TRMT); TXREG='A'; while(1) { if(rcve_flag)

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 71

PROJECT REPORT PSOC BASED ROBOTIC ARM

{ rcve_flag=0; count=0; switch(buffer[0]) { case 'B':if(buffer[1]=='R'&&buffer[2]=='C'&&buffer[3]=='W')

baseclockwise=1; else

if(buffer[1]=='R'&&buffer[2]=='A'&&buffer[3]=='W') baseanticlockwise=1; else if(buffer[1]=='S'&&buffer[2]=='R'&&buffer[3]=='L')

basestop=1; break;

case 'G':if(buffer[1]=='N'&&buffer[2]=='0'&&buffer[3]=='0')

pick=1; else

if(buffer[1]=='P'&&buffer[2]=='0'&&buffer[3]=='0')place=1;

break;

case 'W':if(buffer[1]=='N'&&buffer[2]=='0'&&buffer[3]=='0')movebackward=1;

else if(buffer[1]=='P'&&buffer[2]=='0'&&buffer[3]=='0')

moveforward=1; else if(buffer[1]=='S'&&buffer[2]=='R'&&buffer[3]=='L')

wriststop=1; break;

case 'E':if(buffer[1]=='N'&&buffer[2]=='0'&&buffer[3]=='0')elbowup=1;

else if(buffer[1]=='P'&&buffer[2]=='0'&&buffer[3]=='0')

elbowdwn=1; else if(buffer[1]=='S'&&buffer[2]=='R'&&buffer[3]=='L')

elbostop=1; break; } contol_arms(); } if(timer_bit) { timer_bit=0; if(elbowup==1 || elbowdwn==1)

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 72

PROJECT REPORT PSOC BASED ROBOTIC ARM

{ elbowup=0; elbowdwn=0;

elbow1=0; elbow2=0;

} else if(pick==1 || place==1) { pick=0; place=0; grip1=0; grip2=0; }

else if(moveforward==1 || movebackward==1) { moveforward=0; movebackward=0; move1=0; move2=0; }

}

if(flag) { flag=0; puts_serial2("AT+CMGF=1\r"); puts_serial2("AT+CMGS=\""); puts_serial2("9544656395\"\r"); my_delay(10); puts_serial2("BOMB DETECTED"); my_delay(10); put_serial2(26); flag=0; }

}}

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 73

PROJECT REPORT PSOC BASED ROBOTIC ARM

PROGRAM CODE FOR PSOC

/* ========================================

*

* Copyright YOUR COMPANY, THE YEAR

* All Rights Reserved

* UNPUBLISHED, LICENSED SOFTWARE.

*

* CONFIDENTIAL AND PROPRIETARY INFORMATION

* WHICH IS THE PROPERTY OF your company.

*

* ========================================

*/

#include <device.h>

#include <global.h>

void main()

{

CYGlobalIntEnable;

uint8 adcresult[4];

uint8 chanel_no=0,present_0=0,previous_0=0,present_1=0,previous_1=0,present_2=0,previous_2=0,present_3=0,previous_3=0,present_4=0,previous_4=0;

AMuxSeq_Start();

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 74

PROJECT REPORT PSOC BASED ROBOTIC ARM

PGA_Start();

ADC_Start();

UART_Start();

flag=1;

while(1)

{

AMuxSeq_Next();

ADC_StartConvert();

ADC_IsEndConversion(ADC_WAIT_FOR_RESULT);

ADC_StopConvert();

chanel_no=AMuxSeq_GetChannel();

adcresult[chanel_no]=ADC_GetResult8();

switch(chanel_no)

{

case 0:

if(( adcresult[0]>0)&&( adcresult[0]<25))

{

present_0=1;

}

else if(( adcresult[0]>26)&&( adcresult[0]<55))

{

present_0=2;

}

else if(( adcresult[0]>56)&&( adcresult[0]<80))

{

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 75

PROJECT REPORT PSOC BASED ROBOTIC ARM

present_0=3;

}

else if(( adcresult[0]>81)&&( adcresult[0]<105))

{

present_0=4;

}

else if(( adcresult[0]>106)&&( adcresult[0]<130))

{

present_0=5;

}

else if(( adcresult[0]>131)&&( adcresult[0]<155))

{

present_0=6;

}

else if(( adcresult[0]>156)&&( adcresult[0]<180))

{

//UART_PutString("BSRL\r\n");

present_0=7;

}

else if(( adcresult[0]>181)&&( adcresult[0]<205))

{

//UART_PutString("BSRL\r\n");

present_0=8;

}

else if(( adcresult[0]>206)&&( adcresult[0]<225))

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 76

PROJECT REPORT PSOC BASED ROBOTIC ARM

{

present_0=9;

}

else if(( adcresult[0]>226)&&( adcresult[0]<255))

{

present_0=10;

}

else if(( adcresult[0]>256)&&( adcresult[0]<300))

{

present_0=11;

}

if(present_0!=previous_0)

{

if((present_0-previous_0)>0)

{

UART_PutString("GN00\r\n");

intr_Start();

Timer_Start();

}

else if((present_0-previous_0)<0)

{

UART_PutString("GP00\r\n");

intr_Start();

Timer_Start();

}

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 77

PROJECT REPORT PSOC BASED ROBOTIC ARM

previous_0=present_0;

}

break;

case 1:

if(( adcresult[1]>31)&&( adcresult[1]<100))

{

present_1=1;

}

else if(( adcresult[1]>101)&&( adcresult[1]<150))

{

present_1=2;

}

else if(( adcresult[1]>151)&&( adcresult[1]<200))

{

UART_PutString("BSRL\r\n");

present_1=3;

}

else if(( adcresult[1]>201)&&( adcresult[1]<255))

{

present_1=4;

}

if(present_1!=previous_1)

{

if((present_1-previous_1)>0)

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 78

PROJECT REPORT PSOC BASED ROBOTIC ARM

{

UART_PutString("BRCW\r\n");

intr_Start();

Timer_Start();

}

else if((present_1-previous_1)<0)

{

UART_PutString("BRAW\r\n");

intr_Start();

Timer_Start();

}

previous_1=present_1;

}

break;

case 2:

if(( adcresult[2]>30)&&( adcresult[2]<100))

{

present_2=1;

}

else if(( adcresult[2]>101)&&( adcresult[2]<150))

{

present_2=2;

}

else if(( adcresult[2]>151)&&( adcresult[2]<200))

{

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 79

PROJECT REPORT PSOC BASED ROBOTIC ARM

// present_2=3;

UART_PutString("WN00\r\n");

}

else if(( adcresult[2]>201)&&( adcresult[2]<255))

{

present_2=4;

}

if(present_2!=previous_2)

{

if((present_2-previous_2)>0)

{

UART_PutString("WSRL\r\n");

//UART_PutCRLF("");

intr_Start();

Timer_Start();

}

else if((present_2-previous_2)<0)

{

//UART_PutString("WP00 ");

UART_PutString("WP00\r\n");

intr_Start();

Timer_Start();

}

previous_2=present_2;

}

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 80

PROJECT REPORT PSOC BASED ROBOTIC ARM

break;

case 3:

if(( adcresult[3]>30)&&( adcresult[3]<100))

{

present_3=1;

}

else if(( adcresult[3]>101)&&( adcresult[3]<150))

{

present_3=2;

}

else if(( adcresult[3]>151)&&( adcresult[3]<200))

{

//present_3=3;

UART_PutString("EN00\r\n");

}

else if(( adcresult[3]>201)&&( adcresult[3]<255))

{

present_3=4;

}

if(present_3!=previous_3)

{

if((present_3-previous_3)>0)

{

intr_Start();

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 81

PROJECT REPORT PSOC BASED ROBOTIC ARM

Timer_Start();

UART_PutString("ESRL\r\n");

}

else if((present_3-previous_3)<0)

{

UART_PutString("EP00\r\n");

intr_Start();

Timer_Start();

}

previous_3=present_3;

}

break;

default:break;

}

}

}

/* [] END OF FILE */

DEPT OF ECE, PALAKKAD INSTITUTE OF SCIENCE AND TECHNOLOGY 82