You are on page 1of 47

CHAPTER 1

INTRODUCTION

1.1 EMBEDDED SYSTEM:


An embedded system is a special-purpose system in which the computer is completely
encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose
computer, such as a personal computer, an embedded system performs one or a few predefined
tasks, usually with very specific requirements. Since the system is dedicated to specific tasks,
design engineers can optimize it, reducing the size and cost of the product. Embedded systems
are often mass-produced, benefiting from economies of scale.
Personal digital assistants (PDAs) or handheld computers are generally considered
embedded devices because of the nature of their hardware design, even though they are more
expandable in software terms. This line of definition continues to blur as devices expand. With
the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a
USB port

both features usually Belong to "general purpose computers", the line of nomenclature
blurs even more.
Physically, embedded systems ranges from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a single
microcontroller chip, to very complex with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.

HISTORY:
In the 1960s, computers possessed an ability to acquire, analyze, process data, and
make decisions at very high speeds. However there were some disadvantages with the computer
controls. They were: high cost, program complexity, and hesitancy of personnel to learn.
However the new concept of electronic devices was evolved. They were called programmable
controllers which later became a part of embedded systems. This concept developed from a mix
of computer technology, solid state devices, and traditional electro mechanical sequences. The
first mass-produced embedded system was the Autonetics D-17 guidance computer for the
Minuteman missile released in 1961. It was built from discrete transistor logic and had a hard
disk for main memory.
REQUIREMENTS OF TYPICAL EMBEDDED SYSTEMS: EX: CHEMICAL PLANT: Consider a chemical plant. No. of temperatures have to be measured
&based on values certain operations are performed, such as opening a value.
INPUT: - From sensors which measure temperatures.
OUTPUT: signal that controls a value.
Ex: MOBILE PHONES: The processor of a mobile phone needs to carry out a great deal of
communications protocol processing to make "TELEPHONECAL.

Fig 1.1 Typical embedded system organization

CHARACTERISTICS:

Embedded systems often use a (relatively) slow processor and small memory size with an
intentionally simplified architecture to minimize costs.

Programs on embedded systems must often run with limited resources

Embedded system designers use compilers to develop an embedded system.

They often have no operating system or a speciali8zed embedded operating system (often
a real-time operating system ).

Programs on an embedded system often must run with resources: often there is no disk
drive, operating system, keyboard or screen. may replace rotating media, and a small
keypad and screen may be used instead of a PC's keyboard and screen.

Embedding a computer is to interact with the environment, often by monitoring and


controlling external machinery. In order to do this, analog inputs and outputs must be
transformed to and from digital signal levels.

APPLICATIONS OF EMBEDDED SYSTEMS:


Some widely used applications of embedded systems are listed below:

Automatic teller machines

Cellular telephones.

Computer network.

Disc drives.

Thermo stats.

Sprinklers.

Security monitoring systems.

Hand held calculations.

House-hold appliances.

Inertial guided systems.

Flight control hardware / software.

Medical equipment.

OS USED IN EMBEDDED SYSTEM


REAL TIME OPERATING SYSTEM
C/OS-II is a portable, ROMable; scalable, pre-emptive, real-time deterministic multitasking
kernel for microprocessors, microcontrollers and DSPs. Offering unprecedented ease-of-use,
C/OS-II is delivered with complete 100% ANSI C source code and in-depth documentation.
C/OS-II runs on the largest number of processor architectures, with ports available for
download from the Micrium Web site
C/OS-II manages up to 250 application tasks. C/OS-II includes semaphores, event
flags, mutual-exclusion semaphores that eliminate unbounded priority inversions; message
mailboxes and queues; task, time and timer management; and fixed sized memory block
management.
C/OS-IIs footprint can be scaled (between 5 Kbytes to 24 Kbytes) to only contain the
features required for a specific application. The execution time for most services provided by
C/OS-II is both constant and deterministic; execution times do not depend on the number of
tasks running in the application.
A validation suite provides all documentation necessary to support the use of C/OS-II in
safety-critical systems. Specifically, C/OS-II is currently implemented in a wide array of
high level of safety-critical devices, including:

Those certified for Avionics DO-178B

Medical FDA pre-market notification (510(k)) and pre-market approval (PMA)


devices

SIL3/SIL4 IEC for transportation and nuclear systems, 99% compliant with the Motor
Industry Software Reliability Association (MISRA-C:1998) C Coding Standards

APPLICATIONS
C/OS-II is used in a wide variety of industries:

Avionics

Medical Equipment/Devices

Data Communications Equipment

White Goods (Appliances)

Mobile Phones, PDAs, MIDs

Industrial Controls

Consumer Electronics

Automotive

FEATURES
The features of C/OS-II include:

Unprecedented ease-of-use combined with an extremely short learning curve enables


rapid time-to-market advantage.

Runs on the largest number of processor architectures with ports easily downloaded.

Scalability--Between 5 Kbytes to 24 Kbytes I Max interrupt disable time: 200 clock


cycles (typical configuration, ARM9, no wait states).

Sufficiently robust to meet rigorous safety-critical system requirements

Complete ANSI C source code is available for a 30-day trial use.

MULTI-THREADED APPLICATIONS

C/OS-II allows developers to produce multi-threaded applications, vital to the


development of safety-critical systems. Thanks to improved integration with IAR
Embedded Workbench for ARM, developers can access all the inherent non-re-entrant
features of C/C++ in a thread-safe manner.

Application developers who write code for use in multi-threaded environments will
find the support critical when protecting shared objects using system locks, filestream locks, and thread-local storage (TLS) in multi-threaded environments.

Micrium and IAR collaborated in providing the first thread-safe support in C/OS-II
for the IAR DLIB run-time library. Protection for such non-re-entrant functions as
strtok (), rand (), errno () and more are local to each thread. Global and static variables
typically used by these functions are protected by the Micrium kernel.

