You are on page 1of 40

Chapter 1

Design Objective

The main objectives of the project are (1) to be able to design and construct a robot arm, and
(2) to be able to control and Reprogram the robot arm in real time. The first object is very
straightforward it requires the modern designing capacities. In order to fulfill this objective,
we must have to know the basic joints in the human arm. After studying the basic joint in
human arm we designed the arm that functions same as that of human arm with the help of
Servo motors. The second objective requires the programing skills and also some knowledge
of the controller. With the help of programed micro-controller, we fulfilled our second
objective.

An additional objective will be to program the robot arm to do a simple task. This option, if
to be implemented with accuracy and precision, requires a more challenging task of
familiarizing the science of kinematics both forward and reverse kinematics. However, the
implementation used for the automation of this robot arm is time-based. This means that when
automating the robot arm, a program records the length of time of a certain joint from moving
from one position to another. This kind of automation, however, is not very accurate or precise
since it doesnt take into consideration the actual load that the arm is carrying.

1
Chapter 2

System Description

2.1 Introduction

The word robot is derived from the Czechoslovakian term robota which is generally translated
as forced labor. This means that the original conception of a robot, as far the etymology of
the word is concerned, was to be a capable servant. It was first used in the play by the
Czechoslovakian author Karel Capek entitled R.U.R. (Rossum's Universal Robots). In the
play, robots were portrayed as small, artificial and anthropomorphic creatures strictly obeying
their master's orders. From this humble conception, many authors began getting inspirations
from the concept of a robot. The most famous of all the authors that wrote about robots is
Isaac Asimov. He was the one who formulated the four laws of robots:

1. A robot may not injure humanity, or through inaction, allow humanity to come to
harm.
2. A robot may not injure or harm a human being, or through inaction, allow a human
being to come to harm.
3. A robot must obey orders given to it by human beings, except where such orders
would conflict the 0th or 1st law.
4. A robot must protect its own existence as long as such protection does not conflict
with the previous laws. As time passed, people began formulating an encompassing
definition of a robot.

As currently defined, robots exhibit three key elements:

1. Programmability, implying computational or symbolic manipulative capabilities that


a designer can combine as desired (a robot is a computer)
2. Mechanical capability, enabling it to act on its environment rather than merely
function as a data processing or a computational device (a robot is a machine).
3. Flexibility in that it can operate using a range of programs and manipulates and
transport materials in a variety of ways.

This kind of description does not sway too far from what really most robots in the world are
doing. Most robots used nowadays are designed for heavy, repetitive manufacturing work.
They are specifically designed to handle certain tasks that are difficult, dangerous, or to boring

2
to human beings. Robots can do more work more efficiently than humans can since robots
are precise. They always do the same task with such precision over and over no matter how
long they have worked. Robots nowadays are becoming more and more important in most
industries of the world.

The most common of all these manufacturing robots is the robot arm. A typical robot arm is
made up of seven segments joined by six joints. Usually a servo motor is used in order to
track the movement of the robot arm. The reason for this is quite obvious since servo motors
are designed to move in exact increments unlike DC motors. With such configurations, a
computer may be able to control or manoeuvre the robot very precisely, repeating exactly the
same environment over and over again.

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 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

Some advanced robot arms make use of sensors like motion and pressure sensors in order for
it to detect foreign obstacles and avoid breaking or dropping what it is carrying. Robot arm
also vary with the type of end effector that they are using. While working in a fashion similar
to the human arm, robot arms can still have a much wider range of motion since their design
can be purely up to the imagination of their creator. The joint that connects the segments of a
robotic arm, for example, can rotate as well as moving like a hinge. The end of the robotic
arm designed to actually do the work that it was designed for is known as the end effector,
and can be designed for practically any task. The kind of end effector that a particular robot
arm is using is very much dependent on the kind of task the robot is designed for:

1. For pick and place applications.


2. Blowtorches for auto assembly lines robots.
3. Drills for metal application robots.
4. Spray paints for decoration oriented robots.
5. For welding purpose.

3
Autonomous robotic arms are designed to be programmed and then left alone to repeat their
tasks independent of human control. Conversely, a robotic arm can also be designed to be
operated and controlled by a human being. A situation where human-controlled robotic arms
are essential is in space exploration, where robotic arms can be used to manipulate a heavy
payload or do other work in space that would be difficult or even impossible for an astronaut
to do.

4
2.2 Flow Chart

Micro servo robot is an autonomous robotic arm that can be programed in a real time using a
teach arm that is same as that of the actual arm except the fact that in actual arm has motor
that works as an actuators and the teach arm has a potentiometer that works as a sensor to
send the voltage according to the movement to the microcontroller and applies it to the actual
arm. So according to previous description we can easily understand that our micro servo robot
works in 2 Modes:

2.2.1 Teach Mode: As we already discussed that there are two arms teach arm and actual
arm. In this mode we teach the robot threw the motion of teach arm. To store the moment into
the controller we have to press the button 1 when we press the button 1 the voltage according
to the moment of teach arm. The detailed step wise explanation is as follows:

Step 1: Move the teach arm and observe the moment of actual arm to perform the function
specified.

Step 2: As we move the teach arm from the joint the resistance value of the pot is changed
due to the resistance change the voltage drop across the pot changes therefore change in the
output voltage of the potentiometer.

Step 3: These voltages are read by the microcontroller.

Step 4: Micro controller maps the analog voltage from the pot threw the pin A0, A1, A2, A3
from 1 to 1023 to 0 to 180 or 180 to 0. As the servo motors uses the PWM wave for its
function therefore mapping is necessary.

Step 5: The mapped value is provided to PWM pin D6, D9, D10 and D11 where we connected
the motors that worked as actuators.

Step 6: The microcontroller checks the Digital pin 4 if the value of Digital pin is 0 means the
button 1 is pressed then controller will store the mapped value to the counters as specified in
program.

Step 7: Microcontroller waits for small duration then increment the counter.

Step 8: Otherwise if button 1 is not pressed microcontroller, then the value is discarded. And
start wait for 250 ms then start from step 1

5
Step 9: Microcontroller checks the button 2 that is connected to the Digital pin 5. If the value
is 0 means button is pressed, then play mode is started that is explained in next part.

Step 10: Otherwise if button 2 is not pressed then controller waits for 250 ms and start from
step 1.

6
Fig 1: Flowchart of Teach Mode

7
2.2.2 Play Mode

In this mode the arm moves according to the stored movement in the memory.in order to start
the Play Mode Double press the button switch to play mode. The sketch reads the array step
by step and moves the robot arm. For cool locking movements i added a routine calculates
different micro steps for each servo to have moving start and end sync on all axis. Also added
a ramp for soft increase/decrease velocity. Shorter travel distances the robot does slow, longer
distances with faster speed. Its all about timing so my thoughts in this moment. the step
followed by the microcontroller in play mode are explained as follows:

Step 1: When the button 2 is pressed the control is transferred to the play mode.

Step 2: First the array pointer is incremented by 1 so the values are at the top of counter.

Step 3: Microcontroller reads the values stored in the counter during teach mode from the
counter.

Step 4: Microcontroller calculate the distance and micro steps servo motor has to move in
order according to the value.

Step 5: After calculating the micro steps micro controller applies that values to the digital
PWM pins threw which we connected the servo motor.

Step 6: The movement of servo consist of one or more than one steps called micro steps so
counter will check that the steps are done or not. If they are done then in order to extract the
next movement again step 1 is followed.

Step 7: Else if the steps are not done then control will transfer to step 5.

Step 8: If steps are not done then controller will check for the pause switch and controls the
movement.

Step 9: Controller will repeat the function till reset switch is pressed.

8
Fig 2: Flowchart of Play Mode

9
2.3 System Block Diagram & Description

As we already discussed our robot will work in two modes play mode and teach mode so
therefore its block diagram is divided in two parts one is for reading the movements and other
is for applying the values. The block diagram of micro servo robot is shown below.

Fig 3: Micro Servo Robot Block Diagram

As shown in above block diagram the micro servo robot mainly contains four blocks that are
described as follows.

1. Processor: we used micro controller as processor for the micro servo. A microcontroller
is a small computer (SoC) on a single integrated circuit containing a processor core, memory,
and programmable input/output peripherals. Program memory in the form of Ferroelectric
RAM, NOR flash or OTP ROM is also often included on chip, as well as a typically small
amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the
microprocessors used in personal computers or other general purpose applications consisting
of various discrete chips.

Microcontrollers are used in automatically controlled products and devices, such as


automobile engine control systems, implantable medical devices, remote controls, office
machines, appliances, power tools, toys and other embedded systems. By reducing the size

10
and cost compared to a design that uses a separate microprocessor, memory, and input/output
devices, microcontrollers make it economical to digitally control even more devices and
processes. Mixed signal microcontrollers are common, integrating analog components
needed to control non-digital electronic systems.

Some microcontrollers may use four-bit words and operate at clock rate frequencies as low
as 4 kHz, for low power consumption (single-digit milliwatts or microwatts). They will
generally have the ability to retain functionality while waiting for an event such as a button
press or other interrupt; power consumption while sleeping (CPU clock and most peripherals
off) may be just nanowatts, making many of them well suited for long lasting battery
applications. Other microcontrollers may serve performance-critical roles, where they may
need to act more like a digital signal processor (DSP), with higher clock speeds and power
consumption.

Types of Microcontroller:

As of 2008, there are several dozen microcontroller architectures and vendors including:

ARM core processors (many vendors)


ARM Cortex-M cores are specifically targeted towards microcontroller applications
Atmel AVR (8-bit), AVR32 (32-bit), and AT91SAM (32-bit)
Cypress Semiconductor's M8C Core used in their PSoC (Programmable System-on-
Chip)
Freescale ColdFire (32-bit) and S08 (8-bit)
Freescale 68HC11 (8-bit), and others based on the Motorola 6800 family
Intel 8051, also manufactured by NXP Semiconductors, Infineon and many others
Infineon: 8-bit XC800, 16-bit XE166, 32-bit XMC4000 (ARM based Cortex M4F),
32-bit TriCore and, 32-bit Aurix Tricore Bit microcontrollers[18]
MIPS
Microchip Technology PIC, (8-bit PIC16, PIC18, 16-bit dsPIC33 / PIC24), (32-bit
PIC32)
NXP Semiconductors LPC1000, LPC2000, LPC3000, LPC4000 (32-bit), LPC900,
LPC700 (8-bit)
Parallax Propeller
PowerPC ISE

