Robotics & Automation
Robotics & Automation
(R20A0453)
DIGITAL NOTES
UNIT -I
Introduction to Embedded System Design, Categories of ES, Overview of Embedded System Architecture, Recent
Trends in Embedded Systems, Hardware Architecture of Embedded System, Real-time Embedded Systems,
Robots and Robotics, Microprocessors and Microcontrollers, Microcontroller or Embedded Controller
UNIT - II
Robotics: Classification of Robots, Links and Joint, Degree of freedom, Motors-DC motors, Stepper Motors, Servo
Motors; Power Transmission-Type of Gears, Robotic Sensors, Applications of Robot, S/w used for Robot programming.
UNIT- III
The AVR RISC microcontroller architecture: Introduction, AVR family architecture, register file, Pin
diagram of AVR, memory organization, I/O ports, timers, USART, Interrupt structure.
UNIT-IV
ARM Processor: Fundamentals, Registers, current program status register, pipeline concept, Interrupt and the
vector table.
UNIT V
AI IN ROBOTICS: Robotic perception, localization, mapping- configuring space, planning uncertainmovements,
dynamics and control of movement, Ethics and risks of artificial intelligence in robotics.
TEXT BOOKS:
1) Subrata Ghoshal, "Embedded Systems & Robots", Cengage Learning
2) Stuart Russell, Peter Norvig, “Artificial Intelligence: A modern approch”, Pearson Education,
India2003.
3) ARM System Developer’s Guide: Designing and Optimizing System Software- Andrew N.
Sloss, Dominic Symes, Chris Wright, Elsevier Inc., 2007
REFERENCE BOOKS:
1) M.A. Mazidi, J.G. Mazidi, R.D. Mckinlay, "8051 Microcontroller and Embedded Systems", Pearson.
2) Dr. K.V.K. Prasad, "Embedded/Real-Time Systems: Concepts Design & Programming",
Dreamtech.
3) Microcontrollers and applications, Ajay V Deshmukh , TMGH,2005
COURSE OUTCOMES:
At the end of the course, the students will be able to
1) Understand the overview of Embedded Systems, Robots, Microprocessors &
Microcontrollers.
2) Understand in detail about Robotics and sensors.
3) Understand AVR RISC Microcontroller architecture in detail.
4) Understand about ARM Processor in detail.
5) Understand about Artificial Intelligence in Robotics.
UNIT-1
• So, an embedded system must perform the operations at a high speed so that it can be
readily used for real time applications and its power consumption must be very low and
the size of the system should be as for as possible small and the readings must be
accurate with minimum error. The system must be easily adaptable for different
situations.
Harvard Architecture:
• Computers have separate memory areas for program instructions and data using internal
data buses, allowing simultaneous access to both instructions and data.
Memory:
• Embedded system memory can be either on-chip or off-chip.
• On chip memory access is much fast than off-chip memory, but the size of on-chip
memory is much smaller than the size of off-chip memory.
• The ROM, EPROM, and Flash memory are all read-only type memories often used to store
code in an embedded system.
• The embedded system code does not change after the code is loaded into memory. The
ROM is programmed at the factory and cannot be changed over time.
• The newer microcontrollers come with EPROM or Flash instead of ROM.
• Most microcontroller development kits come with EPROM as well.
• EPROM and Flash memory are easier to rewrite than ROM. EPROM is an Erasable
Programmable
• The size of EPROM ranges up to 32kb in most embedded systems.
• Flash memory is an EPROM which can be programmed from software so that the
developers don‘t need to physically remove the EPROM from the circuit to re-program it.
• It is much quicker and easier to re-write Flash than other types of EPROM.
• When the power is on, the first instruction in ROM is loaded into the PC and then the CPU
fetches the instruction from the location in the ROM pointed to by the PC and stores it in
the IR to start the continuous CPU fetch and execution cycle. The PC is advanced to the
address of the next instruction depending on the length of the current instruction or the
destination of the Jump instruction.
• The memory is divided into Data Memory and Code Memory.
• Most of data is stored in Random Access Memory (RAM) and code is stored in Read Only
Memory (ROM).
• This is due to the RAM constraint of the embedded system and the memory organization.
The RAM is readable and writable, faster access and more expensive volatile storage,
which can be used to store either data or code.
• Once the power is turned off, all information stored in the RAM will be lost.
• The RAM chip can be SRAM (static) or DRAM (dynamic) depending on the manufacturer.
SRAM is faster than DRAM, but is more expensive
I/O Ports:
• The I/O ports are used to connect input and output devices. The common input devices for
an embedded system include keypads, switches, buttons, knobs, and all kinds of sensors
(light, temperature, pressure, etc).
• The output devices include Light Emitting Diodes (LED), Liquid Crystal Displays (LCD),
printers, alarms, actuators, etc. Some devices support both input and output, such as
communication interfaces including Network Interface Cards (NIC), modems, and mobile
phones
Communication Interfaces:
• To transfer the data or to interact with other devices, the embedded devices are provided
the various communication interfaces like RS232, RS422, RS485,USB, SPI(Serial Peripheral
Interface ) ,SCI (Serial Communication Interface) ,Ethernet etc.
Application Specific Circuitry:
• The embedded system sometimes receives the input from a sensor or actuator. In such
situations certain signal conditioning circuitry is needed. This hardware circuitry may
contain ADC, Op-amps, DAC etc.
ADC & DAC:
• Many embedded system application need to deal with non-digital external signals such as
electronic voltage, music or voice, temperature, pressures, and many other signals in the
analog form.
• The digital computer does not understand these data unless they are converted to digital
formats.
• The ADC is responsible for converting analog values to binary digits.
• The DAC is responsible for outputting analog signals for automation controls such as DC
motor.
• In addition to these peripherals, an embedded system may also have sensors, Display
modules like LCD or Touch screen panels, Debug ports c,ertain communication peripherals
like I2C, SPI, Ethernet, CAN, USB for high speed data transmission. Now a days various
sensors are also becoming an important part in the design of real time embedded
systems. Sensors like temperature sensors, light sensors, PIR sensors, gas sensors are
widely used in application specific circuitry.
Power supply:
• Most of the embedded systems now days work on battery operated supplies.
Because low power dissipation is always required. Hence the systems are designed to work
with batteries
Clock:
The clock is used to control the clocking requirement of the CPU for executing instructions
and the configuration of timers.
• The watchdog timer is a special timing device that resets the system after a preset time
delay in case of system anomaly. The watchdog starts up automatically after the system
power up.
• One need to reboot the PC now and then due to various faults caused by hardware or
software. An embedded system cannot be rebooted manually, because it has been
embedded into its system. That is why many microcontrollers come with an on-chip
watchdog timer which can be configured just like the counter in the regular timer. After a
system gets stuck (power supply voltage out of range or regular timer does not issue
timeout after reaching zero count) the watchdog eventually will restart the system to
bring the system back to a normal operational condition.
Real Time Embedded Systems
• A real-time embedded system is a particular version of an embedded system that works on
the basis of real-time computing represented by a dedicated type of operating system —
RTOS.
• Its working principles are as follows:
• Quick response to external factors: an embedded system must work within fixed time
constraints.
• Predictability: an embedded system must be deterministic or predictable, meaning that no
deviations are allowed.
• The deadline is above all: meeting the deadline is more important than other performance
characteristics.
• Operational failures may lead to catastrophe: if a task does not meet time limits, it
negatively affects users and may even lead to fatal results.
Motivation behind Robotics: To cope up with increasing demands of a dynamic and competitive
market, modern manufacturing methods should satisfy the following requirements:
Reduced Production Cost
Increased Productivity
Improved Product Quality
Laws of Robotics:
1)A robot should not injure a human being or through inaction allow a human to be
harmed.
2)A robot must obey orders given by humans except when that conflicts with the first law.
3)A robot must protect its own existence unless that conflicts with the first or second law.
The following are things robots do better than humans:
UNIT-2
Classification of Robots
• Robots can be classified based on the application or by their locomotion / kinematics.
• Classifying Robots by their Application: Based on this classification, there are two broad
ways of categorizing robots.
1)Industrial Robots
2)Service Robots
• Industrial Robots: These were one of the first robots to be used commercially. In a factory
assembly line, these are usually in the form of articulated arms specifically developed for
such applications as welding, material handling, painting and others.
• They can be further subdivided as:
1)Manufacturing Robots
2)Logistics Robots
• Manufacturing robots are designed to move materials, as well as perform a variety of
programmed tasks in manufacturing and production settings. They are often used to
perform duties that are dangerous or unsuitable for human workers.
• Logistics robots are mobile automated guided vehicles primarily used in warehouses and
storage facilities to transport goods.
• Service robots: The International Organization for Standardization defines a service robot
as ‘a robot that performs useful tasks for humans.’ They can be further subdivided as:
1. Medical robots
2. Home robots
3. Defence robots
4. Entertainment robots
5. Agricultural robots
6. Educational robots
Medical robots are professional service robots that are used in and out of hospital settings
to improve the level of patient care. These robots reduce the workload of the medical
staff, which allows them to spend more time caring directly for patients. Mobile medical
robots are used for the delivery of medication and other sensitive materials in a hospital.
Home robots automate tasks like cleaning and disinfecting.
The primary purpose of Education robots is to make kids aware of their potential, utility,
and help kids build their own robots using readymade kits. Educational robots are used
extensively in schools, both in classrooms and in extracurricular activities.
One of the most important uses of robots in defence is to ensure the safety of soldiers and
civilians. For example, remotely operated vehicles (ROVs) are used to carry out dangerous
tasks or activities in hazardous environments, drones are used for surveillance, and so on.
Agricultural robots sense weather pattern and can adjust the watering of crop as needed,
can be used for sowing, de-weeding, and harvesting crops.
Classifying Robots by their Kinematics or Locomotion: Robots can also be classified according to
how they move – or not move.
Cartesian Robots: these are perhaps the most common types of robots. They have three
axes which are linear i.e, they can only move in straight lines rather than rotating and are
mounted at right angles to each other. Because of their rigid structure, this type of robots
usually can offer good levels of precision and repeatability. Cartesian robots are mostly
used in the industrial and the manufacturing sector for pick and place type of operations.
Cylindrical robots: The body of this type of robot is such that the robotic arm can move up
and down along a vertical member. The arm can rotate about that vertical axis and the arm
can also extend or contract. This construction makes the manipulator able to work in a
cylindrical space. They are used for assembly operations, spot welding and for die casting
machines. These cannot reach the objects lying on the floor.
Eg: Versatran 600
Spherical coordinate Robots(Polar coordinate Robots): This type of robot works in a spherical
system. It can move in a bi-angular and single linear direction. SCARA Robots: SCARA stands for
Selective Compliance Arm for Robotic Assembly. This type of robot has one linear and two rotary
movements. Can be used to pick up objects lying on the floor. They are used for assembly
purposes all over the world
Eg: Unimate 2000B
• Revolute coordinate or Articulated Robots: These are robots with a wide range of
movements that include forward, backward, upward and downward motion. Because of
their large work envelope, articulated robots can be used for several different applications
like assembly, arc welding, material handling, machine tending, and packaging.
Note: PUMA stands for Programmable Universal Machine for Assembly
Other types:
Airborne Robots: these robots can fly through the air. Drones are an extremely popular
example of flying robots.
Aquatic Robots: These robots can work on or under water. They are mostly used for
underwater exploration of oil, gas or minerals.
Joints and links
Two basic types types of joints are used in industrial robots
1)Revolute
2)Prismatic
Degree of freedom
Fig 1.9: Representation of six degrees of freedom
DOF of a system: Defined as the minimum number of independent
parameters/variables/coordinates needed to describe the system completely.
Motors:
• DC Motor: A DC motor is defined as a class of electrical motors that convert direct current
electrical energy into mechanical energy.
• From the above definition, we can conclude that any electric motor that is operated using
direct current or DC is called a DC motor.
Parts of a DC Motor
Armature or Rotor
The armature of a DC motor is a cylinder of magnetic laminations that are insulated from one
another. The armature is perpendicular to the axis of the cylinder. The armature is a rotating part
that rotates on its axis and is separated from the field coil by an air gap.
Field Coil or Stator
A DC motor field coil is a non-moving part on which winding is wound to produce a magnetic
field. This electro-magnet has a cylindrical cavity between its poles.
Commutator and Brushes
Commutator
The commutator of a DC motor is a cylindrical structure that is made of copper segments stacked
together but insulated from each other using mica. The primary function of a commutator is to
supply electrical current to the armature winding.
Brushes
The brushes of a DC motor are made with graphite and carbon structure. These brushes conduct
electric current from the external circuit to the rotating commutator. Hence, we come to
understand that the commutator and the brush unit are concerned with transmitting the power
from the static electrical circuit to the mechanically rotating region or the rotor.
DC Motor Working:
A magnetic field arises in the air gap when the field coil of the DC motor is energised. The created
magnetic field is in the direction of the radii of the armature. The magnetic field enters the
armature from the North pole side of the field coil and “exits” the armature from the field coil’s
South pole side.
The conductors located on the other pole are subjected to a force of the same intensity but in
the opposite direction. These two opposing forces create a torque that causes the motor
armature to rotate.
Working principle of DC motor
When kept in a magnetic field, a current-carrying conductor gains torque and develops a
tendency to move. In short, when electric fields and magnetic fields interact, a mechanical force
arises. This is the principle on which the DC motors work.
Types of DC motor
• Self Excited DC Motor
• Separately Excited DC Motor
Self Excited DC Motor
• In self-excited DC motors, the field winding is connected either in series or parallel to the
armature winding. Based on this, the self-excited DC motor can further be classified as:
1. Shunt wound DC motor
2. Series wound DC motor
3. Compound wound DC motor
Shunt wound DC motor:In a shunt wound motor, the field winding is connected parallel to the
armature
Series wound DC motor:In a series wound DC motor, the field winding is connected in series with
the armature winding
Compound wound DC motor:DC motors having both shunt and series field winding is known as
Compound DC motor, The compound motor is further divided into:
Cumulative Compound Motor
Differential Compound Motor
In a cumulative compound motor, the magnetic flux produced by both the windings is in the
same direction. In a differential compound motor, the flux produced by the series field windings
is opposite to the flux produced by the shunt field winding.
2) Separately Excited DC Motor: In a separately excited DC motor, the field coils are energised
from an external source of DC supply
Stepper Motor:
• A stepper motor is an electromechanical device it converts electrical power into
mechanical power. Also, it is a brushless, synchronous electric motor that can divide a full
rotation into an expansive number of steps. The motor’s position can be controlled
accurately without any feedback mechanism, as long as the motor is carefully sized to the
application.Construction & Working Principle:
• The construction of a stepper motor is fairly related to a DC motor. It includes a permanent
magnet like Rotor which is in the middle & it will turn once force acts on it. This rotor is
enclosed through a no. of the stator which is wound through a magnetic coil all over it. The
stator is arranged near to rotor so that magnetic fields within the stators can control the
movement of the rotor.
• The stepper motor can be controlled by energizing every stator one by one. So the stator
will magnetize & works like an electromagnetic pole which uses repulsive energy on the
rotor to move forward. The stator’s alternative magnetizing as well as demagnetizing will
shift the rotor gradually &allows it to turn through great control.
• The stepper motor working principle is Electro-Magnetism. It includes a rotor which is
made with a permanent magnet whereas a stator is with electromagnets. Once the supply
is provided to the winding of the stator then the magnetic field will be developed within
the stator. Now rotor in the motor will start to move with the rotating magnetic field of
the stator. So this is the fundamental working principle of this motor.
• In this motor, there is a soft iron that is enclosed through the electromagnetic stators. The
poles of the stator as well as the rotor don’t depend on the kind of stepper. Once the
stators of this motor are energized then the rotor will rotate to line up itself with the stator
otherwise turns to have the least gap through the stator. In this way, the stators are
activated in a series to revolve the stepper motor.
Driving Techniques
Single Excitation Mode
The basic method of driving a stepper motor is a single excitation mode. It is an old method and
not used much at present but one has to know about this technique. In this technique every
phase otherwise stator next to each other will be triggered one by one alternatively with a
special circuit. This will magnetize & demagnetize the stator to move the rotor forward.
Full Step Drive
In this technique, two stators are activated at a time instead of one in a very less time period.
This technique results in high torque & allows the motor to drive the high load.
Half Step Drive
This technique is fairly related to the Full step drive because the two stators will be arranged next
to each other so that it will be activated first whereas the third one will be activated after that.
This kind of cycle for switching two stators first &after that third stator will drive the motor. This
technique will result in improved resolution of the stepper motor while decreasing the torque.
Micro Stepping
• This technique is most frequently used due to its accuracy. The variable step current will
supply by the stepper motor driver circuit toward stator coils within the form of a
sinusoidal waveform. The accuracy of every step can be enhanced by this small step
current. This technique is extensively used because it provides high accuracy as well as
decreases operating noise to a large extent.
Servo Motors
• A servo motor is a type of motor that can rotate with great precision. Normally this type of
motor consists of a control circuit that provides feedback on the current position of the
motor shaft, this feedback allows the servo motors to rotate with great precision. If you
want to rotate an object at some specific angles or distance, then you use a servo motor. It
is just made up of a simple motor which runs through a servo mechanism.
• If motor is powered by a DC power supply then it is called DC servo motor, and if it is AC-
powered motor then it is called AC servo motor. For this tutorial, we will be discussing only
about the DC servo motor working. Apart from these major classifications, there are many
other types of servo motors based on the type of gear arrangement and operating
characteristics.
• A servo motor usually comes with a gear arrangement that allows us to get a very high
torque servo motor in small and lightweight packages. Due to these features, they are
being used in many applications like toy car, RC helicopters and planes, Robotics, etc.
• Servo motors are rated in kg/cm (kilogram per centimeter) most hobby servo motors are
rated at 3kg/cm or 6kg/cm or 12kg/cm. This kg/cm tells you how much weight your servo
motor can lift at a particular distance. For example: A 6kg/cm Servo motor should be able
to lift 6kg if the load is suspended 1cm away from the motors shaft, the greater the
distance the lesser the weight carrying capacity. The position of a servo motor is decided
by electrical pulse and its circuitry is placed beside the motor.
Servo Motor Working Mechanism
• It consists of three parts:
1. Controlled device
2. Output sensor
3. Feedback system
• It is a closed-loop system where it uses a positive feedback system to control motion and
the final position of the shaft. Here the device is controlled by a feedback signal generated
by comparing output signal and reference input signal.
• Here reference input signal is compared to the reference output signal and the third signal
is produced by the feedback system. And this third signal acts as an input signal to the
control the device. This signal is present as long as the feedback signal is generated or
there is a difference between the reference input signal and reference output signal. So
the main task of servomechanism is to maintain the output of a system at the desired
value at presence of noises.
• Servo Motor Working Principle
• A servo consists of a Motor (DC or AC), a potentiometer, gear assembly, and a controlling
circuit. First of all, we use gear assembly to reduce RPM and to increase torque of the
motor. Say at initial position of servo motor shaft, the position of the potentiometer knob
is such that there is no electrical signal generated at the output port of the potentiometer.
• Now an electrical signal is given to another input terminal of the error detector amplifier.
Now the difference between these two signals, one comes from the potentiometer and
another comes from other sources, will be processed in a feedback mechanism and output
will be provided in terms of error signal. This error signal acts as the input for motor and
motor starts rotating. Now motor shaft is connected with the potentiometer and as the
motor rotates so the potentiometer and it will generate a signal. So as the potentiometer’s
angular position changes, its output feedback signal changes.
• After sometime the position of potentiometer reaches at a position that the output of
potentiometer is same as external signal provided. At this condition, there will be no
output signal from the amplifier to the motor input as there is no difference between
external applied signal and the signal generated at potentiometer, and in this situation
motor stops rotating.
• Servo motor works on PWM (Pulse width modulation) principle, means its angle of
rotation is controlled by the duration of applied pulse to its Control PIN. Basically servo
motor is made up of DC motor which is controlled by a variable resistor (potentiometer)
and some gears. High speed force of DC motor is converted into torque by Gears. We
know that WORK= FORCE X DISTANCE, in DC motor Force is less and distance (speed) is
high and in Servo, force is High and distance is less. The potentiometer is connected to the
output shaft of the Servo, to calculate the angle and stop the DC motor on the required
angle.
• Servo motor can be rotated from 0 to 180 degrees, but it can go up to 210 degrees,
depending on the manufacturing. This degree of rotation can be controlled by applying
the Electrical Pulse of proper width, to its Control pin. Servo checks the pulse in every 20
milliseconds. The pulse of 1 ms (1 millisecond) width can rotate the servo to 0 degrees,
1.5ms can rotate to 90 degrees (neutral position) and 2 ms pulse can rotate it to 180
degree.
• All servo motors work directly with your +5V supply rails but we have to be careful about
the amount of current the motor would consume if you are planning to use more than two
servo motors a proper servo shield should be designed.
Types of Gears:
• A gear is a toothed cylindrical or roller shape component of a machine which meshes with
another toothed cylindrical to transmit power from one shaft to another. It is mainly used
to obtain different torque and speed ratio or changing the direction of driving shaft and
driven shaft.
• Principle:
• It works on the basic principle of thermodynamic which state that energy is neither be
created or destroyed or we can say it is conservative. it can be converted into one form to
another. We know that power is the function of speed and torque or we can say that
power is product of torque (Force in rotary motion) and speed (P = TV) of the shaft. So
when we connect a small gear on driving shaft and a larger gear on driven shaft, the speed
decreases of driven shaft per unit rotation of driving shaft.
Types of Gears:
Gears can be classified in various types according to construction of teeth, Use, the
direction of motion transfer etc. but basically it is classified according to design of teeth.
1. Spur Gear:
These gears are used to transmit the power in same plane or when the driving and driven
shafts are parallel to each other. In this type of gear teeth are cut parallel to the axis of the
shafts so when is meshes with another spur gear it transmit the power in parallel shaft and
when it connects with the helical gear it will transmit power at an angle from the driving
axis.
2. Helical Gear:
• On the helical gears teeth are cut at an angle from the axis of it. It has cylindrical roller with
helicoid teeth. The main advantage of helical gears is that they work with less noise and
vibration because the load is distributed on the full helix as compared to spur gears. It also
has less wear and tear due to which they are widely used in industries. It also used for
transmit power in parallel shaft but sometime they are used to transmit power in non-
parallel shaft also. In the helical gears if the pinion (driving gear) is cut with right handed
teeth then the gear (driven gear) is cut with left handed of in opposite direction.
Does this mean that the microcontroller is another name for a computer…? The answer is NO!
The computer on one hand is designed to perform all the general purpose tasks on a single machine like you can
use a computer to run a software to perform calculations or you can use a computer to store some multimedia file or to
access internet through the browser, whereas the microcontrollers are meant to perform only the specific tasks, for e.g.,
switching the AC off automatically when room temperature drops to a certain defined limit and again turning it ON when
There are number of popular families of microcontrollers which are used in different applications as per their
capability and feasibility to perform the desired task, most common of these are 8051, AVR and PIC microcontrollers.
History of AVR
AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed by
Alf-Egil Bogen and Vegard Wollan. AVR derives its name from its developers and stands for Alf-Egil Bogen Vegard
Wollan RISC microcontroller, also known as Advanced Virtual RISC. The AT90S8515 was the first microcontroller
which was based on AVR architecture however the first microcontroller to hit the commercial market was AT90S1200 in
2. MegaAVR – These are the most popular ones having good amount of memory (upto 256 KB), higher number of inbuilt
3. XmegaAVR – Used commercially for complex applications, which require large program memory and high speed.
The following table compares the above mentioned AVR series of microcontrollers:
Importance of AVR
What’s special about AVR?
They are fast: AVR microcontroller executes most of the instructions in single execution cycle. AVRs are about
4 times faster than PICs, they consume less power and can be operated in different power saving modes. Let’s do the
AVR is an 8-bit microcontroller belonging to the family of Reduced Instruction Set Computer (RISC). In RISC
architecture theinstruction set of the computer are not only fewer in number but also simpler and faster in operation. The
other type of categorization is CISC (Complex Instruction Set Computers). Click to find out differences between RISC
and CISC. We will explore more on this when we will learn about the architecture of AVR microcontrollers in following
section.
Let’s see what all this means. What is 8-bit? This means that the microcontroller is capable of transmitting and receiving
8-bit data. The input/output registers available are of 8-bits. The AVR family controllers have register based architecture
which means that both the operands for an operation are stored in a register and the result of the operation is also
stored in a register. Following figure shows a simple example performing OR operation between two input registers and
The CPU takes values from two input registers INPUT-1 and INPUT-2, performs the logical operation and stores the value
into
In our journey with the AVR we will be working on Atmega16 microcontroller, which is a 40-pin IC and belongs
to the megaAVR category of AVR family. Some of the features of Atmega16 are:
The AVR microcontrollers are based on the advanced RISC architecture and consist of 32 x 8 -bit general purpose working registers. Within one
single clock cycle, AVR can take inputs from two general purpose registers and put them to ALU for carrying out the requested operation, and transfer
back the result to an arbitrary register. The ALU can perform arithmetic as well as logical operations
over the inputs from the register or between the register and a constant. Single register operations like taking a complement can also be executed in
ALU. We can see that AVR does not have any register like accumulator as in 8051 family of microcontrollers; the operations can be performed
AVR follows Harvard Architecture format in which the processor is equipped with separate memories and buses for Program and the Data information.
Here while an instruction is being executed, the next instruction is pre-fetched from the program memory.
Since AVR can perform single cycle execution, it means that AVR can execute 1 million instructions per second if cycle frequency is 1MHz. The higher
is the operating frequency of the controller, the higher will be its processing speed. We need to optimize the power consumption with processing speed
If we are using a crystal of 8 MHz = 8 x 106 Hertz = 8 Million cycles, then AVR can execute 8 million instructions.
Naming Convention.!
The AT refers to Atmel the manufacturer, Mega means that the microcontroller belong to MegaAVR category, 16 signifies the memory of the controller,
which is 16KB.
· I/O Ports: Atmega16 has four (PORTA, PORTB, PORTC and PORTD) 8-bit input-output ports.
· Internal Calibrated Oscillator: Atmega16 is equipped with an internal oscillator for driving its clock. By default Atmega16 is set to operate at internal
calibrated oscillator of 1 MHz. The maximum frequency of internal oscillator is 8Mhz. Alternatively, ATmega16 can be operated using an external crystal oscillator
with a maximum frequency of 16MHz.In this case you need to modify the fuse bits. (Fuse Bits will be explained in a separate tutorial).
e.g., a sensor input and converts it into digital information which is understandable by the microcontroller.
· Timers/Counters: Atmega16 consists of two 8-bit and one 16-bit timer/counter. Timers are useful for generating precision actions for e.g., creating time
· Watchdog Timer: Watchdog timer is present with internal oscillator. Watchdog timer continuously monitors and resets the controller if the code gets stuck at
· Interrupts: Atmega16 consists of 21 interrupt sources out of which four are external. The remaining are internal interrupts which support the peripherals
· USART: Universal Synchronous and Asynchronous Receiver and Transmitter interface is available for interfacing with external device capable of
General Purpose Registers: Atmega16 is equipped with 32 general purpose registers which are coupled directly with the Arithmetic Logical Unit
(ALU) of CPU.
1. Flash EEPROM: Flash EEPROM or simple flash memory is used to store the program dumped or burnt by the useron to the microcontroller. It can be easily
erased electrically as a single unit. Flash memory is non-volatile i.e., it retains the program even if the power is cut-off. Atmega16 is available with 16KB of in system
2. Byte Addressable EEPROM: This is also a nonvolatile memory used to store data like values of certain variables. Atmega16 has 512 bytes of EEPROM, this
memory can be useful for storing the lock code if we are designing an application like electronic door lock.
3. SRAM: Static Random Access Memory, this is the volatile memory of microcontroller i.e., data is lost as soon as power is turned off. Atmega16 is equipped
with 1KB of internal SRAM. A small portion of SRAM is set aside for general purpose registers used by CPU and some for the peripheral subsystems of the
microcontroller.
· ISP: AVR family of controllers have In System Programmable Flash Memory which can be programmed withoutremoving the IC from the circuit, ISP
· SPI: Serial Peripheral Interface, SPI port is used for serial communication between two devices on a common clocksource. The data transmission rate of
· TWI: Two Wire Interface (TWI) can be used to set up a network of devices, many devices can be connected over TWIinterface forming a network, the devices
can simultaneously transmit and receive and have their own unique address.
· DAC: Atmega16 is also equipped with a Digital to Analog Converter (DAC) interface which can be used for reverse action performed by ADC. DAC can be
MegaAVR Family
Various microcontroller of MegaAVR series:
Part R R EEP I/ Ti Interr Operation V Opera Packa
Name O A ROM 0 m upts oltage ting ging
M M Pi er frequ
n ency
s
AVR Microcontroller:
AVR microcontroller is an electronic chip manufactured by Atmel, which has several advantages over other types of
microcontroller.
We can understand microcontroller by comparing it with Personal Computer (PC), which has a motherboard inside it. In that
motherboard a microprocessor (AMD, Intel chips) is used that provides the intelligence, EEPROM and RAM memories for
interfacing to the system like serial ports, display interfaces and disk drivers. A microcontroller has all or most of these features
built into a single chip, therefore it doesn?t require a motherboard and any other components.
AVR microcontroller comes in different configuration, some designed using surface mounting and some designed using hole
mounting. It is available with 8-pins to 100-pins, any microcontroller with 64-pin or over is surface mount only.
o ATmega8 microcontroller
o ATmega16 microcontroller
o ATmega32 microcontroller
o ATmega328 microcontroller
Pin Descriptions:
Port A (PA7-PA0): Port A serves as analog inputs for A/D converter. It also acts as an 8-bit bidirectional I/O port if the A/D
converter is not used internally.
Port B (PB7-PB0) and Port D (PD7-PD0): These ports are 8-bit bidirectional I/O ports. Their output buffers have symmetrical
drive characteristics with high source and sink capability. As inputs, these are pulled low if the pull-up resistors are used. It
also provides various special functional features of the ATmega32.
Port C (PC7-PC0): Port C is an 8-bit bidirectional I/O port. If the Joint Test Action Group (JTAG) interface is enabled, the pull-
up resistors on pins PC2 (TCK), PC3 (TMS), and PC5 (TDI) will be activated.
Consider the interfacing of Joint Test Action Group (JTAG) using Port C of ATmega32 is:-
GND: Ground
RESET: It is a RESET pin which is utilized to set the microcontroller ATmega32 to its primary value. During the beginning of
an application the RESET pin is to be set elevated for two machine rotations.
XTAL1: It is an input for the inverting oscillator amplifier and input to an internal clock operating circuit.
XTAL2: It is an output from an inverting oscillator amplifier.
AVcc: It is a supply voltage pin for A/D converter and Port A. It must be connected with Vcc.
AREF: AREF is an analog signal reference pin for the analog to digital converter.
ATmega32 Memories
In ATmega32 microcontroller two main memory spaces i.e. the program memory and data memory space are used. In addition
it uses an EEPROM memory for data storage.
Consider the five different addressing modes for the data memory is:-
Consider the SRAM data memory structure shown in block diagram of ATmega32 is:
EEPROM Data Memory:
ATmega32 contains 1024 bytes of data EEPROM memory. It can be used as a separate data space in which single bytes can
be read and written.
ATmega8 Microcontroller
It is an 8 bit CMOS technology based microcontroller belongs to the AVR family of microcontroller developed in 1996. It is
built on RISC (Reduced Instruction Set Computer) architecture. Their main advantage is it doesn?t contain any accumulator
register and the result of any operation can be stored inside any register, defined by an instruction.
ATmega8 Architecture:
Consider the block diagram representation of internal architecture configuration of ATmega8 microcontroller is:
Memory:
ATmega8 microcontroller consists of 1KB of SRAM, 8KB of flash memory and 512 bytes of EEPROM.
In ATmega8 microcontroller all the registers are connected directly with Arithmetic Logic Unit (ALU). The EEPROM memory is
used for storing the user defined data.
Input/output ports:
ATmega8 microcontroller consists of 3 I/O ports, named as B, C and D with a combination of 23 I/O lines. Port D consists of
8 I/O lines, Port C consists of 7 I/O lines, and Port B consists of 8 I/O lines.
o Pins 9,10,14,15,16,17,18,19 are used for port B, Whereas Pins 23,24,25,26,27,28 and 1 are used for port C and Pins 2,3,4,5,6,11,12 are used
for port D.
o Pin 1 is used as Reset pin and on applying low level signal for time longer than minimum pulse length will generate a reset signal.
o Pins 3 and 2 can also be used in serial communication for USART (Universal Synchronous and Asynchronous Receiver Transmitter).
o Pin 5 and 4 are used as external interrupts.
o Pins 10 and 9 are used as timer counter oscillators as well as external oscillator where the crystal is connected directly between the pins.
o Pin 19 is used as slave clock input or master clock output for Serial Peripheral Interface (SPI) channel.
o Pin 18 is used as slave clock output or master clock input
o Pins 23 to 28 are used for analog to digital conversion (ADC) channels.
o Pin 12 and 13 are used as Analog Comparator inputs.
o Pins 6 and 11 are used as counter/timer sources.
o Power save Mode: It is used when Counter/Timer is clocked asynchronously. In general this mode used for saving the operational power
requirement of microcontroller.
o Idle Mode: It stops the functioning of CPU, but allows operation of ADC, TWI, SPI, and interrupts system and Watchdog. It is achieved
by setting SM0 to SM2 bits of Microcontroller Unit register flag at zero.
o Power down Mode: It enables external interrupts, the 2-wire serial interface, and watchdog while disabling the external oscillator. It
stops all generated clocks.
o ADC Noise Reduction Mode: It stops the central processing unit but allows the functioning of ADC, timer/counter and external
interrupts.
o Stand By mode: In this mode, only oscillator is allowed to operate by slowing all other operation of microcontroller.
The number of ports in AVR family varies depending on number of pins available on chip. The 8-pin AVR has port B only,
while the 64-pin version has ports A to ports F, and the 100-pin AVR has ports A to ports L.
The table showing Numbers of ports in some AVR family members is shown below:
Note: X indicates that the port is available.
The 40-pin AVR has four ports for using any of the ports as an input or output port, it must be accordingly programmed. In
AVR microcontroller not all ports have 8 pins. For example:-in the ATmega8, Port C has 7 pins.
Each of I/O registers is 8 bits wide, and each port has a maximum of 8 pins, therefore each bit of I/O registers affects one of
the pins.
For accessing I/O registers associated with the ports the common relationship between the registers and the pins of AVR
microcontroller is used.
The relation between the Registers and the Pins of AVR is shown below:
AVR Registers
AVR is 8 bit microcontroller therefore all its ports are 8 bit wide. Every port has 3 registers associated with it each one have
size of 8 bits. Every bit in those registers configures the pins of particular port. Bit0 of these registers are associated with Pin0
of the port, Bit1 of these registers are associated with Pin1 of the port, and same as for other bits.
o DDRx register
o PORTx register
o PINx register
DDRx register:
Data Direction Register configures the data direction of port pins. These registers are used for determining whether port pins
will be used for input or output. On writing 1 to a bit in DDRx makes corresponding port pin as output, while writing 0 to a
bit in DDRx makes corresponding port pin as input.
For example:
1. DDRA= 0b00000000;
o For making lower nibble of port B as output and higher nibble as input:
1. DDRB=0b00001111;
PINx register:
PINx register used to read the data from port pins. In order to read the data from port pin, first we have to change the port?s
data direction to input. This is done by setting bits in DDRx to zero. If port is made output, then reading PINx register will give
a data that has been output on port pins.
There are two input modes. Either we can use port pins as internal pull up or as tri stated inputs. It will be explained as shown
below:
PORTx register:
In general PORTx register can be used for two purposes:
o To output data: when port is configured as output then PORTx register is used. When we set bits in DDRx to 1, corresponding pins
becomes output pins. Now we can write the data into respective bits in PORTx register. This will immediately change the output state of
pins according to data we have written on the ports.For example:
In input mode, when pull-up is enabled, default state of the pin is '1'. So if we don't add anything to pin and if we try to read
it then it will read as 1.
Note: While using on chip Analog to Digital Converter (ADC), ADC port pins must be used as tri stated input.
For example:
To make lower nibble of port A as output, higher nibble as input with pull-ups enabled
1. DDRA = 0x0F; // higher nib> input, lower nib> output
2. PORTA = 0xF0; //lower nib> set output pins to 0
To make port C as input with pull-ups enabled and read data from port a
o The interrupt source must be activated by setting the corresponding interrupt mask/ Interrupt Enable Bit.
o The enable bit in AVR status register must be set to 1. For this the instruction named 'sei' (Set Interrupt Enable).
o The interrupt sub routine must present. If there is no code to b e run, then an empty subroutine must occur at particular memory spaced
to that interrupt.
o Finally the event must occur, so the execution of the routine gets triggered.
Writing an Interrupt Subroutine in AVR Studio:
It is tricky to use an interrupt subroutine into a C code of a microcontroller. Therefore the AVR GCC developers use a few
symbols to represent the interrupts and macros that minimized the code size in many programs.
The interrupt subroutine for External Interrupt 0 and External Interrupt 1 is given below:
Bit 7 6 5 4 3 2 1 0
Read/Write RW RW RW RW RW RW RW RW
Introduction
AVR ATmega has flexible USART, which can be used for serial communication with other devices like computers, serial
GSM, GPS modules, etc.
Before beginning with AVR USART, we will walk through the basics of serial communication.
There are also other supported frame formats available in UART, like parity bit, variable data bits (5-9 data bits).
As we know the bit rate is “Number of bits per second (bps)”, also known as Baud rate in Binary system. Normally this
defines how fast the serial line is. There are some standard baud rates defined e.g. 1200, 2400, 4800, 19200, 115200 bps,
etc. Normally 9600 bps is used where speed is not a critical issue.
AVR ATmega USART has a TTL voltage level which is 0 v for logic 0 and 5 v for logic 1.
In computers and most of the old devices, RS232 protocol is used for serial communication, where normally 9 pin ‘D’ shape connector
is used. RS232 serial communication has different voltage levels than ATmega serial communication i.e. +3 v to +25 v for logic zero
and -3 v to -25 v for logic 1.
So to communicate with RS232 protocol, we need to use a voltage level converter like MAX232 IC.
Although there are 9 pins in the DB9 connector, we don’t need to use all the pins. Only 2nd Tx(Transmit), 3rd Rx(Receive),
and 5th GND pin need to be connected.
With a new PC and laptops, there is no RS232 protocol and DB9 connector. We have to use serial to the USB connector.
There are various serial to USB connectors available e.g. CP2102, FT232RL, CH340, etc.
Serial to USB converter
To see serial communication, we can use a serial terminal like Realterm, Teraterm, etc. By selecting the serial port number
(COM port in windows) and baud rate, we can open a serial port for communication.
It has basically two registers, one is Tx. Byte and the other is Rx Byte. Both share the same UDR register. Do remember
that, when we write to the UDR reg. Tx buffer will get written and when we read from this register, Rx Buffer will get read.
Buffer uses the FIFO shift register to transmit the data.
2. UCSRA: USART Control and Status Register A. As the name suggests, is used for control and status flags. In a
similar fashion, there are two more USART control and status registers, namely UCSRB and UCSRC.
3. UBRR: USART Baud Rate Register, this is a 16-bit register used for the setting baud rate.
This flag bit is set when there is unread data in UDR. The RXC Flag can be used to generate a Receive Complete interrupt.
Bit 6 – TXC: USART Transmit Complete
This flag bit is set when the entire frame from Tx Buffer is shifted out and there is no new data currently present in the
transmit buffer (UDR). The TXC Flag bit is automatically cleared when a transmit complete interrupt is executed, or it can
be cleared by writing a one to its bit location. The TXC Flag can generate a Transmit Complete interrupt.
If UDRE is one, the buffer is empty which indicates the transmit buffer (UDR) is ready to receive new data. The UDRE Flag
can generate a Data Register Empty Interrupt. UDRE is set after a reset to indicate that the transmitter is ready.
This bit is set if a Data OverRun condition is detected. A Data OverRun occurs when the receive buffer is full (two
characters) and a new character is waiting in the receive Shift Register.
The UCSZ2 bits combined with the UCSZ1:0 bit in UCSRC sets the number of data bits (Character Size) in a frame the
receiver and transmitter use.
This bit selects between the Asynchronous and Synchronous mode of operation.
0 = Asynchronous Operation
1 = Synchronous Operation
These bits enable and set the type of parity generation and check. If parity a mismatch is detected, the PE Flag in
UCSRA will be set.
0 0 Disabled
0 1 Reserved
This bit selects the number of Stop Bits to be inserted by the Transmitter. The Receiver ignores this setting.
0 = 1-bit
1 = 2-bit
The UCSZ1:0 bits combined with the UCSZ2 bit in UCSRB sets the number of data bits (Character Size) in a frame the
Receiver and Transmitter use.
0 0 0 5-bit
0 0 1 6-bit
0 1 0 7-bit
0 1 1 8-bit
1 0 0 Reserved
1 0 1 Reserved
1 1 0 Reserved
1 1 1 9-bit
This bit selects between accessing the UCSRC or the UBRRH Register, as both register shares the same address. The
URSEL must be one when writing the UCSRC or else data will be written in the UBRRH register.
Example: suppose Fosc=8 MHz and required baud rate= 9600 bps.
We can also set this value by c code using pre-processor macro as follow.
#define F_CPU 8000000UL /* Define frequency here its 8MHz */
#define USART_BAUDRATE 9600
BAUD_PRESCALE is the value that we have to load in the UBRR register to set the defined baud rate.
Introduction
Generally, we use a timer/counter to generate time delays, waveforms, or to count events. Also, the timer is used for PWM
generation, capturing events, etc.
Every timer has a timer/counter register. It is zero upon reset. We can access value or write a value to this register.
It counts up with each clock pulse.
Each timer has a Timer Overflow flag. When the timer overflows, this flag will get set.
The value in this register is compared with the content of the TCNTn register. When they are equal, the OCFn flag
will get set.
Timer0
First, we need to understand the basic registers of the Timer0
1. TCNT0: Timer / Counter Register 0
This is an 8-bit register used for the operation mode and the clock source selection.
Write only a bit, which can be used while generating a wave. Writing 1 to this bit causes the wave generator to act as if
a compare match has occurred.
0 0 Normal
1 1 Fast PWM
These bits control the waveform generator. We will see this in the compare mode of the timer.
Bit 2:0 - CS02:CS00: Clock Source Select
These bits are used to select a clock source. When CS02: CS00 = 000, then timer is stopped. As it gets a value
between 001 to 101, it gets a clock source and starts as the timer.
0 1 0 clk / 8
0 1 1 clk / 64
1 0 0 clk / 256
1 0 1 clk / 1024
Timer0 Overflow
Normal mode: When the counter overflows i.e. goes from 0xFF to 0x00, the TOV0 flag is set.
2. For normal mode and the pre-scaler option of the clock, set the value in the TCCR0 register. As soon as the clock
Prescaler value gets selected, the timer/counter starts to count, and each clock tick causes the value of the timer/counter to
increment by 1.
3.Timer keeps counting up, so keep monitoring for timer overflow i.e. TOV0 (Timer0 Overflow) flag to see if it is raised.
4. Stop the timer by putting 0 in the TCCR0 i.e. the clock source will get disconnected and the timer/counter will get
stopped.
5. Clear the TOV0 flag. Note that we have to write 1 to the TOV0 bit to clear the flag.
As Fosc = 8 MHz
T = 1 / Fosc = 0.125 μs
Add one more cycle as it takes to roll over and raise TOV0 flag: 219
Example
Let us generate a square waveform having 10 ms high and 10 ms low time:
*Fosc = 8 MHz
Use the pre-scalar 1024, so the timer clock source frequency will be,
10 ms / 128 μs = 78 (approx)
We need 78 timer cycles to generate a delay of 10 ms. Put the value in TCNT0 accordingly.
Value to load in TCNT0 = 256 – 78 (78 clock ticks to overflow the timer)
Thus, if we load 0xB2 in the TCNT0 register, the timer will overflow after 78 cycles i.e. precisely after a delay of 10 ms.
*Note - All calculations are done by considering 8 MHz CPU frequency. If you are using another value of CPU frequency,
modify the calculations accordingly; otherwise, the delay will mismatch.
Timer Interrupt
TIMSK: Timer / Counter Interrupt Mask Register
We have to set the TOIE0 (Timer0 Overflow Interrupt Enable) bit in the TIMSK register to set the timer0 interrupt so that as
soon as the Timer0 overflows, the controller jumps to the Timer0 interrupt routine.
UNIT-4
ARM PROCESSOR
• ARM is a 32-bit microprocessor with RISC (Reduced Instruction Set Computer) architecture.
• RISC processors are designed to perform a smaller number of computer instructions so that they can operate
at a higher speed, performing more millions of instructions per second (MIPS) as compared to CISC (Complex
instruction set Computer) processors.
• ARM is one of the most licensed and thus widespread processor cores in the world.
• Used especially in portable devices due to low power consumption and reasonable performance (MIPS/watt).
• ARM does not manufacture its own VLSI devices. It licenses out its core to many companies such as TI, Philips,
Intel etc.
• Because of their reduced instruction set, they require fewer transistors, which enables a smaller die size for
the integrated circuitry (IC).
• The ARM processor’s smaller size, reduced complexity and lower power consumption makes them suitable for
increasingly miniaturized devices.
• In Harvard implementation two different buses -ARM high bus (AHB) and ARM Peripheral Bus (APB), are used
for data and instructions.
ARM DATA FLOW MODEL
The arrow represent the flow of data and lines represent the buses
The figure also shows abstract components that make ARM processor
Von Neumann
Implementation
• The instruction decoder translates
instructions
• ARM instructions typically have two source registers, Rn and Rm, and a single result or destination register, Rd
§Source operands are read from the register file using the internal bus
ØThe ARM Processor like all processor uses a Load-store architecture
Ø Load instruction: copy data from memory to register
ØStore instruction: copy data from register to memory
ØThere are no data processing instructions that directly manipulate data in memory.
ØALU and MAC (Multiply-accumulate) unit takes the register values Rn and Rm from A and B buses and computes a
result.
ØLoad and store instructions use the ALU to generate an address to be held in the address register and broadcast on
the Address bus.
ØThe register Rm can be alternatively pre-processed in the barrel shifter before it enters the ALU.
ØFor load and store instructions the incrementer updates the address register before the core reads or writes the
next register value from or to the next sequential memory location.
Registers
● General purpose registers hold either data or an address.
● All registers are 32-bit in size.
● 18 active registers
● 16 data registers – r0 to r15
● 2 process status registers
–
–CPSR – Current Program Status Register SPSR – Saved Program Status Register
.
● r13, r14, r15 have special functions
●R13 – stack pointer (sp) and stores the head of the stack in the current processor
mode
●R14 – link register (lr) where the core puts the return address whenever it calls a
subroutine.
●R15 – programme counter (pc) and contains the address of the next instruction to be
fetched by the processor. ● r13 and r14 can also be used as general purpose register as
these registers are banked during a processor mode change.
● The registers r0 to r13 are orthogonal. Any instruction that you can apply to r0, you can equally apply to other
registers. ● There are instructions that treat r14 and r15 in a special way
Current Program Status Register
(CPSR)
● ARM core uses CPSR to monitor and control internal operations.
● CPSR is a dedicated 32-bit register and resides in the register file.
● CPSR is divided into four fields each 8-bits wide:
● Flags – holding instruction conditions
● Status – reserved for future use
● Extension - reserved for future use
● Control – indicate processor mode, state and interrupt mask bits
CPSR
State & Instruction Sets
●
The state of the core determines which instruction set is being executed.
●
There are three instruction sets
●
ARM: Active in ARM state
●
Thumb: Active in Thumb state ● Jazelle: Active in Jazelle state
• The Jazelle (J) and Thumb (T) bits in the cpsr reflect the state of the processor.
• ARM has introduced a set of extensions to the ARM architecture that will allow an ARM processor to directly
execute Java byte code alongside exiting operating systems, middleware and application code.
• To execute Java bytecodes, the Jazelle technology is required and a modified version of the Java virtual machine.
– the hardware portion of Jazelle only supports a subset of the Java bytecodes and rest are emulated in
software
State & Instruction Set Features
ARM Thumb Jazelle
Instruction Size
Core Over 60% of Java : H/W
58 30
instructions The rest : S/W
Interrupt Masks
●Interrupt masks are used to stop specific interrupt requests from interrupting the processor.
●Two types of interrupt request
● Interrupt Request (IRQ)
● Fast interrupt request (FIQ)
● The I bit in the cpsr masks IRQ when set to binary 1
– Q : Overflow & Saturation : In processors with DSP extensions, the Q bit indicates overflow or
saturation that has occcured in an enhanced DSP instruction.
Processor Modes
● The processor mode determines which registers are active and the access rights to the CPSR register itself.
● A non-privileged mode only allows read access to the control field in the CPSR but still allows R/W access
to the condition flags.
Processor Modes
Banked Registers
• ARM has 37 registers in the register file.
• Of those, 20 registers are hidden from a program at different times. These registers are called banked registers
(shown as shaded region).
• Every processor mode except user mode can change mode by writing directly to the mode bits of the CPSR.
• All modes except system mode have a set of associated banked registers that are a subset of the main 16 registers.
• A banked register maps one-to-one onto a user mode register.
• If you change processor mode, a banked register from the new mode will replace an existing register.
•There is no spsr available in the user mode.
Banked Registers Contd ...
Changing Processor Mode
• The processor mode can be changed
– by a program that writes directly to CPSR (the processor has to
be in privileged mode) or
• For example, when an interrupt request comes along, the processor will
change the program counter to 0x18 and begin fetching instructions
from there.
• One can put a branch instruction at this location so that the processor
can jump to the interrupt handler located at some other location in the
memory.
• On reset, the core jumps to address 0x0 and starts fetching instruction.
We either need to provide a reset exception handler (initialization
routine) or we can begin coding at this address.
Pipeline Concept
• The mechanism a RISC processor uses to execute instructions in parallel
to speed up execution.
• As the pipeline length increases, the amount of work done at each stage
is reduced, which allows the processor attain a higher operating
frequency
Perception is the process by which robots map sensor measurements into internal
representations of the environment. Perception is difficult because sensors are noisy, and the
environment is partially observable, unpredictable, and often dynamic. In other words, robots
have all the problems of state estimation.As a rule of thumb, good internal representations for
robots have three properties:
they contain enough information for the robot to make good decisions,
they are structured so that they can be updated efficiently, and
they are natural in the sense that internal variables correspond to natural state
variables in the physical world
Active perception
The most well-known instance of active perception is active vision. The term “active vision”
is essentially synonymous with moving cameras. Active vision work on Cog is oriented
towards opening up the potentially rich area of manipulation-aided vision, which is still largely
unexplored. But there is much to be gained by taking advantage of the fact that robots are actors
in their environment, not simply passive observers. They have the opportunity to examine the
world using causality, by performing probing actions and learning from the response. In
conjunction with a developmental framework, this could allow the robot’s experience to
expand outward from its sensors into its environment, from its own arm to the objects it
encounters, and from those objects both back to the robot itself and outwards to other actors
that encounter those same objects.
Developmental perception
The robot could reliably segment objects from the background (even if it is similar in
appearance) by poking them. It can determine the shape of an object boundary in this special
situation, even though it cannot do this normally. This is precisely the kind of situation that a
developmental framework could exploit. Particular, familiar situations allow the robot to
perceive something about objects and actors (such as a human or the robot itself) that could not
be perceived outside those situations. These objects and actors can be tracked into other, less
familiar situations, which can then be characterized and used for further discovery. Throughout,
existing perceptual capabilities (“primitive features”) can be refined as opportunities arise.
Interpersonal perception
Perception is not a completely objective process; there are choices to be made. For example,
whether two objects are judged to be the same depends on which of their many features are
considered essential and which are considered incidental. For a robot to be useful, it should
draw the same distinctions a human would for a given task. To achieve this, there must be
mechanisms that allow the robot’s perceptual judgments to be channeled and moulded by a
caregiver. This is also useful in situations where the robot’s own abilities are simply not up to
the challenge, and need a helping hand.
Robotics is a separate entity in Artificial Intelligence that helps study the creation of intelligent
robots or machines. Robotics combines electrical engineering, mechanical engineering and
computer science & engineering as they have mechanical construction, electrical component
and programmed with programming language. Although, Robotics and Artificial Intelligence
both have different objectives and applications, but most people treat robotics as a subset of
Artificial Intelligence (AI). Robot machines look very similar to humans, and also, they can
perform like humans, if enabled with AI.
AI algorithms are necessary when you want to allow the robot to perform more complex tasks.
1. AI Programs
2. Robots
Inputs are given in the form of the analogue signal or in the form of the speech waveform.
Also, to operate this, special hardware with sensors and effectors are needed
Localization is the problem of finding out where things are—including the robot itself.
Knowledge about where things are is at the core of any successful physical interaction
with the environment. For example, robot manipulators must know the location of
objects they seek to manipulate; navigating robots must know where they are to find
their way around.
In some situations, no map of the environment is available. Then the robot will have
to acquire a map. This is a bit of a chicken-and-egg problem: the navigating robot
will have to determine its location relative to a map it doesn’t quite know, at the same
time building this map while it doesn’t quite know its actual location. This problem is
important for many robot applications, and it has been studied extensively under the
name simultaneous localization and mapping, abbreviated as SLAM.
SLAM is the estimation of the pose of a robot and the map of the environment
simultaneously. SLAM is hard because a map is needed for localization and a good pose
estimate is needed for mapping
Localization: inferring location given a map.
Mapping: inferring a map given locations.
SLAM: learning a map and locating the robot simultaneously.
SLAM problem is hard because it is kind of a paradox i.e :
In order to build a map, we need now the position.
To determine our position, we need a map.
It is like a chicken-egg problem.
SLAM has multiple parts and each part can be executed in many different ways:
Landmark detection
Data association
State Estimation
State Update
Landmark Update
Data Association
Data association or data matching is that of matching observed landmarks from different
(laser) scans with each other. There are some challenges associated with the Data
Association,
The algorithm might not re-observe landmarks in every frame.
The algorithm wrongly associates a landmark to a previously observed landmark.
There are few approaches to perform data association, we will be discussing the nearest
neighbor algorithm first:
First, when you get the data from the laser scan use landmark extraction to extract all
visible landmarks.
After that, we associate all the extracted landmarks to the closest landmark that can be
observed >N times.
Now, we input the list of extracted landmarks and list of previously detected landmarks
that are in the database, if the landmark is already in the database then, we increase the
their count by N, and if they are not present then set their count to 1.
After the above step, we need to perform the following update steps:
State Estimation: In this step, we use the odometer data to get the current state
estimate.
State update: In this stage, we update our new estimated state by re-observing
landmarks.
Landmarks update: In this step, we add new landmarks that are detected in current
stage.
Applications of SLAM
SLAM problem is fundamental for getting robots autonomous. It has wide variety of
application where we want to represent surroundings with a map such as Indoor,
Underwater, Outer space etc.
Configuration Space
The configuration space is a transformation from the physical space in which the robot
is of finite-size into another space in which the robot is treated as a point. In other words,
the configuration space is obtained by shrinking the robot to a point, while growing the
obstacles by the size of the robot.
A key concept for motion planning is a configuration: – a complete specification of the position
of every point in the system
• A simple example: a robot that translates but does not rotate in the plane: – what is a sufficient
representation of its configuration?
• The space of all configurations is the configuration space or Cspace.
A robot configuration is a specification of the positions of all robot points relative to a fixed
coordinate system
qn
q=(q1,…, q3
qn)
q1
q2
workspace
robot
reference direction
y
reference point
x
• 3-parameter
representati
Space of all its possible configurations
But the topology of this space is usually not that of a Cartesian space
3-D cylind
robot
qy
y
1
S
q’
x 2
Rx S
1
1 1
C = S xS
q2
q1
It is a manifold, i.e., for each point q, there is a 1-to-1 map between a neighborhood of q and
a Cartesian space Rn, where n is the dimensionality of C
C can always be covered by a finite number of charts. Such a set is called an atlas
– d(q1,q2) = d (q2,q1)
Example:
• Robot A and point x of A
where ||a - b|| denotes the Euclidean distance between points a and b in the workspace
Notion of a Path
q0 q1
qn
q2
q4 q(s)
3
s’ s d(t(s),t(s’)) 0
The first approach to path planning uses cell decomposition—that is, it decomposes the free space
into a finite number of contiguous regions, called cells. These regions have the important property
that the path-planning problem within a single region can be solved by simple means (e.g., moving
along a straight line).
Cell decomposition methods can be improved in a number of ways, to alleviate some of these
problems. The first approach allows further subdivision of the mixed cells—perhaps using cells of half
the original size. This can be continued recursively until a path is found that lies entirely within free
cells. (Of course, the method only works if there is a way to decide if a given cell is a mixed cell, which
is easy only if the configuration space boundaries have relatively simple mathematical descriptions.)
This method is complete provided there is a bound on the smallest passageway through which a
solution must pass. Although it focuses most of the computational effort on the tricky areas within
the configuration space, it still fails to scale well to high-dimensional problems because each recursive
splitting of a cell creates 2d smaller cells. A second way to obtain a complete algorithm is to insist on
an exact cell decomposition of the free space.
The potential field can be used as an additional cost term in the shortest-path calculation. This induces
an interesting tradeoff. On the one hand, the robot seeks to minimize path length to the goal. On the
other hand, it tries to stay away from obstacles by virtue of minimizing the potential function.
Skeletonization methods
The second major family of path-planning algorithms is based on the idea of skeletonization. These
algorithms reduce the robot’s free space to a one-dimensional representation, for which the planning
problem is easier. This lower-dimensional representation is called a skeleton of the configuration
space.
In the basic motion planning problem the environment is considered to be completely static as the
robot A is the only moving object in the environment. The environment can also be dynamic, when it
contains moving objects. Another type of environment occurs when not only the motion of the robot
A, but of multiple robots Ai is to be planned (Erdmann and Lozano-Pérez, 1986; Latombe, 1990). This
case differs from an environment with moving objects, as now the motion of more than one robots is
under control.
Finally, a special case arises when manipulation (Choset, 2005; Li et al., 1989) is considered. In this
case, the ability to alter the environment during movement, by moving objects itself, must be taken
into account by the motion planner. Planning for manipulation is such a broad topic in itself that it is
also been addressed with techniques that are outside the scope of motion planning. This study will
therefore not go into depth on this subject.
Robust methods
Uncertainty can also be handled using so-called robust control methods (see page 836) rather than
probabilistic methods. A robust method is one that assumes a bounded amount of uncertainty in each
aspect of a problem, but does not assign probabilities to values within the allowed interval. A robust
solution is one that works no matter what actual values occur, provided they are within the assumed
interval.
A fine-motion plan consists of a series of guarded motions. Each guarded motion consists of (1) a
motion command and (2) a termination condition, which is a predicate on the robot’s sensor values,
and returns true to indicate the end of the guarded move. The motion commands are typically
compliant motions that allow the effector to slide if the motion command would cause collision with
an obstacle.
A common technique to compensate for the limitations of kinematic plans is to use a separate
mechanism, a controller, for keeping the robot on track. Controllers are techniques for generating
robot controls in real time using feedback from the environment, so as to achieve a control objective.
If the objective is to keep the robot on a preplanned path, it is often referred to as a reference
controller and the path is called a reference path. Controllers that optimize a global cost function are
known as optimal controllers. Optimal policies for continuous MDPs are, in effect, optimal controllers.
Controllers that provide force in negative proportion to the observed error are known as P controllers.
The letter ‘P’ stands for proportional, indicating that the actual control is proportional to the error of
the robot manipulator. More formally, let y(t) be the reference path, parameterized by time index t.
The control at generated by a P controller has the form:
at = KP (y(t) − xt) .
Here xt is the state of the robot at time t and KP is a constant known as the gain parameter of the
controller and its value is called the gain factor); Kp regulates how strongly the controller corrects for
deviations between the actual state xt and the desired one y(t). In our example, KP = 1. At first glance,
one might think that choosing a smaller value for KP would remedy the problem.
Our P controller appears to be stable but not strictly stable, since it fails to stay anywhere near its
reference trajectory. The simplest controller that achieves strict stability in our domain is a PD
controller. The letter ‘P’ stands again for proportional, and ‘D’ stands for derivative. PD controllers are
described by the following equation:
As this equation suggests, PD controllers extend P controllers by a differential component, which adds
to the value of at a term that is proportional to the first derivative of the error y(t) − xt over time. What
is the effect of such a term? In general, a derivative term dampens the system that is being controlled.
To see this, consider a situation where the error (y(t)−xt) is changing rapidly over time, as is the case
for our P controller above. The derivative of this error will then counteract the proportional term,
which will reduce the overall response to the perturbation. However, if the same error persists and
does not change, the derivative will vanish and the proportional term dominates the choice of control.
*************************************************************