CHAPTER 2
MICROPROCESSOR AND MICROCONTROLLER
EVALUTION OF MICROPROCESSOR AND MICROCONTROLLER
Microprocessors and microcontrollers are used in embedded system products. An
embedded product uses a microprocessor (or microcontroller) to do one task and one task
only.
Microprocessor as the term come to be known is a general purpose digital computer
central processing unit. Although popularly known as a "computer on chip", the
microprocessor is in no sense a complete digital computer.Microprocessor CPU contains
Arithmetic Logical Unit, a program counter, a stack pointer, some working registers, a clock
timing circuits and interrupt circuit.
To make complete microcomputer memory must add, usually Read Only Memory,
Random Access Memory, memory decoders and an Input/Output devices. In addition special
purpose devices such as interrupts, counters may be added to relieve the CPU from time
consuming counting or timing chores.
The hardware design of microprocessor CPU is arranged so that a small or very large
system can be configured around the CPU as the application demands. The internal CPU
architecture as well as the resultant machine level code that operates that architecture is
comprehensive but as flexible as possible.

The prime use of microprocessor is to read data perform extensive calculations on that
data and store those calculations in mass storage devices or display the results for user use.
The program is used by microprocessor are stored in the mass storage devices and loaded into
RAM as the user directs.
A microcontrollers is a computer on a single chip .Micro suggest that the device is
small and controller tells that the device is used to control objects, process or events.
Microcontroller is a highly integrated chip that contains all the devices comprising a
computer. Typically this includes a CPU, RAM, Input/ Output ports, timers, interrupts. So
microcontroller is also called as "true computer on a chip". Unlike a general purpose
computer which also includes all of these devices. A microcontroller is designed for a very
specific task to control a particular system.
A microcontroller is a general purpose device but one that is meant to read data,
perform limited calculations on that data and control its environment based on those
calculations. The prime use of microcontroller is to control the operation of machine using a
fixed program that is stored in ROM that does not change over the life time of the system.
ADVANTAGES OF MICROPROCESSOR AND MICROCONTROLLER

cost is less

speed is more

power consumption is less

compact device

external components are minimum

MICROPROCESSOR VERSES MICROCONTROLLER


The contrast between microprocessor and microcontroller is best exemplified by the fact that:

Most microprocessor have operational codes for moving data from external

memory to CPU, microcontroller may have one or two.

Microprocessor may have one or two types of bit handling instructions

microcontroller will have many.

Microprocessor concerned with rapid movement of code and data from

external address to the chip, microcontroller is concerned with rapid data


movement of bits with in chip.

Microcontroller can function as a computer with out addition of external

devices, but microprocessor must have many additions to operate an computer.

MICROCONTROLLER
Microcontroller can be termed as a single on chip computer which includes
number of peripherals like RAM, EEPROM, Timers etc., required to perform some
predefined task.

Architecture of AVR Microcontroller


Does this mean that the microcontroller is another name for a computer? The
answer is NO!The computer on one hand is designed to perform all the general purpose tasks
on a single machine like you can use a computer to run a software to perform calculations or
you can use a computer to store some multimedia file or to access internet through the
browser, whereas the microcontrollers are meant to perform only the specific tasks, for e.g.,

switching the AC off automatically when room temperature drops to a certain defined limit
and again turning it ON when temperature rises above the defined limit.
There are number of popular families of microcontrollers which are used in
different applications as per their capability and feasibility to perform the desired task, most
common of these are 8051, AVR and PIC microcontrollers. In this article we will introduce
you with AVR family of microcontrollers.
History of AVR
AVR was developed in the year 1996 by Atmel Corporation. The architecture
of AVR was developed by Alf-EgilBogen and VegardWollan. AVR derives its name from its
developers and stands for Alf-EgilBogenVegardWollan RISC microcontroller, also known as
Advanced Virtual RISC. The AT90S8515 was the first microcontroller which was based on
AVR architecture however the first microcontroller to hit the commercial market was
AT90S1200 in the year 1997.
AVR microcontrollers are available in three categories:
1.

TinyAVR Less memory, small size, suitable only for simpler applications

2.

MegaAVR These are the most popular ones having good amount of memory (upto

256 KB), higher number of inbuilt peripherals and suitable for moderate to complex
applications.
3.

XmegaAVR Used commercially for complex applications, which require large

program memory and high speed.


The following table compares the above mentioned AVR series of microcontrollers:

Series name
Tiny AVR
Mega AVR
Xmega AVR

Pins
6-32
28-100
44-100

Flash Memory
0.5-8 KB
4-256KB
16-384KB

Special Feature
Small in size
Extended peripherals
DMA , Event System
included

Various microcontroller of MegaAVR series:


Atmega-8 and Atmega-32 are other members of MegaAVR series controllers. They are quite
similar toAtmega-8 in architecture. Low power version MegaAVR controllers are also
available in markets. The following table shows the comparison between different members
of MegaAVR family:
Part Name
Atmega-8
Atmega-8L
Atmega-8
Atmega-8L
Atmega-32
Atmega-32L

ROM
8KB
8KB
16KB
16KB
32KB
32KB

RAM

EEP

I/0

Ti

Inter

Operation

Operating

Packa

1KB
1KB
1KB
1KB
2KB
2KB

ROM
512B
512B
512B
512B
1KB
1KB

Pins
23
23
32
32
32
32

mer
3
3
3
3
3
3

rupts
19
19
21
21
21
21

Voltage
4.5-5.5 V
2.7-5.5 V
4.5-5.5 V
2.7-5.5 V
4.5-5.5 V
2.7-5.5 V

frequency
0-16 MHz
0-8 MHz
0-16 MHz
0-8 MHz
0-16 MHz
0-8 MHz

ging
28
28
40
40
40
40

Whats special about AVR?


They are fast: AVR microcontroller executes most of the instructions in
single execution cycle. AVRs are about 4 times faster than PICs, they consume less power
and can be operated in different power saving modes. Lets do the comparison between the
three most commonly used families of microcontrollers.
SPEED
MEMORY
ARCHITECTURE
ADC
TIMERS
PWM CHANNELS