11
Rabbit 2000 (8-bit)
Renesas Electronics: RL78 16-bit MCU; RX 32-bit MCU; SuperH; V850 32-bit
MCU; H8; R8C 16-bit MCU
Silicon Laboratories Pipelined 8-bit 8051 Microcontrollers and mixed-signal ARM-
based 32-bit microcontrollers
STMicroelectronics STM8 (8-bit), ST10 (16-bit) and STM32 (32-bit)
Texas Instruments TI MSP430 (16-bit), MSP432 (32-bit), C2000 (32-bit)
Toshiba TLCS-870 (8-bit/16-bit)

Many others exist, some of which are used in very narrow range of applications or are more
like applications processors than microcontrollers. The microcontroller market is extremely
fragmented, with numerous vendors, technologies, and markets. Note that many vendors sell
or have sold multiple architectures.

2. Analog Sensors: In the broadest definition, a sensor is an object whose purpose is to


detect events or changes in its environment, and then provide a corresponding output. A
sensor is a type of transducer; sensors may provide various types of output, but typically use
electrical or optical signals. For example, a thermocouple generates a known voltage (the
output) in response to its temperature (the environment). A mercury-in-glass thermometer,
similarly, converts measured temperature into expansion and contraction of a liquid, which
can be read on a calibrated glass tube.

