Professional Documents
Culture Documents
Smart Blind Stick: Assist. Prof. Mohamed Abdel-Azim
Smart Blind Stick: Assist. Prof. Mohamed Abdel-Azim
Faculty of Engineering
Dept. of Electronics and
Communication Engineering
Supervised by
Assist. Prof. Mohamed Abdel-Azim
Eng. Ahmed Shabaan, Eng. Mohamed Gamal, Eng. Eman Ashraf
2011-2012
Mansoura University
Faculty of Engineering
Dept. of Electronics and Comm. Engineering
Supervised by
2011-2012
Team Work
Team Work
i
Acknowledgement
Acknowledgement
We would like to express our gratitude to our advisor and supervisor Dr.
Mohammed Abd ElAzim for guiding this work with interest. We would like to
also thank Eng. Ahmed Shaaban and Eng. Mohammed Gamal and Eng. Eman
Ashraf, Teaching Assistance for the countless hours he spent in the labs. We are
grateful to them for setting high standards and giving us the freedom to explore.
We would like to thank our colleagues for the assistance and constant support
provided by them.
Our Team
ii
Acknowledgement
iii
Abstract
Abstract
There is approximately 36.9 million people in the world are blind in 2002
according to World Health Organization. Majority of them are using a
conventional white cane to aid in navigation. The limitation in white cane is that
the information’s are gained by touching the objects by the tip of the cane. The
traditional length of a white cane depends on the height of user and it extends
from the floor to the person’s sternum. So we'll design ultrasound sensor to
detect all kinds of barriers whatever its shape or height and warn him with
vibration. Blind people also face great problems in moving from place to
another in the town and the only way for them is Guide dogs which can cost
about $20, 000 and they can be useful for about 5 – 6 years.
So we'll design GPS for blind people which help him in moving from place
to another in the town with voice orders for directions and he'll identify the
place he want to go with voice only and not need to type any thing.
But we want also to help him in moving indoor or in closed places he goes
daily from place to another we'll design an indoor navigation system depend on
working off line to help him to move from location to another in specific places
home, moles, libraries...Etc. also by voice orders .
He may face a great problem in control his electric devices we'll design for
him a total wireless control system to easily control all his electric devices by
voice connected to a security system to warn him if he indoor or out if any thing
wrong happen and help him to solve this problem .
iv
Contents
v
CHAPTER 1
Introduction
Chapter 1 | Introduction
There is approximately 36.9 million people in the world are blind in 2002
according to World Health Organization. Majority of them are using a
conventional white cane to aid in navigation. The limitation in white cane is that
the information’s are gained by touching the objects by the tip of the cane. The
traditional length of a white cane depends on the height of user and it extends from
the floor to the person’s sternum.
Blind people also face great problems in moving from place to another in the
town and the only way for them is Guide dogs which can cost about $20, 000 and
they can be useful for about 5 – 6 years. They also have a great problem to identify
the objects he frequently used in his house as kitchen tools and clothes. And also
he may face a great problem in control his electric devices or have a security
problem and he can't face it.
All previous problems we're trying to solve them. To help the user moving
easily indoor and outdoor we'll use ultrasound sensor to detect the barriers on his
way and alert him by 2 ways vibration motor which speed increases when the
distance decreases and voice alert told him the distance between him and the
barrier.
To solve the problem of moving outside home from place to another we'll
design a software to be used in smart phones to help him in moving from place to
another with voice orders without any external help he just say the place he want to
go then the phone will guide him with voice orders to arrive this place. To help
him to identify the objects we'll use RFID every important object will have tag or
id when the reader read the id it will told him what it is by voice. Inside the home
we'll design a system to control all electronic devices by voice orders and also a
security system designed especially for them the most important in it is the fire
alarm when it detects a fire it will alert him by a call to his mobile phone and
another call to his friends near him for help and also a security system to warn him
if he forget to close his door. After finishing these applications we're going to make
features after graduation by adding new technologies to help him moving in the
street easier and help him crossing roads and reading books. The products in our
market in Egypt for them don't cover any needs for them.
1
Chapter 1 | Introduction
The blind needs to move control and do his tasks his self without any help
from anybody. There’s just a white stick without any technologies or features. So
finally we'll install on the white stick a sensor and RFID and the other part is a
software part on the mobile to do the navigation and automation tasks.
Our customers are blind people and a visually impaired person there's almost
1 million people in Egypt has one of the past problems.
Our product would cover some needs of our customers as helping them to avoid
the barriers on their way and guide them with voice to the direction they must go to
avoid this and also help the to move free without any external help in different
countries by android application on his mobile which designed especially for them
to guide them with voice through roads and tell them the direction they have to go
to arrive their goal.
To reach our goal we met with different customers to know exactly what they
need and help us to get a vision for our final product to be comfortable and also we
were guided technically by our sponsors to find the best way to cover all these
needs.
In our market the available products doesn't cover any needs we just found a white
stick without any technologies to help the user.
2
Chapter 1 | Introduction
Our project was built on the simplest available technologies to reach our goal
in the way that comfort the user so we divided our project into 2 parts software and
hardware.
The hardware part consists of MCU pic, MP3 module, cam module and
ultrasound sensor module.
The software part is an android application available to be installed on the
mobile.
In the hardware part there're 2 conditions for it indoor and outdoor.
For indoor only one sensor will measure ranges and cam module will take a photo
to the object when the user reaches 2 cm to detect the code put on and send it to
MCU which processing it and identify the code number and then get the object
name from database and then connect the mp3 module WT588D and get the mp3
file address which contains the name of it and out to from the speaker.
For outdoor 3 sensors HC-SR04 sensors will be activated in 3 direction to
determine the best way no barriers on it and send measured data to MCU and the
MCU detect the best way and send the address of the mp3 which contains the
wanted direction and it would be the output.
For navigation outdoor we'll design android application using Google maps
the user detect the place he want to go with voice and the application detect his
current position using GPS and the digital compass detect the angel of view and
guide him to the direction using GPS data and compass data.
Choose Mode
Outdoor Indoor
3
Chapter 1 | Introduction
Project Timing:
The three main parts are individual in execution time but each part has many
branches which are series in execution time.
4
Chapter 1 | Introduction
Technology Readiness:
One of the fundamental components in the product is technology because the
Android and Ultrasonic technology are taking good importance between the
Egyptian customers.
Market Readiness:
The market always has a readiness to any new product the market is common
between products to give the customers the best one for them.
5
CHAPTER 2
Speech Recognition
Chapter 2 | Speech Recognition
2.1 | INTRODUCTION
7
Chapter 2 | Speech Recognition
They are ideally similar for objects in the same class and very different for
objects indifferent class. Pattern class is a family of patterns that share some
common properties. Pattern recognition by machine involves techniques for
assigning patterns to their respective classes automatically and with as little human
intervention as possible.
8
Chapter 2 | Speech Recognition
Speech begins with the generation of an airstream, usually by the lungs and
diaphragm -process called initiation. This air then passes through the larynx tube,
where it is modulated by the glottis (vocal chords). This step is called phonation or
voicing, and is responsible fourth generation of pitch and tone. Finally, the
modulated air is filtered by the mouth, nose, and throat - a process called
articulation - and the resultant pressure wave excites the air.
Depending upon the positions of the various articulators different sounds are
produced. Position of articulators can be modeled by linear time- invariant system
that has frequency response characterized by several peaks called formants. The
change in frequency of formants characterizes the phoneme being articulated.
As a consequence of this physiology, we can notice several characteristics of
the frequency domain spectrum of speech. First of all, the oscillation of the glottis
9
Chapter 2 | Speech Recognition
Fig. (2.3): Audio Sample for /i: / phoneme showing stationary property of phonemes for a short period
The sound comes out in phonemes which are the building blocks of speech.
Each phoneme resonates at a fundamental frequency and harmonics of it and thus
has high energy at those frequencies in other words have different formats. It is the
feature that enables the identification of each phoneme at the recognition stage.
The variations in
Fig.(2.4): Audio Magnitude Spectrum for /i:/ phoneme showing fundamental frequency and its harmonics
10
Chapter 2 | Speech Recognition
The underlying premise for voice authentication is that each person’s voice
differs in pitch, tone, and volume enough to make it uniquely distinguishable.
Several factors contribute to this uniqueness: size and shape of the mouth, throat,
nose, and teeth (articulators) and the size, shape, and tension of the vocal cords.
The chance that all of these are exactly the same in any two people is very low.
Voice Biometric has following advantages from other form of biometrics:
Natural signal to produce
Implementation cost is low since, doesn’t require specialized input device
Acceptable by user
Easily mixed with other form of authentication system for multifactor
authentication only biometric that allows users to authenticate remotely.
11
Chapter 2 | Speech Recognition
of the many source of variability associated with the signal such as the acoustic
realizations of phonemes, the smallest sound units of which words are composed,
are highly dependent on the context. Acoustic variability can result from changes
in the environment as well as in the position and characteristics of the transducer.
Third, within speaker variability can result from changes in the speaker's physical
and emotional state, speaking rate, or voice quality. Finally, differences in socio
linguistic background, dialect, and vocal tract size and shape can contribute to
cross-speaker variability. Such variability is modeled in various ways. At the level
of signal representation, the representation that emphasizes the speaker
independent features is developed.
Speaker Identification
Speaker identification is the process of determining which registered speaker
provides a given utterance. In Speaker Identification (SID) system, no identity
claim is provided, the test utterance is scored against a set of known (registered)
references for each potential speaker and the one whose model best matches the
test utterance is selected. There is two types of speaker identification task closed-
set and open-set speaker identification .In closed-set, the test utterance belongs to
one of the registered speakers.
During testing, a matching score is estimated for each registered speaker. The
speaker corresponding to the model with the best matching score is selected. This
requires N comparisons for a population of N speakers. In open-set, any speaker
can access the system; those who are not registered should be rejected. This
requires another model referred to as garbage model or imposter model or
background model, which is trained with data provided by other speakers different
from the registered speakers.
During testing, the matching score corresponding to the best speaker model is
compared with the matching score estimated using the garbage model. In order to
accept or reject the speaker, making the total number of comparisons equal to N +
12
Chapter 2 | Speech Recognition
Speaker verification
Speaker verification, on the other hand, is the process of accepting or
rejecting the identity claim of a speaker. That is, the goal is to automatically accept
or reject an identity that is claimed by the speaker. During testing, a verification
score is estimated using the claimed speaker model and the anti-speaker model.
This verification score is then compared to a threshold. If the score is higher than
the threshold, the speaker is accepted, otherwise, the speaker is rejected.
Thus, speaker verification, involves a hypothesis test requiring a simple
binary decision: accept or reject the claimed identity regardless of the population
size. Hence, the performance is quite independent of the population size, but it
depends on the number of test utterances used to evaluate the performance of the
system.
And another statistical method widely used for speech recognition is HMM.
HMM models the Markovian nature of speech signal where each phoneme
represents a state and sequence of such phonemes represents a word. Sequence of
Features of such phonemes from different speakers is modeled by HMM.
13
Chapter 2 | Speech Recognition
Starting from the capturing of audio signal, feature extraction consists of the
following steps as shown in the block diagram below:
Speech
Silence Pre- Mel Filter
Signal removal emphasis
Framing Windowing DFT Bank Log
IDF
T
CMS
12MFCC
12 ΔMFCC
12 ΔΔ MFCC
Energy Delta
1 energy
1 Δ energy
1 ΔΔ energy
Fig. (2.5): Pre-Processing and Feature Extraction
2.3.1.1 | Capture
The captured audio signal may contain silence at different positions such as
beginning of signal, in between the words of a sentence, end of signal…. etc. If
silent frames are included, modeling resources are spent on parts of the signal
which do not contribute to the identification. The silence present must be removed
before further processing. There are several ways for doing this: most popular are
Short Time Energy and Zeros Crossing Rate. But they have their own limitation
regarding setting thresholds as an ad hocbasis. The algorithm we used uses
14
Chapter 2 | Speech Recognition
Step 2:
Go from 1st sample to the last sample of the speech recording. In each
sample, check whether one-dimensional Mahalanobis distance functions i.e. | x-μ |/
σ greater than 3 or not. If Mahalanobis distance function is greater than 3, the
sample is to be treated as voiced sample otherwise it is an unvoiced/silence. The
threshold reject the samples up to 99.7% as per given by P [|x−μ|≤3σ] =0.997 in a
Gaussian distribution thus accepting only the voiced samples.
Step 3:
Mark the voiced sample as 1 and unvoiced sample as 0. Divide the whole
speech signal into 10 ms non-overlapping windows. Represent the complete speech
by only zeros and ones.
Step 4:
Consider there are M number of zeros and N number of ones in a window. If
M ≥ N then convert each of ones to zeros and vice versa. This method adopted here
keeping in mind that a speech production system consisting of vocal cord, tongue,
vocal tract etc. cannot change abruptly in a short period of time window taken here
as 10ms.
Step 5:
Collect the voiced part only according to the labeled „1‟ samples from the
windowed array and dump it in a new array. Retrieve the voiced part of the
original speech signal from labeled 1 sample.
15
Chapter 2 | Speech Recognition
2.3.1.4 | Pre-emphasis
16
Chapter 2 | Speech Recognition
Speech is a non-stationary signal, meaning that its statistical properties are not
constant across time. Instead, we want to extract spectral features from a small
window of speech that characterizes a particular sub phone and for which we can
make the (rough) assumption that the signal is stationary (i.e. its statistical
properties are constant within this region).We used frame block of 23.22ms with
50% overlapping i.e., 512 samples per frame.
17
Chapter 2 | Speech Recognition
The extraction of the signal takes place by multiplying the value of the signal
at time n, s frame [n], with the value of the window at time n, S w [n]:
Y[n] = Sw[n] × Sframe[n]
18
Chapter 2 | Speech Recognition
The commonly used algorithm for computing the DFT is the Fast Fourier
Transform or in short FFT.
19
Chapter 2 | Speech Recognition
frequencies. The width of the triangular filters varies according to the Mel scale, so
that the log total energy in a critical band around the center frequency is included.
The centers of the filters are uniformly spaced in the Mel scale.
The result of Mel filter is information about distribution of energy at each Mel
scale band. We obtain a vector of outputs (12 coeffs.) from each filter.
20
Chapter 2 | Speech Recognition
[ ] ∑ () [ ( )]
( ) ( ) ∑ ( )
∑ [ ]
Delta feature
Another interesting fact about the speech signal is that it is not constant from
frame to frame. Co-articulation (influence of a speech sound during another
21
Chapter 2 | Speech Recognition
adjacent or nearby speech sound) can provide a useful cue for phone identity. It
can be preserved by using delta features. Velocity (delta) and acceleration (delta
delta) coefficients are usually obtained from the static window based information.
This delta and delta delta coefficients model the speed and acceleration of the
variation of Cepstral feature vectors across adjacent windows. A simple way to
compute deltas would be just to compute the difference between frames; thus the
delta value d(t ) for a particular Cepstral value c (t) at time t can be estimated as:
( ) [] [] []
The differentiating method is simple, but since it acts as a high-pass filtering
operation on the parameter domain, it tends to amplify noise. The solution to this is
linear regression, i.e. first-order polynomial, the least squares solution is easily
shown to be of the following form:
∑ []
[]
∑
2.4.1 | Introduction
We have used ANNs to model our system and train voices and test it to
classify it into words categories which return actions. And here we will make an
overview about artificial neural networks.
The original inspiration for the term Artificial Neural Network came from
examination of central nervous systems and their neurons, axons, dendrites, and
synapses, which constitute the processing elements of biological neural networks
investigated by neuroscience. In an artificial neural network, simple artificial
nodes, variously called "neurons", "neurodes", "processing elements" (PEs) or
22
Chapter 2 | Speech Recognition
2.4.2 | Models
23
Chapter 2 | Speech Recognition
The word network in the term 'artificial neural network' refers to the inter–
connections between the neurons in the different layers of each system. An
example system has three layers. The first layer has input neurons, which send data
via synapses to the second layer of neurons, and then via more synapses to the
third layer of output neurons. More complex systems will have more layers of
neurons with some having increased layers of input neurons and output neurons.
The synapses store parameters called "weights" that manipulate the data in the
calculations. An ANN is typically defined by three types of parameters:
The interconnection pattern between different layers of neurons
The learning process for updating the weights of the interconnections
The activation function that converts a neuron's weighted input to its output
activation.
Mathematically, a neuron's network function is defined as a composition of
other functions, which can further be defined as a composition of other functions.
This can be conveniently represented as a network structure, with arrows depicting
the dependencies between variables. A widely used type of composition is the
nonlinear weighted sum, where (commonly referred to as the activation function)
is some predefined function, such as the hyperbolic tangent. It will be convenient
for the following to refer to a collection of functions as simply a vector.
24
Chapter 2 | Speech Recognition
The second view is the probabilistic view: the random variable depends upon
the random variable , which depends upon , which depends upon the random
variable . This view is most commonly encountered in the context of graphical
models.
The two views are largely equivalent. In either case, for this particular
network architecture, the components of individual layers are independent of each
other (e.g., the components of are independent of each other given their input).
This naturally enables a degree of parallelism in the implementation. Two separate
depictions of the recurrent ANN dependency graph.
Networks such as the previous one are commonly called feed forward,
because their graph is a directed acyclic graph. Networks with cycles are
commonly called recurrent. Such networks are commonly depicted in the manner
shown at the top of the figure, where is shown as being dependent upon itself.
However, an implied temporal dependence is not shown.
2.4.5 | Learning
What has attracted the most interest in neural networks is the possibility of
learning. Given a specific task to solve, and a class of functions, learning means
using a set of observations to find which solves the task in some optimal sense.
This entails defining a cost function such that, for the optimal solution, - i.e.,
no solution has a cost less than the cost of the optimal solution (see Mathematical
optimization).
The cost function is an important concept in learning, as it is a measure of
how far away a particular solution is from an optimal solution to the problem to be
solved. Learning algorithms search through the solution space to find a function
that has the smallest possible cost.
For applications where the solution is dependent on some data, the cost must
necessarily be a function of the observations; otherwise we would not be modeling
anything related to the data. It is frequently defined as a statistic to which only
approximations can be made. As a simple example, consider the problem of
finding the model , which minimizes , for data pairs drawn from some distribution
. In practical situations we would only have samples from and thus, for the above
example, we would only minimize . Thus, the cost is minimized over a sample of
the data rather than the entire data set.
25
Chapter 2 | Speech Recognition
When some form of online machine learning must be used, where the cost is
partially minimized as each new example is seen. While online machine learning is
often used when is fixed, it is most useful in the case where the distribution
changes slowly over time. In neural network methods, some form of online
machine learning is frequently used for finite datasets.
In supervised learning, we are given a set of example pairs and the aim is to
find a function in the allowed class of functions that matches the examples. In
other words, we wish to infer the mapping implied by the data; the cost function is
related to the mismatch between our mapping and the data and it implicitly
contains prior knowledge about the problem domain.
A commonly used cost is the mean-squared error, which tries to minimize the
average squared error between the network's output, f(x), and the target value y
over all the example pairs. When one tries to minimize this cost using gradient
descent for the class of neural networks called multilayer perceptron’s, one obtains
the common and well-known back-propagation algorithm for training neural
networks.
Tasks that fall within the paradigm of supervised learning are pattern
recognition (also known as classification) and regression (also known as function
approximation). The supervised learning paradigm is also applicable to sequential
26
Chapter 2 | Speech Recognition
data (e.g., for speech and gesture recognition). This can be thought of as learning
with a "teacher," in the form of a function that provides continuous feedback on the
quality of solutions obtained thus far.
27
Chapter 2 | Speech Recognition
discover the policy that minimizes the cost; i.e., the MC for which the cost is
minimal.
ANNs are frequently used in reinforcement learning as part of the overall
algorithm. Dynamic programming has been coupled with ANNs (Neuro dynamic
programming) by Bertsekas and Tsitsiklis and applied to multi-dimensional
nonlinear problems such as those involved in vehicle routing or natural resources
management because of the ability of ANNs to mitigate losses of accuracy even
when reducing the discretization grid density for numerically approximating the
solution of the original control problems.
Tasks that fall within the paradigm of reinforcement learning are control
problems, games and other sequential decision making tasks.
Training a neural network model essentially means selecting one model from
the set of allowed models (or, in a Bayesian framework, determining a distribution
over the set of allowed models) that minimizes the cost criterion. There are
numerous algorithms available for training neural network models; most of them
can be viewed as a straightforward application of optimization theory and
statistical estimation.
Most of the algorithms used in training artificial neural networks employ some
form of gradient descent. This is done by simply taking the derivative of the cost
function with respect to the network parameters and then changing those
parameters in a gradient-related direction.
Evolutionary methods, simulated annealing, expectation-maximization, non-
parametric methods and particle swarm optimization are some commonly used
methods for training neural networks.
28
Chapter 2 | Speech Recognition
Robustness: If the model, cost function and learning algorithm are selected
appropriately the resulting ANN can be extremely robust.
With the correct implementation, ANNs can be used naturally in online
learning and large data set applications. Their simple implementation and the
existence of mostly local dependencies exhibited in the structure allows for fast,
parallel implementations in hardware.
2.4.13 | Applications
The utility of artificial neural network models lies in the fact that they can be
used to infer a function from observations. This is particularly useful in
applications where the complexity of the data or task makes the design of such a
function by hand impractical.
The tasks artificial neural networks are applied to tend to fall within the
following broad categories:
Function approximation, or regression analysis, including time series prediction,
fitness approximation and modeling.
Classification, including pattern and sequence recognition, novelty detection and
sequential decision making.
Data processing, including filtering, clustering, blind source separation and
compression.
Robotics, including directing manipulators, Computer numerical control.
Application areas include system identification and control (vehicle control,
process control, natural resources management), quantum chemistry, game-playing
and decision making (backgammon, chess, poker), pattern recognition (radar
systems, face identification, object recognition and more), sequence recognition
(gesture, speech, handwritten text recognition), medical diagnosis, financial
29
Chapter 2 | Speech Recognition
30
Chapter 2 | Speech Recognition
Artificial neural network types vary from those with only one or two layers of
single direction logic, to complicated multi–input many directional feedback loop
and layers. On the whole, these systems use algorithms in their programming to
determine control and organization of their functions. Some may be as simple as a
one neuron layer with an input and an output, and others can mimic complex
systems such as dANN, which can mimic chromosomal DNA through sizes at
cellular level, into artificial organisms and simulate reproduction, mutation and
population sizes.
Most systems use "weights" to change the parameters of the throughput and
the varying connections to the neurons. Artificial neural networks can be
autonomous and learn by input from outside "teachers" or even self-teaching from
written in rules.
Supervised neural networks that use an MSE cost function can use formal
statistical methods to determine the confidence of the trained model. The MSE on
a validation set can be used as an estimate for variance. This value can then be
used to calculate the confidence interval of the output of the network, assuming a
normal distribution. A confidence analysis made this way is statistically valid as
long as the output probability distribution stays the same and the network is not
modified.
By assigning a softmax activation function on the output layer of the neural
network (or a softmax component in a component-based neural network) for
categorical target variables, the outputs can be interpreted as posterior
probabilities. This is very useful in classification as it gives a certainty measure on
classifications.
31
CHAPTER 3
Image Processing
s
Chapter 3 | Image Processing
3.1 | INTRODUCTION
33
Chapter 3 | Image Processing
The color-responsive chemicals in the cones are called cone pigments and are
very similar to the chemicals in the rods. The retinal portion of the chemical is the
same, however the scotopsin is replaced with photopsins. Therefore, the color-
responsive pigments are made of retinal and photopsins. There are three kinds of
color-sensitive pigments:
• Red-sensitive pigment
• Green-sensitive pigment
• Blue-sensitive pigmentlution representations versus quality of service.
Each cone cell has one of these pigments so that it is sensitive to that color.
The human eye can sense almost any gradation of color when red, green and blue
are mixed.
The wavelengths of the three types of cones (red, green and blue) are shown.
The peak absorbancy of blue-sensitive pigment is 445 nanometers, for green-
sensitive pigment it is 535 nanometers, and for red-sensitive pigment it is 570
nanometers.
MATLAB stores most images as two-dimensional arrays (i.e., matrices), in
which each element of the matrix corresponds to a single pixel in the displayed
image. For example, an image composed of 200 rows and 300 columns of different
colored dots would be stored in MATLAB as a 200-by-300 matrix. Some images,
such as RGB, require a three dimensional array, where the first plane in the 3rd
dimension represents the red pixel intensities, the second plane represents the
green pixel intensities, and the third plane represents the blue pixel intensities.
To reduce memory requirements, MATLAB supports storing image data in
arrays of class uint8 and uint16. The data in these arrays is stored as 8-bit or 16-bit
unsigned integers. These arrays require one-eighth or one-fourth as much memory
as data in double arrays. An image whose data matrix has class uint8 is called an 8-
bit image; an image whose data matrix has class uint16 is called a 16-bit image.
3.2.1 | Fundamentals
A digital image is composed of pixels which can be thought of as small dots
on the screen. A digital image is an instruction of how to color each pixel. We will
see in detail later on how this is done in practice. A typical size of an image is 512-
by-512 pixels. Later on in the course you will see that it is convenient to let the
33
Chapter 3 | Image Processing
BMP
HDF
JPEG
PCX
TIFF
XWB
Most images you find on the Internet are JPEG-images which is the name for
one of the most widely used compression standards for images. If you have
stored an image you can usually see from the suffix what format it is stored in. For
example, an image named myimage.jpg is stored in the JPEG format and we will
see later on that we can load an image of this format into Mat lab.
33
Chapter 3 | Image Processing
Image Enhancement: Processing an image so that the result is more suitable for a
particular application. (Sharpening or deploring an out of focus image, highlighting
edges, improving image contrast, or brightening an image, removing noise)
Image Restoration: This may be considered as reversing the damage done to an
image by a known cause. (Removing of blur caused by linear motion, removal of
optical distortions)
Image Segmentation: This involves subdividing an image into constituent parts,
or isolating certain aspects of an image.(finding lines, circles, or particular shapes
in an image, in an aerial photograph, identifying cars, trees, buildings, or roads.
This is the equivalent to a "gray scale image" and this is the image we will
mostly work with in this course. It represents an image as a matrix where every
element has a value corresponding to how bright/dark the pixel at the
corresponding position should be colored. There are two ways to represent the
number that represents the brightness of the pixel: The double class (or data type).
This assigns a floating number ("a number with decimals") between 0 and 1 to
each pixel. The value 0 corresponds to black and the value 1 corresponds to white.
The other class is called uint8 which assigns an integer between 0 and 255 to
represent the brightness of a pixel. The value 0 corresponds to black and 255 to
white. The class uint8 only requires roughly 1/8 of the storage compared to the
class double. On the other hand, many mathematical functions can only be applied
to the double class. We will see later how to convert between double and uint8.
Fig. (3.1)
33
Chapter 3 | Image Processing
This image format also stores an image as a matrix but can only color a pixel
black or white (and nothing in between). It assigns a 0 for black and a 1 for white.
This is a practical way of representing color images. (In this course we will
mostly work with gray scale images but once you have learned how to work with a
gray scale image you will also know the principle how to work with color images.)
An Indexed image stores an image as two matrices. The first matrix has the same
size as the image and one number for each pixel. The second matrix is called the
color map and its size may be different from the image. The numbers in the first
matrix is an instruction of what number to use in the color map matrix.
Fig. (3.2)
This is another format for color images. It represents an image with three
matrices of sizes matching the image format. Each matrix corresponds to one of
the colors red, green or blue and gives an instruction of how much of each of these
colors a certain pixel should use.
working with a sequence of images. In case you choose to work with biological
imaging later on in this course, you may use this format.
The following table shows how to convert between the different formats given
above. All these commands require the Image processing tool box!
When you encounter an image you want to work with, it is usually in form
of a file (for example, if you down load an image from the web, it is usually stored
as a JPEG-file). Once we are done processing an image, we may want to write it
back to a JPEG-file so that we can, for example, post the processed image on the
web. This is done using the imread and imwrite commands. These commands
require the Image processing tool box!
33
Chapter 3 | Image Processing
Make sure to use semi-colon; after these commands, otherwise you will get
LOTS OF number scrolling on your screen... The commands imread and imwrite
support the formats given in the section "Image formats supported by Matlab"
above.
This section explains how to load and save variables in Mat lab. Once you
have read a file, you probably convert it into an intensity image (a matrix) and
work with this matrix. Once you are done you may want to save the matrix
representing the image in order to continue to work with this matrix at another
time. This is easily done using the commands save and load. Note that save and
load are commonly used Matlab commands, and works independently of what tool
boxes that are installed.
Here are a couple of basic Mat lab commands (do not require any tool box)
for displaying an image.
33
Chapter 3 | Image Processing
Sometimes your image may not be displayed in gray scale even though you
might have converted it into a gray scale image. You can then use the command
colormap (gray) to "force" Matlab to use a gray scale when displaying an image.
If you are using Matlab with an Image processing tool box installed, I
recommend you to use the command imshow to display an image.
Table (3.5)Displaying an image given on matrix form (with image processing tool box)
Operation Matlab command
Display an image represented as the matrix X. imshow(X)
Zoom in (using the left and right mouse button). zoom on
Turn off the zoom function. zoom off
A = imread (filename, fmt) reads a grayscale or true color image named filename
into A. If the file contains a grayscale intensity image, A is a two-dimensional
array. If the file contains a true color (RGB) image, A is a three-dimensional (m-
by-n-by-3) array.
3.6.2 | Rotation
Where;
A: Your image.
ANGLE: The angle (in degrees) you want to rotate your image in the counter
clockwise direction.
METHOD: A string that can have one of these values
If you omit the METHOD argument, IMROTATE uses the default method of
'nearest'.
34
Chapter 3 | Image Processing
Note: to rotate the image clockwise, specify a negative angle. The returned image
matrix B is, in general, larger than A to include the whole rotated image.
IMROTATE sets invalid values on the periphery of B to 0.
3.6.3 | Scaling
3.6.4 | Interpolation
34
Chapter 3 | Image Processing
The algorithm should not return multiple edges pixels when only a single one exist.
Fig.(3.4)
Fig. (3.5)
b=rgb2gray(a); % convert to gray. WE can only do edge tracing for gray images.
edge(b,'prewitt');
edge(b,'sobel');
edge(b,'sobel','vertical');
edge(b,'sobel','horizontal');
edge(b,'sobel','both');
We can only do edge tracing using gray scale images (i.e images without color).
34
Chapter 3 | Image Processing
Fig.(3.6)
Table(3.6):Data types
Type Description Range
Int8 8-bit integer -128_127
Uint8. 8-bit unsigned integer 0_255
Int16 16-bit integer -32768_32767
Double Double precision real number Machine specific
3.8 | MAPPING
33
Chapter 3 | Image Processing
The following Object Graphics example maps a satellite image from the Los
Angeles, California vicinity onto a DEM (Digital Elevation Model) containing the
areas topographical features. The realism resulting from mapping the image onto
the corresponding elevation data provides a more informative view of the area’s
topography. The process is segmented into the following three sections:
• “Opening Image and Geometry Files”
• “Initializing the IDL Display Objects”
• “Displaying the Image and Geometric Surface Objects”
33
Chapter 3 | Image Processing
Note:
Data can be either regularly gridded (defined by a 2D array) or irregularly
gridded (defined by irregular x, y, z points). Both the image and elevation data used
in this example are regularly gridded. If you are dealing with irregularly gridded
data, use GRIDDATA to map the data to a regular grid.
Complete the following steps for a detailed description of the process.
Example Code:
See elevation_object.pro in the examples/doc/image subdirectory of the IDL
installation directory for code that duplicates this example. Run the example
procedure by entering elevation object at the IDL command prompt or view the file
in an IDL Editor window by entering .EDIT elevation_object.pro.
Opening Image and Geometry Files:
The following steps read in the satellite image and DEM files and display the
Elevation data.
4. Define an array for the elevation data, open the file, read in the data and close
the file:
dem = READ_BINARY(demfile, DATA_DIMS = [64, 64]
After reading in the satellite image and DEM data, continue with the next
section to create the objects necessary to map the satellite image onto the elevation
surface.
After reading in the image and surface data in the previous steps, you will
need to create objects containing the data. When creating an IDL Object Graphics
display, it is necessary to create a window object (oWindow), a view object
(oView) and a model object (oModel). These display objects, shown in the
conceptual representation in the following figure, will contain a geometric surface
object (the DEM data) and an image object (the satellite image).
These user-defined objects are instances of existing IDL object classes and
provide access to the properties and methods associated with each object class.
33
Chapter 3 | Image Processing
Note:
(The XOBJVIEW utility (described in “Mapping an Image Object onto a
Sphere” automatically creates window and view Complete the following steps to
initialize the necessary IDL objects.)
1. Initialize the window, view and model display objects. For detailed syntax,
arguments and keywords available with each object initialization, see
IDLgrWindow::Init, IDLgrView::Init and IDLgrModel::Init. The following
three lines use the basic syntax :
oNewObject = OBJ_NEW('Class_Name')
This section displays the objects created in the previous steps. The image and
surface objects will first be displayed in an IDL Object Graphics window and then
with the interactive XOBJVIEW utility.
33
Chapter 3 | Image Processing
1. Center the elevation surface object in the display window. The default object
graphics coordinate system is [–1,–1], [1,1]. To center the object in the window,
position the lower left corner of the surface data at [–0.5,–0.5, –0.5]
for the x, y and z dimensions:
2. Map the satellite image onto the geometric elevation surface using the
IDLgrSurface::Init TEXTURE_MAP keyword:
oSurface -> SetProperty, TEXTURE_MAP = oImage, $
COLOR = [255, 255, 255]
For clearest display of the texture map, set COLOR = [255, 255, 255]. If the image
does not have dimensions that are exact powers of 2, IDL resamples the image into
a larger size that has dimensions which are the next powers of two greater than the
original dimensions. This resampling may cause unwanted sampling artifacts. In
this example, the image does have dimensions that are exact powers of two, so no
resampling occurs.
Note:
(If your texture does not have dimensions that are exact powers of 2 and you
do not want to introduce resampling artifacts, you can pad the texture with unused
data to a power of two and tell IDL to map only a subset of the texture onto the
surface.) For example, if your image is 40 by 40, create a 64 by 64 image and fill
part of it with the image data:
textureImage = BYTARR(64, 64, /NOZERO)
textureImage[0:39, 0:39] = image ; image is 40 by 40
oImage = OBJ_NEW('IDLgrImage', textureImage)
Then, construct texture coordinates that map the active part of the texture to a
surface (oSurface):
textureCoords = [[], [], [], []]
33
Chapter 3 | Image Processing
3. Add the surface object, covered by the satellite image, to the model object.
Then add the model to the view object:
oModel -> Add, oSurface.
oView -> Add, oMode.
4. Rotate the model for better display in the object window. Without rotating the
model, the surface is displayed at a 90 elevation angle, containing no depth
information. The following lines rotate the model 90 away from the viewer along
the x-axis and 30clockwise along the y-axis and the x-axis:
oModel -> ROTATE, [1, 0, 0], -90
oModel -> ROTATE, [0, 1, 0], 30
oModel -> ROTATE, [1, 0, 0], 30
33
Chapter 3 | Image Processing
6. Display the results using XOBJVIEW, setting the SCALE = 1 (instead of the
default value of 1/SQRT3) to increase the size of the initial display:
Fig.( 3.10) Displaying the Image Mapped onto the Surface in XOBJVIEW
For an example of mapping an image onto a regular surface using both Direct
and Object Graphics displays, see “Mapping an Image onto a Sphere”
34
Chapter 3 | Image Processing
In the absence of a network or services we can identify and see the track
through the use of image processing technique, We incorporate the map where an
image of the places familiar to the person and determine how to access them and
return them in a clear and safe.
we calculate the distances by using mat lab function :
IMDISTLINE
and assuming speed to calculate time takes to get from one point to another and
we guide person through voice commands for example on the road to move
forward or back word or to left or to right. We have thus, we provide another way
to work mapping without being online.
34
CHAPTER 4
GPS Navigation
Chapter 4 | GPS Navigation
4.1 | INTRODUCTION
35
Chapter 4 | GPS Navigation
35
Chapter 4 | GPS Navigation
33
Chapter 4 | GPS Navigation
-Two sphere surfaces intersecting in a circle -Surface of sphere intersecting a circle (not a solid disk) at two
points
Fig. (4-3)
35
Chapter 4 | GPS Navigation
4.4 | COMMUNICATION
The navigational signals transmitted by GPS satellites encode a variety of
information including satellite positions, the state of the internal clocks, and the
health of the network. These signals are transmitted on two separate carrier
frequencies that are common to all satellites in the network. Two different
encodings are used: a public encoding that enables lower resolution navigation,
and an encrypted encoding used by the U.S. military.
35
Chapter 4 | GPS Navigation
message, the ephemeris, provides the precise orbit for the satellite. The last part of
the message, the almanac sub commutated in sub frames 4 & 5, contains coarse
orbit and status information for up to 32 satellites in the constellation as well as
data related to error correction. Thus, in order to obtain an accurate satellite
location from this transmitted message the receiver must demodulate the message
from each satellite it includes in its solution for 18 to 30 seconds. In order to
collect all the transmitted almanacs the receiver must demodulate the message for
732 to 750 seconds or 12 1/2 minutes.
All satellites broadcast at the same frequencies. Signals are encoded
using code division multiple access (CDMA) allowing messages from individual
satellites to be distinguished from each other based on unique encodings for each
satellite (that the receiver must be aware of). Two distinct types of CDMA
encodings are used: the course/acquisition (C/A) code, which is accessible by the
general public, and the precise (P) code, that is encrypted so that only the U.S.
military can access it.
The ephemeris is updated every 2 hours and is generally valid for 4 hours,
with provisions for updates every 6 hours or longer in non-nominal conditions. The
almanac is updated typically every 24 hours. Additionally data for a few weeks
following is uploaded in case of transmission updates that delay data upload.
P(Y) code, plus the L2C and military codes on the Block IIR-M and
L2 1227.60 MHz
newer satellites.
All satellites broadcast at the same two frequencies, 1.57542 GHz (L1
signal) and 1.2276 GHz (L2 signal). The satellite network uses a CDMA spread-
35
Chapter 4 | GPS Navigation
spectrum technique where the low-bitrate message data is encoded with a high-
rate pseudo-random (PRN) sequence that is different for each satellite. The
receiver must be aware of the PRN codes for each satellite to reconstruct the actual
message data. The C/A code, for civilian use, transmits data at
1.023 million chips per second, whereas the P code, for U.S. military use, transmits
at 10.23 million chips per second. The L1 carrier is modulated by both the C/A and
P codes, while the L2 carrier is only modulated by the P code. The P code can be
encrypted as a so-called P(Y) code that is only available to military equipment with
a proper decryption key. Both the C/A and P(Y) codes impart the precise time-of-
day to the user.
The L3 signal at a frequency of 1.38105 GHz is used by the United States
Nuclear Detonation (NUDET) Detection System (USNDS) to detect, locate, and
report nuclear detonations (NUDETs) in the Earth's atmosphere and near space.
One usage is the enforcement of nuclear test ban treaties.
The L4 band at 1.379913 GHz is being studied for additional ionospheric
correction.
The L5 frequency band at 1.17645 GHz was added in the process of GPS
modernization. This frequency falls into an internationally protected range for
aeronautical navigation, promising little or no interference under all circumstances.
The first Block IIF satellite that would provide this signal is set to be launched in
2009.The L5 consists of two carrier components that are in phase quadrature with
each other. Each carrier component is bi-phase shift key (BPSK) modulated by a
separate bit train. "L5, the third civil GPS signal, will eventually support safety-of-
life applications for aviation and provide improved availability and accuracy.
35
Chapter 4 | GPS Navigation
surfaces of the spheres. In the ideal case of no errors, the receiver is at the
intersection of the surfaces of the spheres.
Let b denote the clock error or bias, the amount that the receiver's clock is off.
The receiver has four unknowns, the three components of GPS receiver position
and the clock bias [x, y, z, b]. The equations of the sphere surfaces are given by:
( ) ( ) ( ) ([ ] )
Or in terms of pseudo ranges, ( ) , as
√( ) ( ) ( ) .
These equations can be solved by algebraic or numerical methods.
4.9 | TRILATERATION
The receiver can use trilateration and one dimensional numerical root finding.
Trilateration is used to determine the position based on three satellite's pseudo
ranges. In the usual case of two intersections, the point nearest the surface of the
sphere corresponding to the fourth satellite is chosen. Let d denote the signed
distance from the receiver position to the sphere around the fourth satellite.
56
Chapter 4 | GPS Navigation
When more than four satellites are available, the calculation can use the four
best or more than four, considering number of channels, processing capability,
and geometric dilution of precision (GDOP). Using more than four is an over-
determined system of equations with no unique solution, which must be solved
by least-squares or a similar technique. If all visible satellites are used, the results
are as good as or better than using the four best. Errors can be estimated through
the residuals. With each combination of four or more satellites, a GDOP factor can
be calculated, based on the relative sky directions of the satellites used. As more
satellites are picked up, pseudo ranges from various 4-way combinations can be
processed to add more estimates to the location and clock offset. The receiver then
takes the weighted average of these positions and clock offsets. After the final
location and time are calculated, the location is expressed in a specific coordinate
system such as latitude and longitude, using the WGS 84 geodetic datum or a
country-specific system.
Error analysis for the Global Positioning System is an important aspect for
determining what errors and their magnitude are to be expected. GPS errors are
affected by geometric dilution of precision and depend on signal arrival time
errors, numerical errors, atmospherics effects, ephemeris errors, multipath errors
and other effects. The single largest source of error in modeling the orbital
dynamics is due to variability in solar radiation pressure.
4.13.1 | Augmentation
Integrating external information into the calculation process can materially
improve accuracy. Such augmentation systems are generally named or described
56
Chapter 4 | GPS Navigation
based on how the information arrives. Some systems transmit additional error
information (such as clock drift, ephemera, or ionospheric delay), others
characterize prior errors, while a third group provides additional navigational or
vehicle information.
Examples of augmentation systems include the Wide Area Augmentation
System (WAAS),European Geostationary Navigation Overlay Service
(EGNOS),Differential GPS, Inertial Navigation Systems(INS) and Assisted GPS.
56
Chapter 4 | GPS Navigation
coupled with DGPS normally realizes between 20–30 centimeters (7.9–12 in) of
absolute accuracy.
Relative Kinematic Positioning (RKP) is a third alternative for a precise GPS-
based positioning system. In this approach, determination of range signal can be
resolved to a precision of less than 10 centimeters (3.9 in). This is done by
resolving the number of cycles that the signal is transmitted and received by the
receiver by using a combination of differential GPS (DGPS) correction data,
transmitting GPS signal phase information and ambiguity resolution techniques via
statistical tests—possibly with processing in real-time (real-time kinematic
positioning, RTK).
55
Chapter 4 | GPS Navigation
55
Chapter 4 | GPS Navigation
( ( ( )))
Triple difference results can be used to estimate unknown variables. For example if
the position of receiver 1 is known but the position of receiver 2 unknown, it may
be possible to estimate the position of receiver 2 using numerical root finding and
least squares. Triple difference results for three independent time pairs quite
possibly will be sufficient to solve for receiver 2's three position components. This
may require the use of a numerical procedure. An approximation of receiver 2's
53
Chapter 4 | GPS Navigation
position is required to use such a numerical method. This initial value can probably
be provided from the navigation message and the intersection of sphere surfaces.
Such a reasonable estimate can be key to successful multidimensional root finding.
Iterating from three time pairs and a fairly good initial value produces one
observed triple difference result for receiver 2's position. Processing additional
time pairs can improve accuracy, over determining the answer with multiple
solutions. Least squares can estimate an over determined system. Least squares
determines the position of receiver 2 which best fits the observed triple difference
results for receiver 2 positions under the criterion of minimizing the sum of the
squares.
containing all types of maps, like streets maps, which may be displayed in human
readable format via text or in a graphical format
providing suggested directions to a human in charge of a vehicle or vessel via text
or speech
providing directions directly to an autonomous vehicle such as a robotic probe
providing information on traffic conditions (either via historical or real time data)
and suggesting alternative directions
Providing information on nearby amenities such as restaurants, fueling stations,
etc.
In other words, all GPS devices can answer the question "Where am I?", and may
also be able to answer:
55
Chapter 4 | GPS Navigation
If some roads are usually busy at this time or are busy right now, what would be a
better route to take?
Where can I get something to eat nearby or where can I get fuel for my vehicle?
55
CHAPTER 5
Ultrasound
Chapter 5 | Ultrasound
5.1 | INTRODUCTION
5.1.1 | History
96
Chapter 5 | Ultrasound
As the zone of compression begins its migration through the medium, the
piston may be withdrawn from right to left to create a region of reduced pressure
immediately behind the compression zone. Molecules from the surrounding
medium move into this region to restore it to normal particle density; and a second
region, termed a zone of rarefaction, begins to migrate away from the piston (C).
That is, the compression zone (high pressure) is followed by a zone of rarefaction
(low pressure) also moving through the medium.
07
Chapter 5 | Ultrasound
the direction of wave propagation. A wave with a frequency between about 20 and
20,000 Hz is a sound wave that is audible to the human ear. An infrasonic wave is
a sound wave below 20 Hz; it is not audible to the human ear. An ultrasound (or
ultrasonic) wave has a frequency greater than 20,000 Hz and is also inaudible. In
clinical diagnosis, ultrasound waves of frequencies between 1 and 20 MHz are
used.
As a longitudinal wave moves through a medium, molecules at the edge of the
wave slide past one another. Resistance to this shearing effect causes these
molecules to move somewhat in a direction away from the moving longitudinal
wave.
This transverse motion of molecules along the edge of the longitudinal wave
establishes shear waves that radiate transversely from the longitudinal wave. In
general, shear waves are significant only in a rigid medium such as a solid. In
biologic tissues, bone is the only medium in which shear waves are important.
07
Chapter 5 | Ultrasound
07
Chapter 5 | Ultrasound
Table (5-3): Calculation of Decibel Values Forms Intensity Ratios and Amplitude Ratios
Ratio of Ultrasound wave Intensity Ratio(I/I0) (dB) Amplitude Ratio
parameters (A/A0) (dB)
1000 30 60
100 20 40
10 10 20
2 3 6
1 0 0
⁄ −3 −6
⁄ −10 −20
⁄ −20 −40
⁄ −30 −60
07
Chapter 5 | Ultrasound
informative. The trans-mitted signal then becomes the reference intensity for this
particular application. For audible sound, a statement such as “a jet engine
produces sound at 100 dB” is appropriate because there is a generally accepted
reference intensity of 10 -16 W/cm2 for audible sound.
A 1-kHz tone (musical note C one octave above middle C) at this intensity is
barely audible to most listeners. A 1-kHz note at 120 dB (10 -4 W/cm2) is painfully
loud. Because intensity is power per unit area and power is energy per unit time
(Table 5-2), Eq. (5-1) may be used to compare the power or the energy contained
within two ultrasound waves. Thus we could also write
10 log (Power/Power0)= 10 log(E/E0)
When comparing the pressure of two waves, Eq. (5-3) may be used directly.
That is, the pressure does not have to be converted to intensity to determine the
decibel value.
The decibel value for the ratio of two waves may be calculated from Eq. (5-1)
or from Eq. (5-3), depending upon the information that is available concerning the
waves (see Margin Table). The “half-power value” (ratio of 0.5 in power between
two waves) is –3 dB, whereas the “half-amplitude value” (ratio of 0.5 in
amplitude) is –6 dB (Table 5-3). This difference reflects the greater sensitivity of
the decibel scale to amplitude compared with intensity values.
07
Chapter 5 | Ultrasound
07
Chapter 5 | Ultrasound
velocity of the ultrasound wave through the medium. Properties of ultrasound such
as reflection, transmission, and refraction are characteristic of the wave velocity
rather than the molecular velocity.
Fig. (5.2)
09
Chapter 5 | Ultrasound
5.7 | REFLECTION
00
Chapter 5 | Ultrasound
Where Z1 and Z2 are the acoustic impedances of the two media. The fraction of
the incident energy that is transmitted across an interface is described by the
transmission coefficient , where
=
( )
07
Chapter 5 | Ultrasound
Fig.(5.3)
06
Chapter 5 | Ultrasound
5.8 | REFRACTION
But
Sin 90 =1
Therefore
= sin-1 [Ci / Cr]
Where sin−1, or arcsine, refers to the angle whose sine is ci /cr. For any
particular interface, the critical angle depends only upon the velocity of ultrasound
in the two media separated by the interface.
77
Chapter 5 | Ultrasound
5.9 | ABSORPTION
Relaxation processes are the primary mechanisms of energy dissipation for an
ultrasound beam transversing tissue. These processes involve (a) removal of
energy from the ultrasound beam and (b) eventual dissipation of this energy
primarily as heat. As discussed earlier, ultrasound is propagated by displacement of
molecules of a medium into regions of compression and rarefaction. This
displacement requires energy that is provided to the medium by the source of
ultrasound. As the molecules attain maximum displacement from an equilibrium
position, their motion stops, and their energy is transformed from kinetic energy
associated with motion to potential energy associated with position in the
compression zone.
From this position, the molecules begin to move in the opposite direction, and
potential energy is gradually transformed into kinetic energy. The maximum
kinetic energy (i.e., the highest molecular velocity) is achieved when the molecules
pass through their original equilibrium position, where the displacement and
potential energy are zero. If the kinetic energy of the molecule at this position
equals the energy absorbed originally from the ultrasound beam, then no
dissipation of energy has occurred, and the medium is an ideal transmitter of
ultrasound. Actually, the conversion of kinetic to potential energy (and vice versa)
is always accompanied by some dissipation of energy. Therefore, the energy of the
ultrasound beam is gradually reduced as it passes through the medium.
This reduction is termed relaxation energy loss. The rate at which the beam
energy decreases is a reflection of the attenuation properties of the medium.
77
Chapter 5 | Ultrasound
understood at present. These complex attenuation patterns are reflected in the data
in Figure (5.3).
77
Chapter 5 | Ultrasound
5.10.1 | Introduction:
77
Chapter 5 | Ultrasound
6. it’s EXPENSIVE.
The SRF04 was designed to be just as easy to use as the Polaroid sonar, requiring a
short trigger pulse and providing an echo pulse. Your controller only has to time
the length of this pulse to find the range. The connections to the SRF04 are shown
below:
The SRF04 Timing diagram is shown below. You only need to supply a short
10uS pulse to the trigger input to start the ranging. The SRF04 will send out an 8
cycle burst of ultrasound at 40 kHz and raise its echo line high. It then listens for
an echo, and as soon as it detects one it lowers the echo line again. The echo line is
therefore a pulse whose width is proportional to the distance to the object. By
timing the pulse it is possible to calculate the range in inches/centimeters or
anything else.
If nothing is detected then the SRF04 will lower its echo line anyway after
about 36mS.Here is the schematic,
77
Chapter 5 | Ultrasound
77
Chapter 5 | Ultrasound
smaller objects. The transducer can handle 20v of drive, so I decided to get up
close to this level. A MAX232 IC, usually used for RS232 communication makes
and ideal driver, providing about 16v of drive.
The receiver is a classic two stage op-amp circuit. The input capacitor C8
blocks some residual DC which always seems to be present. Each gain stage is set
to 24 for a total gain of 576-ish. This is close the 25 maximum gain available using
the LM1458. The gain bandwidth product for the LM1458 is 1 MHz the maximum
gain at 40 kHz is 1000000/40000 = 25.
The output of the amplifier is fed into an LM311 comparator. A small amount
of positive feedback provides some hysteresis to give a clean stable output.
The problem of getting operation down to 1-2cm is that the receiver will pick
up direct coupling from the transmitter, which is right next to it. To make matters
worse the piezo transducer is a mechanical object that keeps resonating sometime
after the drive has been removed. Up to 1mS depending on when you decide it has
stopped. It is much harder to tell the difference between this direct coupled ringing
and a returning echo, which is why many designs, including the Polaroid module,
simply blank out this period.
In operation, the processor waits for an active low trigger pulse to come in. It
then generates just eight cycles of 40 kHz. The echo line is then raised to signal the
host processor to start timing. The raising of the echo line also shuts of the
MAX232. After a while – no more than 10-12mS normally, the returning echo will
be detected and the PIC will lower the echo line. The width of this pulse represents
the flight time of the sonic burst. If no echo is detected then it will automatically
time out after about 30mS (It’s two times the WDT period of the PIC). Because the
79
Chapter 5 | Ultrasound
MAX232 is shut down during echo detection, you must wait at least 10mS
between measurement cycles for the +/- 10v to recharge.
Performance of this design is, I think, quite good. It will reliably measure
down to 3cm and will continue detecting down to 1cm or less but after 2-3cm the
pulse width doesn’t get any smaller.
70
Chapter 5 | Ultrasound
Fig.(5.10)
Since the original design of the SRF04 was published, there have been
incremental improvements to improve performance and manufacturing reliability.
The op-amp is now an LMC6032 and the comparator is an LP311. The 10uF
capacitor is now 22uF and a few resistor values have been tweaked. These changes
have happened over a period of time.
All SRF04's manufactured after May 2003 have new software implementing
an optional timing control input using the "do not connect" pin. This connection is
the PIC's Vpp line used to program the chip after assembly. After programming it’s
just an unused input with a pull-up resistor. When left unconnected the SRF04
behaves exactly as it always has and is described above. When the "do not
connect" pin is connected to ground (0v), the timing is changed slightly to allow
the SRF04 to work with the slower controllers such as the Pic axe. The SRF04's
"do not connect" pin now acts as a timing control. This pin is pulled high by
default and when left unconnected, the timing remains exactly as before.
With the timing pin pulled low (grounded) a 300uS delay is added between
the end of the trigger pulse and transmitting the sonic burst. Since the echo output
is not raised until the burst is completed, there is no change to the range timing, but
the 300uS delay gives the Pic axe time to sort out which pin to look at and start
77
Chapter 5 | Ultrasound
doing so. The new code has shipped in all SRF04's since the end of April 2003.
The new code is also useful when connecting the SRF04 to the slower Stamps
Such as the BS2. Although the SRF04 works with the BS2, the echo line needs to
be connected to the lower number input pins. This is because the Stamps take
progressively longer to look at the higher numbered pins and can miss the rising
edge of the echo signal. In this case you can connect the "do not connect" pin to
ground and give it an extra 300uS to get there.
76
CHAPTER 6
Microcontroller
Chapter 6 | Microcontroller
6.1 | INTRODUCTION
19
Chapter 6 | Microcontroller
The first single-chip microprocessor was the 4-bit Intel 4004 released in
1971, with the Intel 8008 and other more capable microprocessors becoming
available over the next several years. However, both processors required external
chips to implement a working system, raising total system cost, and making it
impossible to economically computerize appliances.
Most microcontrollers at this time had two variants. One had an erasable
EPROM program memory, which was significantly more expensive than the
PROM variant which was only programmable once. Erasing the EPROM required
exposure to ultraviolet light through a transparent quartz lid. One-time parts could
be made in lower-cost opaque plastic packages.
Cost has plummeted over time, with the cheapest 8-bit microcontrollers
being available for under $0.25 in quantity (thousands) in 2009, and some 32-bit
microcontrollers around $1 for similar quantities.
19
Chapter 6 | Microcontroller
6.1.3 | Interrupts
19
Chapter 6 | Microcontroller
6.1.4 Programs
19
Chapter 6 | Microcontroller
Many embedded systems need to read sensors that produce analog signals.
This is the purpose of the analog-to-digital converter (ADC). Since processors are
built to interpret and process digital data, i.e. 1s and 0s, they are not able to do
anything with the analog signals that may be sent to it by a device. So the analog to
digital converter is used to convert the incoming data into a form that the processor
can recognize. A less common feature on some microcontrollers is a digital-to-
analog converter (DAC) that allows the processor to output analog signals or
voltage levels.
A dedicated Pulse Width Modulation (PWM) block makes it possible for the
CPU to control power converters, resistive loads, motors, etc., without using lots of
CPU resources in tight timer loops.
19
Chapter 6 | Microcontroller
Integrating the memory and other peripherals on a single chip and testing them as a
unit increases the cost of that chip, but often results in decreased net cost of the
embedded system as a whole. Even if the cost of a CPU that has integrated
peripherals is slightly more than the cost of a CPU and external peripherals, having
fewer chips typically allows a smaller and cheaper circuit board, and reduces the
labor required to assemble and test the circuit board.
This integration drastically reduces the number of chips and the amount of
wiring and circuit board space that would be needed to produce equivalent systems
using separate chips. Furthermore, on low pin count devices in particular, each pin
may interface to several internal peripherals, with the pin function selected by
software. This allows a part to be used in a wider variety of applications than if
pins had dedicated functions. Micro-controllers have proved to be highly popular
in embedded systems since their introduction in the 1970s.
19
Chapter 6 | Microcontroller
Many microcontrollers are so quirky that they effectively require their own
non-standard dialects of C, such as SDCC for the 8051, which prevent using
standard tools (such as code libraries or static analysis tools) even for code
unrelated to hardware features. Interpreters are often used to hide such low level
quirks.
19
Chapter 6 | Microcontroller
19
Chapter 6 | Microcontroller
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.
11
Chapter 6 | Microcontroller
often need tools to measure interrupt latencies and track down which critical
sections cause slowdowns.
o One common technique just blocks all interrupts for the duration of the critical
section. This is easy to implement, but sometimes critical sections get
uncomfortably long.
o A more complex technique just blocks the interrupts that may trigger access to that
data structure. This is often based on interrupt priorities, which tend to not
correspond well to the relevant system data structures. Accordingly, this technique
is used mostly in very constrained environments.
o Processors may have hardware support for some critical sections. Examples
include supporting atomic access to bits or bytes within a word, or other atomic
access primitives like the LDREX/STREX exclusive access primitives introduced
in the ARMv6 architecture.
Interrupt nesting. Some microcontrollers allow higher priority interrupts to
interrupt lower priority ones. This allows software to manage latency by giving
time-critical interrupts higher priority (and thus lower and more predictable
latency) than less-critical ones.
Trigger rate. When interrupts occur back-to-back, microcontrollers may avoid an
extra context save/restore cycle by a form of tail call optimization. Lower end
microcontrollers tend to support fewer interrupt latency controls than higher end
ones.
6.3.1 | Data
From the earliest microcontrollers to today, six-transistor SRAM is almost
always used as the read/write working memory, with a few more transistors per bit
used in the register file. MRAM could potentially replace it as it is 4 to 10 times
denser which would make it more cost effective.
In addition to the SRAM, some microcontrollers also have internal
EEPROM for data storage; and even ones that do not have any (or not enough) are
often connected to external serial EEPROM chip (such as the BASIC Stamp) or
external serial flash memory chip. A few recent microcontrollers beginning in
2003 have "self-programmable" flash memory.
911
Chapter 6 | Microcontroller
6.3.2 | Firmware
PICs are popular with both industrial developers and hobbyists alike due to
their low cost, wide availability, large user base, extensive collection of application
notes, availability of low cost or free development tools, and serial programming
(and re-programming with flash memory) capability. Microchip announced on
September 2011 the shipment of its ten billionth PIC processor.
These devices feature a 12-bit wide code memory, a 32-byte register file,
and a tiny two level deep call stack. They are represented by the PIC10 series, as
well as by some PIC12 and PIC16 devices. Baseline devices are available in 6-pin
to 40-pin packages.
919
Chapter 6 | Microcontroller
implemented using a register pair: after writing an address to the FSR (file select
register), the INDF (indirect f) register becomes an alias for the addressed register.
If banked RAM is implemented, the bank number is selected by the high 3 bits of
the FSR. This affects register numbers 16–31; registers 0–15 are global and not
affected by the bank select bits.
The ROM address space is 512 words (12 bits each), which may be extended
to 2048 words by banking. CALL and GOTO instructions specify the low 9 bits of
the new code location; additional high-order bits are taken from the status register.
Note that a CALL instruction only includes 8 bits of address, and may only specify
addresses in the first half of each 512-word page.
919
Chapter 6 | Microcontroller
register; the PICmicro TRIS registers are called I/O control registers), but the
equivalents are obvious.
919
Chapter 6 | Microcontroller
direct register to register moves (prior cores needed to move registers through the
accumulator)
an external program memory interface to expand the code space
an 8-bit × 8-bit hardware multiplier
a second indirect register pair
auto-increment/decrement addressing controlled by control bits in a status register
(ALUSTA)
919
Chapter 6 | Microcontroller
the addition of several new instructions, notable for manipulating the FSR
registers.
These changes were primarily aimed at improving the efficiency of a data stack
implementation. If FSR2 is used either as the stack pointer or frame pointer, stack
items may be easily indexed—allowing more efficient re-entrant code. Microchip's
MPLAB C18 C compiler chooses to use FSR2 as a frame pointer.
PIC24 and dsPIC 16-bit microcontrollers
In 2001, Microchip introduced the dsPIC series of chips, which entered mass
production in late 2004. They are Microchip's first inherently 16-bit
microcontrollers. PIC24 devices are designed as general purpose microcontrollers.
dsPIC devices include digital signal processing capabilities in addition.
Architecturally, although they share the PIC moniker, they are very different
from the 8-bit PICs. The most notable differences are:[15]
they feature a set of 16 working registers (W0-W15)
they fully support a stack in RAM, and do not have a hardware stack
bank switching is not required to access RAM or special function registers
data stored in program memory can be accessed directly using a feature called
Program Space Visibility
interrupt sources may be assigned to distinct handlers using an interrupt vector
table
Some features are:
hardware MAC (multiply–accumulate)
barrel shifting
bit reversal
(16×16)-bit single-cycle multiplication and other DSP operations
hardware divide assist (19 cycles for 16/32-bit divide)
hardware support for loop indexing
Direct memory access
dsPICs can be programmed in C using Microchip's C30 compiler which is a variant
of gcc.
919
Chapter 6 | Microcontroller
(16-bit) devices allowing the use of common libraries, software and hardware
tools.
The PIC32 architecture brings a number of new features to Microchip portfolio,
including:
The highest execution speed 80 MIPS (120+[16] Dhrystone MIPS @ 80 MHz)
The largest flash memory: 512 Kbytes
One instruction per clock cycle execution
The first cached processor
Allows execution from RAM
Full Speed Host/Dual Role and OTG USB capabilities
Full JTAG and 2 wire programming and debugging
Real-time trace
Some of the program instructions give the same results as logic gates. The
principle of their operation will be discussed in the text below.
AND Gate
Fig.(6.2)
The logic gate ‘AND’ has two or more inputs and one output. Let us
presume that the gate used in this example has only two inputs. A logic one (1) will
appear on its output only if both inputs (A AND B) are driven high (1). Table on
the right shows mutual dependence between inputs and the output.
Fig.(6.3)
919
Chapter 6 | Microcontroller
remember that logic AND in a program refers to the corresponding bits of two
registers.
OR GATE
Fig.(6.4)
Similarly, OR gates also have two or more inputs and one output. If the gate
has only two inputs the following applies. Alogic one (1) will appear on its output
if either input (A OR B) is driven high (1). If the OR gate has more than two inputs
then the following applies. A logic one (1) appears on its output if at least one
input is driven high (1). If all inputs are at logic zero (0), the output will be at logic
zero (0) as well.
Fig.(6.5)
In the program, logic OR operation is performed in the same manner as logic AND
operation.
NOT GATE
The logic gate NOT has only one input and only one output. It operates in an
extremely simple way. When logic zero (0) appears on its input, a logic one (1)
appears on its output and vice versa. It means that this gate inverts the signal and is
often called inverter, therefore.
Fig.(6.6)
919
Chapter 6 | Microcontroller
Fig.(6.7)
In the program, logic NOT operation is performed upon one byte. The result
is a byte with inverted bits. If byte bits are considered to be a number, the inverted
value is actually a complement thereof. The complement of a number is a value
which added to the number makes it reach the largest 8-digit binary number. In
other words, the sum of an 8-digit number and its complement is always 255.
EXCLUSIVE OR GATE
Fig.(6.8)
Fig.(6.9)
REGISTER
In short, a register or a memory cell is an electronic circuit which can
memorize the state of one byte.
919
Chapter 6 | Microcontroller
Fig.(6.10)
SFR REGISTERS
In addition to registers which do not have any special and predetermined
function, every microcontroller has a number of registers (SFR) whose function is
predetermined by the manufacturer. Their bits are connected (literally) to internal
circuits of the microcontroller such as timers, A/D converter, oscillators and others,
which means that they are directly in command of the operation of these circuits,
i.e. the microcontroller. Imagine eight switches which control the operation of a
small circuit within the microcontroller- Special Function Registers do exactly that.
Fig.(6.11)
In other words, the state of register bits is changed from within the program,
registers run small circuits within the microcontroller; these circuits are via
microcontroller pins connected to peripheral electronics which is used for... Well,
it’s up to you.
911
Chapter 6 | Microcontroller
sensors). It is simply performed by software, which means that a pin function can
be changed during operation.
Fig.(6.12)
MEMORY UNIT
Memory is part of the microcontroller used for data storage. The easiest way
to explain it is to compare it with a filing cabinet with many drawers. Suppose, the
drawers are clearly marked so that their contents can be easily found out by
reading the label on the front of the drawer .
991
Chapter 6 | Microcontroller
Fig.(6.13)
999
Chapter 6 | Microcontroller
Flash Memory
This type of memory was invented in the 80s in the laboratories of INTEL
and was represented as the successor to the UV EPROM. Since the content of this
memory can be written and cleared practically an unlimited number of times,
microcontrollers with Flash ROM are ideal for learning, experimentation and
small-scale production. Because of its great popularity, most microcontrollers are
manufactured in flash technology today. So, if you are going to buy a
microcontroller, the type to look for is definitely flash!
INTERRUPT
Most programs use interrupts in their regular execution. The purpose of the
microcontroller is mainly to respond to changes in its surrounding. In other words,
when an event takes place, the microcontroller does something... For example,
when you push a button on a remote controller, the microcontroller will register it
and respond by changing a channel, turn the volume up or down etc. If the
microcontroller spent most of its time endlessly checking a few buttons for hours
or days, it would not be practical at all.
999
Chapter 6 | Microcontroller
This is why the microcontroller has learnt a trick during its evolution.
Instead of checking each pin or bit constantly, the microcontroller delegates the
‘wait issue’ to a ‘specialist’ which will respond only when something attention
worthy happens. The signal which informs the central processor unit about such an
event is called an INTERRUPT.
CENTRAL PROCESSOR UNIT (CPU)
As its name suggests, this is a unit which monitors and controls all processes
within the microcontroller. It consists of several subunits, of which the most
important are:
Instruction Decoder is a part of electronics which decodes program instructions
and runs other circuits on the basis of that. The ‘instruction set’ which is different
for each microcontroller family expresses the abilities of this circuit;
Arithmetical Logical Unit (ALU) performs all mathematical and logical operations
upon data; and
Accumulator is an SFR closely related to the operation of the ALU. It is a kind of
working desk used for storing all data upon which some operation should be
performed (addition, shift/move etc.). It also stores results ready for use in further
processing. One of the SFRs, called a Status Register (PSW), is closely related to
the accumulator. It shows at any given time the ‘status’ of a number stored in the
accumulator (number is larger or less than zero etc.). Accumulator is also called
working register and is marked as W register or just W, therefore.
Fig.(6.14)
BUS
A bus consists of 8, 16 or more wires. There are two types of buses: the
address bus and the data bus. The address bus consists of as many lines as
necessary for memory addressing. It is used to transmit address from the CPU to
the memory. The data bus is as wide as the data, in our case it is 8 bits or wires
wide. It is used to connect all the circuits within the microcontroller.
SERIAL COMMUNICATION
999
Chapter 6 | Microcontroller
Fig.(6.15)
BAUD RATE
The term baud rate is used to denote the number of bits transferred per
second [bps]. Note that it refers to bits, not bytes. It is usually required by the
protocol that each byte is transferred along with several control bits. It means that
one byte in serial data stream may consist of 11 bits. For example, if the baud rate
is 300 bps then maximum 37 and minimum 27 bytes may be transferred per
second. The most commonly used serial communication systems are:
999
Chapter 6 | Microcontroller
Fig.(6.16)
Fig.(6.17)
999
Chapter 6 | Microcontroller
communication line is used, both receiver and transmitter operate at the same
predefined rate in order to maintain necessary synchronization. This is a very
simple way of transferring data since it basically represents the conversion of 8-bit
data from parallel to serial format. Baud rate is not high, up to 1 Mbit/sec.
OSCILLATOR
Fig.(6.18)
Fig.(6.19)
999
Chapter 6 | Microcontroller
Fig.(6.20)
The LP, XT and HS modes use external oscillator as a clock source the
frequency of which is determined by quartz crystal or ceramic resonators
connected to the OSC1 and OSC2 pins. Depending on the features of the
component in use, select one of the following modes:
LP mode - (Low Power) is used for low-frequency quartz crystal only. This mode
is designed to drive only 32.768 kHz crystals usually embedded in quartz watches.
It is easy to recognize them by small size and specific cylindrical shape. The
current consumption is the least of the three modes.
XT mode is used for intermediate-frequency quartz crystals up to 8 MHz The
current consumption is the medium of the three modes.
HS mode - (High Speed) is used for high-frequency quartz crystals over 8 MHz
The current consumption is the highest of the three modes.
Fig.(6.21)
999
Chapter 6 | Microcontroller
Fig.(6.22)
Fig.(6.23)
Fig.(6.24)
999
Chapter 6 | Microcontroller
RCIO mode. Likewise, the RC circuit is connected to the OSC1 pin. This time,
the available OSC2 pin is used as an additional general-purpose I/O pin. In both
cases, it is recommended to use components as shown in figure. The frequency of
such an oscillator is calculated according to the formula f = 1/T in which:
f = frequency [Hz];
T = R * C = time constant [s];
R = resistor resistance [Ω]; and
C = capacitor capacity [F].
There are two things worth attention concerning the microcontroller power
supply circuit:
Brown out is a potentially dangerous condition which occurs at the moment the
microcontroller is being turned off or when the power supply voltage drops to a
minimum due to electric noise. As the microcontroller consists of several circuits
with different operating voltage levels, this state can cause its out-of-control
performance. In order to prevent it, the microcontroller usually has a built-in
circuit for brown out reset which resets the whole electronics as soon as the
microcontroller incurs a state of emergency.
Reset pin is usually marked as MCLR (Master Clear Reset). It is used for external
reset of the microcontroller by applying a logic zero (0) or one (1) to it, which
depends on the type of the microcontroller. In case the brown out circuit is not
built in, a simple external circuit for brown out reset can be connected to the
MCLR pin.
TIMERS/COUNTERS
The microcontroller oscillator uses quartz crystal for its operation. Even
though it is not the simplest solution, there are many reasons to use it. The
frequency of such oscillator is precisely defined and very stable, so that pulses it
generates are always of the same width, which makes them ideal for time
measurement. Such oscillators are also used in quartz watches. If it is necessary to
measure time between two events, it is sufficient to count up pulses generated by
this oscillator. This is exactly what the timer does.
991
Chapter 6 | Microcontroller
If the timer uses an internal quartz oscillator for its operation then it can be
used to measure time between two events (if the register value is T1 at the moment
measurement starts, and T2 at the moment it terminates, then the elapsed time is
equal to the result of subtraction T2-T1). If registers use pulses coming from
external source then such a timer is turned into a counter. This is only a simple
explanation of the operation itself. It is however more complicated in practice.
Fig.(6.25)
Fig.(6.26)
991
Chapter 6 | Microcontroller
Fig.(6.26)
Fig.(6.28)
999
Chapter 6 | Microcontroller
COUNTERS
If the timer receives pulses frm the microcontroller input pin, then it turns
into a counter. Obviously, it is the same electronic circuit able to operate in two
different modes. The only difference is that in this case pulses to be counted come
over the microcontroller input pin and their duration (width) is mostly undefined.
This is why they cannot be used for time measurement, but for other purposes such
as counting products on an assembly line, number of axis rotation, passengers etc.
(depending on sensor in use).
WATCHDOG TIMER
A watchdog timer is a timer connected to a completely separate RC
oscillator within the microcontroller.If the watchdog timer is enabled, every time it
counts up to the maximum value, the microcontroller reset occurs and the program
execution starts from the first instruction. The point is to prevent this from
happening by using a specific command.
Anyway, the whole idea is based on the fact that every program is executed
in several longer or shorter loops. If instructions which reset the watchdog timer
are set at the appropriate program locations, besides commands being regularly
executed, then the operation of the watchdog timer will not affect the program
execution. If for any reason, usually electrical noise in industry, the program
counter ‘gets stuck’ at some memory location from which there is no return, the
watchdog timer will not be cleared, so the register’s value being constantly
incremented will reach the maximum et voila! Reset occurs!
Fig.(6.29)
A/D CONVERTER
999
Chapter 6 | Microcontroller
Fig.(6.30)
Fig.(6.31)
INTERNAL ARCHITECTURE
All upgraded microcontrollers use one of two basic design models called
Harvard and von-Neumann architecture. They represent two different ways of
exchanging data between CPU and memory.
VON-NEUMANN ARCHITECTURE
999
Chapter 6 | Microcontroller
Fig.(6.32)
HARVARD ARCHITECTURE
Fig.(6.33)
999
Chapter 6 | Microcontroller
bits wide, all data being exchanged are of the same width. During the process of
written a program, only 8-bit data are considered. In other words, all you can
change from within the program and all you can influence are 8 bits wide. All the
programs written for these microcontrollers will be stored in the microcontroller
internal ROM after being compiled into machine code. However, ROM memory
locations do not have 8, but 12, 14 or 16 bits. The rest of bits 4, 6 or 8 represent
instruction specifying for the CPU what to do with the 8-bit data.
Fig.(6.34)
All instructions understandable to the microcontroller are called together the
Instruction Set. When you write a program in assembly language, you actually
specify instructions in such an order they should be executed. The main restriction
here is a number of available instructions. The manufacturers usually adopt either
approach described below:
999
Chapter 6 | Microcontroller
999
Chapter 6 | Microcontroller
Several third parties make C language compilers for PICs, many of which integrate
to MPLAB and/or feature their own IDE. A fully featured compiler for the
PICBASIC language to program PIC microcontrollers is available from melbas,
Inc. Development tools are available for the PIC family under the GPL or other
free software or open source licenses.
Fig.(6.35)
999
Chapter 6 | Microcontroller
from a host computer, to intelligent programmers that can verify the device at
several supply voltages. Many of these complex programmers use a pre-
programmed PIC themselves to send the programming commands to the PIC that
is to be programmed. The intelligent type of programmer is needed to program
earlier PIC models (mostly EPROM type) which do not support in-circuit
programming.
Many of the higher end flash based PICs can also self-program (write to
their own program memory). Demo boards are available with a small boot loader
factory programmed that can be used to load user programs over an interface such
as RS-232 or USB, thus obviating the need for a programmer device. Alternatively
there is boot loader firmware available that the user can load onto the PIC using
ICSP. The advantages of a boot loader over ICSP is the far superior programming
speeds, immediate program execution following programming, and the ability to
both debug and program using the same cable.
6.6.2 | Debugging
Software emulation
Commercial and free emulators exist for the PIC family processors.
In-circuit debugging
Later model PICs feature an ICD (in-circuit debugging) interface, built into
the CPU core. ICD debuggers (MPLAB ICD2 and other third party) can
999
Chapter 6 | Microcontroller
communicate with this interface using three lines. This cheap and simple
debugging system comes at a price however, namely limited breakpoint count (1
on older pics 3 on newer PICs), loss of some IO (with the exception of some
surface mount 44-pin PICs which have dedicated lines for debugging) and loss of
some features of the chip. For small PICs, where the loss of IO caused by this
method would be unacceptable, special headers are made which are fitted with
PICs that have extra pins specifically for debugging.
In-circuit emulators
Microchip offers three full in circuit emulators: the MPLAB ICE2000
(parallel interface, a USB converter is available); the newer MPLAB ICE4000
(USB 2.0 connection); and most recently, the REAL ICE. All of these ICE tools
can be used with the MPLAB IDE for full source-level debugging of code running
on the target.
The ICE2000 requires emulator modules, and the test hardware must provide
a socket which can take either an emulator module, or a production device.
The REAL ICE connects directly to production devices which support in-
circuit emulation through the PGC/PGD programming interface, or through a high
speed connection which uses two more pins. According to Microchip, it supports
"most" flash-based PIC, PIC24, and dsPIC processors.
991
Chapter 6 | Microcontroller
Fig.(6.37)
Fig.(6.38)
991
Chapter 6 | Microcontroller
Fig.(6.39)
Along one side of the small printed board of the LCD display there are pins
that enable it to be connected to the microcontroller. There are in total of 14 pins
marked with numbers (16 if there is a backlight).
Fig.(6.40)
999
Chapter 6 | Microcontroller
An LCD screen can display two lines with 16 characters each. Every
character consists of 5x8 or 5x11 dot matrix. This book covers a 5x8 character
display which is most commonly used.
Display contrast depends on the power supply voltage and whether messages
are displayed in one or two lines. For this reason, varying voltage 0-Vdd is applied
to the pin marked as Vee. A trimmer potentiometer is usually used for this purpose.
Some of the LCD displays have built-in backlight (blue or green LEDs). When
used during operation, a current limiting resistor should be serially connected to
one of the pins for backlight power supply (similar to LED diodes).
Fig.(6.41)
If there are no characters displayed or if all of them are dimmed when the
display is switched on, the first thing that should be done is to check the
potentiometer for contrast adjustment. Is it properly adjusted? The same applies if
the mode of operation has been changed (writing in one or two lines).
999
Chapter 6 | Microcontroller
DDRAM Memory
DDRAM memory is used for storing characters to be displayed. The size of
this memory is capable of storing 80 characters. Some memory locations are
directly connected to the characters on display.
Everything works quite simply: it is enough to configure the display to
increment addresses automatically (shift right) and set the starting address for the
message to be displayed (for example 00 hex).
Afterwards, all characters sent through lines D0-D7 will be displayed in the
message format we are used to- from left to right. In this case, displaying starts
from the first field of the first line because the initial address is 00 hex. If more
than 16 characters are sent, then all of them will be memorized, but only the first
sixteen characters will be visible. In order to display the rest of them, the shift
command should be used. Virtually, everything looks as if the LCD display is a
window which shifts left-right over memory locations containing different
characters. In reality, this is how the effect of the message shifting over the screen
has been created.
Fig.(6.42)
This is a sort of RAM memory so that data can be written to and read from it,
but its content is irretrievably lost when the power goes off.
CGROM Memory
CGROM memory contains a standard character map with all characters that
can be displayed on the screen. Each character is assigned to one memory location:
999
Chapter 6 | Microcontroller
Fig.(6.43)
999
Chapter 6 | Microcontroller
What is ASCII? From their inception till today, computers can recognize
only numbers, but not letters. It means that all data a computer swaps with a
peripheral device has a binary format even though the same is recognized by the
man as letters (the keyboard is an excellent example). In other words, every
character matches a unique combination of zeroes and ones. ASCII is character
encoding based on the English alphabet. ASCII code specifies a correspondence
between standard character symbols and their numerical equivalents.
Fig.(6.44)
CGRAM Memory
Apart from standard characters, the LCD display can also display symbols
defined by the user itself. It can be any symbol in the size of 5x8 pixels. RAM
memory called CGRAM in the size of 64 bytes enables it.
Memory registers are 8 bits wide, but only 5 lower bits are used. Logic one
(1) in every register represents a dimmed dot, while 8 locations grouped together
represent one character. It is best illustrated in figure below:
999
Chapter 6 | Microcontroller
Fig.(6.45)
All data transferred to an LCD through the outputs D0-D7 will be interpreted as
a command or a data, which depends on the RS pin logic state:
RS = 1 - Bits D0 - D7 are addresses of the characters to be displayed. LCD
processor addresses one character from the character map and displays it. The
DDRAM address specifies location on which the character is to be displayed. This
999
Chapter 6 | Microcontroller
999
Chapter 6 | Microcontroller
Depending on how many lines are used for connecting an LCD to the
microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate mode is
selected at the beginning of the operation in the process called 'initialization'. The
8-bit LCD mode uses outputs D0- D7 to transfer data as explained on the previous
page.
The main purpose of the 4-bit LCD mode is to save valuable I/O pins of the
microcontroller. Only 4 higher bits (D4-D7) are used for communication, while
others may be left unconnected. Each piece of data is sent to the LCD in two steps-
four higher bits are sent first (normally through the lines D4-D7), then four lower
bits. Initialization enables the LCD to link and interpret received bits correctly.
Fig.(6.46)
999
Chapter 6 | Microcontroller
Data is rarely read from the LCD (it is mainly transferred from the
microcontroller to the LCD) so it is often possible to save an extra I/O pin by
simple connecting the R/W pin to the Ground. Such a saving has its price.
Messages will be normally displayed, but it will not be possible to read the busy
flag since it is not possible to read the display either. Fortunately, there is a simple
solution. After sending a character or a command it is important to give the LCD
enough time to do its job. Owing to the fact that the execution of a command may
last for approximately 1.64mS, it will be sufficient to wait about 2mS for the LCD.
The LCD is automatically cleared when powered up. It lasts for approximately
15mS. After this, it is ready for operation. The mode of operation is set by default,
which means that:
1. Display is cleared.
2. Mode DL = 1 - Communication through 8-bit interface
3. N = 0 - Messages are displayed in one line
4. F = 0 - Character font 5 x 8 dots
5. Display/Cursor on/off
D = 0 - Display off
U = 0 - Cursor off
B = 0 - Cursor blink off
6. Character entry ID = 1 Displayed addresses are automatically incremented by 1
7. S = 0 Display shift off
Automatic reset mostly occurs without any problems. Mostly, but not always!
If for any reason the power supply voltage doesn’t reach full value within 10mS,
the display will start to perform completely unpredictably. If the voltage unit is not
able to meet that condition or if it is needed to provide completely safe operation,
the process of initialization is applied. Initialization, among other things, causes a
new reset by enabling the display to operate normally.
991
CHAPTER 7
System Implementation
Chapter 7 | System Implementation
7.1| INTRODUCTION
We’ll take overview about the project to completely understand the project.
The project aims to help visually impaired to face the different problems they face
in their life.
Our system pass through different stages we start with searches then surveys
then searching for sponsors to help us to get the best form of the product then we
start design phase then development to get the best results the making prototype
and get the final product.
Our systems consists of 2 parts hardware and software :
The software is out door navigation online and offline designed initially using
MATLAB. The user just has to say the place he wants to go and we have 2 cases:
Case 1: if GPS is on, the code will receive GPS data and compare it with database
and due to the result a specific action is done
Case 2: if GPS is off, the code will choose the pre-saved maps in the database and
due to the speed and the length of the road which is calculated the program will
calculate the time between the wanted orders.
7.2| SURVEYS
141
Chapter 7 | System Implementation
7.3| SEARCHES
We start searches to find the best way to reach our goal. At the first we
wanted to make sensor and indoor and outdoor navigation beside security system.
In this part we reach to all technical data we need to start designing the systems.
We did our searches to get the best available GPS module available and we
choose the MediaTek MT3329 GPS module because of:
-Based on MediaTek Single Chip Architecture.
-Dimension:16mm x 16mm x 6mm
-L1 Frequency, C/A code, 66 channels
-High Sensitivity Up to -165dBm tracking, superior urban performances
-Position Accuracy:< 3m CEP (50%) without SA (horizontal)
-Cold Start is under 35 seconds (Typical)
-Warm Start is under 34 seconds (Typical)
-Hot Start is under 1 second (Typical)
-Low Power Consumption:48mA @ acquisition, 37mA @ tracking
-Low shut-down current consumption:15uA, typical
-DGPS (WAAS, EGNOS, MSAS) support (optional by firmware)
-USB/UART Interface
-Support AGPS function (Offline mode: EPO valid up to 14 days )
-Includes a Molex cable adapter, 5 cm
-Includes the new basic adapter
-Weight: 0.3oz; 8 g
141
Chapter 7 | System Implementation
Then we start our search to connect the GPS module with matlab so we buy
FTDI cable to connect between the module and pc
7.4| SPONSORS
Brilliance and we'll need it as a technical support to help us to find the best
technical solutions for any problems.
7.5| PRE-DESIGN
Table(7.2):Acceptable specificitions
No. Need Imp
1 The suspension Acceptable Range 5
2 The suspension Used Outdoor 5
3 The suspension Low Cost 5
141
Chapter 7 | System Implementation
to
1.9cm * 2.1cm US
Measurement
Weather Resistance
2.5V to start work
Ultrasound Range
Design it a watch
Buttons
uart data transfer
Very Small Size
choose Mode
Mp3 Module
Module
Cycle
Two
Fast
6
1 Acceptab
√
le Range
2 Fast
√ √ √
response
3 used
√
outdoor
4 Low cost √
5 Light
√ √
Intensity
6 Low
√
power
144
Chapter 7 | System Implementation
7 Good
style and √ √ √
Finishing
8 Arabic
Languag √
e
9 Easy to
√
Use
10 High
quality √ √ √
materials
11 Clear
√
Voice
141
Chapter 7 | System Implementation
time plan
exams
design
develop
lectures; 21.2 exams; 21.2
finishing
other
design; 25.62 travelling
activities;
18.18 play
other activities
play; 1.59 develop; lectures
travelling; 1.7 finishing; 2.01 8.5
Fig.(7.1)
141
Chapter 7 | System Implementation
7.6| DESIGN
141
Chapter 7 | System Implementation
141
Chapter 7 | System Implementation
141
Chapter 7 | System Implementation
Mapping Code:
111
Chapter 7 | System Implementation
Button1 Button 2
Indoor Outdoor
User Interface
Main Board
Ultrasound Supply
sensors dc
modules power
Input
MCU
Camera
module
Output
111
Chapter 7 | System Implementation
Main Board
Input Supply
dc
power
Ultrasoun
d sensors MCU
modules
Output
Mp3 module
White U_S to left
stick
U_S to forward
U_S to Right
Speaker
Fig.(7.10): Blind men Geometric Layout
111
Chapter 7 | System Implementation
U_S to Center
U_S to Left Button 2 Button 1 U_S to Right
Fig.(7.11): This design is optional not the default design but the Stick is the default one which
we work on it firstly.
Speaker
PW
M
MP3 MCU Ultrasound
module SPI data Analog data module
Select mp3 file
Fig. (7.12)
111
Chapter 7 | System Implementation
Speaker
PW
M
MP3 MCU Ultrasound
module SPI data Analog data module
Select mp3 file
RFID
Module
Fig.(7.13)
Table(7.5)
Line Name Properties
1 Power 5v
2 Ground 0v
3 Input analog
114
Chapter 7 | System Implementation
Control 2 Ultrasound
unit 3 sensor
Fig.(7.14)
Table(7.6)
Line Name Properties
1 Power 3.3v
2 Power 3.3v
3 Ground 0v
4 Spi data
5 Spi CS
6 Spi clk
1
2
Control 3 MP3
unit 4 Module
5
6
Fig(7.15)
Choose mode
Voice output
111
CHAPTER 8
Conclusion
Chapter 8 | Conclusion
8.1| INTRODUCTION
Finally our purpose was to make a project solve a real problem found in our
life or solve difficulties faces some people as we said before blind or deaf people
need a special care and special devices to make their life easier.
After the survey we did and meeting sponsors technical and marketing we
choose the most wanted applications:
Outdoor navigation, ultrasound sensor and objects identifier and we cancelled
indoor navigation as the user doesn't need it.
We'll have an overview for every part
8.2| OVERVIEW
851
Chapter 8 | Conclusion
by getting the pre-saved length of the road then divide it by velocity and calculate
the delay between every order the code take a specific action.
This part calculate the distance between the user and any barrier on his way and
this sensor connected with dc vibration motor and due to this distance the motor's
speed increases while the distance decreases.
In this part we use RFID reader connected with microcontroller and mp3
module.
Every object will have a tag when the user's hands approaches to any object the
reader activate the tag and this tag sends its id to the reader which sends it to pic.
The pic due to the ID will activate a specific wav file saved in mp3 module
which contains the name of the object.
8.3| FEATURES
We plan to develop and add more features in our project to solve all problems we
can solve it.
These features appear in the next points:
Help him to read books.
Help him to market easily.
Help him to reach his lost objects.
851
Appendix
Appendix A: GUI
Appendix A: GUI
A.1 | INTRODUCTION
GUI components can include menus, toolbars, push buttons, radio buttons, list
boxes, and sliders—just to name a few. GUIs created using MATLAB® tools can
also perform any type of computation, read and write data files, communicate with
other GUIs, and display data as tables or as plots. The following figure illustrates a
simple GUI that you can easily build yourself.
• An axes component
161
Appendix A: GUI
• A pop-up menu listing three data sets that correspond to MATLAB functions:
peaks, membrane, and sinc
• A static text component to label the pop-up menu
• Three buttons that provide different kinds of plots: surface, mesh, and contour
When
you click a push button, the axes component displays the selected data set using the
specified type of 3-D plot.
In the GUI described in “What Is a GUI?” the user selects a data set from the
pop-up menu, then clicks one of the plot type buttons. The mouse click invokes a
function that plots the selected data in the axes.
Most GUIs wait for their user to manipulate a control, and then respond to
each action in turn. Each control, and the GUI itself, has one or more user-written
routines (executable MATLAB code) known as callbacks, named for the fact that
they “call back” to MATLAB to ask it to do things. The execution of each callback
is triggered by a particular user action such as pressing a screen button, clicking a
mouse button, selecting a menu item, typing a string or a numeric value, or passing
the cursor over a component.
The GUI then responds to these events. You, as the creator of the GUI,
provide callbacks which define what the components do to handle events.
162
Appendix A: GUI
Although you can provide a callback with certain data and make it do
anything you want, you cannot control when callbacks will execute. That is, when
your GUI is being used, you have no control over the sequence of events that
trigger particular callbacks or what other callbacks might still be running at those
times. This distinguishes event-driven programming from other types of control
flow, for example, processing sequential data files.
A.1.4|Where Do I Start?
The first approach starts with a figure that you populate with components
from within a graphic layout editor. GUIDE creates an associated code file
containing callbacks for the GUI and its components. GUIDE saves both the figure
(as a FIG-file) and the code file. Opening either one also opens the other to run the
GUI.
In the second, programmatic, GUI-building approach, you create a code file that
defines all component properties and behaviors; when a user executes the file, it
creates a figure, populates it with components, and handles user interactions. The
figure is not normally saved between sessions because the code in the file creates a
new one each time it runs.
163
Appendix A: GUI
As a result, the code files of the two approaches look different. Programmatic
GUI files are generally longer, because they explicitly define every property of the
figure and its controls, as well as the callbacks. GUIDE GUIs define most of the
properties within the figure itself. They store the definitions in its FIG-file rather
than in its code file. The code file contains callbacks and other functions that
initialize the GUI when it opens.
A.2|WHAT IS GUIDE?
164
Appendix A: GUI
Table (A.2): ways to open GUIDE from the MATLAB Command line
Command Result
guide Opens GUIDE with a choice of GUI templates
guide FIG-file name Opens FIG-file name in GUIDE
You can also right-click a FIG-file in the Current Folder Browser and select
Fig.(A.2)
165
Appendix A: GUI
Fig.(A.3)
. All tools in the tool palette have tool tips. Setting a GUIDE preference
lets you display the palette in GUIDE with tool names or just their icons.
When you open GUIDE to create a new GUI, a gridded layout area displays.
It has a menu bar and toolbar above it, a tool palette to its left, and a status bar
below it, as shown below. See “GUIDE Tools Summary” on page 4-3 for a full
description. At any point, you can access help topics from the GUIDE
Help menu, shown in the following illustration. The first three options lead you to
topics in the GUIDE documentation that can help you get started using GUIDE.
The Example GUIs option opens a list of complete examples of GUIs built using
GUIDE that you can browse, study, open in GUIDE, and run.
The bottom option, Online Video Demos, opens a list of GUIDE- and related GUI-
building video tutorials on MATLAB Central. You can access MATLAB video
demos, as well as the page on MATLAB Central by clicking links in the following
table.
166
Appendix A: GUI
The GUIDE Layout Editor enables you to populate a GUI by clicking and
dragging GUI components into the layout area.
Fig.(A.4)
There you can resize, group and align buttons, text fields, sliders, axes, and other
components you add. Other tools accessible from the Layout Editor enable you to:
• Create menus and context menus
• Create toolbars
• Modify the appearance of components
167
Appendix A: GUI
Fig.(A.5)
168
Appendix A: GUI
Fig.(A.6)
To use the GUI, select a data set from the pop-up menu, then click one of the
plot-type buttons. Clicking the button triggers the execution of a callback that plots
the selected data in the axes.
Lay Out the Simple GUI in GUIDE
Open a New GUI in the GUIDE Layout Editor
1 Start GUIDE by typing guide at the MATLAB prompt. The GUIDE Quick
Start dialog displays, as shown in the following figure.
2 In the GUIDE Quick Start dialog box, select the Blank GUI (Default) template.
Click OK to display the blank GUI in the Layout Editor, as shown in the following
figure.
169
Appendix A: GUI
Fig.(A.7)
3 Display the names of the GUI components in the component palette. Select File
> Preferences. Then select GUIDE > Show names in component palette, and then
click OK. The Layout Editor then appears as shown in the following figure
Fig(A.8)
170
Appendix A: GUI
Fig.(A.9)
1 Select all three push buttons by pressing Ctrl and clicking them.
2 Select Tools > Align Objects.
3 Make these settings in the Alignment Tool, as shown in the following figure:
• Left-aligned in the horizontal direction.
171
Appendix A: GUI
Fig.(A.10)
4 Click OK. Your GUI now looks like this in the Layout Editor.
Fig.(A.11)
172
Appendix A: GUI
Label the Push Buttons. Each of the three push buttons lets the GUI user
choose a plot type: 1 Select Property Inspector from the View menu. surf, mesh,
and contour. This '
Fig.(A.12)
topic shows you how to label the buttons with those choices.
2 In the layout area, select the top push button by clicking it
Fig.(A.13)
3 In the Property Inspector, select the String property and then replace the existing
173
Appendix A: GUI
Fig.(A.14)
5 Select each of the remaining push buttons in turn and repeat steps 3 and 4. Label
the middle push button Mesh, and the bottom button Contour. List Pop-Up Menu
Items. The pop-up menu provides a choice of three data sets: peaks, membrane,
and sinc. These data sets correspond to MATLAB functions of the same name.
This topic shows you how to list those data sets as choices in the pop-menu.
1 In the layout area, select the pop-up menu by clicking it.
2 In the Property Inspector, click the button next to String. The String dialog box
displays.
Fig.(A.15)
3 Replace the existing text with the names of the three data sets: Peaks, Membrane,
and Sinc. Press Enter to move to the next line.
174
Appendix A: GUI
Fig.(A.16)
4 When you have finished editing the items, click OK. The first item in your list,
Peaks, appears in the pop-up menu in the layout area.
Fig.(A.17)
175
Appendix A: GUI
Modify the Static Text. In this GUI, the static text serves as a label for the
pop-up menu. The user cannot change this text. This topic shows you how to
change the static text to read Select Data.
1 In the layout area, select the static text by clicking it.
2 In the Property Inspector, click the button next to String. In the String dialog box
that displays, replace the existing text with the phrase Select Data.
3 Click OK. The phrase Select Data appears in the static text component above the
Fig.(A.18)
pop-up menu.
Completed Simple GUIDE GUI Layout
In the Layout Editor, your GUI now looks like this and the next step is to save the
layout. The next topic, “Save the GUI Layout”
Fig.(A.19)
176
Appendix A: GUI
Fig.(A.20)
3 GUIDE opens a Save As dialog box in your current folder and prompts you for a
FIG-file name.
Fig.(A.21)
177
Appendix A: GUI
4 Browse to any folder for which you have write privileges, and then enter the
filename simple_gui for the FIG-file. GUIDE saves both the FIG-file and the code
file using this name.
5 If the folder in which you save the GUI is not on the MATLAB path, GUIDE
opens a dialog box, giving you the option of changing the current folder to the
folder containing the GUI files, or adding that folder to the top or bottom of the
MATLAB path.
Fig.(A.22)
6 GUIDE saves the files simple_gui.fig and simple_gui.m and activates the GUI. It
also opens the GUI code file in your default editor.
The GUI opens in a new window. Notice that the GUI lacks the standard menu bar
and toolbar that MATLAB figure windows display. You can add your own menus
and toolbar buttons with GUIDE, but by default a GUIDE
GUI includes none of these components. When you operate simple_gui, you can
select a data set in the pop-up menu and click the push buttons, but nothing
happens. This is because the code file contains no statements to service the pop-up
menu and the buttons.
178
Appendix A: GUI
Fig.(A.23)
To run a GUI created with GUIDE without opening GUIDE, execute its code
file by typing its name. simple_gui You can also use the run command with the
code file, for example, run simple_gui
Note Do not attempt to run a GUIDE GUI by opening its FIG-file outside of
GUIDE. If you do so, the figure opens and appears ready to use.
179
Appendix B: RFID
Appendix B: RFID
B.1|INTRODUCTION
1- A scanning antenna.
2- A transceiver with a decoder to interpret the data.
3- A transponder - the RFID tag - that has been programmed with information.
This is an absolutely key part of the technology; RFID tags do not need to
contain batteries, and can therefore remain usable for very long periods of time
(maybe decades).
When an RFID tag passes through the field of the scanning antenna, it detects
the activation signal from the antenna. That "wakes up" the RFID chip, and it
transmits the information on its microchip to be picked up by the scanning antenna.
871
Appendix 2:RFID
In addition, the RFID tag may be of one of two types Active RFID tag have their
own power source; the advantage of these tags is that the reader can be much
farther away and still get the signal. Even though some of these
devices are built to have up to a 10 year.
life span, they have limited life spans passive RFID tag , however, do not require
batteries, and can be much smaller and have a virtually unlimited life span.
RFID tags can be read in a wide variety of circumstances, where barcodes or other
optically read technologies are useless.
The tag need not be on the surface of the object (and is therefore not
subject to wear)
The read time is typically less than 100 milliseconds
Large numbers of tags can be read at once rather than item by item.
Since RFID systems make use of the electromagnetic spectrum (like Wi-Fi
networks or cell phones), they are relatively easy to jam using energy at the right
frequency. Although this would only be an inconvenience for consumers in stores
(longer waits at the checkout), it could be disastrous in other environments where
RFID is increasingly used, like hospitals or in the military in the field.
Also, active RFID tags (those that use a battery to increase the range of the
system) can be repeatedly interrogated to wear the battery down, disrupting the
system.
871
Appendix B: RFID
Reader collision occurs when the signals from two or more readers overlap.
The tag is unable to respond to simultaneous queries. Systems must be carefully set
up to avoid this problem; many systems use an anti-collision protocol (also called
a singulation protocol. Anti-collision protocols enable the tags to take turns in
transmitting to a reader.
4- RFID Tag Collision
Tag collision occurs when many tags are present in a small area; but since the
read time is very fast, it is easier for vendors to develop systems that ensure that
tags respond one at a time.
1-The contents of an RFID tag can be read after the item leaves the
supply chain
An RFID tag cannot tell the difference between one reader and another. RFID
scanners are very portable; RFID tags can be read from a distance, from a few
inches to a few yards. This allows anyone to see the contents of your purse or
pocket as you walk down the street. Some tags can be turned off when the item has
left the supply chain
2-RFID tags are difficult to remove
RFID tags are difficult to for consumers to remove; some are very small (less
than a half-millimeter square, and as thin as a sheet of paper) - others may be
hidden or embedded inside a product where consumers cannot see them. New
technologies allow RFID tags to be "printed" right on a product and may not be
removable at all
Since the tags can be read without being swiped or obviously scanned, anyone
with an RFID tag reader can read the tags embedded in your clothes and other
consumer products without your knowledge. For example, you could be
scanned before you enter the store, just to see what you are carrying. You might
then be approached by a clerk who knows what you have in your backpack or
purse, and can suggest accessories or other items.
811
Appendix 2:RFID
For various reasons, RFID reader/tag systems are designed so that distance
between the tag and the reader is kept to a minimum (see the material on tag
collision above). However, a high-gain antenna can be used to read the tags from
much further away, leading to privacy problems.
One of the main concerns with RFID tags is that their contents can be read by
anyone with an appropriately equipped scanner - even after you take it out of the
store.
One technology that has been suggested is a zombie RFID tag, a tag that can be
temporarily deactivated when it leaves the store. The process would work like this:
you bring your purchase up to the register, the RFID scanner reads the item, you
pay for it and as you leave the store, you pass a special device that sends a signal to
the RFID tag to "die." That is, it is no longer readable.
The "zombie" element comes in when you bring an item back to the store. A
special device especially made for that kind of tag "re-animates" the RFID tag,
allowing the item to reenter the supply chain.
818
References
]3[JamesD.Foley,AndriesvanDam,StevenK.Feiner,JohnF.Hughes,andRichardL.
Phillips. Introduction to Computer Graphics. Addison-Wesley, 1994.
]12[JeanPaulSerra.Image analysisandmathematicalmorphology.
AcademicPress,1982.
]14[MilanSonka,VaclavHlavac,andRogerBoyle.ImageProcessing,Analysis and
MachineVision. PWS Publishing, secondedition,1999.
281
References
281
References
M¨unchen, 1988.
Verlag, 1995.
[31] J.J. Odell S. Young and P.C. Woodland. Tree-based state tying
II:636–639, 1993.
281
References
[39] McDicken, W. Diagnostic Ultrasonics. New York, John Wiley & Sons,
1976.
[46] Kinsler, L. E., et al. Fundamentals of Acoustics, 3rd edition New York,
John Wiley & Sons, 1982, pp. 115–117.
[47] ter Haar GR. In CR Hill (ed): Physical Principles of Medical Ultrasonics.
Chichester, England, Ellis Horwood/Wiley, 1986.
[48] Kossoff, G., Garrett, W. J., Carpenter, D. A., Jellins, J., Dadd, M. J.
Principles and classification of soft tissues by grey scale echography.
Ultrasound Med. Biol. 1976; 2:89–111.
[51] Dunn, F., Edmonds, P., and Fry, W. Absorption and Dispersion of
Ultrasound in Biological Media, in H. Schwan (ed.), Biological Engineering.
New York, McGraw-Hill, 1969, p. 205
281