8051
Slow
Small
CISC
Not Present
Inbuilt
Not Present

PIC
Moderate
Large
RISC
Inbuilt
Inbuilt
Inbuilt

AVR
Fast
Large
RISC
Inbuilt
Inbuilt
Inbuilt

AVR is an 8-bit microcontroller belonging to the family of Reduced Instruction Set


Computer (RISC). In RISC architecture the instruction set of the computer are not only fewer
in number but also simpler and faster in operation. The other type of categorization is CISC

(Complex Instruction Set Computers). We will explore more on this when we will learn about
the architecture of AVR microcontrollers in following section.
Lets see what all this means. What is 8-bit? This means that the
microcontroller is capable of transmitting and receiving 8-bit data. The input/output registers
available are of 8-bits. The AVR family controllers have register based architecture which
means that both the operands for an operation are stored in a register and the result of the
operation is also stored in a register. Following figure shows a simple example performing
OR operation between two input registers and storing the value in Output Register.

The CPU takes values from two input registers INPUT-1 and INPUT-2,
performs the logical operation and stores the value into the OUTPUT register. All this
happens in 1 execution cycle.
WORKING PRINCIPLE:
OVERVIEW OF ATMEGA-8
The Atmega-8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. By executing powerful instructions in a single clock cycle, the Atmega-8
achieves throughputs approaching 1 MIPS per MHz, allowing the system designer to
optimize power consumption versus processing speed. The AVR core combines a rich
instruction set with 32 general purpose working registers.

All the 32 registers are directly connected to the Arithmetic Logic Unit (ALU),
allowing two independent registers to be accessed in one single instruction executed in one
clock cycle. The resulting architecture is more code efficient while achieving throughputs up
to ten times faster than conventional CISC microcontrollers.
The Atmega-8 provides the following features: 8K bytes of In-System Programmable
Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23
general purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial programmable
USART, a byte oriented Two-wire Serial Interface, a 6-channel ADC (eight channels in TQFP
and MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal
Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle
mode stops the CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt
system to continue functioning. The Power-down mode saves the register contents but freezes
the Oscillator, disabling all other chip functions until the next Interrupt or Hardware Reset. In
Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a
timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the
CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise
during ADC conversions. In Standby mode, the crystal/resonator Oscillator is running while
the rest of the device is sleeping. This allows very fast start-up combined with low-power
consumption.
The device is manufactured using Atmels high density non-volatile memory
technology. The Flash Program memory can be reprogrammed In-System through an SPI
serial interface, by a conventional non-volatile memory programmer, or by an On-chip boot
program running on the AVR core. The boot program can use any interface to download the
application program in the Application Flash memory. Software in the Boot Flash Section
will continue to run while the Application Flash Section is updated, providing true ReadWhile-Write operation. By combining an 8-bit RISC CPU with In-System SelfProgrammable Flash on a monolithic chip, the Atmel Atmega-8 is a powerful microcontroller
that provides a highly-flexible and cost-effective solution to many embedded control
applications.
The Atmega-8 AVR is supported with a full suite of program and system development
tools, including C compilers, macro assemblers, program debugger/simulators, In-Circuit
Emulators, and evaluation kits.

Naming Convention.
The AT refers to Atmel the manufacturer, Mega means that the microcontroller
belong to MegaAVR category, 8 signifies the memory of the controller, which is 8KB.

FEATURES OF ATMEGA-8

8-bit microcontroller

High-performance, Low-power AVR 8-bit Microcontroller

Advanced RISC Architecture


130 Powerful Instructions Most Single-clock Cycle Execution
32 x 8 General Purpose Working Registers
Fully Static Operation
Up to 16 MIPS Throughput at 16 MHz
On-chip 2-cycle Multiplier

Nonvolatile Program and Data Memories


8K Bytes of In-System Self-Programmable Flash
Endurance: 10,000 Write/Erase Cycles
Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
512 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
1K Byte Internal SRAM
Programming Lock for Software Security

Peripheral Features
Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and
Capture Mode
Real Time Counter with Separate Oscillator
Three PWM Channels
8-channel ADC in TQFP and MLF package

Eight Channels 10-bit Accuracy


6-channel ADC in PDIP package
Eight Channels 10-bit Accuracy
Byte-oriented Two-wire Serial Interface
Programmable Serial USART
Master/Slave SPI Serial Interface
Programmable Watchdog Timer with Separate On-chip Oscillator
On-chip Analog Comparator

Special Microcontroller Features


Power-on Reset and Programmable Brown-out Detection
Internal Calibrated RC Oscillator
External and Internal Interrupt Sources
Five Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, and
Standby

I/O and Packages


23 Programmable I/O Lines
28-lead PDIP, 32-lead TQFP, and 32-pad MLF

Operating Voltages
2.7 - 5.5V (Atmega-8)
4.5 - 5.5V (Atmega-8)

Speed Grades
0 - 8 MHz (Atmega-8)
0 - 16 MHz (Atmega-8)

Power Consumption at 4 Mhz, 3V, 25C


Active: 3.6 mA
Idle Mode: 1.0 mA
Power-down Mode: 0.5 A

PIN DIAGRAM(ATMEGA-8 )

PIN DESCRIPTION
VCC
Digital supply voltage.
GND
Ground.

Port B (PB7..PB0)
XTAL1/XTAL2/TOSC1/TOSC2
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port B output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port B pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from the inverting
Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as
TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.
Port C (PC5..PC0)
Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port C output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port C pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C. If the
RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low level on
this pin for longer than the minimum pulse length will generate a Reset, even if the clock is
not running. Shorter pulses are not guaranteed to generate a Reset.
Port D (PD7..PD0)

Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port D output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port D pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
RESET
Reset input. A low level on this pin for longer than the minimum pulse length will
generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to
generate a reset.
AVCC
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6).
It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital
supply voltage, VCC.
AREF
AREF is the analog reference pin for the A/D Converter.

ADC7..6 (TQFP and MLF Package Only)