Sensors are used in everyday objects such as touch-sensitive elevator buttons (tactile sensor)
and lamps which dim or brighten by touching the base, besides innumerable applications of
which most people are never aware. With advances in micromachinery and easy-to-use micro
controller platforms, the uses of sensors have expanded beyond the most traditional fields of
temperature, pressure or flow measurement, for example into MARG sensors. Moreover,
analog sensors such as potentiometers and force-sensing resistors are still widely used.
Applications include manufacturing and machinery, airplanes and aerospace, cars, medicine,
and robotics.it is also included in our day-to-day life.

A sensor's sensitivity indicates how much the sensor's output changes when the input quantity
being measured changes. For instance, if the mercury in a thermometer moves 1 cm when the
temperature changes by 1 C, the sensitivity is 1 cm/C (it is basically the slope Dy/Dx
assuming a linear characteristic). Some sensors can also have an impact on what they

12
measure; for instance, a room temperature thermometer inserted into a hot cup of liquid cools
the liquid while the liquid heats the thermometer. Sensors need to be designed to have a small
effect on what is measured; making the sensor smaller often improves this and may introduce
other advantages. [citation needed] Technological progress allows more and more sensors to
be manufactured on a microscopic scale as micro sensors using MEMS technology. In most
cases, a micro sensor reaches a significantly higher speed and sensitivity compared with
macroscopic approaches.

3. Actuators: An actuator is a type of motor that is responsible for moving or controlling a


mechanism or system. It is operated by a source of energy, typically electric current, hydraulic
fluid pressure, or pneumatic pressure, and converts that energy into motion.
An actuator is the mechanism by which a control system acts upon an environment. The
control system can be simple (a fixed mechanical or electronic system), software-based (e.g.
a printer driver, robot control system), a human, or any other input. A rotary actuator is an
actuator that produces a rotary motion or torque.
The simplest actuator is purely mechanical, where linear motion in one direction gives rise to
rotation. The most common actuators though are electrically powered. Other actuators may
be powered by pneumatic or hydraulic power, or may use energy stored internally through
springs.
The motion produced by an actuator may be either continuous rotation, as for an electric
motor, or movement to a fixed angular position as for servomotors and stepper motors. A
further form, the torque motor, does not necessarily produce any rotation but merely generates
a precise torque which then either causes rotation, or is balanced by some opposing torque.
Stepper motors: Stepper motors are a form of electric motor that has the ability to move
in discrete steps of a fixed size. This can be used either to produce continuous rotation at a
controlled speed or to move by a controlled angular amount. If the stepper is combined with
either a position encoder or at least a single datum sensor at the zero position, it is possible to
move the motor to any angular position and so to act as a rotary actuator.
Servomotors: A servomotor is a packaged combination of several components: a
motor (usually electric, although fluid power motors may also be used), a gear train to reduce
the many rotations of the motor to a higher torque rotation, a position encoder that identifies
the position of the output shaft and an inbuilt control system. The input control signal to the
servo indicates the desired output position. Any difference between the position commanded
and the position of the encoder gives rise to an error signal that causes the motor and gear
13
train to rotate until the encoder reflects a position matching that commanded.A simple low-
cost servo of this type is widely used for radio-controlled models.
Other types: A recent, and novel, form of ultra-lightweight actuator uses memory
wire. As a current is applied, the wire is heated above its transition temperature and so changes
shape, applying a torque to the output shaft. When power is removed, the wire cools and
returns to its earlier shape.

