Академический Документы
Профессиональный Документы
Культура Документы
INDEX
TOPICS
Certificates
Acknowledgement........
CHAPTER 1: INTRODUCTION
3.9 LCD
3.10 Geared DC motor
REFERENCES
CHAPTER 1: INTRODUCTION
1.1Introduction:
The project aims in designing an intelligent courier mailbox system which is capable of
automatically sending information about mail to user and delivery notification to courier officials. As
the time moves the life style of the persons has completely changed and there is no time for the people
for micro management of every issue personally. So, this is the right time to provide some space to
the technology into our lives for monitoring the issues which requires our personal presence for the
things to happen. One among those issues which require our personal presence is receiving the courier
which is sent back if we are not present at the time the courier boy comes to our house. This may lead
to the delay in receiving the important information and in some scenarios it may also lead to tough
situations. So our project aims in providing a very reliable and very user friendly solution to overcome
this kind of problem.
As we know the advancements in the Radio Frequency and GSM technologies and making
use of those existing technologies we can design a device which is capable of identifying the arrival of
courier and forward the same to the person who need to receive the mail and also send an
acknowledgement to the courier office so that they do not require the signature of the particular
person for whom the courier is meant for. The basic idea of the system is to employ an RFID tag to
the courier and send the identity number to the receivers mobile. The receiver of the courier will have
a letter box whose opening and closing is made automatically using Geared DC motor, which has an
RF reader and a dedicated GSM modem in it. As soon as the courier boy drops the letter in to the
letter box it the RF reader reads the identity number of the tag and informs the same to the micro
controller and compares it with the identity number send by the courier office and if both are same,
then it sends message to the receiver and also to the courier office about the arrival of the courier.
To design the entire system we require a microcontroller which acts as a medium of
communication between the RF reader and the GSM modem. The major advantage of this system is
the presence of the GSM modem enables the device to communicate with the receiver no matter
where ever he was present on the globe (GSM availability).
Presents the topic embedded systems. It explains the about what is embedded systems,
Presents the hardware description. It deals with the block diagram of the project and
explains the purpose of each block. In the same chapter the explanation of microcontroller, RFID
module, GSM modem, power supplies, LEDs, RS232 cable, LCD are considered.
Chapter 4 Presents the software description. It explains the implementation of the project using PIC
C Compiler software.
Chapter 5 Presents the project description along with RFID module, GSM modem, and LCD
interfacing to microcontroller.
Chapter 6 Presents the results, conclusion and future scope of the project.
5
early mass-produced embedded system was the Autonetics D-17 guidance computer for
the Minuteman missile, released in 1961. It was built from transistor logic and had a hard disk for
main memory. When the Minuteman II went into production in 1966, the D-17 was replaced with a
new computer that was the first high-volume use of integrated circuits.
2.1.2 Tools:
Embedded development makes up a small fraction of total programming. There's also a
large number of embedded architectures, unlike the PC world where 1 instruction set rules, and the
Unix world where there's only 3 or 4 major ones. This means that the tools are more expensive. It also
means that they're lowering featured, and less developed. On a major embedded project, at some point
you will almost always find a compiler bug of some sort.
Debugging tools are another issue. Since you can't always run general programs on
your embedded processor, you can't always run a debugger on it. This makes fixing your program
difficult. Special hardware such as JTAG ports can overcome this issue in part. However, if you stop
on a breakpoint when your system is controlling real world hardware (such as a motor), permanent
equipment damage can occur. As a result, people doing embedded programming quickly become
masters at using serial IO channels and error message style debugging.
2.1.3 Resources:
To save costs, embedded systems frequently have the cheapest processors that can do
the job. This means your programs need to be written as efficiently as possible. When dealing with
large data sets, issues like memory cache misses that never matter in PC programming can hurt you.
Luckily, this won't happen too often- use reasonably efficient algorithms to start, and optimize only
when necessary. Of course, normal profilers won't work well, due to the same reason debuggers don't
work well.
Memory is also an issue. For the same cost savings reasons, embedded systems usually
have the least memory they can get away with. That means their algorithms must be memory efficient
(unlike in PC programs, you will frequently sacrifice processor time for memory, rather than the
reverse). It also means you can't afford to leak memory. Embedded applications generally use
deterministic memory techniques and avoid the default "new" and "malloc" functions, so that leaks
can be found and eliminated more easily. Other resources programmers expect may not even exist.
For example, most embedded processors do not have hardware FPUs (Floating-Point Processing
Unit). These resources either need to be emulated in software, or avoided altogether.
8
Interactive resident debugging, using the simple shell provided by the embedded operating
system (e.g. Forth and Basic)
External debugging using logging or serial port output to trace operation using either a
monitor in flash or using a debug server like the Remedy Debugger which even works for
A complete emulator provides a simulation of all aspects of the hardware, allowing all of it to
be controlled and modified and allowing debugging on a normal PC.
Unless restricted to external debugging, the programmer can typically load and run software
through the tools, view the code running in the processor, and start or stop its operation. The
view of the code may be as assembly code or source-code.
Because an embedded system is often composed of a wide variety of elements, the
debugging strategy may vary. For instance, debugging a software(and microprocessor) centric
embedded system is different from debugging an embedded system where most of the processing is
performed by peripherals (DSP, FPGA, co-processor). An increasing number of embedded systems
today use more than one single processor core. A common problem with multi-core development is
the proper synchronization of software execution. In such a case, the embedded system design may
wish to check the data traffic on the busses between the processor cores, which requires very lowlevel debugging, at signal/bus level, with a logic analyzer, for instance.
2.2.2 Reliability:
Embedded systems often reside in machines that are expected to run continuously for
years without errors and in some cases recover by them if an error occurs. Therefore the software is
usually developed and tested more carefully than that for personal computers, and unreliable
mechanical moving parts such as disk drives, switches or buttons are avoided.
Specific reliability issues may include:
The system cannot safely be shut down for repair, or it is too inaccessible to repair. Examples
include space systems, undersea cables, navigational beacons, bore-hole systems, and
automobiles.
The system must be kept running for safety reasons. "Limp modes" are less tolerable. Often
backups are selected by an operator. Examples include aircraft navigation, reactor control
systems, safety-critical chemical factory controls, train signals, engines on single-engine
aircraft.
The system will lose large amounts of money when shut down: Telephone switches, factory
controls, bridge and elevator controls, funds transfer and market making, automated sales and
service.
A variety of techniques are used, sometimes in combination, to recover from errors
both software bugs such as memory leaks, and also soft errors in the hardware:
10
Watchdog timer that resets the computer unless the software periodically notifies the
watchdog
Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly secure &
In this design, the software simply has a loop. The loop calls subroutines, each of
which manages a part of the hardware or software.
Some embedded systems are predominantly interrupt controlled. This means that tasks
performed by the system are triggered by different kinds of events. An interrupt could be generated
for example by a timer in a predefined frequency, or by a serial port controller receiving a byte. These
kinds of systems are used if event handlers need low latency and the event handlers are short and
simple.
Usually these kinds of systems run a simple task in a main loop also, but this task is not
very sensitive to unexpected delays. Sometimes the interrupt handler will add longer tasks to a queue
structure. Later, after the interrupt handler has finished, these tasks are executed by the main loop.
This method brings the system close to a multitasking kernel with discrete processes.
11
Cooperative Multitasking:
Primitive Multitasking:
In this type of system, a low-level piece of code switches between tasks or threads
based on a timer (connected to an interrupt). This is the level at which the system is generally
considered to have an "operating system" kernel. Depending on how much functionality is required, it
introduces more or less of the complexities of managing multiple tasks running conceptually in
parallel.
As any code can potentially damage the data of another task (except in larger systems
using an MMU) programs must be carefully designed and tested, and access to shared data must be
controlled by some synchronization strategy, such as message queues, semaphores or a non-blocking
synchronization scheme.
Because of these complexities, it is common for organizations to buy a real-time
operating system, allowing the application programmers to concentrate on device functionality rather
than operating system services, at least for large systems; smaller systems often cannot afford the
overhead associated with a generic real time system, due to limitations regarding memory size,
performance, and/or battery life.
the operating system kernel allocates memory and switches the CPU to different threads of execution.
User mode processes implement major functions such as file systems, network interfaces, etc.
In general, microkernels succeed when the task switching and intertask communication
is fast, and fail when they are slow. Exokernels communicate efficiently by normal subroutine calls.
The hardware and all the software in the system are available to, and extensible by application
12
programmers. Based on performance, functionality, requirement the embedded systems are divided
into three categories:
2.3.2 Stand Alone Embedded System:
These systems takes the input in the form of electrical signals from transducers or
commands from human beings such as pressing of a button etc.., process them and produces desired
output. This entire process of taking input, processing it and giving output is done in standalone mode.
Such embedded systems comes under stand alone embedded systems
Eg: microwave oven, air conditioner etc...
2.3.3 Real-time embedded systems:
Embedded systems which are used to perform a specific task or operation in a specific
time period those systems are called as real-time embedded systems. There are two types of real-time
embedded systems.
not done in a particular time period then there is a cause of damage to the entire equipment.
Eg: consider a system in which we have to open a valve within 30 milliseconds. If this valve is
not opened in 30 ms this may cause damage to the entire equipment. So in such cases we use
embedded systems for doing automatic operations.
13
Eg:
Consider a web camera that is connected to the computer with internet can be used to
spread communication like sending pictures, images, videos etc.., to another computer
with internet connection throughout anywhere in the world.
the desktop of your computer which is connected to internet. This gives an alerting message with
image on to the desktop of your computer, and then you can open the door lock just by clicking the
mouse. Fig: 2.2 show the network communications in embedded systems.
Among these Microcontroller is of low cost processor and one of the main advantage of
microcontrollers is, the components such as memory, serial communication interfaces, analog
to digital converters etc.., all these are built on a single chip. The numbers of external
components that are connected to it are very less according to the application.
14
Microprocessors are more powerful than microcontrollers. They are used in major applications
with a number of tasking requirements. But the microprocessor requires many external
components like memory, serial communication, hard disk, input output ports etc.., so the
power consumption is also very high when compared to microcontrollers.
Digital signal processing is used mainly for the applications that particularly involved with
processing of signals
Today a lot of industries are using embedded systems for process control. In industries
we design the embedded systems to perform a specific operation like monitoring temperature,
pressure, humidity ,voltage, current etc.., and basing on these monitored levels we do control other
devices, we can send information to a centralized monitoring station.
Fig2.6: Robot
In critical industries where human presence is avoided there we can use robots which
are programmed to do a specific operation.
2.4.5 Computer networking:
Embedded systems are used as bridges routers etc..
17
GSM
modem
RS 232
interfacing
LED indicators
Crystal Oscillator
Reset
LCD
driver
Micro
controller
RFID
Reader
LCD
Geared DC
Motor driver
Geared DC
Motor
FIG 3.1: Block diagram of RFID and GSM based intelligent courier mail box system with
automatic delivery notification
18
for production of microprocessors, and the first computers were made by adding external peripherals
such as memory, input-output lines, timers and other. Further increasing of the volume of the package
resulted in creation of integrated circuits. These integrated circuits contained both processor and
peripherals. That is how the first chip containing a microcomputer, or what would later be known as a
microcontroller came about.
Microprocessors and microcontrollers are widely used in embedded systems products.
Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount
of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip
ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in
which cost and space are critical.
3.2.2 Description:
Introduction to PIC Microcontrollers:
PIC stands for Peripheral Interface Controller given by Microchip Technology to
identify its single-chip microcontrollers. These devices have been very successful in 8-bit
microcontrollers. The main reason is that Microchip Technology has continuously upgraded the
device architecture and added needed peripherals to the microcontroller to suit customers'
requirements. The development tools such as assembler and simulator are freely available on the
internet at www.microchip.com.
Low - end PIC Architectures:
Microchip PIC microcontrollers are available in various types. When PIC
microcontroller MCU was first available from General Instruments in early 1980's, the
microcontroller consisted of a simple processor executing 12-bit wide instructions with basic I/O
functions. These devices are known as low-end architectures. They have limited program memory and
are meant for applications requiring simple interface functions and small program & data memories.
Some of the low-end device numbers are
12C5XX
16C5X
16C505
20
7. Powerful output pin control (25 mA (max.) current sourcing capability per pin.)
8. EPROM/OTP/ROM/Flash memory option.
9. I/O port expansion capability.
CPU Architecture:
The CPU uses Harvard architecture with separate Program and Variable (data) memory interface.
This facilitates instruction fetch and the operation on data/accessing of variables simultaneously.
Architecture of PIC microcontroller
Power-on reset
Watchdog timer
Peripheral features:
22
crystal/clock
Timer0: 8-bit timer/counter with 8-bit prescaler can be incremented during sleep via external
Timer2:8-bit timer/counter with 8-bit period register prescaler and post scalar.
In-circuit programming
Analogue comparators
Internal oscillator
USART serial interface
23
24
Pin 13, 14 are used for crystal oscillator to connect to generate a frequency of about 20MHz.
Pin 11, 12 and31, 32 are used for voltage supply Vdd(+)and Vss(-)
PIC 16F877A Specification:
RAM
368 bytes
EEPROM
256 bytes
8k words
Operating Frequency
DC to 20MHz
I/O port
Port A,B,C,D,E
This is the specification for PIC16F877A from Microchip. A single microcontroller
which is very brilliant and is very easy to be assembled, program and also the price is very cheap. It
cost less than 10 dollar. The good thing is that single unit can be purchased at that 10 dollar price.
Unlike some other Integrated Circuit that must be bought at a minimum order quantity such as 1000
units or 2000 units or else you wont be able to purchase it.
One unit of PIC16F877A microcontroller can be programmed and erased so many times.
Some said about 10 000 times. If you are doing programming and downloading your code into the
PIC 20 times a day that means you can do that for 500 days which is more than a year!
The erasing time is almost unnoticeable because once new program are loaded into the PIC,
the old program will automatically be erased immediately. During my time of Degree study, I did not
use PIC but I use other type of microcontroller. I have to wait for about 15 to 30 minutes to erase the
EEPROM before I can load a new program and test the microcontroller. One day I can only modify
my code and test it for less than 10 times. 10x15 minutes = 150 minutes.
RAM:
PIC16F877A already made with 368 bytes of Random Access Memory (RAM) inside it. Any
temporary variable storage that we wrote in our program will be stored inside the RAM. Using this
microcontroller you dont need to buy any external RAM.
25
EEPROM:
256 bytes of EEPROM are available also inside this microcontroller. This is very useful to
store information such as PIN Number, Serial Number and so on. Using EEPROM is very important
because data stored inside EEPROM will be retained when power supply is turn off. RAM did not
store data permanently. Data inside RAM is not retained when power supply is turn off.
The size of program code that can be stored is about 8k words inside PIC16F877A ROM. 1
word size is 14 bits. By using the free version of the CCS C compiler only 2k words of program can
be written and compiled. To write 8k words of C program you have to purchase the original CCS C
compiler and it cost less than 700 dollar.
Crystal oscillator:
The crystal oscillator speed that can be connected to the PIC microcontroller range from DC to
20Mhz. Using the CCS C compiler normally 20Mhz oscillator will be used and the price is very
cheap. The 20 MHz crystal oscillator should be connected with about 22pF capacitor. Please refer to
my circuit schematic.
There are 5 input/output ports on PIC microcontroller namely port A, port B, port C, port D
and port E. Each port has different function. Most of them can be used as I/O port.
3.3 REGULATED POWER SUPPLY:
3.3.1 Introduction:
Power supply is a supply of electrical power. A device or system that supplies electrical
or other types of energy to an output load or group of loads is called a power supply unit or PSU. The
term is most commonly applied to electrical energy supplies, less often to mechanical ones, and rarely
to others.
A power supply may include a power distribution system as well as primary or
secondary sources of energy such as
Conversion of one form of electrical power to another desired form and voltage, typically
involving converting AC line voltage to a well-regulated lower-voltage DC for electronic devices.
26
Low voltage, low power DC power supply units are commonly integrated with the devices they
27
Fig 3.3.3 Circuit diagram of Regulated Power Supply with Led connection
The components mainly used in above figure are
230V AC MAINS
BRIDGE RECTIFIER(DIODES)
TRANSFORMER
CAPACITOR
RESISTOR
LED(LIGHT EMITTING DIODE)
The detailed explanation of each and every component mentioned above is as follows:
Transformation: The process of transforming energy from one device to another is called
transformation. For transforming energy we use transformers.
Transformers:
A transformer is a device that transfers electrical energy from one circuit to another
through inductively coupled conductors without changing its frequency. A varying current in the first
or primary winding creates a varying magnetic flux in the transformer's core, and thus a
varying magnetic field through the secondary winding. This varying magnetic field induces a
varying electromotive force (EMF) or "voltage" in the secondary winding. This effect is called mutual
induction.
28
If a load is connected to the secondary, an electric current will flow in the secondary
winding and electrical energy will be transferred from the primary circuit through the transformer to
the load. This field is made up from lines of force and has the same shape as a bar magnet.
If the current is increased, the lines of force move outwards from the coil. If the current
is reduced, the lines of force move inwards.
If another coil is placed adjacent to the first coil then, as the field moves out or in, the
moving lines of force will "cut" the turns of the second coil. As it does this, a voltage is induced in the
second coil. With the 50 Hz AC mains supply, this will happen 50 times a second. This is called
MUTUAL INDUCTION and forms the basis of the transformer.
The input coil is called the PRIMARY WINDING; the output coil is the
SECONDARY WINDING. Fig: 3.3.4 shows step-down transformer.
For example, if the secondary has half the primary turns; the secondary will have half
the primary voltage.
Another example is if the primary has 5000 turns and the secondary has 500 turns, then
the turns ratio is 10:1.
29
If the primary voltage is 240 volts then the secondary voltage will be x 10 smaller = 24
volts. Assuming a perfect transformer, the power provided by the primary must equal the power taken
by a load on the secondary. If a 24-watt lamp is connected across a 24 volt secondary, then the
primary must supply 24 watts.
To aid magnetic coupling between primary and secondary, the coils are wound on a
metal CORE. Since the primary would induce power, called EDDY CURRENTS, into this core, the
core is LAMINATED. This means that it is made up from metal sheets insulated from each other.
Transformers to work at higher frequencies have an iron dust core or no core at all.
Note that the transformer only works on AC, which has a constantly changing current
and moving field. DC has a steady current and therefore a steady field and there would be no
induction.
Some transformers have an electrostatic screen between primary and secondary. This is
to prevent some types of interference being fed from the equipment down into the mains supply, or in
the other direction. Transformers are sometimes used for IMPEDANCE MATCHING.
We can use the transformers as step up or step down.
Step Up transformer:
In case of step up transformer, primary windings are every less compared to secondary
winding.
Because of having more turns secondary winding accepts more energy, and it releases
more voltage at the output side.
Step down transformer:
Incase of step down transformer, Primary winding induces more flux than the
secondary winding, and secondary winding is having less number of turns because of that it accepts
less number of flux, and releases less amount of voltage.
30
figure. The circuit has four diodes connected to form a bridge. The ac input voltage is applied to the
diagonally opposite ends of the bridge. The load resistance is connected between the other two ends of
the bridge.
For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct, whereas
diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with the load
resistance RL and hence the load current flows through RL.
For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct
whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the load
resistance RL and hence the current flows through RL in the same direction as in the previous half
cycle. Thus a bi-directional wave is converted into a unidirectional wave.
Input
Output
33
Features:
across its plates. In its basic form a capacitor consists of two parallel conductive plates that are not
connected but are electrically separated either by air or by an insulating material called the Dielectric.
When a voltage is applied to these plates, a current flows charging up the plates with electrons giving
one plate a positive charge and the other plate an equal and opposite negative charge. This flow of
electrons to the plates is known as the Charging Current and continues to flow until the voltage across
the plates (and hence the capacitor) is equal to the applied voltage Vcc. At this point the capacitor is
said to be fully charged and this is illustrated below. The construction of capacitor and an electrolytic
capacitor are shown in figures 3.3.9 and 3.3.10 respectively.
Units of Capacitance:
Microfarad (F) 1F = 1/1,000,000 = 0.000001 = 10-6 F
Nanofarad (nF) 1nF = 1/1,000,000,000 = 0.000000001 = 10-9 F
Pico farad (pF) 1pF = 1/1,000,000,000,000 = 0.000000000001 = 10-12 F
Operation of Capacitor:
Think of water flowing through a pipe. If we imagine a capacitor as being a storage
tank with an inlet and an outlet pipe, it is possible to show approximately how an electronic capacitor
works.
35
First, let's consider the case of a "coupling capacitor" where the capacitor is used to
connect a signal from one part of a circuit to another but without allowing any direct current to flow.
So a coupling capacitor allows "alternating current" to pass through because the ball
valve doesn't get a chance to close as the waves go up and down. However, a steady current quickly
fills the tank so that all flow stops.
A capacitor will pass alternating current but (apart from an initial surge) it will not pass
d.c.
36
Regulation:
The process of converting a varying voltage to a constant regulated voltage is called as
regulation. For the process of regulation we use voltage regulators.
Voltage Regulator:
A voltage regulator (also called a regulator) with only three terminals appears to be a
simple device, but it is in fact a very complex integrated circuit. It converts a varying input voltage
into a constant regulated output voltage. Voltage Regulators are available in a variety of outputs like
5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are designed for positive input.
For applications requiring negative input, the LM79XX series is used. Using a pair of voltagedivider resistors can increase the output voltage of a regulator circuit.
It is not possible to obtain a voltage lower than the stated rating. You cannot use a 12V
regulator to make a 5V power supply. Voltage regulators are very robust. These can withstand overcurrent draw due to short circuits and also over-heating. In both cases, the regulator will cut off before
any damage occurs. The only way to destroy a regulator is to apply reverse voltage to its input.
Reverse polarity destroys the regulator almost instantly. Fig: 3.3.11 shows voltage regulator.
V = IR
Resistors are elements of electrical networks and electronic circuits and are ubiquitous in most
electronic equipment. Practical resistors can be made of various compounds and films, as well as
resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).
The primary characteristics of a resistor are the resistance, the tolerance, maximum working
voltage and the power rating. Other characteristics include temperature coefficient, noise, and
inductance. Less well-known is critical resistance, the value below which power dissipation limits the
maximum permitted current flow, and above which the limit is applied voltage. Critical resistance is
determined by the design, materials and dimensions of the resistor.
Resistors can be made to control the flow of current, to work as Voltage dividers, to
dissipate power and it can shape electrical waves when used in combination of other components.
Basic unit is ohms.
Theory of operation:
Ohm's law:
The behavior of an ideal resistor is dictated by the relationship specified in Ohm's law:
V = IR
Ohm's law states that the voltage (V) across a resistor is proportional to the current (I)
through it where the constant of proportionality is the resistance (R).
Power dissipation:
The power dissipated by a resistor (or the equivalent resistance of a resistor network) is
calculated using the following:
38
3.4. LED:
A light-emitting diode (LED) is a semiconductor light source. LEDs are used as
indicator lamps in many devices, and are increasingly used for lighting. Introduced as a practical
electronic component in 1962, early LEDs emitted low-intensity red light, but modern versions are
available across the visible, ultraviolet and infrared wavelengths, with very high brightness. The
internal structure and parts of a led are shown in figures 3.4.1 and 3.4.2 respectively.
39
Working:
The structure of the LED light is completely different than that of the light bulb.
Amazingly, the LED has a simple and strong structure. The light-emitting semiconductor material is
what determines the LED's color. The LED is based on the semiconductor diode.
When a diode is forward biased (switched on), electrons are able to recombine with
holes within the device, releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy of the photon) is
determined by the energy gap of the semiconductor. An LED is usually small in area (less than
1 mm2), and integrated optical components are used to shape its radiation pattern and assist in
reflection. LEDs present many advantages over incandescent light sources including lower energy
consumption, longer lifetime, improved robustness, smaller size, faster switching, and greater
durability and reliability. However, they are relatively expensive and require more precise current and
heat management than traditional light sources. Current LED products for general lighting are more
expensive to buy than fluorescent lamp sources of comparable output. They also enjoy use in
applications as diverse as replacements for traditional light sources in automotive lighting
(particularly indicators) and in traffic signals. The compact size of LEDs has allowed new text and
video displays and sensors to be developed, while their high switching rates are useful in advanced
communications technology. The electrical symbol and polarities of led are shown in fig: 3.4.3.
40
High-efficiency
No UV Rays
Visual signal application where the light goes more or less directly from the LED to the
human eye, to convey a message or meaning.
Illumination where LED light is reflected from object to give visual response of these objects.
Generate light for measuring and interacting with processes that do not involve the human
visual system.
RFID Tags
The tag is the basic building block of RFID. Each tag consists of an antenna and a small silicon chip
that contains a radio receiver, a radio modulator for sending a response back to the reader, control
logic, some amount of memory, and a power system. The power system can be completely powered
by the incoming RF signal, in which case the tag is known as a passive tag. Alternatively, the tags
power system can have a battery, in which case the tag is known as an active tag.
The primary advantages of active tags are their reading range and reliability. With the proper
antenna on the reader and the tag, a 915MHz tag can be read from a distance of 100 feet or more. The
tags also tend to be more reliable because they do not need a continuous radio signal to power their
electronics.
Passive tags, on the other hand, can be much smaller and cheaper than active ones because
they dont have batteries. Another advantage is their longer shelf life: Whereas an active tags
batteries may last only a few years, a passive tag could in principle be read many decades after the
chip was manufactured
Between the active and the passive tags are the semi-passive tags. These tags have a battery,
like active tags, but still use the readers power to transmit a message back to the RFID reader using a
technique known as backscatter. These tags thus have the read reliability of an active tag but the read
range of a passive tag. They also have a longer shelf life than a tag that is fully active.
Tags come in all shapes and sizes. The smallest tag that has ever been produced is the Hitachi
mu-chip, which is less than 0.4mm on a side. Designed to be embedded in a piece of paper and used
for tracking documents printed in an office environment, the mu-chip can be read only at a distance of
42
a few centimeters. Of course, the mu-chip is a passive tag. With a larger antenna it could have a
significantly longer reading range, but that would defeat its purpose.
RFID tags can be promiscuous, in which case they will communicate with any reader.
Alternatively, they can be secure, requiring that the reader provide a password or other kind of
authentication credential before the tags respond. The vast majority of RFID tags that have been
deployed are promiscuous. Not only are these tags cheaper, but the systems also are much easier to
manage. Systems that employ passwords or encryption codes require that the codes be distributed in
advance and properly controlled. This is an exceedingly difficult management problem.
The simplest RFID chips contain only a serial numberthink of this as a 64- bit or 96-bit
block of read-only storage. Although the serial number can be burned into the chip by the
manufacturer, it is also common for the chips to be programmed in the field by the end user. Some
chips will accept only a single serial number, while other chips allow the serial number to be changed
after it is burned in. More sophisticated RFID chips can contain read-write memory that can be
programmed by a reader. Chips can also have sensors, an example of which is an air pressure sensor
to monitor the inflation of a tire. The chips might store the results of the sensor in a piece of readwrite memory or simply report the sensors reading to the RFID reader. Chips can also have a selfdestruct, or kill feature. This is a special code that, when received by the chip, causes the chip to no
longer respond to commands. For financial applications,\ the full capabilities of smart cards have been
combined with the wireless protocols and passive powering used in RFID. The result is a class of
high-capability RFID tags also called contact less smart cards.
RFID tags can interfere with each other. When multiple tags are present in a readers field, the reader
may be unable to decipher the signals from the tags. For many applications, such as raising the gate in
a parking lot, this is not a problem. The systems are optimized so that only one tag is within range at a
time. However, for other applications, reading multiple tags at once is essential. For these
applications, the tags need to support either an anti-collision protocol or, more commonly, a
43
singulation protocol. A singulation protocol allows a reader to determine that multiple tags are visible
and to iterate through the tags, getting them to take turns responding so that each may be read without
interference from the others.
Electronic Product Code (EPC) tags are a special kind of tag that follows the
EPC standard developed by the MIT Auto-ID Center and is now managed by the trade organization
EPC global. Sanjay Sharma, cofounder of the Auto-ID Center.
Readers
The RFID reader sends a pulse of radio energy to the tag and listens for the tags response. The tag
detects this energy and sends back a response that contains the tags serial number and possibly other
information as well.
44
In simple RFID systems, the readers pulse of energy functioned as an on-off switch; in more
sophisticated systems, the readers RF signal can contain commands to the tag, instructions to read or
write memory that the tag contains, and even passwords.
Historically, RFID readers were designed to read only a particular kind of tag, but so-called
multimode readers that can read many different kinds of tags are becoming increasingly popular.
RFID readers are usually on, continually transmitting radio energy and awaiting any tags that
enter their field of operation. However, for some applications, this is unnecessary and could be
undesirable in battery-powered devices that need to conserve energy. Thus, it is possible to configure
an RFID reader so that it sends the radio pulse only in response to an external event. For example,
most electronic toll collection systems have the reader constantly powered up so that every passing
car will be recorded. On the other hand, RFID scanners used in veterinarians offices are frequently
equipped with triggers and power up the only when the trigger is pulled.
Like the tags themselves, RFID readers come in many sizes. The largest readers might consist
of a desktop personal computer with a special card and multiple antennas connected to the card
through shielded cable. Such a reader would typically have a network connection as well so that it
could report tags that it reads to other computers. The smallest readers are the size of a postage stamp
and are designed to be embedded in mobile telephones.
Antennas and Radio
The RFID physical layer consists of the actual radios and antennas used to couple the reader to the tag
so that information can be transferred between the two.
Radio energy is measured by two fundamental characteristics: the frequencies at which it
oscillates and the strength or power of those oscillations. Commercial FM broadcast stations in the
United States transmit with energy at a frequency between 88MHz and 108MHz, or 1 million
isolations per second. The AM spectrum, by contrast, transmits at 500,000 to 1,500,000 oscillations
per second, or between 500KHz and 1500KHz. Microwave ovens cook with RF energy that vibrates
2.4 billion times each second, which is 2.4GHz.
Most RFID systems use the so-called unlicensed spectrum, which is a specific part of the spectrum set
aside for use without a radio license. Popular bands are the low-frequency (LF) band at 125
134.2KHz, the high-frequency band at 13.56MHz, the ultrahigh-frequency (UHF) band at 915MHz
45
(in North America; varies in other regions), and the industrial, scientific, and medical (ISM) band at
2.4GHz.
The names of the LF, HF, and UHF bands reflect the history of radios development: Radio
systems first transmitted at the lower frequencies and moved to the higher frequencies only as
technology advanced. For this reason, lower frequency radio gear was traditionally cheaper than
equipment that operated at higher frequencies. Today, however, the difference in radio prices more
often reflects market sizes, the cost of patents and other licenses, and the result of subsidies or crossmarketing agreements from equipment manufacturers.
When analyzing the energy that is radiated from an antenna, electrical engineers divide the field into
two parts: the near field, which is the part of radiation that is within a small number of wavelengths of
the antenna, and the far field, which is the energy that is radiated beyond the near field. Because the
wavelength of LF and HF devices tends to be much larger than the ranges at which RFID systems
typically operate, these systems operate in the near field, while UFH and ISM systems operate in the
far field.
As with most radio systems, the larger the antenna on the reader and the tag, the better an
RFID system will work because large antennas are generally more efficient at transmitting and
receiving radio power than are small antennas. Thus, a large antenna on the reader means that more
power can be sent to the RFID tag and more of the tags emitted energy can be collected and
analyzed. A large antenna on the tag means that more of the power can be collected and used to power
the chip. Likewise, a large antenna on the chip means that more power can be transmitted back to the
reader.
46
The Network
Most RFID tags transmit a number and nothing more. So what does a typical reader do with a typical
96-bit number like 79,228,162,514,264,337,593, 543,950,335. In most cases, the reader sends it to a
computer.
What the computer does with the RFID code depends on the application. With an accesscontrol system, the computer might look to see if the RFID number is present on a list of numbers
thats allowed access to a particular door or location. If the number is present, the computer might
energize a solenoid that would unlock the door. In the case of the Mobil Speed pass system, the tags
serial number and its response to the random challenge that was generated by the reader are sent over
Mobils payment network. If the challenge response matches the token, Mobils computers approve
the user of the customers credit-card number to complete the transaction.
Advantages of RFID Technology
RFID tags are very simple to install/inject inside the body of animals, thus helping to keep a
track on them. This is useful in animal husbandry and on poultry farms. The installed RFID
tags give information about the age, vaccinations and health of the animals.
RFID technology is better than bar codes as it cannot be easily replicated and therefore, it
increases the security of the product.
Supply chain management forms the major part of retail business and RFID systems play a
key role by managing updates of stocks, transportation and logistics of the product.
Barcode scanners have repeatedly failed in providing security to gems and jewelries in shops.
But nowadays, RFID tags are placed inside jewelry items and an alarm is installed at the exit
doors.
The RFID tags can store data up to 2 KB whereas; the bar code has the ability to read just 1012 digits.
47
The RFID technology, though very beneficial, is expensive to install. Small and medium scale
enterprises find it costly to use it in their firms and offices.
It is difficult for an RFID reader to read the information in case of RFID tags installed in
liquids and metal products. The problem is that the liquid and metal surfaces tend to reflect the
radio waves, which makes the tags unreadable. The tags have to be placed in various
alignments and angles for taking proper reading. This is a tedious task when the work involves
big firms.
Interference has been observed if devices such as forklifts and walkie-talkies are in the vicinity
of the distribution centers. The presence of mobile phone towers has been found to interfere
with RFID radio waves. Wal-Mart, the retail sector giant, has installed billions of RFID tags in
their products throughout the world and they have encountered such problems.
The USA and Europe, for instance, have different range of frequencies that allow RFID tags to
function. This makes it mandatory for international shipping companies and other
organizations to be aware of the working pattern of other nations also, which can be very time-
consuming.
RFID technology has been referred to as invasive technology. Consumers are apprehensive
about their privacy when they purchase products with RFID tags. Once the radio chips are
installed in the product, the customer can be tracked and his personal information can be
collected by the RFID reader. However, many stores have a facility that deactivates the RFID
tags after the product has been purchased.
48
3.6 GSM
Global System for Mobile Communication (GSM)
Definition:
GSM, which stands for Global System for Mobile communications, reigns (important) as the
worlds most widely used cell phone technology. Cell phones use a cell phone service carriers GSM
network by searching for cell phone towers in the nearby area. Global system for mobile
communication (GSM) is a globally accepted standard for digital cellular communication.
GSM is the name of a standardization group established in 1982 to create a
common European mobile telephone standard that would formulate specifications for a pan-European
mobile cellular radio system operating at 900 MHz. It is estimated that many countries outside of
Europe will join the GSM partnership.
49
MODEM SPECIFICATIONS:
The SIM300 is a complete Tri-band GSM solution in a compact plug-in module.
Featuring an industry-standard interface, the SIM300 delivers GSM/GPRS900/1800/1900Mhz
performance for voice, SMS, data and Fax in a small form factor and with low power consumption.
The leading features of SIM300 make it deal fir virtually unlimited application, such as WLL
applications (Fixed Cellular Terminal), M2M application, handheld devices and much more.
1. Tri-band GSM/GPRS module with a size of 40x33x2.85
2. Customized MMI and keypad/LCD support
3. An embedded powerful TCP/IP protocol stack
4. Based upon mature and field proven platform, backed up by our support service, from
definition to design and production.
General Features:
Tri-band GSM/GPRS900/1800/1900Mhz
GPRS multi-slot class 10
GPRS mobile station class B
Complaint to GSM phase 2/2+
i. -class 4(2W @900MHz)
Dimensions: 40x33x2.85 mm
Weight: 8gm
50
USSD
PPP-stack
PBCCH support
Compatibility:
At cellular command interface
Specifications for voice:
1. Tricodec
-Half rate (HR)
-Full rate (FR)
-Enhanced full rate (EFR)
2. Hands free operation
(Echo cancellation)
51
Drivers:
Microsoft windows mobile RIL driver
MUX driver
Interfaces:
LCD interface
Keypad interfaces
RTC backup
Dual-Serial interfaces
Antenna connector and antenna pad
Approvals:
FTA
Local type approval
CE
Need of GSM:
The GSM study group aimed to provide the followings through the GSM:
52
GSM Architecture:
A GSM network consists of several functional entities whose functions and interfaces are
defined. The GSM network can be divided into following broad parts.
Following fig shows the diagram of GSM Network along with added elements.
MSC/VLR Service Area: The area covered by one MSC is called the MSC/VLR service area.
PLMN: The area covered by one network operator is called PLMN. A PLMN can contain one or
more MSCs.
The GSM networks parts are explained as follows:
1) Mobile Station:
The mobile station (MS) consists of the physical equipment, such as the radio
transceiver, display and digital signal processors, and a smart card called the Subscriber Identity
Module (SIM).
The SIM provides personal mobility, so that the user can have access to all
subscribed services irrespective of both the location of the terminal and the use of a specific terminal.
By inserting the SIM card into another GSM cellular phone, the user is able to receive calls at that
phone, make calls from that phone, or receive other subscribed services.
The mobile equipment is uniquely identified by the International Mobile Equipment Identity
(IMEI). The SIM card contains the International Mobile Subscriber Identity (IMSI), identifying the
subscriber, a secret key for authentication, and other user information. The IMEI and the IMSI are
independent, thereby providing personal mobility.
55
The Base Station Controller manages the radio resources for one or more BTSs. It
handles radio channel setup, frequency hopping, and handovers, as described below. The BSC is the
connection between the mobile and the Mobile service Switching Center (MSC). The BSC also
translates the 13 kbps voice channel used over the radio link to the standard 64
kbps channel used by the Public Switched Telephone Network or ISDN.
3) Network Subsystem:
The central component of the Network Subsystem is the Mobile
services Switching Center (MSC). It acts like a normal switching node of the
PSTN or ISDN, and in addition provides all the functionality needed to handle
a mobile subscriber, such as registration, authentication, location updating, handovers, and call
routing to a roaming subscriber. These services are provided in conjunction with several functional
entities, which together form the Network Subsystem. The MSC provides the connection to the
public fixed network (PSTN or ISDN), and signaling between functional entities uses the ITUT
Signaling System Number 7 (SS7), used in ISDN and widely used in current public networks.
The Home Location Register (HLR) and Visitor Location Register (VLR), together with the
MSC, provide the call routing and (possibly international) roaming capabilities of GSM. The HLR
contains all the administrative information of each subscriber registered in the corresponding GSM
network, along with the current location of the mobile. The current location of the mobile is in the
form of a Mobile Station Roaming Number (MSRN) which is a regular ISDN number used to route a
call to the MSC where the mobile is currently located.
The other two registers are used for authentication and security purposes. The Equipment
Identity Register (EIR) is a database that contains a list of all valid mobile equipment on the network,
where each mobile station is identified by its International Mobile Equipment Identity (IMEI). An
IMEI is marked as invalid if it has been reported stolen or is not type approved. The Authentication
Center is a protected database that stores a copy of the secret key stored in each subscriber's SIM card,
which is used for authentication and ciphering of the radio channel.
GSM - The Base Station Subsystem (BSS):
The BSS is composed of two parts:
between components that are made by different suppliers. The radio components of a BSS may
consist of four to seven or nine cells. A BSS may have one or more base stations. The BSS uses the
Abis interface between the BTS and the BSC. A separate high-speed line (T1 or E1) is then connected
from the BSS to the Mobile MSC.
57
The BTS corresponds to the transceivers and antennas used in each cell of the network. A
BTS is usually placed in the center of a cell. Its transmitting power defines the size of a cell. Each
BTS has between 1 and 16 transceivers, depending on the density of users in the cell. Each BTS
serves a single cell. It also includes the following functions:
Encoding, encrypting, multiplexing, modulating, and feeding the RF signals to the antenna.
Timing advances
58
MSC. The BSC also translates the 13 Kbps voice channel used over the radio link to the standard 64
Kbps channel used by the Public Switched Telephone Network (PSDN) or ISDN.
It assigns and releases frequencies and time slots for the MS. The BSC also handles intercell
handover. It controls the power transmission of the BSS and MS in its area. The function of the BSC
is to allocate the necessary time slots between the BTS and the MSC. It is a switching device that
handles the radio resources. Additional functions include:
Providing an interface to the Operations and Maintenance Center for the BSS
Performing traffic concentration to reduce the number of lines from the MSC
Power management
Time-delay measurements of received signals from the MS
statistics).
Security Management.
Maintenance Tasks.
The operation and Maintenance functions are based on the concepts of the Telecommunication
The OSS is the functional entity from which the network operator monitors and controls the
system. The purpose of OSS is to offer the customer cost-effective support for centralized, regional
and local operational and maintenance activities that are required for a GSM network. An important
function of OSS is to provide a network overview and support the maintenance activities of different
operation and maintenance organizations.
61
62
Frequency Band:
The uplink frequency range specified for GSM is 933 - 960 MHz (basic 900 MHz band only).
The downlink frequency band 890 - 915 MHz (basic 900 MHz band only).
Channel Spacing:
200 kHz.
Speech Coding:
GSM uses linear predictive coding (LPC). The purpose of LPC is to reduce the bit rate. The
LPC provides parameters for a filter that mimics the vocal tract. The signal passes through this filter,
leaving behind a residual signal. Speech is encoded at 13 kbps.
Duplex Distance:
The duplex distance is 80 MHz. Duplex distance is the distance between the uplink and
downlink frequencies. A channel has two frequencies, 80 MHz apart.
Misc:
WCDMA.
Duplex Technique: Frequency Division Duple Xing (FDD) access mode previously known as
Advantages of GSM:
destinations.
GSM is mature, having started in the mid-80s. This maturity means a more stable network
GSM's maturity means engineers cut their teeth on the technology, creating an unconscious
preference.
63
The availability of Subscriber Identity Modules, which are smart cards that provide secure
data encryption give GSM m-commerce advantages.
GSM COMMANDS:
Commands always start with AT (which means Attention) and finish with a <CR> character.
Information responses and result codes
Responses start and end with <CR><LF>, except for the ATV0 DCE response format) and the ATQ1
(result code suppression) commands.
_ If command syntax is incorrect, an ERROR string is returned.
_ If command syntax is correct but with some incorrect parameters, the +CME ERROR:
<Err> or +CMS ERROR: <Sms Err> strings are returned with different error codes.
_ If the command line has been performed successfully, an OK string is returned.
In some cases, such as AT+CPIN? or (unsolicited) incoming events, the product does not return the
OK string as a response.
In the following examples <CR> and <CR><LF> are intentionally omitted.
1. Manufacturer identification +CGMI
2. Request model identification +CGMM
3. Request revision identification +CGMR
4. Product Serial Number +CGSN
5. Dial command D
ATD<nb> where <nb> is the destination phone number.
Please note that for an international number, the local international prefix does not need to be set
(usually 00) but does need to be replaced by the + character.
Example: to set up a voice call to Wavecom offices from another country, the AT command is:
64
ATD+33146290800;
Note that some countries may have specific numbering rules for their GSM handset numbering. The
response to the ATD command is one of the following:
6. Hang-Up command H
Description:
The ATH (or ATH0) command disconnects the remote user. In the case of multiple calls, all calls are
released (active, on-hold and waiting calls). The specific Wavecom ATH1 command has been
appended to disconnect the current outgoing call, only in dialing or alerting state (ie. ATH1 can be
used only after the ATD command, and before its terminal response (OK, NO CARRIER, ...). It can
be useful in the case of multiple calls.
Syntax:
Command syntax: ATH
7. Answer a call A
Description:
When the product receives a call, it sets the RingInd signal and sends the ASCII RING or
+CRING: <type> string to the application (+CRING if the cellular result code +CRC is enabled).
Then it waits for the application to accept the call with the ATA command.
Syntax:
Command syntax: ATA
8. Redial last telephone number ATDL
Description:
This command redials the last number used in the ATD command. The last number dialed is
displayed followed by ; for voice calls only
Syntax:
Command syntax: ATDL
65
when it ends. The requirement to send these additional two bits causes asynchronous communication
to be slightly slower than synchronous however it has the advantage that the processor does not have
to deal with the additional idle characters.
There are special IC chips made by many manufacturers for serial data
communications. These chips are commonly referred to as UART (universal asynchronous receivertransmitter) and USART (universal synchronous-asynchronous receiver-transmitter). The 8051 has a
built-in UART.
Serial transmission involves the sending of data one bit at a time, over single
communications line. In contrast, parallel communications require at least as many lines as there
are bits in a word being transmitted (for an 8-bit word, a minimum of 8 lines are needed) serial
transmission is beneficial for long distance communications, where as parallel is designed for
short distance or when very high transmission rates are required.
68
Serial Ports come in two "sizes", There are the D-Type 25 pin connector and the D-Type 9
Pin connector both of which are male on the back of the PC, thus you will require a female connector
on your device. Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors.
70
Serial Pinouts (D9 Connectors) D-Type-9 Pin No. Abbreviation Full Name:
71
72
The MAX232 has a successor, the MAX232A. The ICs are almost identical, however, the MAX232A
is much more often used (and easier to get) than the original MAX232, and the MAX232A only needs
external capacitors 1/10th the capacity of what the original MAX232 needs.
It should be noted that the MAX232 (A) is just a driver/receiver. It does not generate the necessary
RS-232 sequence of marks and spaces with the right timing, it does not decode the RS-232 signal, it
does not provide a serial/parallel conversion. All it does is to convert signal voltage levels. Generating
serial data with the right timing and decoding serial data has to be done by additional circuitry, e.g. by
a 16550 UART or one of these small micro controllers (e.g. Atmel AVR, Microchip PIC) getting
more and more popular.
The MAX232 and MAX232A were once rather expensive ICs, but today they are cheap. It has also
helped that many companies now produce clones (ie. Sipex). These clones sometimes need different
external circuitry, e.g. the capacities of the external capacitors vary. It is recommended to check the
data sheet of the particular manufacturer of an IC instead of relying on Maxim's original data sheet.
The original manufacturer (and now some clone manufacturers, too) offers a large series of similar
ICs, with different numbers of receivers and drivers, voltages, built-in or external capacitors, etc. E.g.
The MAX232 and MAX232A need external capacitors for the internal voltage pump, while the
MAX233 has these capacitors built-in. The MAX233 is also between three and ten times more
expensive in electronic shops than the MAX232A because of its internal capacitors. It is also more
difficult to get the MAX233 than the garden variety MAX232A.
A similar IC, the MAX3232 is nowadays available for low-power 3V logic.
The MAX232 (A) has two receivers (converts from RS-232 to TTL voltage levels) and two drivers
(converts from TTL logic to RS-232 voltage levels). This means only two of the RS-232 signals can
be converted in each direction. The old MC1488/1498 combo provided four drivers and receivers.
Typically a pair of a driver/receiver of the MAX232 is used for
73
There are not enough drivers/receivers in the MAX232 to also connect the DTR, DSR, and DCD
signals. Usually these signals can be omitted when e.g. communicating with a PC's serial interface. If
the DTE really requires these signals either a second MAX232 is needed, or some other IC from the
MAX232 family can be used (if it can be found in consumer electronic shops at all).
Description information:
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to
supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each receiver converts TIA/EIA-232F inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical
hysteresis of 0.5 V, and can accept 30-V inputs. Each driver converts TTL/CMOS input levels into
TIA/EIA-232-F levels. The driver, receiver, and
Voltage-generator functions are available as cells in the Texas Instruments
Serial RS-232 (V.24) communication works with voltages (between -15V ... -3V are used to
transmit a binary '1' and +3V ... +15V to transmit a binary '0') which are not compatible with today's
computer logic voltages. On the other hand, classic TTL computer logic operates between 0V ... +5V
(roughly 0V ... +0.8V referred to as low for binary '0', +2V ... +5V for high binary '1' ). Modern low74
power logic operates in the range of 0V ... +3.3V or even lower. So, the maximum RS-232 signal
levels are far too high for today's computer logic electronics, and the negative RS-232 voltage can't be
grokked at all by the computer logic. Therefore, to receive serial data from an RS-232 interface the
voltage has to be reduced, and the 0 and 1 voltage levels inverted. In the other direction (sending data
from some logic over RS-232) the low logic voltage has to be "bumped up", and a negative voltage
has to be generated, too.
RS-232
TTL
Logic
<-> 1
75
76
Pin description:
Pin No.
Name
Description
Pin no. 1
VSS
Pin no. 2
VCC
Pin no. 3
VEE
Contrast adjust
Pin no. 4
RS
Pin no. 5
R/W
Pin no. 6
EN
Enable signal
Pin no. 7
D0
Pin no. 8
D1
Pin no. 9
D2
Pin no. 10
D3
Pin no. 11
D4
Pin no. 12
D5
Pin no. 13
D6
Pin no. 14
D7
Instruction
input
1 = Data input
0 = Write to LCD module
1 = Read from LCD module
78
The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the
data being sent is text data which should be displayed on the screen. For example, to display the letter
"T" on the screen we would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the information on the data
bus is being written to the LCD. When RW is high (1), the program is effectively querying (or
reading) the LCD. Only one instruction ("Get LCD status") is a read command. All others are write
commands--so RW will almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by
the user). In the case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4,
DB5, DB6, and DB7.
Schematic:
Circuit Description:
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected
to the Control Port. The Control Port is an open collector / open drain output. While most Parallel
Ports have internal pull-up resistors, there is a few which don't. Therefore by incorporating the two
79
10K external pull up resistors, the circuit is more portable for a wider range of computers, some of
which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore we hard wire the
R/W line of the LCD panel, into write mode. This will cause no bus conflicts on the data lines. As a
result we cannot read back the LCD's internal Busy Flag which tells us if the LCD has accepted and
finished processing the last instruction. This problem is overcome by inserting known delays into our
program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with
all the examples, I've left the power supply out. We can use a bench power supply set to 5v or use an
onboard +5 regulator. Remember a few de-coupling capacitors, especially if we have trouble with the
circuit working properly.
SETB RW
Handling the EN control line:
As we mentioned above, the EN line is used to tell the LCD that we are ready for it to execute
an instruction that we've prepared on the data bus and on the other control lines. Note that the EN line
must be raised/ lowered before/after each instruction sent to the LCD regardless of whether that
instruction is read or write text or instruction. In short, we must always manipulate EN when
communicating with the LCD. EN is the LCD's way of knowing that we are talking to it. If we don't
raise/lower EN, the LCD doesn't know we're talking to it on the other lines.
Thus, before we interact in any way with the LCD we will always bring the EN line low with
the following instruction:
CLR EN
And once we've finished setting up our instruction with the other control lines and data bus lines,
we'll always bring this line high:
80
SETB EN
The line must be left high for the amount of time required by the LCD as specified in its
datasheet. This is normally on the order of about 250 nanoseconds, but checks the datasheet. In the
case of a typical microcontroller running at 12 MHz, an instruction requires 1.08 microseconds to
execute so the EN line can be brought low the very next instruction. However, faster microcontrollers
(such as the DS89C420 which executes an instruction in 90 nanoseconds given an 11.0592 MHz
crystal) will require a number of NOPs to create a delay while EN is held high. The number of NOPs
that must be inserted depends on the microcontroller we are using and the crystal we have selected.
The instruction is executed by the LCD at the moment the EN line is brought low with a final
CLR EN instruction.
Checking the busy status of the LCD:
As previously mentioned, it takes a certain amount of time for each instruction to be executed
by the LCD. The delay varies depending on the frequency of the crystal attached to the oscillator
input of the LCD as well as the instruction which is being executed.
While it is possible to write code that waits for a specific amount of time to allow the LCD to
execute instructions, this method of "waiting" is not very flexible. If the crystal frequency is changed,
the software will need to be modified. A more robust method of programming is to use the "Get LCD
Status" command to determine whether the LCD is still busy executing the last instruction received.
The "Get LCD Status" command will return to us two tidbits of information; the information
that is useful to us right now is found in DB7. In summary, when we issue the "Get LCD Status"
command the LCD will immediately raise DB7 if it's still busy executing a command or lower DB7 to
indicate that the LCD is no longer occupied. Thus our program can query the LCD until DB7 goes
low, indicating the LCD is no longer busy. At that point we are free to continue and send the next
command.
81
Applications:
Medical equipment
Advertising system
Security systems
Climatizing units
Simulators
Lab development
Home automation
Serial terminal
EPOS
Gaming box
PLC Interface
Environmental monitoring
Student projects
PC external display
HMI operator interface.
82
into your Express PCB directory. At this point start the program and get ready to setup the workspace
to suit your style.
Click View -> Options. In this menu, setup the units for mm or in depending on how
you think, and click see through the top copper layer at the bottom. The standard color scheme of
red and green is generally used but it is not as pleasing as red and blue.
4.1.2 The Interface:
When a project is first started you will be greeted with a yellow outline. This yellow outline
is the dimension of the PCB. Typically after positioning of parts and traces, move them to their final
position and then crop the PCB to the correct size. However, in designing a board with a certain size
constraint, crop the PCB to the correct size before starting.
Fig: 4.1 show the toolbar in which the each button has the following functions:
The select tool: It is fairly obvious what this does. It allows you to move
and manipulate
parts. When this tool is selected the top toolbar will show buttons to move traces to the top /
The Insert Corner in trace: button does exactly what it says. When this tool is selected,
clicking on a trace will insert a corner which can be moved to route around components and
other traces.
The remove a trace button is not very important since the delete key will achieve the same
result.
care must be taken with stubborn chips such as the TPA6120 amplifier from TI. The TPA6120
datasheet specifies not to run a ground plane under the pins or signal traces of this chip as the
capacitance generated could effect performance negatively.
4.2 PIC Compiler:
PIC compiler is software used where the machine language code is written and
compiled. After compilation, the machine source code is converted into hex code which is to be
dumped into the microcontroller for further processing. PIC compiler also supports C language code.
Its important that you know C language for microcontroller which is commonly
known as Embedded C. As we are going to use PIC Compiler, hence we also call it PIC C. The PCB,
PCM, and PCH are separate compilers. PCB is for 12-bit opcodes, PCM is for 14-bitopcodes, and
PCH is for 16-bit opcode PIC microcontrollers. Due to many similarities, all three compilers are
covered in this reference manual. Features and limitations that apply to only specific microcontrollers
are indicated within. These compilers are specifically designed to meet the unique needs of the PIC
microcontroller. This allows developers to quickly design applications software in a more readable,
high-level language. When compared to a more traditional C compiler, PCB, PCM, and PCH have
some limitations. As an example of the limitations, function recursion is not allowed.
This is due to the fact that the PIC has no stack to push variables onto, and also
because of the way the compilers optimize the code. The compilers can efficiently implement normal
C constructs, input/output operations, and bit twiddling operations. All normal C data types are
supported along with pointers to constant arrays, fixed point decimal, and arrays of bits.
PIC C is not much different from a normal C program. If you know assembly, writing
a C program is not a crisis. In PIC, we will have a main function, in which all your application
specific work will be defined. In case of embedded C, you do not have any operating system running
in there. So you have to make sure that your program or main file should never exit. This can be done
with the help of simple while (1) or for (;;) loop as they are going to run infinitely.
We have to add header file for controller you are using, otherwise you will not be able
to access registers related to peripherals.
#include <16F877A.h> // header file for PIC 16F877A//
86
4.3 Proteus:
Proteus is software which accepts only hex files. Once the machine code is converted
into hex code, that hex code has to be dumped into the microcontroller and this is done by the Proteus.
Proteus is a programmer which itself contains a microcontroller in it other than the one which is to be
programmed. This microcontroller has a program in it written in such a way that it accepts the hex file
from the pic compiler and dumps this hex file into the microcontroller which is to be programmed. As
the Proteus programmer requires power supply to be operated, this power supply is given from the
power supply circuit designed and connected to the microcontroller in proteus. The program which is
to be dumped in to the microcontroller is edited in proteus and is compiled and executed to check any
errors and hence after the successful compilation of the program the program is dumped in to the
microcontroller using a dumper.
4.4 Procedural steps for compilation, simulation and dumping:
4.4.1 Compilation and simulation steps:
For PIC microcontroller, PIC C compiler is used for compilation. The compilation
steps are as follows:
Open PIC C compiler.
You will be prompted to choose a name for the new project, so create a separate folder where
all the files of your project will be stored, choose a name and click save.
87
Click Project, New, and something the box named 'Text1' is where your code should be
written later.
Now you have to click 'File, Save as' and choose a file name for your source code ending with
the letter '.c'. You can name as 'project.c' for example and click save. Then you have to add
this file to your project work.
88
89
You can then start to write the source code in the window titled 'project.c' then before testing
your source code; you have to compile your source code, and correct eventual syntax errors.
Fig 4.4: Picture of checking errors and warnings using PIC C compiler
This is how we compile a program for checking errors and hence the compiled program is
saved in the file where we initiated the program.
90
After compilation, next step is simulation. Here first circuit is designed in Express PCB
using Proteus 7 software and then simulation takes place followed by dumping. The simulation steps
are as follows:
10. Now click on letter p, then under that select PIC16F877A ,other components related to the
project and click OK. The PIC 16F877A will be called your 'Target device, which is the final
destination of your source code.
91
2. Select Tools option and click on Check Communication for establishing a connection as shown
in below window
92
Fig 4.7: Picture of checking communications before dumping program into microcontroller
3. After connecting the dumper properly to the microcontroller kit the window is appeared as shown
below.
93
4. Again by selecting the Tools option and clicking on Check Communication the microcontroller
gets recognized by the dumper and hence the window is as shown below.
94
5. Import the program which is .hex file from the saved location by selecting File option and
clicking on Import Hex as shown in below window.
95
6. After clicking on Import Hex option we need to browse the location of our program and click the
prog.hex and click on open for dumping the program into the microcontroller.
96
97
98
Fig 5.1: schematic diagram of RFID and GSM based intelligent courier mail box
The above schematic diagram of RFID and GSM based intelligent courier mailbox system with
automatic delivery notification explains the interfacing section of each component with micro
controller, RFID and GSM. Crystal oscillator connected to 9th and 10th pins of micro controller and
regulated power supply is also connected to micro controller and LEDs also connected to micro
controller through resistors.
The detailed explanation of each module interfacing with microcontroller is as follows:
99
5.2 Interfacing crystal oscillator and reset button with micro controller:
Fig 5.2: Diagram of crystal oscillator and reset input interfacing with micro controller
100
101
102
Advantages:
1. Highly efficient and user friendly design.
2. Easy to operate.
3. Low power consumption.
4. Efficient design.
5. Works anywhere in the world (GSM availability).
6. Incase of emergency intimation can be sent to predefined numbers.
Disadvantages:
1. Modem should be properly installed for proper working of the system.
2. Poor network signal can decrease the performance of system.
Applications:
This system can be practically implemented in real time at places where security is a concern
like banks, schools, hospitals, colleges etc..,
103
CHAPTER 7: RESULTS
7.1 Result:
The project RFID and GSM based intelligent courier mailbox system with automatic
delivery notification was designed such that an automatic sending information about mail to user and
delivery notification to courier officials from an intelligent courier mailbox system
7.2 Conclusion:
Integrating features of all the hardware components used have been developed in it.
Presence of every module has been reasoned out and placed carefully, thus contributing to the best
working of the unit. Secondly, using highly advanced ICs with the help of growing technology, the
project has been successfully implemented. Thus the project has been successfully designed and
tested.
7.3 Future Scope:
Our project RFID and GSM based intelligent courier mailbox system with automatic delivery
notification is mainly intended to design a security control system using RFID technology. The
system consists of a RFID reader, LCD display which is interfaced to the Micro Controller. When a
RFID tag is placed in front of RFID reader which reads the tag number and this is fed as input to the
micro controller. The micro controller is programmed in such a way that the input from RFID reader
is checked and displays the respective information on the LCD display.
This project can be extended using a GSM module. GSM module sends the alert message to
the respective authorities when un authorized card is detected by the RFID reader.
104
REFERENCES
Books referred:
105
APPENDIX
Program Code:
The program code which is dumped in the microcontroller of our project is shown below.
#include <16F877A.h>
#include <sms.c>
#include <string.h>
#include <stepper.c>
#include <lcd.c>
#use
delay (clock=20000000)
#use
#use
char ch = 0;
char data[150]; //for SMS storage
char help[] = {"help"};
char mail[] = {"MB*"};
char about[] = {"about"};
char clear[] = {"clear"};
char num[15];
char RFID[20];
char owner_num[15];
char sender_num[15];
int count = 0;
void start()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"GSM & RFID based ");
lcd_gotoxy(1,2);
printf(lcd_putc," Mailbox System");
delay_ms(3000);
106
void sendingsms()
{
lcd_gotoxy(1,2);
printf(lcd_putc,"Sending SMS...");
}
void shownum()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"num = %s",num);
}
void show_message()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"Received Message");
lcd_gotoxy(1,2);
printf(lcd_putc,"from:%s",num);
}
void init_gsm()
{
fprintf(GSM,"AT\r\n");
delay_ms(2000);
fprintf(GSM,"AT+CMGF=1\r\n");
delay_ms(2000);
}
{
int i;
int j = 0;
for (i = 11; i < 21; i++) //10 digit phone number
{
write_eeprom(i, owner_num[j]);
j++;
}
}
}
void WRITE_RFID_EEPROM(char rfid_num[]) //RFID Tag Number
{
int i;
int j = 0;
for (i = 22; i < 34; i++) //12 digit rfid number
{
write_eeprom(i, rfid_num[j]);
j++;
}
}
109
void show_mailbox_message()
{
lcd_putc('\f');
lcd_gotoxy(1,1);
READ_RFID_EEPROM();
printf(lcd_putc,"RFID Tag Number");
lcd_gotoxy(1,2);
READ_RFID_EEPROM();
printf(lcd_putc," %s",RFID);
delay_ms(2000);
lcd_putc('\f');
lcd_gotoxy(1,1);
READ_RFID_EEPROM();
printf(lcd_putc,"Owner Ph. Number");
READ_OWNER_NUM_EEPROM();
110
lcd_gotoxy(1,2);
printf(lcd_putc," %s",owner_num);
delay_ms(2000);
lcd_putc('\f');
lcd_gotoxy(1,1);
READ_RFID_EEPROM();
printf(lcd_putc," Courier Office");
READ_SENDER_NUM_EEPROM();
lcd_gotoxy(1,2);
printf(lcd_putc," Ph:%s",sender_num);
delay_ms(2000);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc," Waiting for");
lcd_gotoxy(1,2);
printf(lcd_putc," RFID mail");
delay_ms(2000);
}
void send_message()
{
delay_ms(1000);
fputc(0x1A,GSM); //^Z
}
void send_sms_num()
{
fprintf(GSM,"AT+CMGS=\"%s\"\r\n",num);
delay_ms(2000);
}
void read_rfid_data()
{
char ch;
111
int i = 0;
while(1)
{
ch = fgetc(RF_ID);
RFID[i] = ch;
i++;
if(i > 11)
break;
}
RFID[i] = 0;
}
void send_sms_to_owner()
{
READ_OWNER_NUM_EEPROM();
fprintf(GSM,"AT+CMGS=\"%s\"\r\n",owner_num);
delay_ms(2000);
fprintf(GSM,"Your Mail Box at home received a RFID Mail with ID No: %s\r\n",RFID);
send_message();
}
void send_sms_to_office()
{
READ_SENDER_NUM_EEPROM();
fprintf(GSM,"AT+CMGS=\"%s\"\r\n",sender_num);
fprintf(GSM,"The RFID Mail with ID: %s is been delivered.\r\n",RFID);
send_message();
}
void open_box()
{
int x = 0;
while(x < 48) //48 steps
{
stepper_forward(); //rotate stepper motor by one step (forward)
112
delay_ms(100);
x++;
}
}
void close_box()
{
int y = 0;
while(y < 48) //48 steps
{
stepper_reverse(); //rotate stepper motor by one step (reverse)
delay_ms(100);
y++;
}
}
void main()
{
int mailbox_flag = 0;
char tdata[20];
int i = 0;
int j = 0;
lcd_init();
start(); //Welcome message
//Microcontroller Health Check
output_high(PIN_D1);
delay_ms(1000);
output_low(PIN_D1);
delay_ms(1000);
output_high(PIN_D1);
delay_ms(1000);
output_low(PIN_D1);
lcd_putc('\f');
113
lcd_gotoxy(1,1);
printf(lcd_putc," Initialising");
lcd_gotoxy(1,2);
printf(lcd_putc," GSM Modem");
delay_ms(2000);
init_gsm();
while(1)
{
output_high(PIN_D1); //LED Indicator
delay_ms(50);
output_low(PIN_D1);
mailbox_flag = READ_MAIL_FLAG_EEPROM(); //read mailbox sms flag from eeprom
if(mailbox_flag == 1)
{
show_mailbox_message();
//read the rfid tag number from RFID Reader (live data)
if(!strcmp(tdata,RFID)) //compare live RFID number with stored number (strcmp returns 0 if
matches)
{
output_high(PIN_D1);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc," Received Mail");
delay_ms(1500);
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc," Opening Box");
lcd_gotoxy(1,2);
114
}
count = 0;
data[count] = 0;
fprintf(GSM,"AT+CMGR=1\r\n");
fgets(data,GSM); //read into the variable 'data'
i = 0;
while(data[i] != '*')
{
i++;
}
i++;
116
j = 0;
lcd_gotoxy(1,1);
118