In the TQFP and MLF package, ADC7..6 serve as analog inputs to the A/D converter.
These pins are powered from the analog supply and serve as 10-bit ADC channels.

CHAPTER 3
PROCESSING OF AVR CPU CORE

INTRODUCTION
This section discusses the AVR core architecture in general. The main function of the
CPU core is to ensure correct program execution. The CPU must therefore be able to access
memories, perform calculations, control peripherals, and handle interrupts.
In order to maximize performance and parallelism, the AVR uses a Harvard
architecture with separate memories and buses for program and data. Instructions in the
Program memory are executed with a single level pipelining. While one instruction is being
executed, the next instruction is pre-fetched from the Program memory. This concept enables
instructions to be executed in every clock cycle. The Program memory is In- System
Reprogrammable Flash memory.
The fast-access Register File contains 32 x 8-bit general purpose working registers
with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU)
operation. In a typical ALU operation, two operands are output from the Register File, the
operation is executed, and the result is stored back in the Register File in one clock cycle.

ARCHITECTURE

Six of the 32 registers can be used as three 16-bit indirect address register pointers for
Data Space addressing enabling efficient address calculations. One of these address pointers
can also be used as an address pointer.
The ALU supports arithmetic and logic operations between registers or between a
constant and a register. Single register operations can also be executed in the ALU. After an
arithmetic operation, the Status Register is updated to reflect information about the result of
the operation.
The Program flow is provided by conditional and unconditional jump and call
instructions, able to directly address the whole address space. Most AVR instructions have a
single 16-bit word format. Every Program memory address contains a 16- or 32-bit
instruction.

Program Flash memory space is divided in two sections, the Boot program section
and the Application program section. Both sections have dedicated Lock Bits for write and
read/write protection. The SPM instruction that writes into the Application Flash memory
section must reside in the Boot program section.
During interrupts and subroutine calls, the return address Program Counter (PC) is
stored on the Stack. The Stack is effectively allocated in the general data SRAM, and
consequently the Stack size is only limited by the total SRAM size and the usage of the
SRAM. All user programs must initialize the SP in the reset routine (before subroutines or
interrupts are executed). The Stack Pointer SP is read/write accessible in the I/O space. The
data SRAM can easily be accessed through the five different addressing modes supported in
the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
A flexible interrupt module has its control registers in the I/O space with an additional global
interrupt enable bit in the Status Register. All interrupts have a separate Interrupt Vector in the
Interrupt Vector table. The interrupts have priority in accordance with their Interrupt Vector
position. The lower the Interrupt Vector address, the higher the priority. The I/O memory
space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, and other
I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations
following those of the Register File, 0x20 - 0x5F.

ARITHMATIC AND LOGIC UNIT(ALU)


The high-performance AVR ALU operates in direct connection with all the 32 general
purpose working registers. Within a single clock cycle, arithmetic operations between general
purpose registers or between a register and an immediate are executed. The ALU operations
are divided into three main categories arithmetic, logical, and bit-functions. Some
implementations of the architecture also provide a powerful multiplier supporting both
signed/unsigned multiplication and fractional format.

STATUS REGISTER
The Status Register contains information about the result of the most recently
executed arithmetic instruction. This information can be used for altering program flow in
order to perform conditional operations. Note that the Status Register is updated after all
ALU operations, as specified in the Instruction Set Reference. This will in many cases
remove the need for using the dedicated compare instructions, resulting in faster and more
compact code.
The Status Register is not automatically stored when entering an interrupt routine and
restored when returning from an interrupt. This must be handled by software.
GENERAL PURPOSE REGISTER
The Register File is optimized for the AVR Enhanced RISC instruction set. In order to
achieve the required performance and flexibility, the following input/output schemes are
supported by the Register File:
One 8-bit output operand and one 8-bit result input.
Two 8-bit output operands and one 8-bit result input.
Two 8-bit output operands and one 16-bit result input.
One 16-bit output operand and one 16-bit result input.

STACK POINTER
The Stack is mainly used for storing temporary data, for storing local variables and
for storing return addresses after interrupts and subroutine calls. The Stack Pointer Register
always points to the top of the Stack. Note that the Stack is implemented as growing from
higher memory locations to lower memory locations. This implies that a Stack PUSH
command decreases the Stack Pointer.
The Stack Pointer points to the data SRAM Stack area where the Subroutine and Interrupt
Stacks are located. This Stack space in the data SRAM must be defined by the program
before any subroutine calls are executed or interrupts are enabled. The Stack Pointer must be
set to point above 0x60. The Stack Pointer is decremented by one when data is pushed onto

the Stack with the PUSH instruction, and it is decremented by two when the return address is
pushed onto the Stack with subroutine call or interrupt.
The Stack Pointer is incremented by one when data is popped from the Stack with the
POP instruction, and it is incremented by two when address is popped from the Stack with
return from subroutine RET or return from interrupt RETI.
The AVR Stack Pointer is implemented as two 8-bit registers in the I/O space. The
number of bits actually used is implementation dependent. Note that the data space in some
implementations of the AVR architecture is so small that only SPL is needed. In this case, the
SPH Register will not be present

Arduino Uno
Arduino Uno R3 Front Arduino Uno R3 Back
Arduino Uno R2 Front Arduino Uno SMD Arduino Uno Front Arduino Uno Back
Overview
The Arduino Uno is a microcontroller board based on the ATmega328
(datasheet). It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic
resonator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to
a computer with a USB cable or power it with a AC-to-DC adapter or battery to
get started. The Uno differs from all preceding boards in that it does not use the
FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2
up to version R2) programmed as a USB-to-serial converter. Revision 2 of the Uno
board has a resistor pulling the 8U2 HWB line to ground, making it easier to put
into DFU mode.
Revision 3 of the board has the following new features:

1.0pinout: added SDA and SCL pins that are near to the AREF pin and two
other new pins