Performance metrics

Performance metrics for actuators include speed, acceleration, and force (alternatively,
angular speed, angular acceleration, and torque), as well as energy efficiency and
considerations such as mass, volume, operating conditions, and durability, among others.

Force: When considering force in actuators for applications, two main metrics should be
considered. These two are static and dynamic loads. Static load is the force capability of the
actuator while not in motion. Conversely, the dynamic load of the actuator is the force
capability while in motion. The two aspects rarely have the same weight capability and must
be considered separately.
Speed: Speed should be considered primarily at a no-load pace, since the speed will
invariably decrease as the load amount increases. The rate the speed will decrease will directly
correlate with the amount of force and the initial speed.
Operating conditions: Actuators are commonly rated using the standard IP Code rating
system. Those that are rated for dangerous environments will have a higher IP rating than
those for personal or common industrial use.
Durability: This will be determined by each individual manufacturer, depending on
usage and quality.

4. Power Supply:

A power supply is an electronic device that supplies electric energy to an electrical load. The
primary function of a power supply is to convert one form of electrical energy to another and,
as a result, power supplies are sometimes referred to as electric power converters. Some
power supplies are discrete, stand-alone devices, whereas others are built into larger devices
along with their loads. Examples of the latter include power supplies found in desktop
computers and consumer electronics devices.

14
Every power supply must obtain the energy it supplies to its load, as well as any energy it
consumes while performing that task, from an energy source. Depending on its design, a
power supply may obtain energy from various types of energy sources, including electrical
energy transmission systems, energy storage devices such as a batteries and fuel cells,
electromechanical systems such as generators and alternators, solar power converters, or
another power supply.

All power supplies have a power input, which receives energy from the energy source, and a
power output that delivers energy to the load. In most power supplies the power input and
output consist of electrical connectors or hardwired circuit connections, though some power
supplies employ wireless energy transfers in lieu of galvanic connections for the power input
or output. Some power supplies have other types of inputs and outputs as well, for functions
such as external monitoring and control.

2.4 Schematic diagram

A schematic, or schematic diagram, is a representation of the elements of a system using


abstract, graphic symbols rather than realistic pictures. A schematic usually omits all details
that are not relevant to the information the schematic is intended to convey, and may add
unrealistic elements that aid comprehension. For example, a subway map intended for riders
may represent a subway station with a dot; the dot doesn't resemble the actual station at all
but gives the viewer information without unnecessary visual clutter. A schematic diagram of
a chemical process uses symbols to represent the vessels, piping, valves, pumps, and other
equipment of the system, emphasizing their interconnection paths and suppressing physical
details. In an electronic circuit diagram, the layout of the symbols may not resemble the layout
in the circuit. In the schematic diagram, the symbolic elements are arranged to be more easily
interpreted by the viewer.

We have used the Eagle pro software for the designing of the schematic diagram the
schematic prepared by the software is as shown in fig 3.

15
Fig 4: Micro Servo Robot Schematic diagram

2.5 List of components

Atmel ATmega328
micro servos
power supply
potentiometer
push button
Wires
Zip Ties and Glue

16
Atmega 328

In our days, there have been many advancement in the field of Electronics and many cutting
edge technologies are being developed every day, but still 8 bit microcontrollers have its own
role in the digital electronics market dominated by 16-32 & 64 bit digital devices. Although
powerful microcontrollers with higher processing capabilities exist in the market, 8bit
microcontrollers still hold its value because of their easy-to-understand-operation, very much
high popularity, ability to simplify a digital circuit, low cost compared to features offered,
addition of many new features in a single IC and interest of manufacturers and consumers.

Todays microcontrollers are much different from what it were in the initial stage, and the
number of manufacturers are much more in count than it was a decade or two ago. At present
some of the major manufacturers are Microchip (publication: PIC microcontrollers), Atmel
(publication: AVR microcontrollers), Hitachi, Phillips, Maxim, NXP, Intel etc. Our interest
is upon ATmega32. It belongs to Atmels AVR series micro controller family. Lets see the
features.

PIN count: Atmega32 has got 40 pins. Two for Power (pin no.10: +5v, pin no. 11: ground),
two for oscillator (pin 12, 13), one for reset (pin 9), three for providing necessary power and
reference voltage to its internal ADC, and 32 (48) I/O pins.

