Vehicle Movement Based Street Light With External Light Sensor Document
Vehicle Movement Based Street Light With External Light Sensor Document
Certificates ……………………………………………………………………
Acknowledgement ………………………………………………………........
CHAPTER 1: INTRODUCTION
3.8 LDR
1
3.9 LCD
REFERENCES
2
CHAPTER 1: INTRODUCTION
1.1 Introduction:
The main aim of project is to build an Arduino based vehicle movement detecting street light.
This project explains about reducing power consumption on street lights. In general lot of
current is wasted because there is no manual maintenance for switching on and off of these
lights during vehicle is came and went or passing through the street light.
This system demonstrates the usage of LEDs (light emitting diodes) as light source and its
variable intensity control, according to the requirement. LEDs consume less power and its
life is more, as compared to conventional HID lamps.
The most important and interesting feature is its intensity that can be controlled according to
requirement during non-peak hours, which is not feasible in HID lamps.
EXISITING SYSTEM
The problems with non automatic Street light system are inefficient power consumption and
more manual operations. The street lights needs to be operated by man for switching it on or
off. This takes man power and it is time taking. Unless the street lights are manually switched
off these consume a lot of power. The street lights systems are not flexible.
PROPOSED SYSTEM
Now a day, every system is automated in order to face new challenges in the present day
situation. Automated systems have less manual operations, so that the flexibility, reliabilities
are high and accurate. Hence every field prefers automated control systems. Especially in the
field of electronics automated systems are doing better performance increasingly.
The main goal of our project is to control the switching of Street Lights automatically
according vehicle movement. This allows us to realize the task efficiently and effectively
without the intervention of human by making it automated and even we can avoid
unnecessary wastage of power by switching it off at right time.
3
This project is designed around a microcontroller which forms the heart of the project. In our
project we are going to make using IR sensor to detect the vehicle movement and according
to that the street light is on /off condition.
1.3 Thesis:
Chapter 1 Presents introduction to the overall thesis and the overview of the project. In the
project overview a brief introduction of ARDUINO Microcontroller, power supply, ir
sensor, adc, led and its applications are discussed.
Chapter 2 Presents the Arduino embedded systems. It explains the about what is embedded
systems, need for embedded systems, explanation of it along with its applications.
Chapter 3 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 ARDUINO-
microcontrollers, power supplies, ir senor, adc, led are considered.
Chapter 4 Presents the software description. It explains the implementation of the project
using arduino ide Compiler software.
4
Chapter 6 Presents the advantages, disadvantages and applications of the project.
Chapter 7 Presents the results, conclusion and future scope of the project.
5
CHAPTER 2: EMBEDDED SYSTEMS
Embedded systems are controlled by one or more main processing cores that are typically
either microcontrollers or digital signal processors (DSP). The key characteristic, however, is
being dedicated to handle a particular task, which may require very powerful processors. For
example, air traffic control systems may usefully be viewed as embedded, even though they
involve mainframe computers and dedicated regional and national networks between airports
and radar sites. (Each radar probably includes one or more embedded systems of its own.)
Since the embedded system is dedicated to specific tasks, design engineers can optimize it to
reduce the size and cost of the product and increase the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale.
Physically embedded systems range 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. Complexity varies from low, with a single microcontroller
chip, to very high with multiple units, peripherals and networks mounted inside a large
chassis or enclosure.
In general, "embedded system" is not a strictly definable term, as most systems have some
element of extensibility or programmability. For example, handheld computers share some
elements with embedded systems such as the operating systems and microprocessors which
power them, but they allow different applications to be loaded and peripherals to be
connected. Moreover, even systems which don't expose programmability as a primary feature
generally need to support software updates. On a continuum from "general purpose" to
"embedded", large application systems will have subcomponents at most points even if the
system as a whole is "designed to perform one or a few dedicated functions", and is thus
appropriate to call "embedded". A modern example of embedded system is shown in fig: 2.1.
6
Fig 2.1:A modern example of embedded system
Labeled parts include microprocessor (4), RAM (6), flash memory (7).Embedded systems
programming is not like normal PC programming. In many ways, programming for an
embedded system is like programming PC 15 years ago. The hardware for the system is
usually chosen to make the device as cheap as possible. Spending an extra dollar a unit in
order to make things easier to program can cost millions. Hiring a programmer for an extra
month is cheap in comparison. This means the programmer must make do with slow
processors and low memory, while at the same time battling a need for efficiency not seen in
most PC applications. Below is a list of issues specific to the embedded field.
2.1.1 History:
In the earliest years of computers in the 1930–40s, computers were sometimes dedicated to a
single task, but were far too large and expensive for most kinds of tasks performed by
embedded computers of today. Over time however, the concept of programmable controllers
evolved from traditional electromechanical sequencers, via solid state devices, to the use of
computer technology.
One of the first recognizably modern embedded systems was the Apollo Guidance Computer,
developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the project's
inception, the Apollo guidance computer was considered the riskiest item in the Apollo
project as it employed the then newly developed monolithic integrated circuits to reduce the
size and weight. An early mass-produced embedded system was the Autonetics D-17
7
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
8
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.
Embedded systems frequently control hardware, and must be able to respond to them in real
time. Failure to do so could cause inaccuracy in measurements, or even damage hardware
such as motors. This is made even more difficult by the lack of resources available. Almost
all embedded systems need to be able to prioritize some tasks over others, and to be able to
put off/skip low priority tasks such as UI in favor of high priority tasks like hardware control.
The uses of embedded systems are virtually limitless, because every day new products are
introduced to the market that utilizes embedded computers in novel ways. In recent years,
hardware such as microprocessors, microcontrollers, and FPGA chips have become much
cheaper. So when implementing a new form of control, it's wiser to just buy the generic chip
and write your own custom software for it. Producing a custom-made chip to handle a
particular task or set of tasks costs far more time and money. Many embedded computers
even come with extensive libraries, so that "writing your own software" becomes a very
trivial task indeed. From an implementation viewpoint, there is a major difference between a
computer and an embedded system. Embedded systems are often required to provide Real-
Time response. The main elements that make embedded systems unique are its reliability and
ease in debugging.
2.2.1 Debugging:
9
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 heterogeneous multi core systems.
An in-circuit debugger (ICD), a hardware device that connects to the microprocessor
via a JTAG or Nexus interface. This allows the operation of the microprocessor to be
controlled externally, but is typically restricted to specific debugging capabilities in
the processor.
An in-circuit emulator replaces the microprocessor with a simulated equivalent,
providing full control over all aspects of the microprocessor.
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 low-level 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 themselves 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:
10
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:
Watchdog timer that resets the computer unless the software periodically notifies the
watchdog
Subsystems with redundant spares that can be switched over to
software "limp modes" that provide partial function
Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly
secure & reliable system environment
An Embedded Hypervisor is able to provide secure encapsulation for any subsystem
component, so that a compromised software component cannot interfere with other
subsystems, or privileged-level system software. This encapsulation keeps faults from
propagating from one subsystem to another, improving reliability. This may also
allow a subsystem to be automatically shut down and restarted on fault detection.
Immunity Aware Programming
In this design, the software simply has a loop. The loop calls subroutines, each of which
manages a part of the hardware or software.
11
Interrupt Controlled System:
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.
Cooperative Multitasking:
A non-preemptive multitasking system is very similar to the simple control loop scheme,
except that the loop is hidden in an API. The programmer defines a series of tasks, and each
task gets its own environment to “run” in. When a task is idle, it calls an idle routine, usually
called “pause”, “wait”, “yield”, “nop” (stands for no operation), etc.The advantages and
disadvantages are very similar to the control loop, except that adding new software is easier,
by simply writing a new task, or adding to the queue-interpreter.
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.
12
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.
A microkernel is a logical step up from a real-time OS. The usual arrangement is that 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 programmers. Based on performance, functionality, requirement the embedded
systems are divided into three categories:
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
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.
These embedded systems follow an absolute dead line time period i.e.., if the tasking is not
done in a particular time period then there is a cause of damage to the entire equipment.
13
E.g.: 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.
These embedded systems follow a relative dead line time period i.e.., if the task is not done in
a particular time that will not cause damage to the equipment.
E.g.: Consider a TV remote control system, if the remote control takes a few milliseconds
delay it will not cause damage either to the TV or to the remote control. These systems which
will not cause damage when they are not operated at considerable time period those systems
comes under soft real-time embedded systems.
E.g.:
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.
Whenever a person comes near the door, it captures the image of a person and sends to 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.
14
Fig 2.2: Network communication embedded systems
The central processing unit (c.p.u) can be any one of the following microprocessor,
microcontroller, digital signal processing.
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.
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
15
2.4 APPLICATIONS OF EMBEDDED SYSTEMS:
At home we use a number of embedded systems which include microwave oven, remote
control, vcd players, dvd players, camera etc….
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.
16
Fig2.6: Robot
In critical industries where human presence is avoided there we can use robots
which are programmed to do a specific operation.
17
Fig2.8: Cell Phone Fig2.9: Web camera
18
CHAPTER 3: HARDWARE DESCRIPTION
3.1 Introduction:
In this chapter the block diagram of the project and design aspect of independent modules are
considered. Block diagram is shown in fig: 3.1:
19
The main blocks of this project are:
1. Microcontroller(ARDUINOA)
2. ADC
3. Crystal oscillator
4. Reset button
5. RPS.
6. LED indicators
7. IR Sensors.
8. High powered LED'S.
9. LDR
10. LCD display
20
Figure 3.3.1 Structure of Arduino Board
Looking at the board from the top down, this is an outline of what you will see (parts of the
board you might interact with in the course of normal use are highlighted)
Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for
digital i/o (Digital Read and Digital Write) if you are also using serial communication
(e.g. Serial.begin).
21
Reset Button - S1 (dark blue)
Toggles External Power and USB Power (place jumper on two pins closest to desired
supply) - SV1 (purple)
USB (used for uploading sketches to the board and for serial communication between
the board and the computer; can be used to power the board) (yellow)
Digital Pins
In addition to the specific functions listed below, the digital pins on an Arduino board
can be used for general purpose input and output via the pin Mode(), Digital Read(), and
Digital Write() commands. Each pin has an internal pull-up resistor which can be turned on
and off using digital Write() (w/ a value of HIGH or LOW, respectively) when the pin is
configured as an input. The maximum current per pin is 40mA.
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
On the Arduino Diecimila, these pins are connected to the corresponding pins of the
FTDI USB-to-TTL Serial chip. On the Arduino BT, they are connected to the
corresponding pins of the WT11 Bluetooth module. On the Arduino Mini and LilyPad
Arduino, they are intended for use with an external TTL serial module (e.g. the Mini-
USB Adapter).
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 attach Interrupt()
function for details.
PWM: 3, 5, 6, 9, 10, and 11 Provide 8-bit PWM output with the analog Write()
function. On boards with an ATmega8, PWM output is available only on pins 9, 10,
and 11.
BT Reset: 7. (Arduino BT-only) Connected to the reset line of the bluetooth module.
22
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is not
currently included in the Arduino language.
LED: 13. On the Diecimila and LilyPad, 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.
Analog Pins
In addition to the specific functions listed below, the analog input pins support 10-bit
analog-to-digital conversion (ADC) using the analog Read() function. Most of the analog
inputs can also be used as digital pins: analog input 0 as digital pin 14 through analog input 5
as digital pin 19. Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as
digital pins.
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the Wire library
(documentation on the Wiring website).
Power Pins
VIN (sometimes labeled "9V"): 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. Also note that the
Lily Pad has no VIN pin and accepts only a regulated input.
5V: The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator,
or be supplied by USB or another regulated 5V supply.
3V3 (Diecimila-only) : A 3.3 volt supply generated by the on-board FTDI chip.
23
3.3.2 Atmega328
3.3.2 Pin diagram
24
Pin Description
GND: Ground.
Port A (PA7-PA0):
Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-
directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up
resistors (selected for each bit). The Port A output buffers have symmetrical drive
characteristics with both high sink and source capability. When pins PA0 to PA7 are used as
inputs and are externally pulled low, they will source current if the internal pull-up resistors
are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the
clock is not running.
Port B (PB7-PB0):
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. Port B also serves the functions of various
special features of the ATmega32.
Port C (PC7-PC0):
Port C is an 8-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. If the JTAG interface is enabled, the pull-up
resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be activated even if a reset
occurs. The TD0 pin is tri-stated unless TAP states that shift out data are entered. Port C also
serves the functions of the JTAG interface.
Port D (PD7-PD0):
25
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. Port D also serves the functions of various
special features of the ATmega32.
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.
XTAL1: Input to the inverting Oscillator amplifier and input to the internal clock operating
circuit.
AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. 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.
AREF: AREF is the analog reference pin for the A/D Converter.
Features
1.8-5.5V operating range
Up to 20MHz
Part: ATMEGA328P-AU
1kB EEPROM
2 8-bit Timer/Counters
16-bit Timer/Counter
26
Master/Slave SPI interface
Watchdog timer
23 IO lines
27
Figure 3.3.3 AVR Block Diagram
Overview
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.
28
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 for look up tables in Flash program memory. These added
function registers are the 16-bit X-, Y-, and Z-register, described later in this section. 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. 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.
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 versionR2) programmed
as a USB-to-serial converter.
Pin out: 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 with both the
board that uses the AVR, which operates with 5V and with the Arduino. Due that
operates 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
29
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.
Arduino Characteristics
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.
IOREF. This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin
voltage and select the appropriate power source or enable voltage translators on the
outputs for working with the 5V or 3.3V.
Memory:
The ATmega328 has 32 KB (with 0.5 KB used for the boot loader). It also has 2 KB
of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).
30
Serial Communication:
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V)
serial communication, which is 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 Software Serial 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. For SPI communication, use
the SPI library.
3.3.1 Introduction:
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. Low voltage, low power DC power supply units are commonly
integrated with the devices they supply, such as computers and household electronics.
Batteries.
31
Solar power.
Generators or alternators.
The basic circuit diagram of a regulated power supply (DC O/P) with led connected as load is
shown in fig: 3.3.3.
32
Fig 3.3.3 Circuit diagram of Regulated Power Supply with Led connection
230V AC MAINS
TRANSFORMER
BRIDGE RECTIFIER(DIODES)
CAPACITOR
VOLTAGE REGULATOR(IC 7805)
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:
33
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 turn’s ratio is 10:1.
34
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.
Step Up transformer:
Because of having more turns secondary winding accepts more energy, and it
releases more voltage at the output side.
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.
35
A battery is a type of linear power supply that offers benefits that traditional
line-operated power supplies lack: mobility, portability and reliability. A battery consists of
multiple electrochemical cells connected to provide the voltage desired. Fig: 3.3.5 shows Hi-
Watt 9V battery
36
Fig 3.3.6: Pencil Battery of 1.5V
RECTIFICATION:
Rectifiers:
When only one diode is used to rectify AC (by blocking the negative or
positive portion of the waveform), the difference between the term diode and the term
rectifier is merely one of usage, i.e., the term rectifier describes a diode that is being used to
convert AC to DC. Almost all rectifiers comprise a number of diodes in a specific
arrangement for more efficiently converting AC to DC than is possible with only one diode.
Before the development of silicon semiconductor rectifiers, vacuum tube diodes and copper
(I) oxide or selenium rectifier stacks were used.
37
The Bridge rectifier circuit is shown in fig: 3.3.7, which converts an ac voltage
to dc voltage using both half cycles of the input ac voltage. The Bridge rectifier circuit is
shown in the 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
DB107:
38
Now -a -days Bridge rectifier is available in IC with a number of DB107. In
our project we are using an IC in place of bridge rectifier. The Arduinoture of DB 107 is
shown in fig: 3.3.8.
Features:
Filtration:
Filters:
39
Electronic filters are electronic circuits, which perform signal-processing
functions, specifically to remove unwanted frequency components from the signal, to
enhance wanted ones.
Introduction to Capacitors:
40
Fig 3.3.9:Construction Of a Capacitor Fig 3.3.10:Electrolytic
Capaticor
Units of Capacitance:
41
Operation of Capacitor:
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.
A capacitor will pass alternating current but (apart from an initial surge) it will
not pass d.c.
42
Where a capacitor is used to decouple a circuit, the effect
is to "smooth out ripples". Any ripples, waves or pulses
of current are passed to ground while d.c. Flows
smoothly.
Regulation:
Voltage Regulator:
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 over-current 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.
43
Fig 3.3.11: Voltage Regulator
Resistors:
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.
Theory of operation:
44
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:
45
Fig 3.3.12: Resistor Fig 3.3.13: Color Bands In Resistor
3.4 LED:
46
Fig : Inside a LED Fig : Parts of a LED
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. LED’s 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 LED’s has allowed new text and video displays and sensors to be
47
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.
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.
48
Generate light for measuring and interacting with processes that do not involve the
human visual system.
3.6 IR sensor
Infrared (IR) light is electromagnetic radiation with longer wavelengths than those of
visible light, extending from the nominal red edge of the visible spectrum at 700 nanometres
(nm) to 1 mm. This range of wavelengths corresponds to a frequency range of approximately
430 THz down to 300 GHz,[1] and includes most of the thermal radiation emitted by objects
near room temperature. Infrared light is emitted or absorbed by molecules when they change
their rotational-vibrational movements. The existence of infrared radiation was first
discovered in 1800 by astronomer William Herschel.
Much of the energy from the Sun arrives on Earth in the form of infrared radiation.
Sunlight at zenith provides an irradiance of just over 1 kilowatt per square meter at sea level.
Of this energy, 527 watts is infrared radiation, 445 watts is visible light, and 32 watts is
ultraviolet radiation.[2] The balance between absorbed and emitted infrared radiation has a
critical effect on the Earth's climate.
Light comparison[3]
Name Wavelength Frequency (Hz) Photon Energy (eV)
Gamma ray less than 0.01 nm more than 10 EHz 124 keV – 300+ GeV
49
Microwave 1 mm – 1 meter 300 GHz – 300 MHz 1.24 µeV – 1.24 meV
Infrared imaging is used extensively for military and civilian purposes. Military
applications include target acquisition, surveillance, night vision, homing and tracking. Non-
military uses include thermal efficiency analysis, environmental monitoring, industrial
facility inspections, remote temperature sensing, short-ranged wireless communication,
spectroscopy, and weather forecasting. Infrared astronomy uses sensor-equipped telescopes
to penetrate dusty regions of space, such as molecular clouds; detect objects such as planets,
and to view highly red-shifted objects from the early days of the universe.[4]
At the atomic level, infrared energy elicits vibrational modes in a molecule through a
change in the dipole moment, making it a useful frequency range for study of these energy
states for molecules of the proper symmetry. Infrared spectroscopy examines absorption and
transmission of photons in the infrared energy range, based on their frequency and intensity.[5]
A typical system for detecting infrared radiation is given in the following block diagram :
INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor5.gif" \* MERGEFORMATINET INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor5.gif" \* MERGEFORMATINET INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor5.gif" \* MERGEFORMATINET
1. Infrared Source
50
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 fibers.
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.
INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor6.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor6.jpg" \* MERGEFORMATINET INCLUDEPICTURE
"http://www.engineersgarage.com/sites/default/files/imagecache/Original/wysiwyg_imageupl
oad/4214/IR-Sensor6.jpg" \* MERGEFORMATINET
51
Choice of IR band or a specific wavelength is dictated by the technical requirements of a
specific application.
3. Optical Components.
4. Infrared detectors.
Various types of detectors are used in IR sensors. Important specifications of detectors are
• Photosensitivity or Responsivity
Responsivity is the Output Voltage/Current per watt of incident energy. Higher the better
NEP represents detection ability of a detector and is the amount of incident light equal to
intrinsic noise level of a detector
• Detectivity(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.
5. Signal Processing
Since detector outputs are typically very small, preamplifiers with associated circuitry are
used to further process the received signals.
Working:
52
IR sensors use infra red light to sense objects in front of them and gauge their
distance. The commonly used Sharp IR sensors have two black circles which used for this
process, an emitter and a detector (see image right).
A pulse of infra red light is emitted from the emitter and spreads out in a large arc. If
no object is detected then the IR light continues forever and no reading is recorded. However,
if an object is nearby then the IR light will be reflected and some of it will hit the detector.
This forms a simple triangle between the object, emitter and detector. The detector is able to
detect the angle that the IR light arrived back at and thus can determine the distance to the
object. This is remarkably accurate and although interference from sunlight is still a problem,
these sensors are capable of detecting dark objects in sunlight now.
53
telecommunications.
NIR and SWIR is sometimes called "reflected infrared" while MWIR and LWIR is
sometimes referred to as "thermal infrared." Due to the nature of the blackbody radiation
curves, typical 'hot' objects, such as exhaust pipes, often appear brighter in the MW compared
to the same object viewed in the LW.
54
IR-A: 700 nm–1400 nm (0.7 µm – 1.4 µm, 215 THz – 430 THz)
IR-B: 1400 nm–3000 nm (1.4 µm – 3 µm, 100 THz – 215 THz)
A third scheme divides up the band based on the response of various detectors:
Near infrared: from 0.7 to 1.0 µm (from the approximate end of the response of the human
eye to that of silicon).
Short-wave infrared: 1.0 to 3 µm (from the cut off of silicon to that of the MWIR
atmospheric window. InGaAs covers to about 1.8 µm; the less sensitive lead salts
cover this region.
Mid-wave infrared: 3 to 5 µm (defined by the atmospheric window and covered by
Indium antimonide [InSb] and HgCdTe and partially by lead selenide [PbSe]).
These divisions are justified by the different human response to this radiation: near
infrared is the region closest in wavelength to the radiation detectable by the human eye, mid
and far infrared are progressively further from the visible spectrum. Other definitions follow
different physical mechanisms (emission peaks, vs. bands, water absorption) and the newest
follow technical reasons (The common silicon detectors are sensitive to about
55
1,050 nm, while InGaAs' sensitivity starts around 950 nm and ends between 1,700 and
2,600 nm, depending on the specific configuration). Unfortunately, international standards for
these specifications are not currently available.
The boundary between visible and infrared light is not precisely defined. The human
eye is markedly less sensitive to light above 700 nm wavelength, so longer wavelengths make
insignificant contributions to scenes illuminated by common light sources. But particularly
intense light (e.g., from IR lasers, or from bright daylight with the visible light removed by
colored gels) can be detected up to approximately 780 nm, and will be perceived as red light,
although sources of up to 1050 nm can be seen as a dull red glow in intense sources. Using an
opaque IR-passing photographic filter, it is possible to see the Wood effect of glowing foliage
if all visible light leaks from around the filter are blocked, and the eye is given a moment to
adjust to the extremely dim image.[12] The onset of infrared is defined (according to different
standards) at various values typically between 700 nm and 800 nm.
In optical communications, the part of the infrared spectrum that is used is divided
into seven bands based on availability of light sources transmitting/absorbing materials
(fibers) and detectors:
56
IR transmitter and receiver
Basics of IR transmitter and receiver transmitter and receiver are commonly used in
engineering projects for remote control of objects. In particularly, in Robotic system uses
transmitter and receiver. Here i would like to describe the basics if IR transmitter and receiver
Basics of IR transmitter:
When IR rays gets emitted from LED, it moves in the direction it is angled. When any
obstacle interferes in the path, the IR rays get cut and it produces secondary wavelets which
propagates mostly in return direction or in a direction opposite to that of the primary waves,
which produces the net result like reflection of IR rays.
Basics of IR receiver:
Infrared photo receiver is a two terminal PN junction device, which operates in a reverse bias.
It has a small transparent window, which allows light to strike the PN junction. A photodiode
is a type of photo detector capable of converting light into either current or voltage,
depending upon the mode of operation. Most photodiodes will look similar to a light emitting
57
diode. They will have two leads, or wires, coming from the bottom. The shorter end of the
two is the cathode, while the longer end is the anode.
Various types of infrared based applications are available in the market. The circuit
for infrared based applications is designed along with the transmitter and receiver sections i.e.
we can’t use it for other application. But the infrared communication project which we have
done here can be used in any application just by replacing the application at the place of
infrared LED in the circuit diagram of infrared communication. By using this project we can
design infrared based applications easily. The entire circuit consists of two sections named as
1. Transmitter section:
58
2. Receiver section:
We can increase the distance between the IR transmitter and receiver just by placing
the lens between them. After connecting the IR transmitter and receiver circuit, we can get
the output by applying 6V Power supply to the circuit. We can use this circuit with any
application very simply. For example a buzzer circuit is placed at the output of IR circuit,
when the signals are interrupted, the buzzer produces sound. Both the transmitter and receiver
parts can be mounted on a single bread board or PCB. The infrared receiver must be placed
behind the IR Led to avoid false indication due to infrared leakage. An object moving nearby
actually reflects the IR rays emitted by the IR Led.
Photo Diodes:
INCLUDEPICTURE
"http://72.232.229.42/thumb/2/2b/Photodiode_symbol.svg/250px-
Photodiode_symbol.svg.png" \* MERGEFORMATINET INCLUDEPICTURE
"http://72.232.229.42/thumb/2/2b/Photodiode_symbol.svg/250px-
59
Photodiode_symbol.svg.png" \* MERGEFORMATINET INCLUDEPICTURE
"http://72.232.229.42/thumb/2/2b/Photodiode_symbol.svg/250px-
Photodiode_symbol.svg.png" \* MERGEFORMATINET
Principle of operation:
Photodiodes can be used under either zero bias (photovoltaic mode) or reverse bias
(photoconductive mode). In zero bias, light falling on the diode causes a current across the
device, leading to forward bias which in turn induces "dark current" in the opposite direction
to the photocurrent. This is called the photovoltaic effect, and is the basis for solar cells in
fact; a solar cell is just a large number of big photodiodes. Reverse bias induces only little
current (known as saturation or back current) along its direction.
But a more important effect of reverse bias is widening of the depletion layer
(therefore expanding the reaction volume) and strengthening the photocurrent. Circuits based
on this effect are more sensitive to light than ones based on the photovoltaic effect and also
tend to have lower capacitance, which improves the speed of their time response. On the
other hand, the photovoltaic mode tends to exhibit less electronic noise.
Avalanche photodiodes have a similar structure, but they are operated with much
higher reverse bias. This allows each photo-generated carrier to be multiplied by avalanche
breakdown, resulting in internal gain within the photodiode, which increases the effective
responsivity of the device.
60
Features:
1. Responsivity:
The responsivity may also be expressed as quantum efficiency, or the ratio of the
number of photo generated carriers to incident photons and thus a unit less quantity.
2. Dark current:
The dark current includes photocurrent generated by background radiation and the
saturation current of the semiconductor junction. Dark current must be accounted for by
calibration if a photodiode is used to make an accurate optical power measurement, and it is
also a source of noise when a photodiode is used in an optical communication system.
3. Noise-equivalent power:
(NEP) The minimum input optical power to generate photocurrent, equal to the RMS
noise current in a 1 hertz bandwidth. The related characteristic directivity (D) is the inverse of
NEP, 1/NEPThe NEP is roughly the minimum detectable input power of a photodiode.
Applications:
1. P-N photodiodes are used in similar applications to other photo detectors, such as
photoconductors, charge-coupled devices, and photomultiplier tubes.
2. Photodiodes are used in consumer electronics devices such as compact disc players,
smoke detectors, and the receivers for remote controls in VCRs and televisions.
3. PIN diodes are much faster and more sensitive than ordinary p-n junction diodes, and
hence are often used for optical communications and in lighting regulation.
1. Due to the intrinsic layer, a PIN photodiode must be reverse biased (Vr). The Vr
increases the depletion region allowing a larger volume for electron-hole pair
production, and reduces the capacitance thereby increasing the bandwidth.
61
2. The Vr also introduces noise current, which reduces the S/N ratio. Therefore, a
reverse bias is recommended for higher bandwidth applications and/or applications
where a wide dynamic range is required.
3. A PN photodiode is more suitable for lower light applications because it allows for
unbiased operation.
Applications
Night vision
Infrared is used in night vision equipment when there is insufficient visible light to
see.[16] Night vision devices operate through a process involving the conversion of ambient
light photons into electrons which are then amplified by a chemical and electrical process and
then converted back into visible light. [16] Infrared light sources can be used to augment the
available ambient light for conversion by night vision devices, increasing in-the-dark
visibility without actually using a visible light source.[16]
The use of infrared light and night vision devices should not be confused with thermal
imaging which creates images based on differences in surface temperature by detecting
infrared radiation (heat) that emanates from objects and their surrounding environment.
Thermography
Infrared radiation can be used to remotely determine the temperature of objects (if the
emissivity is known). This is termed thermography, or in the case of very hot objects in the
NIR or visible it is termed pyrometry. Thermography (thermal imaging) is mainly used in
military and industrial applications but the technology is reaching the public market in the
form of infrared cameras on cars due to the massively reduced production costs.
62
Tracking
Infrared tracking, also known as infrared homing, refers to a passive missile guidance
system which uses the emission from a target of electromagnetic radiation in the infrared part
of the spectrum to track it. Missiles which use infrared seeking are often referred to as "heat-
seekers", since infrared (IR) is just below the visible spectrum of light in frequency and is
radiated strongly by hot bodies. Many objects such as people, vehicle engines, and aircraft
generate and retain heat, and as such, are especially visible in the infrared wavelengths of
light compared to objects in the background
Heating
Infrared radiation can be used as a deliberate heating source. According to this Mayo
Clinic article states that, "Several studies have looked at using infrared saunas in the
treatment of chronic health problems, such as high blood pressure, congestive heart failure
and rheumatoid arthritis, and found some evidence of benefit." For example it is used in
infrared saunas to heat the occupants, and also to remove ice from the wings of aircraft (de-
icing). Far infrared is also gaining popularity as a safe heat therapy method of natural health
care and physiotherapy. Infrared can be used in cooking and heating food as it predominantly
heats the opaque, absorbent objects, rather than the air around them.
Communications
63
infrared light-emitting diodes (LEDs) to emit infrared radiation which is focused by a plastic
lens into a narrow beam.
The beam is modulated, i.e. switched on and off, to encode the data. The receiver uses
a silicon photodiode to convert the infrared radiation to an electric current. It responds only to
the rapidly pulsing signal created by the transmitter, and filters out slowly changing infrared
radiation from ambient light. Infrared communications are useful for indoor use in areas of
high population density. IR does not penetrate walls and so does not interfere with other
devices in adjoining rooms. Infrared is the most common way for remote controls to
command appliances. Infrared remote control protocols like RC-5, SIRC, are used to
communicate with infrared.
Infrared lasers are used to provide the light for optical fiber communications systems.
Infrared light with a wavelength around 1,330 nm (least dispersion) or 1,550 nm (best
transmission) are the best choices for standard silica fibers.
64
High power LED’s from Philips Lumileds Lighting Company mounted on a 21 mm star
shaped base metal core PCB
High power LED’s (HPLED) can be driven at currents from hundreds of mA to more than an
ampere, compared with the tens of mA for other LED’s. They produce up to over a thousand
lumens. Since overheating is destructive, the HPLEDs must be mounted on a heat sink to
allow for heat dissipation. If the heat from a HPLED is not removed, the device will burn out
in seconds. A single HPLED can often replace an incandescent bulb in a flashlight, or be set
in an array to form a powerful LED lamp.
Some well-known HPLEDs in this category are the Lumileds Rebel Led, Osram Opto
Semiconductors Golden Dragon and Cree X-lamp. As of September 2009 some HPLEDs
manufactured by Cree Inc. now exceed 105 lm/W (e.g. the XLamp XP-G LED chip emitting
Cool White light) and are being sold in lamps intended to replace incandescent, halogen, and
even fluorescent style lights as LED’s become more cost competitive.
LED’s have been developed by Seoul Semiconductor that can operate on AC power without
the need for a DC converter. For each half cycle part of the LED emits light and part is dark,
and this is reversed during the next half cycle. The efficacy of this type of HPLED is
typically 40 lm/W. A large number of LED elements in series may be able to operate directly
from line voltage. In 2009 Seoul Semiconductor released a high DC voltage capable of being
driven from AC power with a simple controlling circuit. The low power dissipation of these
LED affords them to be use used more flexibly than the original AC LED.
3.6.1: Advantages:
Efficiency: LED’s produce more light per watt than incandescent bulbs.
Color: LED’s can emit light of an intended color without the use of color filters that
traditional lighting methods require. This is more efficient and can lower initial costs.
Size: LED’s can be very small (smaller than 2 mm2) and are easily populated onto
printed circuit boards.
65
On/Off time: LED’s light up very quickly. A typical red indicator LED will achieve
full brightness in microseconds. LED’s used in communications devices can have
even faster response times.
Cycling: LED’s are ideal for use in applications that are subject to frequent on-off
cycling, unlike fluorescent lamps that burn out more quickly when cycled frequently,
or HID lamps that require a long time before restarting.
Cool light: In contrast to most light sources, LED’s radiate very little heat in the form
of IR that can cause damage to sensitive objects or fabrics. Wasted energy is
dispersed as heat through the base of the LED.
Slow failure: LED’s mostly fail by dimming over time, rather than the abrupt burn-
out of incandescent bulbs.
Lifetime: LED’s can have a relatively long useful life. One report estimates 35,000 to
50,000 hours of useful life, though time to complete failure may be longer.
Fluorescent tubes typically are rated at about 10,000 to 15,000 hours, depending
partly on the conditions of use, and incandescent light bulbs at 1,000–2,000 hours.
Shock resistance: LED’s, being solid state components, are difficult to damage with
external shock, unlike fluorescent and incandescent bulbs which are fragile.
Focus: The solid package of the LED can be designed to focus its light. Incandescent
and fluorescent sources often require an external reflector to collect light and direct it
in a usable manner.
66
2. LED destination displays on buses, one with a colored route number
4. LED digital display that can display 4 digits along with points.
67
6. Dropped ceiling with LED lamps
7. LED panel light source used in an experiment on plant growth. The findings of such
experiments may be used to grow food in space on long duration missions.
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.
68
Generate light for measuring and interacting with processes that do not involve the
human visual system.
Typically, an ADC is an electronic device that converts an input analog voltage (or
current) to a digital number proportional to the magnitude of the voltage or current. However,
some non-electronic or only partially electronic devices, such as rotary encoders, can also be
considered ADCs. The digital output may use different coding schemes, such as binary, Gray
code or two's complement binary.
5.1 Resolution:
The resolution of the converter indicates the number of discrete values it can produce
over the range of analog values. The values are usually stored electronically in binary form,
so the resolution is usually expressed in bits. In consequence, the number of discrete values
available, or "levels", is usually a power of two. For example, an ADC with a resolution of 8
bits can encode an analog input to one in 256 different levels, since 28 = 256. The values can
represent the ranges from 0 to 255 (i.e. unsigned integer) or from -128 to 127 (i.e. signed
integer), depending on the application.
Resolution can also be defined electrically, and expressed in volts. The voltage
resolution of an ADC is equal to its overall voltage measurement range divided by the
number of discrete intervals as in the formula:
Where:
Q is resolution in volts per step (volts per output codes less one),
69
M is the ADC's resolution in bits.
N is the number of intervals, (one less than the number of available levels, or output
codes), which is: N = 2M − 1
Example 1
o Full scale measurement range = 0 to 10 volts
o ADC voltage resolution is: (10V - 0V) / 4095 steps = 10V / 4095 steps
0.00244 V/step 2.44 mV/step
Example 2
o ADC voltage resolution is: (10V - (-10V)) / 16383 steps = 20V / 16383 steps
0.00122 V/step 1.22 mV/step
Example 3
In practice, the smallest output code ("0" in an unsigned system) represents a voltage range
which is 0.5Q, that is, half the ADC voltage resolution (Q), as does the largest output code.
The other N − 2 codes are all equal in width and represent the ADC voltage resolution (Q)
calculated above. Doing this centers the code on an input voltage that represents the M th
division of the input voltage range. For example, in Example 3, with the 3-bit ADC spanning
a 7 V range, each of the N divisions would represent 1 V, except the 1st ("0" code) and the
last ("7" code) which are 0.5 V wide. Doing this the "1" code spans a voltage range from 0.5
70
to 1.5 V, the "2" code spans a voltage range from 1.5 to 2.5 V, etc. Thus, if the input signal is
at 3/8ths of the full-scale voltage, then the ADC outputs the "3" code, and will do so as long
as the voltage stays within the range of 2.5/8ths and 3.5/8ths. This practice is called "mid-
tread" operation. This type of ADC can be modeled mathematically as:
The exception to this convention seems to be the Microchip ARDUINO processor, where all
M steps are equal width. This practice is called "Mid-Rise with Offset" operation.
Most ADCs are of a type known as linear. The term linear as used here means that the
range of the input values that map to each output value has a linear relationship with the
output value, i.e., that the output value k is used for the range of input values from
m(k + b)
to
m(k + 1 + b),
71
where m and b are constants. Here b is typically 0 or −0.5. When b = 0, the ADC is
referred to as mid-rise, and when b = −0.5 it is referred to as mid-tread.
If the probability density function of a signal being digitized is uniform, then the
signal-to-noise ratio relative to the quantization noise is the best possible. Because this is
often not the case, it is usual to pass the signal through its cumulative distribution function
(CDF) before the quantization. This is good because the regions that are more important get
quantized with a better resolution. In the dequantization process, the inverse CDF is needed.
This is the same principle behind the companders used in some tape-recorders and
other communication systems, and is related to entropy maximization.
For example, a voice signal has a Laplacian distribution. This means that the region
around the lowest levels, near 0, carries more information than the regions with higher
amplitudes. Because of this, logarithmic ADCs are very common in voice communication
systems to increase the dynamic range of the representable values while retaining fine-
granular fidelity in the low-amplitude region.
An eight-bit A-law or the μ-law logarithmic ADC covers the wide dynamic range and
has a high resolution in the critical low-amplitude region, that would otherwise require a 12-
bit linear ADC.
5.3 Accuracy:
An ADC has several sources of errors. Quantization error and (assuming the ADC is
intended to be linear) non-linearity is intrinsic to any analog-to-digital conversion. There is
also a so-called aperture error which is due to a clock jitter and is revealed when digitizing a
time-variant signal (not a constant value).
These errors are measured in a unit called the LSB, which is an abbreviation for least
significant bit. In the above example of an eight-bit ADC, an error of one LSB is 1/256 of the
full signal range, or about 0.4%.
72
5.4 Quantization error:
Quantization error is due to the finite resolution of the ADC, and is an unavoidable
imperfection in all types of ADC. The magnitude of the quantization error at the sampling
instant is between zero and half of one LSB.
In the general case, the original signal is much larger than one LSB. When this
happens, the quantization error is not correlated with the signal, and has a uniform
distribution. Its RMS value is the standard deviation of this distribution, given by
In the eight-bit ADC example, this represents 0.113% of the full signal range.
At lower levels the quantizing error becomes dependent of the input signal, resulting
in distortion. This distortion is created after the anti-aliasing filter, and if these distortions are
above 1/2 the sample rate they will alias back into the audio band. In order to make the
quantizing error independent of the input signal, noise with an amplitude of 1 quantization
step is added to the signal. This slightly reduces signal to noise ratio, but completely
eliminates the distortion. It is known as dither.
5.5 Non-linearity:
All ADCs suffer from non-linearity errors caused by their physical imperfections,
causing their output to deviate from a linear function (or some other function, in the case of a
deliberately non-linear ADC) of their input. These errors can sometimes be mitigated by
calibration, or prevented by testing.
Important parameters for linearity are integral non-linearity (INL) and differential
non-linearity (DNL). These non-linearities reduce the dynamic range of the signals that can
be digitized by the ADC, also reducing the effective resolution of the ADC.
The analog signal is continuous in time and it is necessary to convert this to a flow of
digital values. It is therefore required to define the rate at which new digital values are
73
sampled from the analog signal. The rate of new values is called the sampling rate or
sampling frequency of the converter.
A continuously varying bandlimited signal can be sampled (that is, the signal values
at intervals of time T, the sampling time, are measured and stored) and then the original
signal can be exactly reproduced from the discrete-time values by an interpolation formula.
The accuracy is limited by quantization error. However, this faithful reproduction is only
possible if the sampling rate is higher than twice the highest frequency of the signal. This is
essentially what is embodied in the Shannon-Nyquist sampling theorem.
Since a practical ADC cannot make an instantaneous conversion, the input value must
necessarily be held constant during the time that the converter performs a conversion (called
the conversion time). An input circuit called a sample and hold performs this task—in most
cases by using a capacitor to store the analog voltage at the input, and using an electronic
switch or gate to disconnect the capacitor from the input. Many ADC integrated circuits
include the sample and hold subsystem internally.
5.7 Aliasing:
All ADCs work by sampling their input at discrete intervals of time. Their output is
therefore an incomplete Arduinoture of the behaviour of the input. There is no way of
knowing, by looking at the output, what the input was doing between one sampling instant
and the next. If the input is known to be changing slowly compared to the sampling rate, then
it can be assumed that the value of the signal between two sample instants was somewhere
between the two sampled values. If, however, the input signal is changing rapidly compared
to the sample rate, then this assumption is not valid.
If the digital values produced by the ADC are, at some later stage in the system,
converted back to analog values by a digital to analog converter or DAC, it is desirable that
the output of the DAC be a faithful representation of the original signal. If the input signal is
changing much faster than the sample rate, then this will not be the case, and spurious signals
called aliases will be produced at the output of the DAC. The frequency of the aliased signal
is the difference between the signal frequency and the sampling rate. For example, a 2 kHz
sine wave being sampled at 1.5 kHz would be reconstructed as a 500 Hz sine wave. This
problem is called aliasing.
74
To avoid aliasing, the input to an ADC must be low-pass filtered to remove
frequencies above half the sampling rate. This filter is called an anti-aliasing filter, and is
essential for a practical ADC system that is applied to analog signals with higher frequency
content.
Although aliasing in most systems is unwanted, it should also be noted that it can be
exploited to provide simultaneous down-mixing of a band-limited high frequency signal (see
undersampling and frequency mixer).
5.8 Dither:
In A to D converters, performance can usually be improved using dither. This is a very small
amount of random noise (white noise) which is added to the input before conversion. Its
amplitude is set to be about half of the least significant bit. Its effect is to cause the state of
the LSB to randomly oscillate between 0 and 1 in the presence of very low levels of input,
rather than sticking at a fixed value. Rather than the signal simply getting cut off altogether at
this low level (which is only being quantized to a resolution of 1 bit), it extends the effective
range of signals that the A to D converter can convert, at the expense of a slight increase in
noise - effectively the quantization error is diffused across a series of noise values which is
far less objectionable than a hard cutoff. The result is an accurate representation of the signal
over time. A suitable filter at the output of the system can thus recover this small signal
variation.
An audio signal of very low level (with respect to the bit depth of the ADC) sampled
without dither sounds extremely distorted and unpleasant. Without dither the low level
always yields a '1' from the A to D. With dithering, the true level of the audio is still recorded
as a series of values over time, rather than a series of separate bits at one instant in time.
A virtually identical process, also called dither or dithering, is often used when
quantizing photographic images to a fewer number of bits per pixel—the image becomes
noisier but to the eye looks far more realistic than the quantized image, which otherwise
becomes banded. This analogous process may help to visualize the effect of dither on an
analogue audio signal that is converted to digital.
75
Dithering is also used in integrating systems such as electricity meters. Since the
values are added together, the dithering produces results that are more exact than the LSB of
the analog-to-digital converter.
Note that dither can only increase the resolution of a sampler, it cannot improve the
linearity, and thus accuracy does not necessarily improve.
5.9 Oversampling:
Usually, signals are sampled at the minimum rate required, for economy, with the
result that the quantization noise introduced is white noise spread over the whole pass band of
the converter. If a signal is sampled at a rate much higher than the Nyquist frequency and
then digitally filtered to limit it to the signal bandwidth then there are 3 main advantages:
digital filters can have better properties (sharper rolloff, phase) than analogue filters,
so a sharper anti-aliasing filter can be realised and then the signal can be downsampled
giving a better result
a 20 bit ADC can be made to act as a 24 bit ADC with 256× oversampling
the signal-to-noise ratio due to quantization noise will be higher than if the whole
available band had been used. With this technique, it is possible to obtain an effective
resolution larger than that provided by the converter alone
The improvement in SNR is 3dB (equivalent to 0.5 bits) per octave of oversampling
which is not sufficient for many applications. So, oversampling is usually coupled with
noise shaping(see /sigma-/delta modulators). With noise shaping, the improvement is
6L+3 dB per octave where L is the order of loop filter used for noise shaping. e.g. - a 2nd
order loop filter will provide an improvement of 15dB/octave.
The speed of an ADC varies by type. The Wilkinson ADC is limited by the clock rate
which is processable by current digital circuits. Currently, frequencies up to 300 MHz are
possible. The conversion time is directly proportional to the number of channels. For a
successive approximation ADC, the conversion time scales with the logarithm of the number
of channels. Thus for a large number of channels, it is possible that the successive
approximation ADC is faster than the Wilkinson. However, the time consuming steps in the
76
Wilkinson are digital, while those in the successive approximation are analog. Since analog is
inherently slower than digital, as the number of channels increases, the time required also
increases. Thus there are competing processes at work. Flash ADCs are certainly the fastest
type of the three. The conversion is basically performed in a single parallel step. For an 8-bit
unit, conversion takes place in a few tens of nanoseconds.
There is, as expected, somewhat of a trade off between speed and precision. Flash
ADCs have drifts and uncertainties associated with the comparator levels, which lead to poor
uniformity in channel width. Flash ADCs have a resulting poor linearity. For successive
approximation ADCs, poor linearity is also apparent, but less so than for flash ADCs. Here,
non-linearity arises from accumulating errors from the subtraction processes. Wilkinson
ADCs are the best of the three. These have the best differential non-linearity. The other types
require channel smoothing in order to achieve the level of the Wilkinson.
The sliding scale or randomizing method can be employed to greatly improve the
channel width uniformity and differential linearity of any type of ADC, but especially flash
and successive approximation ADCs. Under normal conditions, a pulse of a particular
amplitude is always converted to a certain channel number. The problem lies in that channels
are not always of uniform width, and the differential linearity decreases proportionally with
the divergence from the average width. The sliding scale principle uses an averaging effect to
overcome this phenomenon. A random, but known analog voltage is added to the input pulse.
It is then converted to digital form, and the equivalent digital version is subtracted, thus
restoring it to its original value. The advantage is that the conversion has taken place at a
random point. The statistical distribution of the final channel numbers is decided by a
weighted average over a region of the range of the ADC. This in turn desensitizes it to the
width of any given channel.
A direct conversion ADC or flash ADC has a bank of comparators sampling the
input signal in parallel, each firing for their decoded voltage range. The comparator bank
77
feeds a logic circuit that generates a code for each voltage range. Direct conversion is
very fast, capable of gigahertz sampling rates, but usually has only 8 bits of resolution or
fewer, since the number of comparators needed, 2N - 1, doubles with each additional bit,
requiring a large expensive circuit. ADCs of this type have a large die size, a high input
capacitance, high power dissipation, and are prone to produce glitches on the output (by
outputting an out-of-sequence code). Scaling to newer submicrometre technologies does
not help as the device mismatch is the dominant design limitation. They are often used for
video, wideband communications or other fast signals in optical storage.
78
sampling frequency multiplied by the number of bits of resolution desired. For example,
to sample audio at 44.1 kHz with 32 bit resolution, a clock frequency of over 1.4 MHz
would be required. ADCs of this type have good resolutions and quite wide ranges. They
are more complex than some other designs.
The Wilkinson ADC was designed by D. H. Wilkinson in 1950. The Wilkinson ADC
is based on the comparison of an input voltage with that produced by a charging
capacitor. The capacitor is allowed to charge until its voltage is equal to the amplitude of
the input pulse. (A comparator determines when this condition has been reached.) Then,
the capacitor is allowed to discharge linearly, which produces a ramp voltage. At the
point when the capacitor begins to discharge, a gate pulse is initiated. The gate pulse
remains on until the capacitor is completely discharged. Thus the duration of the gate
pulse is directly proportional to the amplitude of the input pulse. This gate pulse operates
a linear gate which receives pulses from a high-frequency oscillator clock. While the gate
is open, a discrete number of clock pulses pass through the linear gate and are counted by
the address register. The time the linear gate is open is proportional to the amplitude of
the input pulse, thus the number of clock pulses recorded in the address register is
proportional also. Alternatively, the charging of the capacitor could be monitored, rather
than the discharge.
79
An integrating ADC (also dual-slope or multi-slope ADC) applies the unknown
input voltage to the input of an integrator and allows the voltage to ramp for a fixed time
period (the run-up period). Then a known reference voltage of opposite polarity is applied
to the integrator and is allowed to ramp until the integrator output returns to zero (the run-
down period). The input voltage is computed as a function of the reference voltage, the
constant run-up time period, and the measured run-down time period. The run-down time
measurement is usually made in units of the converter's clock, so longer integration times
allow for higher resolutions. Likewise, the speed of the converter can be improved by
sacrificing resolution. Converters of this type (or variations on the concept) are used in
most digital voltmeters for their linearity and flexibility.
A pipeline ADC (also called subranging quantizer) uses two or more steps of
subranging. First, a coarse conversion is done. In a second step, the difference to the input
signal is determined with a digital to analog converter (DAC). This difference is then
converted finer, and the results are combined in a last step. This can be considered a
refinement of the successive approximation ADC wherein the feedback reference signal
consists of the interim conversion of a whole range of bits (for example, four bits) rather
than just the next-most-significant bit. By combining the merits of the successive
approximation and flash ADCs this type is fast, has a high resolution, and only requires a
small die size.
80
along with the error generated by the discrete levels of the Flash, is fed back and
subtracted from the input to the filter. This negative feedback has the effect of noise
shaping the error due to the Flash so that it does not appear in the desired signal
frequencies. A digital filter (decimation filter) follows the ADC which reduces the
sampling rate, filters off unwanted noise signal and increases the resolution of the output.
(sigma-delta modulation, also called delta-sigma modulation)
A Time-interleaved ADC uses M parallel ADCs where each ADC sample data every
M:th cycle of the effective sample clock. This result in that the sample rate is increased M
times compared to what each individual ADC can manage. In practice the individual
differences between the M ADCs degrade the overall performance reducing the SFDR.
However, technologies exist to correct for these time-interleaving mismatch errors.
81
removes any distortions added by the frontend to yield the binary data that is the digital
representation of the original analog signal.
Most converters sample with 6 to 24 bits of resolution, and produce fewer than 1
mega sample per second. Thermal noise generated by passive components such as resistors
masks the measurement when higher resolution is desired. For audio applications and in room
temperatures, such noise is usually a little less than 1 μV (microvolt) of white noise. If the
Most Significant Bit corresponds to a standard 2 volts of output signal, this translates to a
noise-limited performance that is less than 20~21 bits, and obviates the need for any
dithering. Mega- and giga sample per second converters are available, though (Feb 2002).
Mega sample converters are required in digital video cameras, video capture cards, and TV
tuner cards to convert full-speed analog video to digital video files. Commercial converters
usually have ±0.5 to ±1.5 LSB error in their output.
In many cases the most expensive part of an integrated circuit is the pins, because
they make the package larger, and each pin has to be connected to the integrated circuit's
silicon. To save pins, it's common for slow ADCs to send their data one bit at a time over a
serial interface to the computer, with the next bit coming out when a clock signal changes
state, say from zero to 5V. This saves quite a few pins on the ADC package, and in many
cases, does not make the overall design any more complex. (Even microprocessors which use
memory-mapped I/O only need a few bits of a port to implement a serial bus to an ADC.)
Commercial ADCs often have several inputs that feed the same converter, usually
through an analog multiplexer. Different models of ADC may include sample and hold
circuits, instrumentation amplifiers or differential inputs, where the quantity measured is the
difference between two voltages.
5.14 Applications:
82
Very fast ADCs are needed in digital oscilloscopes, and are crucial for new applications like
software defined radio.
LDR
Working
83
A Light Dependent Resistor (LDR, photoconductor, or photocell) is a device which
has a resistance which varies according to the amount of light falling on its surface. They will
be having a resistance of 1 MOhm in total darkness, and a resistance of a 1 to 10 of kOhm in
bright light. A photoelectric device can be either intrinsic or extrinsic.
Applications:
An LDR can even be used in a simple remote control circuit using the backlight of a
mobile phone to turn on a device - call the mobile from anywhere in the world, it lights up the
LDR, and lighting can be turned on remotely!
There are two basic circuits using light dependent resistors - the first is activated by
darkness, the second is activated by light.
84
In the circuit diagram on the left, the led lights up whenever the LDR is in darkness.
The 10K variable resistor is used to fine-tune the level of darkness required before the LED
lights up. The 10K standard resistor can be changed as required to achieve the desired effect,
although any replacement must be at least 1K to protect the transistor from being damaged by
excessive current.
By swapping the LDR over with the 10K and 10K variable resistors , the circuit will
be activated instead by light. Whenever sufficient light falls on the LDR (manually fine-tuned
using the 10K variable resistor), the LED will light up.
The circuits shown above are not practically useful. In a real world circuit, the LED
(and resistor) between the positive voltage input (Vin) and the collector (C) of the transistor
would be replaced with the device to be powered.
85
Typically a relay is used - particularly when the low voltage light detecting circuit is used to
switch on (or off) a 240V mains powered device. A diagram of that part of the circuit is
shown above. When darkness falls (if the LDR circuit is configured that way around), the
relay is triggered and the 240V device - for example a security light - switches on.
The relationship between the resistance RL and light intensity Lux for a typical LDR
is
With the LDR connected to 5V through a 3.3K resistor, the output voltage of the LDR is
Vo = 5*RL / (RL+3.3)
86
LCD MODULE
To display interactive messages we are using LCD Module. We examine an
intelligent LCD display of two lines,16 characters per line that is interfaced to the controllers.
The protocol (handshaking) for the display is as shown. Whereas D0 to D7th bit is the Data
lines, RS, RW and EN pins are the control pins and remaining pins are +5V, -5V and GND to
provide supply. Where RS is the Register Select, RW is the Read Write and EN is the Enable
pin.
The display contains two internal byte-wide registers, one for commands (RS=0) and
the second for characters to be displayed (RS=1). It also contains a user-programmed RAM
area (the character RAM) that can be programmed to generate any desired character that can
be formed using a dot matrix. To distinguish between these two data areas, the hex command
byte 80 will be used to signify that the display RAM address 00h will be chosen.Port1 is used
to furnish the command or data type, and ports 3.2 to3.4 furnish register select and read/write
levels.
The display takes varying amounts of time to accomplish the functions as listed. LCD bit 7 is
monitored for logic high (busy) to ensure the display is overwritten.
Liquid Crystal Display also called as LCD is very helpful in providing user interface as well
as for debugging purpose. The most common type of LCD controller is HITACHI 44780
which provides a simple interface between the controller & an LCD. These LCD's are very
simple to interface with the controller as well as are cost effective.
87
you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e.
display should be faster then we have to use 8-bit mode because basically 4-bit mode takes
twice as more time as compared to 8-bit mode.
Pin Symbol Function
1 Vss Ground
2 Vdd Supply Voltage
3 Vo Contrast Setting
4 RS Register Select
5 R/W Read/Write Select
6 En Chip Enable Signal
7-14 DB0-DB7 Data Lines
15 A/Vee Gnd for the backlight
16 K Vcc for backlight
When RS is low (0), the data is to be treated as a command. When RS is high (1), the data
being sent is considered as text data which should be displayed on the screen.
When R/W is low (0), the information on the data bus is being written to the LCD. When RW
is high (1), the program is effectively reading from the LCD. Most of the times there is no
need to read from the LCD so this line can directly be connected to Gnd thus saving one
controller line.
The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is
required to latch the data. The LCD interprets and executes our command at the instant the
EN line is brought low. If you never bring EN low, your instruction will never be executed.
88
Basic 16x 2 Characters LCD - Black on Green 5V:
Description:
This is a basic 16 character by 2 line display. Black text on Green background. Utilizes the
extremely common HD44780 parallel interface chipset. Interface code is freely available. We
will need ~11 general I/O pins to interface to this LCD screen. Includes LED backlight.
89
Pin Description:
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs
which have only 1 controller and support at most of 80 characters, whereas LCDs supporting
more than 80 characters make use of 2 HD44780 controllers.
Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (two pins
are extra in both for back-light LED connections). Pin description is shown in the table
below.
90
Figure 1: Character LCD type HD44780 Pin diagram
Pin description:
0 = Instruction input
Pin no. 4 RS
1 = Data input
91
Pin no. 11 D4 Data bus line 4
0 = Instruction input
Pin no. 11 RS
1 = Data input
92
Pin no. 16 NC Not Connected
LCD Background:
Frequently, an 8051 program must interact with the outside world using input and
output devices that communicate directly with a human being. One of the most common
devices attached to an 8051 is an LCD display. Some of the most common LCDs connected
to the 8051 are 16x2 and 20x2 displays. This means 16 characters per line by 2 lines and 20
characters per line by 2 lines, respectively.
44780 Background:
The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data
bus. The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data
bus. If a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines plus
the 4 lines for the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data
lines (3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that we are sending it
data. To send data to the LCD, our program should make sure this line is low (0) and then set
the other two control lines and/or put data on the data bus. When the other lines are
completely ready, bring EN high (1) and wait for the minimum amount of time required by
the LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again.
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
93
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.
Description:
This is the first interfacing example for the Parallel Port. We will start with
something simple. This example doesn't use the Bi-directional feature found on newer ports,
thus it should work with most, if no all Parallel Ports.
It however doesn't show the use of the Status Port as an input. A 16 Character x 2
Line LCD Module to the Parallel Port. These LCD Modules are very common these days,
and are quite simple to work with, as all the logic required running them is on board.
Schematic:
94
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 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.
95
As we've mentioned, the LCD requires either 8 or 11 I/O lines to communicate with.
For the sake of this tutorial, we are going to use an 8-bit data bus--so we'll be using 11 of the
8051's I/O pins to interface with the LCD.
Let's draw a sample pseudo-schematic of how the LCD will be connected to the 8051.
As we can see, we've established a 1-to-1 relation between a pin on the 8051 and a line
on the 44780 LCD. Thus as we write our assembly program to access the LCD, we are going
to equate constants to the 8051 ports so that we can refer to the lines by their 44780 name as
opposed to P0.1, P0.2, etc. Let's go ahead and write our initial equates:
96
Having established the above equates, we may now refer to our I/O lines by their
44780 name. For example, to set the RW line high (1), we can execute the following
instruction:
SETB RW
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:
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 8051 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.
97
The instruction is executed by the LCD at the moment the EN line is brought low with
a final CLR EN instruction.
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. Additionally, if the LCD itself is
changed for another LCD which, although 44780 compatible, requires more time to perform
its operations, the program will not work until it is properly 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.
Since we will use this code every time we send an instruction to the LCD, it is useful
to make it a subroutine. Let's write the code:
WAIT_LCD:
98
JB ACC.7,WAIT_LCD;If bit 7 high, LCD still busy
CLR EN ;Finish the command
CLR RW ;Turn off RW for future commands
RET
Thus, our standard practice will be to send an instruction to the LCD and then call
our WAIT_LCD routine to wait until the instruction is completely executed by the LCD.
This will assure that our program gives the LCD the time it needs to execute instructions and
also makes our program compatible with any LCD, regardless of how fast or slow it is.
The last byte we need to send is used to configure additional operational parameters of the
LCD. We must send the value 06h.
CLR RS
MOV DATA, #06h
SETB EN
CLR EN
LCALL WAIT_LCD
INIT_LCD:
CLR RS
MOV DATA, #38h
SETB EN
CLR EN
LCALL WAIT_LCD
CLR RS
MOV DATA, #0Eh
SETB EN
CLR EN
LCALL WAIT_LCD
CLR RS
MOV DATA, #06h
99
SETB EN
CLR EN
LCALL WAIT_LCD
RET
Having executed this code the LCD will be fully initialized and ready for us to send
display data to it.
When the LCD is first initialized, the screen should automatically be cleared by the
44780 controller. However, it's always a good idea to do things our self so that we can be
completely sure that the display is the way we want it. Thus, it's not a bad idea to clear the
screen as the very first operation after the LCD has been initialized.
CLEAR_LCD:
CLR RS
MOV DATA, #01h
SETB EN
CLR EN
LCALL WAIT_LCD
RET
How that we've written a "Clear Screen" routine, we may clear the LCD at any time by
simply executing an LCALL CLEAR_LCD.
Applications:
Medical equipment
Electronic test equipment
100
Industrial machinery Interface
Serial terminal
Advertising system
EPOS
Restaurant ordering systems
Gaming box
Security systems
R&D Test units
Climatizing units
PLC Interface
Simulators
Environmental monitoring
Lab development
Student projects
Home automation
PC external display
HMI operator interface.
101
Express PCB – for designing circuit
ARDUINO C compiler - for compilation part
Proteus 7 (Embedded C) – for simulation part
Express PCB has been used to design many PCBs (some layered and with
surface-mount parts. Print out PCB patterns and use the toner transfer method with an Etch
Resistant Pen to make boards. However, Express PCB does not have a nice print layout. Here
is the procedure to design in Express PCB and clean up the patterns so they print nicely.
Express PCB comes with a less then exciting list of parts. So before any project
is started head over to Audio logic and grab the additional parts by morsel, ppl, and tangent,
and extract them into your Express PCB directory. At this point start the program and get
ready to setup the workspace to suit your style.
102
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.
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 / bottom copper layer, and rotate buttons.
The zoom to selection tool: does just that.
The place pad: button allows you to place small soldier pads which are useful for
board connections or if a part is not in the part library but the part dimensions are
available. When this tool is selected the top toolbar will give you a large selection of
round holes, square holes and surface mount pads.
The place component: tool allows you to select a component from the top toolbar and
then by clicking in the workspace places that component in the orientation chosen
using the buttons next to the component list. The components can always be rotated
afterwards with the select tool if the orientation is wrong.
103
The place trace: tool allows you to place a solid trace on the board of varying
thicknesses. The top toolbar allows you to select the top or bottom layer to place the
trace on.
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.
Before starting a project there are several ways to design a PCB and one must
be chosen to suit the project’s needs.
When making a PCB you have the option of making a single sided board, or a
double sided board. Single sided boards are cheaper to produce and easier to etch, but much
harder to design for large projects. If a lot of parts are being used in a small space it may be
difficult to make a single sided board without jumpering over traces with a cable. While
there’s technically nothing wrong with this, it should be avoided if the signal travelling over
the traces is sensitive (e.g. audio signals).
104
When using a double sided board you must consider which traces should be on
what side of the board. Generally, put power traces on the top of the board, jumping only to
the bottom if a part cannot be soldiered onto the top plane (like a relay), and vice- versa.
Some projects like power supplies or amps can benefit from having a solid
plane to use for ground. In power supplies this can reduce noise, and in amps it minimizes
the distance between parts and their ground connections, and keeps the ground signal as
simple as possible. However, 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.
105
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.
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 Arduino 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.
Plug in your board and wait for Windows to begin it’s driver installation process
After a few moments, the process will fail, despite its best efforts
106
Click on the Start Menu, and open up the Control Panel
While in the Control Panel, navigate to System and Security. Next, click on System
Look under Ports (COM & LPT). You should see an open port named “Arduino UNO
(COMxx)”. If there is no COM & LPT section, look under ‘Other Devices’ for
‘Unknown Device’
Right click on the “Arduino UNO (COMxx)” or “Unknown Device” port and choose
the “Update Driver Software” option
Next, choose the “Browse my computer for Driver software” option
107
Finally, navigate to and select the Uno’s driver file, named “ArduinoUNO.inf”,
located in the “Drivers” folder of the Arduino Software download (not the “FTDI
USB Drivers” sub-directory). If you cannot see the .inf file, it is probably just hidden.
You can select the ‘drivers’ folder with the ‘search sub-folders’ option selected
instead.
Windows will finish up the driver installation from there
For earlier versions of the Arduino boards (e.g. Arduino Duemilanove, Nano, or Diecimila)
check out this page for specific directions.
After following the appropriate steps for your software install, we are now ready to test your
first program with your Arduino board!
Open the Blink example sketch by going to: File > Examples > 1.Basics > Blink
108
Select the type of Arduino board you’re using: Tools > Board > your board type
109
Select the serial/COM port that your Arduino is attached to: Tools > Port > COMxx
If you’re not sure which serial device is your Arduino, take a look at the available
ports, then unplug your Arduino and look again. The one that disappeared is your
Arduino.
With your Arduino board connected, and the Blink sketch open, press the ‘Upload’
button
110
After a second, you should see some LEDs flashing on your Arduino, followed by the
message ‘Done Uploading’ in the status bar of the Blink sketch.
If everything worked, the onboard LED on your Arduino should now be blinking!
You just programmed your first Arduino!
111
CHAPTER 5: PROJECT DESCRIPTION
WORKING PRINCIPLE
In our project we have used four LED’s in place of bulbs for the indication of street
lights. To detect the present of an object we have used LDR and a source of light. LDR is a
special type of resistance whose value depends on the brightness of the light, which is falling
on it. It has resistance of about 1 mega ohm when in total darkness, but a resistance of only
about 5k ohms when brightness illuminated. It responds to a large part of light spectrum.
112
In the present system, mostly the lightning-up of highways is done through High Intensity
Discharge lamps (HID), whose energy consumption is high and there is no specialized
mechanism to turn on the Highway light in the evening and switch off in the morning.
Its intensity cannot be controlled according to the requirement, so there is a need to switch to
an alternative method of lightning system, i.e., by using LEDs. This system is built to
overcome the present day drawback of HID lamps.
This system demonstrates the usage of LEDs (light emitting diodes) as light source and its
variable intensity control, according to the requirement. LEDs consume less power and its
life is more, as compared to conventional HID lamps.
The most important and interesting feature is its intensity that can be controlled according to
requirement during non-peak hours, which is not feasible in HID lamps. IR sensor is used to
vehicle movement according to that the high powered leds are glown that are nothing but
here street lights.
113
A cluster of LEDs are used to form a street light. The microcontroller contains programmable
instructions that controls the intensity of lights based on the PWM (Pulse width modulation)
signals generated.
ADVANTAGES
• Simple in construction
• Efficient method
• Less maintenance
DISADVANTAGES:
Applications
• This system can be practically implemented in real time to switch the street lights
automatically without manual switching.
114
CHAPTER 7: RESULTS
7.1 Result:
According to this project we can develop an advanced street light control system thereby
human effort and power wastage can be minimized.
7.2 Conclusion:
In coming days, this system will prove a great boon to the world, since it will save a lot of
electricity of power plants that gets wasted in illuminating the street lights.as the conventional
sources are depleting very fast, then its time to think of alternatives.
This project has scope of improvement and many enhancements can be done to make it more
reliable and interesting. This concept in future can be enhanced by integrating it with a solar
panel, which converts the solar intensity into corresponding voltage, and this energy is used
to feed the highway lights. All this will be possible, however, only through innovation, hard
work and above all proper use of technology.
For example, when a vehicle or a person meet with an accident street light remains on a
system can be introduced to inform the respective authorities. similarly, a system can be
introduced to inform the technicians about the default.
115
REFERENCES
1. www.wikipedia.com
2. www.allaboutcircuits.com
3. www.microchip.com
4. www.howstuffworks.com
Books referred:
5. Embedded C –Michael.J.Pont.
116