placed near to the RESET pin, the IOREF that allow the shields to adapt to the
voltage provided
from the board. In future, shields will be compatible both with the board that use
the AVR,
which operate with 5V and with the Arduino Due that operate with 3.3V. The
second one is a
not connected pin, that is reserved for future purposes.

Stronger RESET circuit.

Atmega 16U2 replace the 8U2.

"Uno" means one in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino,
moving forward. The Uno is the latest in a series of USB Arduino boards, and the
reference model for the Arduino platform; for a comparison with previous
versions, see the index of Arduino boards.
Summary
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
Schematic & Reference Design
EAGLE files: arduino-uno-Rev3-reference-design.zip (NOTE: works with Eagle 6.0
and newer)
Schematic: arduino-uno-Rev3-schematic.pdf
Note:
The Arduino reference design can use an Atmega8, 168, or 328,
Current models use an ATmega328, but an Atmega8 is shown in the schematic
for reference. The pin configuration is identical on all three processors.
Power
The Arduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically. External (non-USB)
power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the
board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin
headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less
than 7V, however, the 5V pin may supply less than five volts and the board may
be unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:

VIN. The input voltage to the Arduino board when it's using an external
power source (as

opposed to 5 volts from the USB connection or other regulated power source).
You can supply
voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.

5V.This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V),
the USB connector (5V), or the VIN pin of the board (7-12V). Supplying
voltage via the 5V or 3.3V pins bypasses the regulator, and can damage
your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum
current draw is 50 mA.
GND. Ground pins.

Memory

The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB
of SRAM and 1 KB
of EEPROM (which can be read and written with the EEPROM library).
Input and Output
Each of the 14 digital pins on the Uno can be used as an input or output, using
pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can
provide or receive a
maximum of 40 mA and has an internal pull-up resistor (disconnected by default)
of 20-50 kOhms. In
addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial
data. These pins
are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial
chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt()
function for
details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication
using the SPI library.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the
LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10
bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is
it possible to change
the upper end of their range using the AREF pin and the analogReference()
function. Additionally, some
pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a
reset button to
shields which block the one on the board.
See also the mapping between Arduino pins and ATmega328 ports. The mapping
for the Atmega8,
168, and 328 is identical.
Communication
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or
other microcontrollers. The
communication, which is

ATmega328

provides

UART

TTL

(5V)

serial

available on digital pins 0 (RX) and 1 (TX). An ATmega16U2 on the board


channels this serial
communication over USB and appears as a virtual com port to software on the
computer. The '16U2
firmware uses the standard USB COM drivers, and no external driver is needed.
However, on Windows,
a .inf file is required. The Arduino software includes a serial monitor which allows
simple textual data to
be sent to and from the Arduino board. The RX and TX LEDs on the board will
flash when data is being
transmitted via the USB-to-serial chip and USB connection to the computer (but
not for serial
communication on pins 0 and 1).
A SoftwareSerial library allows for serial communication on any of the Uno's
digital pins.

The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino
software includes a
Wire library to simplify use of the I2C bus; see the documentation for details. For
SPI communication,
use the SPI library.
Programming
The Arduino Uno can be programmed with the Arduino software (download).
Select "Arduino Uno from
the Tools > Board menu (according to the microcontroller on your board). For
details, see the
reference and tutorials.
The ATmega328 on the Arduino Uno comes preburned with a bootloader that
allows you to upload new
code to it without the use of an external hardware programmer. It communicates
using the original
STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the
ICSP (In-Circuit
Serial Programming) header; see these instructions for details.
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available . The
ATmega16U2/8U2 is loaded with a DFU bootloader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy)
and then resetting the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground,
making it easier to put into DFU mode.
You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to
load a new firmware. Or you can use the ISP header with an external
programmer (overwriting the
DFU bootloader). See this user-contributed tutorial for more information.
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is
designed in a way that allows it to be reset by software running on a connected
computer. One of the

hardware flow control lines (DTR) of the ATmega8U2/16U2 is connected to the


reset line of the
ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low),
the reset line drops
long enough to reset the chip. The Arduino software uses this capability to allow
you to upload code by
simply pressing the upload button in the Arduino environment. This means that
the bootloader can
have a shorter timeout, as the lowering of DTR can be well-coordinated with the
start of the upload.
This setup has other implications. When the Uno is connected to either a
computer running Mac OS X
or Linux, it resets each time a connection is made to it from software (via USB).
For the following halfsecond or so, the bootloader is running on the Uno. While it
is programmed to ignore malformed data
(i.e. anything besides an upload of new code), it will intercept the first few bytes
of data sent to the
board after a connection is opened. If a sketch running on the board receives
one-time configuration or
other data when it first starts, make sure that the software with which it
communicates waits a second
after opening the connection and before sending this data.
The Uno contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace
can be soldered together to re-enable it. It's labeled "RESET-EN". You may also be
able to disable the
auto-reset by connecting a 110 ohm resistor from 5V to the reset line; see this
forum thread for
details.
USB Overcurrent Protection
The Arduino Uno has a resettable polyfuse that protects your computer's USB
ports from shorts and
overcurrent. Although most computers provide their own internal protection, the
fuse provides an extra
layer of protection. If more than 500 mA is applied to the USB port, the fuse will
automatically break
the connection until the short or overload is removed.
Physical Characteristics
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches
respectively, with the USB