About I/O pins: ATmega32 is capable of handling analogue inputs. Port A can be used as
either DIGITAL I/O Lines or each individual pin can be used as a single input channel to the
internal ADC of ATmega32, plus a pair of pins AREF, AVCC & GND (refer to ATmega32
datasheet) together can make an ADC channel.

No pins can perform and serve for two purposes (for an example: Port A pins cannot work as
a Digital I/O pin while the Internal ADC is activated) at the same time. Its the programmers
responsibility to resolve the conflict in the circuitry and the program. Programmers are
advised to have a look to the priority tables and the internal configuration from the datasheet.

Digital I/O pins: ATmega32 has 32 pins (4portsx8pins) configurable as Digital I/O pins.

Timers: 3 Inbuilt timer/counters, two 8 bit (timer0, timer2) and one 16 bit (timer1).

ADC: It has one successive approximation type ADC in which total 8 single channels are
selectable. They can also be used as 7 (for TQFP packages) or 2 (for DIP packages)
differential channels. Reference is selectable, either an external reference can be used or the

17
internal 2.56V reference can be brought into action. There external reference can be
connected to the AREF pin.

Communication Options: ATmega32 has three data transfer modules embedded in it. They
are

Two Wire Interface


USART
Serial Peripheral Interface

Fig 5: Pinout of Atmega 328

18
Analog comparator: On-chip analog comparator is available. An interrupt is assigned for
different comparison result obtained from the inputs.

External Interrupt: 3External interrupt is accepted. Interrupt sense is configurable.

Memory: It has 32Kbytes of In-System Self-programmable Flash program memory, 1024


Bytes EEPROM, 2Kbytes Internal SRAM. Write/Erase Cycles: 10,000 Flash / 100,000
EEPROM.

Clock: It can run at a frequency from 1 to 16 MHz. Frequency can be obtained from external
Quartz Crystal, Ceramic crystal or an R-C network. Internal calibrated RC oscillator can also
be used.

More Features: Up to 16 MIPS throughput at 16MHz. Most of the instruction executes in a


single cycle. Two cycle on-chip multiplication. 32 8 General Purpose Working Registers

Debug: JTAG boundary scan facilitates on chip debug.

Programming: Atmega32 can be programmed either by In-System Programming via Serial


peripheral interface or by Parallel programming. Programming via JTAG interface is also
possible. Programmer must ensure that SPI programming and JTAG are not be disabled using
fuse bits; if the programming is supposed to be done using SPI or JTAG.

19
Fig 6: Block diagram of Atmega 328

20
Servo Motors: A servomotor is a rotary actuator or linear actuator that allows for precise
control of angular or linear position, velocity and acceleration. It consists of a suitable motor
coupled to a sensor for position feedback. It also requires a relatively sophisticated controller,
often a dedicated module designed specifically for use with servomotors.

Servomotors are not a specific class of motor although the term servomotor is often used to
refer to a motor suitable for use in a closed-loop control system.

Servomotors are used in applications such as robotics, CNC machinery or automated


manufacturing.

A servomotor is a closed-loop servomechanism that uses position feedback to control its


motion and final position. The input to its control is some signal, either analogue or digital,
representing the position commanded for the output shaft.

The motor is paired with some type of encoder to provide position and speed feedback. In the
simplest case, only the position is measured. The measured position of the output is compared
to the command position, the external input to the controller. If the output position differs
from that required, an error signal is generated which then causes the motor to rotate in either
direction, as needed to bring the output shaft to the appropriate position. As the positions
approach, the error signal reduces to zero and the motor stops.

The very simplest servomotors use position-only sensing via a potentiometer and bang-bang
control of their motor; the motor always rotates at full speed (or is stopped). This type of
servomotor is not widely used in industrial motion control, but it forms the basis of the simple
and cheap servos used for radio-controlled models.

More sophisticated servomotors use optical rotary encoders to measure the speed of the output
shaft and a variable-speed drive to control the motor speed. Both of these enhancements,
usually in combination with a PID control algorithm, allow the servomotor to be brought to
its commanded position more quickly and more precisely, with less overshooting.

To fully understand how the servo works, you need to take a look under the hood. Inside there
is a pretty simple set-up: a small DC motor, potentiometer, and a control circuit. The motor
is attached by gears to the control wheel. As the motor rotates, the potentiometer's resistance
changes, so the control circuit can precisely regulate how much movement there is and in
which direction.

21
When the shaft of the motor is at the desired position, power supplied to the motor is stopped.
If not, the motor is turned in the appropriate direction. The desired position is sent via
electrical pulses through the signal wire. The motor's speed is proportional to the difference
between its actual position and desired position. So if the motor is near the desired position,
it will turn slowly, otherwise it will turn fast. This is called proportional control. This means
the motor will only run as hard as necessary to accomplish the task at hand, a very efficient
little guy.

Fig 7: Micro servo motor

Fig 8: Servo motor Block diagram

22
Servos are controlled by sending an electrical pulse of variable width, or pulse width
modulation (PWM), through the control wire. There is a minimum pulse, a maximum pulse,
and a repetition rate.