connector and power jack extending beyond the former dimension. Four screw
holes allow the board to
be attached to a surface or case. Note that the distance between digital pins 7
and 8 is 160 mil
(0.16"), not an even multiple of the 100 mil spacing of the other pins.

16x2 LCD

A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data.
The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data
register stores the data to be displayed on the LCD. The data is the ASCII value of
the character to be displayed on the LCD. Click to learn more about internal structure
of a LCD.

LCD Technologies and types:


Some of the LCD technologies are,

Blue Mode STN - This is the basic LCD, which needs lot of improvement on contrast
ratio and viewing angle.

FSTN (Film STN) - Comes with an additional linearization film to offer better
contrast.

CSTN (colour STN) - Layers of color filters are added to create up to 65,000 colors.

DSTN (Double STN) - Improves contrast and eliminates any other colors appearing
on the screen.

Types based on displayed data:

1. Segment LCD: Displays numbers, letters and fixed symbols and were used in old
style industrial panel display and such standard where we need to display fixed
number of characters.

2. Graphical LCD: Instead of segments it has pixels in rows and columns. By


energizing set of pixels any character can be displayed.
3.Color LCD displays: Are of type passive matrix and Thin film transistor/ active
matrix.
Two types of color displays:

Passive Matrix

Row & Column approach


Apply small bias to perpendicular lines of electrodes
Bias strong enough to darken bit at line intersection
Multiplexed addressing scheme

Advantages: Simple to implement

Disadvantages: Can cause distortion

Active Matrix

Each cell has its own thin-film transistor (TFT)


Addressed independently from behind LCD
Direct addressing scheme

Advantages: Sharp display, better viewing angle, 40:1 contrast

Disadvantages: Need better backlight, complex hardware

Recent passive-matrix displays using new CSTN and DSTN technologies


produce sharp colorsrivaling active-matrix displays.

LCD Module Backlighting:

LCDs unlike LEDS do not produce light, they need some external light source
to view. So most the latest LCD screens used in notebook computers use a light
source. They use CFT or EL Panel or in recent times white LED as source of light
fixed in the background of LCD.
LED lamp is a better choice over CFT and EL due to its ability to offer variety of
colors, intensity, long life (>100K Hrs), wide temperature range, and low voltage
operation.

Electroluminescent/EL Panel: The EL backlight consumes less power but require


high voltage (120VAC @ 400Hz Typically). EL panel is also not long lasting and is
sensitive to wider operating temperature range.
Cold Cathode Florescent Lamp: This backlight is most popular and is suitable for
large sized LCD displays. CFT has same drawbacks of EL panel i.e. short life span
and limited temperature range, and need high voltage to operate (>300VAC @ 3080KHz) and is also prone to vibrations.

Different viewing modes:

Reflective: In the reflective mode LCDs use ambient light to illuminate the display
making them more suitable for outdoor use.
Transmissive: Transmissive mode will depend on internal backlight and is only
viewable in indoors.

Transflective: Transflective mode LCDs employ both Reflective and Transmissive


types and switch based on the availability of ambient light.

Special characteristics of LCDs:

Liquid Crystals are very sensitive to constant electric fields. Only AC-voltages
should be applied as DC voltages can cause an electrochemical reaction, which
destroys the liquid crystals irreversibly.

Temperature dependent and in a very cold or hot environment LCD may not
work correctly. This is a reversible effect. Some displays need temperature
compensation circuits to automatically adjust the applied LC voltage.

Key specifications of LCD display:

Important factors to consider when evaluating an LCD monitor:

1. Resolution: The horizontal and vertical size measured by number of pixels (e.g.,
1024x768).
2. Dot pitch: The distance between the centers of two adjacent pixels. Smaller dot
pitch indicate sharper image.
3. Viewable size: The diagonal size of the LCD display panel
4. Response time: The minimum time LCD takes to change a pixel's color or
brightness.
5. Refresh rate: The rate at which the data is loaded in the monitor measured with
the unit of number of times per second. Higher the refresh rate lesser is the
flickering.
6. Matrix type: Active TFT or Passive.

7. Viewing angle: The angle from which the user can view the image on the display
clearly.
8. Color support: The types and number of colors supported by the LCD (known as
color gamut).
9. Brightness: The amount of light emitted from the display (known as luminance).
10. Contrast ratio: The ratio of the intensity of the brightest bright to the darkest
dark.
11. Aspect ratio: The ratio of the width to the height (for example, 4:3, 5:4, 16:9 or
16:10).
12. Gamma correction: It is the name of a nonlinear operation used to code and
decode luminance or tristimulus values in video or still image systems

Advantages of LCDs:
Consumes less power and generates less heat.
Saves lot of space compared picture tubes due to LCD's flatness.
Due to less weight and flatness LCDs are highly portable.
No flicker and less screen glare in LCDs to reduce eyestrain.

Drawbacks:

The disadvantages of LCD displays are,

LCDs cannot form multiple resolution images.


The contrast ratio for LCD images is lesser than CRT and plasma displays.
Due to their longer response time, LCDs show ghost images and mixing when
images change rapidly.
The narrow viewing angle of an LCD weakens the image quality in wider viewing
angles.

PIN Diagram

PIN Description

LCD Interfacing:

GSM/GPRS MODEM
GSM/GPRS MODEM is a class of wireless MODEM devices that are
designed for communication of a computer with the GSM and GPRS

network. It requires a SIM (Subscriber Identity Module) card just like


mobile phones to activate communication with the network. Also they
have IMEI (International Mobile Equipment Identity) number similar to
mobile phones for their identification. A GSM/GPRS MODEM can perform
the following operations:
1.

Receive, send or delete SMS messages in a SIM.

2.

Read, add, search phonebook entries of the SIM.

3.

Make, Receive, or reject a voice call.

The MODEM needs AT commands, for interacting with processor or


controller, which are communicated through serial communication. These
commands are sent by the controller/processor. The MODEM sends back a
result after it receives a command. Different AT commands supported by
the MODEM can be sent by the processor/controller/computer to interact
with the GSM and GPRS cellular network.

AT COMMANDS:
AT commands are used to control MODEMs. AT is the abbreviation
for Attention. These commands come from Hayes commands that were
used by the Hayes smart modems. The Hayes commands started with AT
to indicate the attention from the MODEM. The dial up and wireless
MODEMs (devices that involve machine to machine communication) need
AT commands to interact with a computer. These include the Hayes
command set as a subset, along with other extended AT commands.
AT commands with a GSM/GPRS MODEM or mobile phone can be
used to access following information and services:
1.
Information and configuration pertaining to mobile device or
MODEM and SIM card.
2.

SMS services.

3.

MMS services.

4.

Fax services.

5.

Data and Voice link over mobile network.

The Hayes subset commands are called the basic commands and the
commands specific to a GSM network are called extended AT commands.

Explanation of commonly used AT commands:


1) AT - This command is used to check communication between the
module and the computer.
For example,
AT
OK
The command returns a result code OK if the computer (serial port)
and module are connected properly. If any of module or SIM is not
working, it would return a result code ERROR.
2) +CMGF - This command is used to set the SMS mode. Either text or
PDU mode can be selected by assigning 1 or 0 in the command.
SYNTAX:

AT+CMGF=<mode>

0: for PDU mode


1: for text mode
The text mode of SMS is easier to operate but it allows limited features of
SMS. The PDU
(protocol data unit) allows more access to SMS services
but the operator requires bit level knowledge of TPDUs. The headers and
body of SMS are accessed in hex format in PDU mode so it allows availing
more features.
For example,
AT+CMGF=1
OK
2) +CMGW - This command is used to store message in the SIM.
SYNTAX:
Ctrl+z

AT+CMGW= Phone number> Message to be stored

As one types AT+CMGW and phone number, > sign appears on next line
where one can type the message. Multiple line messages can be typed in
this case. This is why the message is terminated by providing a Ctrl+z
combination. As Ctrl+z are pressed, the following information response is
displayed on the screen.
+CMGW: Number on which message has been stored.

4) +CMGS - This command is used to send a SMS message to a phone


number.
SYNTAX:

AT+CMGS= serial number of message to be send.

As the command AT+CMGS and serial number of message are entered,


SMS is sent to the particular SIM.
For example,
AT+CMGS=1
OK
5) ATD - This command is used to dial or call a number.
SYNTAX: ATD<Phone number>(Enter)
For example,
ATD123456789
6) ATA - This command is used to answer a call. An incoming call is
indicated by a message RING which is repeated for every ring of the call.
When the call ends NO CARRIER is displayed on the screen.
SYNTAX: ATA (Enter)
As ATA followed by enter key is pressed, incoming call is answered.
For example,
RING
RING
ATA
7) ATH - This command is used to disconnect remote user link with the
GSM module.
SYNTAX: ATH (Enter)

GSM/GPRS Module:
A Fig below show GSM/GPRS module assembles a GSM/GPRS modem
with standard communication interfaces like RS-232 (Serial Port), USB etc.,
so that it can be easily interfaced with a computer or a microprocessor /
microcontroller based system. The power supply circuit is also built in the
module that can be activated by using a suitable adaptor.

Fig: GSM/GPRS Module

Circuit Diagram:

IR SENSOR:
Infrared radiation is the portion of electromagnetic spectrum having
wavelengths longer than visible light wavelengths, but smaller than
microwaves, i.e., the region roughly from 0.75m to 1000 m is the
infrared region. Infrared waves are invisible to human eyes. The
wavelength region of 0.75m to 3 m is called near infrared, the region

from 3 m to 6 m is called mid infrared and the region higher than 6 m


is called far infrared. (The demarcations are not rigid; regions are defined
differently by many).

TYPES OF IR SENSORS:
There are different types of IR sensors working in various regions of
the IR spectrum but the physics behind "IR sensors" is governed by three
laws:
1. Plancks radiation law:
Every object at a temperature T not equal to 0 K emits radiation.
Infrared radiant energy is determined by the temperature and surface
condition of an object. Human eyes cannot detect differences in infrared
energy because they are primarily sensitive to visible light energy from
400 to 700 nm. Our eyes are not sensitive to the infrared energy.

2. Stephan Boltzmann Law


The total energy emitted at all wavelengths by a black body is
related to the absolute temperature as

3. Weins Displacement Law


Weins Law tells that objects of different temperature emit spectra
that peak at different wavelengths. It provides the wavelength for
maximum spectral radiant emittance for a given temperature.
The relationship between the true temperature of the black body and its
peak spectral exitance or dominant wavelength is described by this law.
The world is not full of black bodies; rather it comprises of selectively
radiating bodies like rocks, water, etc. and the relationship between the
two is given by emissivity (E).

Emissivity depends on object colour, surface roughness, moisture


content, degree of compaction, field of view, viewing angle & wavelength.

ELEMENTS OF INFRARED DETECTION SYSTEM


A typical system for detecting infrared radiation is given in the following

block diagram :

1. Infrared Source
All objects above 0 K radiate infrared energy and hence are infrared
sources. Infrared sources also include blackbody radiators, tungsten lamps,
silicon carbide, and various others. For active IR sensors, infrared Lasers and
LEDs of specific IR wavelengths are used as IR sources.

2. Transmission Medium
Three main types of transmission medium used for Infrared transmission are
vacuum, the atmosphere, and optical fibres.

The transmission of IR radiation is affected by presence of CO2, water


vapour and other elements in the atmosphere. Due to absorption by molecules of
water carbon dioxide, ozone, etc. the atmosphere highly attenuates most IR
wavelengths leaving some important IR windows in the electromagnetic spectrum;
these are primarily utilized by thermal imaging/ remote sensing applications.

Medium wave IR (MWIR:3-5 m)

Long wave IR (LWIR:8-14 m)

Choice of IR band or a specific wavelength is dictated by the technical requirements


of a specific application.
3. Optical Components.
Often optical components are required to converge or focus infrared
radiations, to limit spectral response, etc. To converge/focus radiations, optical
lenses made of quartz, CaF2, Ge and Si, polyethylene Fresnel lenses, and
mirrors made of Al, Au or a similar material are used. For limiting spectral
responses, band pass filters are used. Choppers are used to pass/ interrupt
the IR beams.
4. Infrared detectors.
Various types of detectors are used in IR sensors. Important
specifications of detectors ar
Photosensitivity or Responsively
Responsively is the Output Voltage/Current per watt of incident energy. Higher the
better.
Noise Equivalent Power (NEP)
NEP represents detection ability of a detector and is the amount
of incident light equal to intrinsic noise level of a detector.