A servo motor can usually only turn 90 degrees in either direction for a total of 180 degree
movement. The motor's neutral position is defined as the position where the servo has the
same amount of potential rotation in the both the clockwise or counter-clockwise direction.
The PWM sent to the motor determines position of the shaft, and based on the duration of the
pulse sent via the control wire; the rotor will turn to the desired position. The servo motor
expects to see a pulse every 20 milliseconds (ms) and the length of the pulse will determine
how far the motor turns. For example, a 1.5ms pulse will make the motor turn to the 90-degree
position. Shorter than 1.5ms moves it to 0 degrees, and any longer than 1.5ms will turn the
servo to 180 degrees.

Fig 9: Servo motor timing diagram

The exact PWM width is depend on the servo motor types and brands; on this tutorial we will
use the Parallax Continues Servo which using 1ms and 2ms respectively. The Parallax servo
motor consists of three wires colored with White, Red and Black. The Red and Black wires
go to the Vcc and Gnd, while the White wire is use to feed the PWM signal from the PIC
16F690 microcontroller I/O port.

23
Driving the servo motor using PIC 16F690 microcontroller might be simple as you thing at
the first time; we just use the PIC PWM peripheral to do the job (you could learn of how to
use the PIC PWM peripheral on the article H-Bridge Microchip PIC Microcontroller PWM
Motor Controller posted on this blog), but looking at the PIC 16F690 datasheet with the 8
Mhz of internal frequency clock (use in this tutorial) and using maximum prescaler of 16
(TIMER2) the minimum PWM frequency we could achieve can be calculated using this
formula:

PWM period = [( PR2 + 1) ] x 4 x Tosc x (TMR2 prescaler value) second

Using maximum PR2 register value of 0xFF (255 decimal), we will get this result:

PWM period = (255 + 1) x 4 x (1 / 8000000) x 16= 0.002048 second

PWM frequency = 1 / PWM period = 1 / 0.002048 = 488.28 Hz

The 488.28 Hz frequency is still too high from the servo motor working frequency of 50Hz;
therefore this leads us to these three methods bellow:

Keep using the PIC PWM peripheral and lower the operation frequency by setting the
OSCCON register and PR2 register until it meets the servo motor frequency requirement.
This approach will secrify the program execution speed as we will operate the PIC
Microcontroller with the 500 khz clock speed, so we simply not choose it.
Secondly, we create our own PWM function to mimic the PWM signal as follow: turn on
the PORT, make some 2 ms delay, turn off the PORT, and make some 18 ms delay and
so forth. This approach is what I called a dirty method which is not the efficient way to
do it, so we just drop this method.
The third approach is to use the PIC 16F690 microcontroller TIMER0 with the interrupt
to actually generate the PWM signal as the TIMER0 have wider prescaler to choose
comparing to the TIMER2, but unfortunately the PWM peripheral on the PIC 16F690
only work with TIMER2 not TIMER0. Therefore, we will make this TIMER0 as our
PWM base generator for driving the servo motor on this tutorial. The principal we learn
here could be applied to the other type of PIC Microcontroller or AVR Microcontroller
as well.

24
Power supply: In most of our electronic products or projects we need a power supply for
converting mains AC voltage to a regulated DC voltage. For making a power supply
designing of each and every component is essential. Here Im going to discuss the designing
of regulated 5V Power Supply.

Lets start with very basic things the choosing of components

Component List :

Step down transformer


Voltage regulator
Capacitors
Diodes

Lets get into detail of rating of the devices :

Transformer: A transformer is an electrical device that transfers electrical energy between


two or more circuits through electromagnetic induction. Electromagnetic induction produces
an electromotive force within a conductor which is exposed to time varying magnetic fields.
Transformers are used to increase or decrease the alternating voltages in electric power
applications.

A varying current in the transformer's primary winding creates a varying magnetic flux in the
transformer core and a varying field impinging on the transformer's secondary winding. This
varying magnetic field at the secondary winding induces a varying electromotive force (EMF)
or voltage in the secondary winding due to electromagnetic induction. Making use of
Faraday's Law (discovered in 1831) in conjunction with high magnetic permeability core
properties, transformers can be designed to efficiently change AC voltages from one voltage
level to another within power networks.

Selecting a suitable transformer is of great importance. The current rating and the secondary
voltage of the transformer is a crucial factor.

The current rating of the transformer depends upon the current required for the load
to be driven.
The input voltage to the 7805 IC should be at least 2V greater than the required 2V
output, therefore it requires an input voltage at least close to 7V.

25
So I chose a 6-0-6 transformer with current rating 500mA (Since 6*2 = 8.4V).

Fig 10: ideal transformer representation