Directivity (D*: D-star)

D* is the photosensitivity per unit area of a detector. It is a


measure of S/N ratio of a detector. D* is inversely proportional to NEP.
Larger D* indicates better sensing element.
In addition, wavelength region or temperature to be measured, response time,
cooling mechanism, active area, no of elements, package, linearity, stability,
temperature characteristics, etc. are important parameters which need attention
while selecting IR detectors.
5.

Signal Processing

Since detector outputs are typically very small, preamplifiers with associated circuitry
are used to further process the received signals.

IR SENSOR CIRCUIT:

Laser Diode Theory & Operation


Laser diodes and light emitting diodes have a number of elements in common with respect to
their theory of operation. However the laser diode theory of operation incorporates more
elements, taking in additional processes to provide the coherent light it produces.
While there are many different forms of laser diode, the basis of the laser diode theory of
operation is very similar - the basic precepts remain the same, although there are a number of
minor differences in the way they are implemented..

Laser diode theory basics


There are three main processes in semiconductors that are associated with light:

Light absorption: Absorption occurs when light enters a semiconductor and its energy
is transferred to the semiconductor to generate additional free electrons and holes. This
effect is widely used and enables devices like to photo-detectors and solar cells to
operate.

Spontaneous emission: The second effect known as spontaneous emission occurs in


LEDs. The light produced in this manner is what is termed incoherent. In other words the
frequency and phase are random, although the light is situated in a given part of the
spectrum.

Stimulated emission:

Stimulated emission is different. A light photon entering the

semiconductor lattice will strike an electron and release energy in the form of another
light photon. The way in which this occurs releases this new photon of identical
wavelength and phase. In this way the light that is generated is said to be coherent.
The key to the laser diode operation occurs at the junction of the highly doped p and n type
regions. In a normal p-n junction current flows across the p-n junction. This action can occur
because the holes from the p-type region and the electrons from the n-type region combine. With
an electromagnetic wave (in this instance light) in passing through the laser diode junction diode
junction it is found that the photo-emission process occurs. Here the photons release further
photons of light occurs when they strike electrons during the recombination of holes and
electrons occurs.
Naturally there is some absorption of the light, resulting in the generation of holes and electrons
but there is an overall gain in level.
The structure of the laser diode creates an optical cavity in which the light photons have multiple
reflections. When the photons are generated only a small number are able to leave the cavity. In
this way when one photon strikes an electron and enables another photon to be generated the
process repeats itself and the photon density or light level starts to build up. It is in the design of
better optical cavities that much of the current work on lasers is being undertaken. Ensuring the
light is properly reflected is the key to the operation of the device.

PHOTORESISTOR

The symbol for a photoresistor


A photoresistor or light dependent resistor (LDR) is a resistor whose resistance decreases
with increasing incident light intensity; in other words, it exhibits photoconductivity.
photoelectric or light sensing device are used in almost any branch of industry for
control,safety,amusement and sound reproduction and inspection and measurement.
A photoresistor is made of a high resistance semiconductor. If light falling on the device is of
high enough frequency, photons absorbed by the semiconductor give bound electrons enough
energy to jump into the conduction band. The resulting free electron (and its hole partner)
conduct electricity, thereby lowering resistance.
A photoelectric device can be either intrinsic or extrinsic. An intrinsic semiconductor has its
own charge carriers and is not an efficient semiconductor, for example, silicon. In intrinsic
devices the only available electrons are in the valence band, and hence the photon must have
enough energy to excite the electron across the entire bandgap. Extrinsic devices have
impurities, also called dopants, added whose ground state energy is closer to the conduction
band; since the electrons do not have as far to jump, lower energy photons (that is, longer
wavelengths and lower frequencies) are sufficient to trigger the device. If a sample of silicon
has some of its atoms replaced by phosphorus atoms (impurities), there will be extra electrons
available for conduction. This is an example of an extrinsic semiconductor. Photoresistors are
basically photocells.[2]

The internal components of a photoelectric control for a typical Americanstreetlight. The


photoresistor is facing rightwards, and controls whether current flows through the heater
which opens the main power contacts. At night, the heater cools, closing the power contacts,
energizing the street light.
Specification and model

A Light Dependent Resistor


There are many types of photoresistors, with different specifications and models.
Photoresistors can be coated with or packaged in different materials that vary the resistance,
depending on the use for each LDR.
Applications
Photoresistors come in many types. Inexpensive cadmium sulphide cells can be found in
many consumer items such as camera light meters, street lights, clock radios, alarm devices,
outdoor clocks, solar street lamps and solar road studs, etc.
They are also used in some dynamic compressors together with a small incandescent
lamp or light emitting diode to control gain reduction and are also used in bed lamps, etc.
Lead sulphide (PbS) and indium antimonide (InSb) LDRs (light dependent resistor) are used
for the mid infrared spectral region. Ge:Cu photoconductors are among the best farinfrared detectors available, and are used for infrared astronomy and infrared spectroscopy.

RFID READER NSK EDK - 125 -TTL

The NSK125 series RFID Proximity OEM Reader Module has a


built-in antenna in minimized form factor. It is designed to work
on the industry standard carrier frequency of 125 kHz.
This LF reader module with an internal or an external antenna
facilitates communication with Read-Only transponderstype
UNIQUE or TK5530 via the air interface. The tag data is sent to
the host systems via the wired communication interface with a
protocol selected from the module Both TTland Wiegend
Protocol
The LF module is best suited for applications in Access
Control,Time and Attendance, Asset Management, Handheld
Readers,Immobilizers, and other RFID enabled applications.
CONNECTION DETAILS
Connect - 5 volts and GND
TX - TTL output Can be directly connected to Microcontroller
( To covert TTL to UART use Converter Board )
D0 & D1 - is used for wigend protocol
Features
Output- TTL or Wigand26
Plug-and-Play, needs +5V to become a reader
Buzzer indicates tag reading operation

Compact size and cost-effective