Voltage regulator IC: The 78xx (sometimes L78xx, LM78xx, MC78xx...) is a family of self-
contained fixed linear voltage regulator integrated circuits. The 78xx family is commonly
used in electronic circuits requiring a regulated power supply due to their ease-of-use and low
cost. For ICs within the family, the xx is replaced with two digits, indicating the output
voltage (for example, the 7805 has a 5-volt output, while the 7812 produces 12 volts). The
78xx line are positive voltage regulators: they produce a voltage that is positive relative to a
common ground. There is a related line of 79xx devices which are complementary negative
voltage regulators. 78xx and 79xx ICs can be used in combination to provide positive and
negative supply voltages in the same circuit.

78xx ICs have three terminals and are commonly found in the TO-220 form factor, although
they are available in surface-mount, TO-92, and TO-3 packages. These devices support an
input voltage anywhere from around 2.5 volts over the intended output voltage up to a
maximum of 35 to 40 volts depending on the model, and typically provide 1 or 1.5 amperes
of current (though smaller or larger packages may have a lower or higher current rating).

7805 IC Rating:

Input voltage range 7V- 35V


Current rating Ic = 1A
Output voltage range VMax=5.2V, VMin=4.8V

26
Fig 11: 7805 IC

Rectifier: A rectifier is an electrical device that converts alternating current (AC), which
periodically reverses direction, to direct current (DC), which flows in only one direction. The
process is known as rectification. Physically, rectifiers take a number of forms, including
vacuum tube diodes, mercury-arc valves, copper and selenium oxide rectifiers, semiconductor
diodes, silicon-controlled rectifiers and other silicon-based semiconductor switches.
Historically, even synchronous electromechanical switches and motors have been used. Early
radio receivers, called crystal radios, used a "cat's whisker" of fine wire pressing on a crystal
of galena (lead sulfide) to serve as a point-contact rectifier or "crystal detector".

a full wave rectifier circuit produces an output voltage or current which is purely DC or has
some specified DC component. Full wave rectifiers have some fundamental advantages over
their half wave rectifier counterparts.

Fig 12: Bridge rectifier

The average (DC) output voltage is higher than for half wave, the output of the full wave
rectifier has much less ripple than that of the half wave rectifier producing a smoother output
waveform.

27
Capacitors:

Knowledge of Ripple factor is essential while designing the values of capacitors

It is given by

Y=1/(43fRC) (as the capacitor filter is used)

1. f= frequency of AC (50 Hz)

2. R=resistance calculated

R= V/Ic

V= secondary voltage of transformer

V=62=8. 4

R=8.45/500mA=16.9 standard 18 chosen

3. C= filtering capacitance

We have to determine this capacitance for filtering

Y=Vac-rms/Vdc

Vac-rms = Vr/23

Vdc= VMax-(Vr/2)

Vr= VMax- VMin

Vr = 5.2-4.8 =0. 4V

Vac-rms = .3464V

Vdc = 5V

Y=0 .06928

Hence the capacitor value is found out by substituting the ripple factor in Y=1/(43fRC)

Thus, C= 2314 F and standard 2200F is chosen

Datasheet of 7805 prescribes to use a 0.01F capacitor at the output side to avoid transient
changes in the voltages due to changes in load and a 0.33F at the input side of regulator to
avoid ripples if the filtering is far away from regulator.
28
Fig 13: Power supply

Potentiometer: A potentiometer, informally a pot, is a three-terminal resistor with a sliding


or rotating contact that forms an adjustable voltage divider. If only two terminals are used,
one end and the wiper, it acts as a variable resistor or rheostat.

The measuring instrument called a potentiometer is essentially a voltage divider used for
measuring electric potential (voltage); the component is an implementation of the same
principle, hence its name.

Potentiometers are commonly used to control electrical devices such as volume controls on
audio equipment. Potentiometers operated by a mechanism can be used as position
transducers, for example, in a joystick.

Fig 14: Potentiometer

29
Potentiometers are rarely used to directly control significant power (more than a watt), since
the power dissipated in the potentiometer would be comparable to the power in the controlled
load.

Operation of potentiometer: The potentiometer can be used as a voltage divider to obtain a


manually adjustable output voltage at the slider (wiper) from a fixed input voltage applied across
the two ends of the potentiometer. This is their most common use.

The voltage across RL can be calculated by:

If RL is large compared to the other resistances (like the input to an operational amplifier),
the output voltage can be approximated by the simpler equation:

(dividing throughout by RL and cancelling terms with RL as denominator)

As an example, assume

, , , and

Since the load resistance is large compared to the other resistances, the output voltage VL
will be approximately:

Due to the load resistance, however, it will actually be slightly lower: 6.623 V.

One of the advantages of the potential divider compared to a variable resistor in series with
the source is that, while variable resistors have a maximum resistance where some current
will always flow, dividers are able to vary the output voltage from maximum (VS) to

30
ground (zero volts) as the wiper moves from one end of the potentiometer to the other.
There is, however, always a small amount of contact resistance.

In addition, the load resistance is often not known and therefore simply placing a variable
resistor in series with the load could have a negligible effect or an excessive effect,
depending on the load.

Push button: A push-button (also spelled pushbutton) or simply button is a simple switch
mechanism for controlling some aspect of a machine or a process. Buttons are typically
made out of hard material, usually plastic or metal. The surface is usually flat or shaped to
accommodate the human finger or hand, so as to be easily depressed or pushed. Buttons are
most often biased switches, though even many un-biased buttons (due to their physical
nature) require a spring to return to their un-pushed state. Different people use different
terms for the "pushing" of the button, such as press, depress, mash, hit, and punch.

Fig 15: Push button

31
Chapter 3

Physical & Technical Specifications

Our micro servo robot is having following Physical specification.

1. Degree of Freedom: 4

2. Payload Capacity (Fully Extended): 20gm

3. Maximum Reach (Fully Extended): 10cm

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

5. Joint speed (Adjustable): 0-60 rpm

6. Hardware interface: USB

7. Waist Spin: 180

8. Shoulder Pitch: 180

9. Elbow Pitch: 180

10. Wrist spin: 180

Technical specification of our micro servo robot

1. Input supply voltage: 100-230 V AC


2. Input supply current: 2 A -6 A AC
3. Input supply frequency: 50 Hz
4. Adapter output voltage: 5V DC
5. Adapter Output Current: 1A DC
6. Transformer voltage rating: 230V 12V AC
7. 7805 Rectifier IC output voltage rating: 4.8V to 5.2V
8. Potentiometer resistance: 100 k

32
Chapter 4

Future Scope

As we know that in twentieth century the market for robots is continuously increasing and
everything is going autonomous and to increase the productivity in industry we must have to
make it autonomous and our robot plays an important role in it.

In future the micro servo robot is became an important part of industry because of its unique
quality such as easy to program in real time, increased throughput speed, precision and safety.

Another quality of Micro servo robot that makes is suitable for industry use is that it does not
require any programing skill while reprograming.

33
Chapter 5

Conclusion

As described by the recent development in the artificial intelligence robotic technology is


evolving day by day and micro servo robot plays an important role in that development. Due
to its advantages it will help to increase the productivity of industries. There are also several
disadvantage that are to be resolved.

34
List of figures and tables

Fig 1: Flowchart of Teach Mode (Page no. 7)


Fig 2: Flowchart of Play Mode (Page no. 9)
Fig 3: Micro Servo Robot Block Diagram (Page no. 10)
Fig 4: Micro Servo Robot Schematic diagram (Page no. 16)
Fig 5: Pinout of Atmega 328 (Page no.18)
Fig 6: Block diagram of Atmega 328 (Page no. 20)
Fig 7: Micro servo motor (Page no. 22)
Fig 8: Servo motor Block diagram (Page no. 22)
Fig 9: Servo motor timing diagram (Page no. 23)
Fig 10: ideal transformer representation (page no. 26)
Fig 11: 7805 IC (page no. 27)
Fig 12: Bridge rectifier (page no. 27)
Fig 13: Power supply (page no. 29)
Fig 14: Potentiometer (page no. 29)
Fig 15: Push button (page no. 31)

35
References

www.atmel.com/devices/atmega328www.jameco.com
en.wikipedia.org/wiki/ATmega328
www.electrical4u.com
www.learnabout-electronics.org

36
Annexure 1

Program

#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
byte counter = 0;
int positions[15][3];
void setup() {
Serial.begin(9600);
servo1.attach(6);
servo2.attach(9);
servo3.attach(10);
servo4.attach(11);
pinMode(4,INPUT_PULLUP);
pinMode(5,INPUT_PULLUP);
}

void loop()
{

int location0 = analogRead(A0);


location0 = map(location0,0,1023,0,180);

servo1.write(location0);
Serial.print("A0 = ");
Serial.print(location0);

37
int location1 = analogRead(A1);
location1 = map(location1,0,1023,180,0);
servo2.write(location1);
Serial.print(" A1 = ");
Serial.print(location1);

int location2 = analogRead(A2);


location2 = map(location2,0,1023,0,180);
servo3.write(location2);
Serial.print(" A2 = ");
Serial.print(location2);

int location3 = analogRead(A3);


location3 = map(location3,0,1023,180,0);
servo4.write(location3);
Serial.print(" A3 = ");
Serial.println(location3);

if(digitalRead(4)==0)
{
Serial.println("press");
positions[counter][0] = location0;
positions[counter][1] = location1;
positions[counter][2] = location2;
positions[counter][3] = location3;
Serial.println(counter++);

delay(1000);
}

if(digitalRead(5)==0)
{

38
Serial.println("AUTO");
play();
delay(1000);
}
}

void play()
{

Serial.println("play mode");

while(1)
{

byte count=0;
while(count<=counter)
{

servo1.write(positions[count][0]);
servo2.write(positions[count][1]);
servo3.write(positions[count][2]);
servo4.write(positions[count][3]);
delay(900);
count++;

}
}

39
40

You might also like