Sei sulla pagina 1di 136

PLEASE NOTE: THE MATTER

PRODUCED BELOW IS
REFERENCE MATERIAL ONLY
FOR PREPARING THE
PROJECT REPORT. IT IS NOT
THE COMPLETE PROJECT
REPORT.

A PROJECT REPORT ON

Android Application Controlled Remote Robot Operation


Submitted in partial fulfillment of the requirements
For the award of the degree
BACHELOR OF ENGINEERING
IN
____________________________________ ENGINEERING
SUBMITTED BY
--------------------

(--------------)

--------------------- (---------------)
--------------------- (---------------)

DEPARTMENT OF _______________________ ENGINEERING


__________COLLEGE OF ENGINEERING
AFFILIATED TO ___________ UNIVERSITY

CERTIFICATE

This is to certify that the dissertation work entitled Android

Application

Controlled Remote Robot Operation


is the work done by_______________________________________________
submitted in partial fulfillment for the award of BACHELOR OF ENGINEERING
(B.E) in Electronics and Communication

Engineering from_______ College of

Engineering affiliated to _________ University , Hyderabad .

________________
(Head of the department, ECE)

____________
(Assistant Professor)

EXTERNAL EXAMINER

ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any
task would be incomplete without the mentioning of the people whose constant
guidance and encouragement made it possible. We take pleasure in presenting
before you, our project, which is result of studied blend of both research and
knowledge.

We express our earnest gratitude to our internal guide, Assistant Professor


______________, Department of ECE, our project guide, for his constant support,
encouragement and guidance. We are grateful for his cooperation and his valuable
suggestions.

Finally, we express our gratitude to all other members who are involved either
directly or indirectly for the completion of this project.

DECLARATION
4

We, the undersigned, declare that the project entitled

Android Application Controlled Remote Robot Operation


, being submitted in partial fulfillment for the award of Bachelor of Engineering
Degree in Electronics and Communication Engineering, affiliated to _________
University, is the work carried out by us.

__________

_________

_________

__________

_________

_________

CONTENTS
1. ABSTRACT

PAGE NO.
10
5

2. INTRODUCTION TO EMBEDDED SYSTEMS


3.

13

BLOCK DIAGRAM OF PROJECT

4. HARDWARE REQUIREMENTS
4.1 VOLTAGE REGULATOR
4.2 MICROCONTROLLER (AT89S52/C51)
4.3 PUSH BUTTONS
4.4 MOTOR DRIVER L293D
4.5 DC MOTOR
4.6 ENCODER AND DECODER (HT12E, HT12D)
4.7 MICRO CONTROLLER AT89C2051
4.8 BATTERY
4.9 RF MODULE
4.10 BC547
4.11 1N4007
4.12 RESISTOR
4.13 CAPACITOR
4.14 METAL DETECTOR
5. SOFTWARE REQUIREMENTS

56

5.1 IDE

57

5.2 CONCEPT OF COMPILER

57

5.3 CONCEPT OF CROSS COMPILER

58

5.4 KEIL C CROSS COMPILER

59

5.5 BUILDING AN APPLICATION IN UVISION2

59

5.6 CREATING YOUR OWN APPLICATION IN UVISION2

59

5.7 DEBUGGING AN APPLICATION IN UVISION2

60

5.8 STARTING UVISION2 & CREATING A PROJECT

61
6

5.9 WINDOWS_ FILES

61

5.10 BUILDING PROJECTS & CREATING HEX FILES

61

5.11 CPU SIMULATION

62

5.12 DATABASE SELECTION

62

5.13 START DEBUGGING

63

5.14 DISASSEMBLY WINDOW

63

5.15 EMBEDDED C

64

6. SCHEMATIC DIAGRAM

66

6.1 DESCRIPTION

67

7. LAYOUT DIAGRAM

71

8. BILL OF MATERIALS

72

9. CODING

75

9.1 COMPILER

76

9.2 SOURCE CODE

84

10. HARDWARE TESTING

88

10.1 CONTINUITY TEST

88

10.2 POWER ON TEST

89

11. RESULTS

69

12. CONCLUSION

93

13. BIBLIOGRAPHY

94

LIST OF FIGURES

PAGE NO.

2(a) EMBEDDED DESIGN CALLS

19

2(b) V DIAGRAM

19

3 BLOCK DIAGRAM OF THE PROJECT


4.1 A TYPICAL TRANSFORMER

26

4.2(a) BLOCK DIAGRAM OF VOLTAGE


REGULATOR
4.2(c) RATING OF VOLTAGE REGULATOR
4.2(c) PERFORMANCE CHARACTERISTICS
OF VOLTAGE REGULATOR

21

4.5(a) BLOCK DIAGRAM OF AT89S52

24

4.5(b) PIN DIAGRAM OF AT89S52

25

4.5(c) OSCILLATOR CONNECTIONS

29

4.5(d) EXTERNAL CLOCK DRIVE CONFIG.

30

4.6(a) RELAY
4.6(b) INTERNAL CIRCUIT OF RELAY
4.2.6(c) ULN2003
4.7(a) PUSH ON BUTTON 51
4.7(b) TABLE FOR TYPES OF PUSH BUTTONS
4.8(a) L293D PINDIAGRAM
4.8(b) BLOCK DIAGRAM OF L293D
4.8(c) DC MOTOR
4.10(a) PIN DIAGRAM
4.10(b) BLOCK DIAGRAM
6 SCHEMATIC DIAGRAM
8

7 LAYOUT DIAGRAM

1. ABSTRACT
9

{PLEASE REFER CD}

10

2. INTRODUCTION TO EMBEDDED SYSTEMS

What is embedded system?


An Embedded System is a combination of computer hardware and software, and perhaps
additional mechanical or other parts, designed to perform a specific function. An embedded
system is a microcontroller-based, software driven, reliable, real-time control system,
autonomous, or human or network interactive, operating on diverse physical variables and in
diverse environments and sold into a competitive and cost conscious market.
An embedded system is not a computer system that is used primarily for processing, not a
software system on PC or UNIX, not a traditional business or scientific application. High-end
embedded & lower end embedded systems. High-end embedded system - Generally 32, 64 Bit
Controllers used with OS. Examples Personal Digital Assistant and Mobile phones etc .Lower
end embedded systems - Generally 8,16 Bit Controllers used with an minimal operating systems
and hardware layout designed for the specific purpose.
SYSTEM DESIGN CALLS:
11

Build
Operating
Digital
Integrated Download
circuit
Electronic design
Systems
design
Debug
Analog
Tools
Electronic design
Computer

Embedded Architecture
Sensors and Systems

measurements
Software
Engineering
Electric motors
and actuatorsControl
Data
Engineering
Communication

Embedded system design calls on many disciplines

Figure 2(a): Embedded system design calls

Har
Sy
EMBEDDED SYSTEM DESIGN CYCLE
dw
ste
are
m
Rapi
-inDef
d
the
init
Prot
ion
otypi
Lo
Targ
ng
op
eting
Tes
tin
g

Sy
ste
m
Tes
tin
g

12

Figuren 2(b) V Diagram


Characteristics of Embedded System

An embedded system is any computer system hidden inside a product other than a
computer.

They will encounter a number of difficulties when writing embedded system software in
addition to those we encounter when we write applications.

Throughput Our system may need to handle a lot of data in a short period of
time.

ResponseOur system may need to react to events quickly.

TestabilitySetting up equipment to test embedded software can be difficult.

DebugabilityWithout a screen or a keyboard, finding out what the software is


doing wrong (other than not working) is a troublesome problem.

Reliability embedded systems must be able to handle any situation without


human intervention.

Memory space Memory is limited on embedded systems, and you must make
the software and the data fit into whatever memory exists.

Program installation you will need special tools to get your software into
embedded systems.

Power consumption Portable systems must run on battery power, and the
software in these systems must conserve power.

Processor hogs computing that requires large amounts of CPU time can
complicate the response problem.

Cost Reducing the cost of the hardware is a concern in many embedded system
projects; software often operates on hardware that is barely adequate for the job.

Embedded systems have a microprocessor/ microcontroller and a memory. Some have a


serial port or a network connection. They usually do not have keyboards, screens or disk
drives.

APPLICATIONS
13

1)
2)
3)
4)
5)
6)
7)

Military and aerospace embedded software applications


C o mmu n i ca t io n App l ic a t io ns
I nd us t r ia l au to ma t io n a nd p ro ce s s c on tr o l s o ft w a re
Mastering the complexity of applications.
Reduction of product design time.
Real time processing of ever increasing amounts of data.
Intelligent, autonomous sensors.

CLASSIFICATION

Real Time Systems.

RTS is one which has to respond to events within a specified deadline.

A right answer after the dead line is a wrong answer.

RTS CLASSIFICATION

Hard Real Time Systems

Soft Real Time System

HARD REAL TIME SYSTEM

"Hard" real-time systems have very narrow response time.

Example: Nuclear power system, Cardiac pacemaker.

SOFT REAL TIME SYSTEM

"Soft" real-time systems have reduced constrains on "lateness" but still must operate very
quickly and repeatable.

Example: Railway reservation system takes a few extra seconds the data remains valid.

14

3. PROJECT BLOCK DIAGRAM


{PLEASE REFER CD}

15

4. HARDWARE REQUIREMENTS
HARDWARE COMPONENTS:

1. BATTERY
2. VOLTAGE REGULATOR
3. MICRO CONTROLLER AT89C2051
4. MICRO CONTROLLER AT89S8052
5. PUSH BUTTONS
6. L293D
7. DC MOTOR
8. RF MODULE
9. BC547
10. 1N4007
11. RESISTOR
12. CAPACITOR
13. METAL DETECTOR

16

4.1 BATTERY
An electrical battery is a combination of one or more electrochemical cells, used to convert
stored chemical energy into electrical energy. The battery has become a common power source
for many household and industrial applications.
Batteries may be used once and discarded, or recharged for years as in standby power
applications. Miniature cells are used to power devices such as hearing aids and wristwatches;
larger batteries provide standby power for telephone exchanges or computer data centers.
WORKING OF BATTERY:
A battery is a device that converts chemical energy directly to electrical energy. It
consists of a number of voltaic cells; each voltaic cell consists of two half cells connected in
series by a conductive electrolyte containing anions and cat ions. One half-cell includes
electrolyte and the electrode to which anions (negatively-charged ions) migrate, i.e. the anode or
negative electrode; the other half-cell includes electrolyte and the electrode to which cat ions
(positively-charged ions) migrate, i.e. the cathode or positive electrode. In the red ox reaction
that powers the battery, reduction (addition of electrons) occurs to cat ions at the cathode, while
oxidation (removal of electrons) occurs to anions at the anode. The electrodes do not touch each
other but are electrically connected by the electrolyte. Many cells use two half-cells with
different electrolytes. In that case each half-cell is enclosed in a container, and a separator that is
porous to ions but not the bulk of the electrolytes prevents mixing.
Each half cell has an electromotive force (or emf), determined by its ability to drive
electric current from the interior to the exterior of the cell. The net emf of the cell is the
difference between the emfs of its half-cells. Therefore, if the electrodes have emfs and, in other
words, the net emf is the difference between the reduction potentials of the half-reactions.
The electrical driving force or across the terminals of a cell is known as the terminal
voltage (difference) and is measured in volts. The terminal voltage of a cell that is neither
charging nor discharging is called the open-circuit voltage and equals the emf of the cell.
17

Because of internal resistance, the terminal voltage of a cell that is discharging is smaller in
magnitude than the open-circuit voltage and the terminal voltage of a cell that is charging
exceeds the open-circuit voltage. An ideal cell has negligible internal resistance, so it would
maintain a constant terminal voltage of until exhausted, then dropping to zero. If such a cell
maintained 1.5 volts and stored a charge of one Coulomb then on complete discharge it would
perform 1.5 Joule of work. In actual cells, the internal resistance increases under discharge, and
the open circuit voltage also decreases under discharge. If the voltage and resistance are plotted
against time, the resulting graphs typically are a curve; the shape of the curve varies according to
the chemistry and internal arrangement employed.
An electrical battery is one or more electrochemical cells that convert stored chemical energy
into electrical energy. Since the invention of the first battery (or "voltaic pile") in 1800 by
Alessandro Volta, batteries have become a common power source for many household and
industrial applications. According to a 2005 estimate, the worldwide battery industry generates
US$48 billion in sales each year, with 6% annual growth. There are two types of batteries:
primary batteries (disposable batteries), which are designed to be used once and discarded, and
secondary batteries (rechargeable batteries), which are designed to be recharged and used
multiple times. Miniature cells are used to power devices such as hearing aids and wristwatches;
larger batteries provide standby power for telephone exchanges or computer data centers.

Principle of operation
A battery is a device that converts chemical energy directly to electrical energy. It consists of a
number of voltaic cells; each voltaic cell consists of two half cells connected in series by a
conductive electrolyte containing anions and cations. One half-cell includes electrolyte and the
electrode to which anions (negatively charged ions) migrate, i.e., the anode or negative electrode;
the other half-cell includes electrolyte and the electrode to which cations (positively charged
ions) migrate, i.e., the cathode or positive electrode. In the redox reaction that powers the battery,
cations are reduced (electrons are added) at the cathode, while anions are oxidized (electrons are
removed) at the anode. The electrodes do not touch each other but are electrically connected by
18

the electrolyte. Some cells use two half-cells with different electrolytes. A separator between half
cells allows ions to flow, but prevents mixing of the electrolytes.
Each half cell has an electromotive force (or emf), determined by its ability to drive electric
current from the interior to the exterior of the cell. The net emf of the cell is the difference
between the emfs of its half-cells, as first recognized by Volta. Therefore, if the electrodes have
emfs

and

, then the net emf is

; in other words, the net emf is the difference

between the reduction potentials of the half-reactions. The electrical driving force or
across the terminals of a cell is known as the terminal voltage (difference) and is measured in
volts. The terminal voltage of a cell that is neither charging nor discharging is called the opencircuit voltage and equals the emf of the cell. Because of internal resistance, the terminal voltage
of a cell that is discharging is smaller in magnitude than the open-circuit voltage and the terminal
voltage of a cell that is charging exceeds the open-circuit voltage. An ideal cell has negligible
internal resistance, so it would maintain a constant terminal voltage of

until exhausted, then

dropping to zero. If such a cell maintained 1.5 volts and stored a charge of one coulomb then on
complete discharge it would perform 1.5 joule of work. In actual cells, the internal resistance
increases under discharge, and the open circuit voltage also decreases under discharge. If the
voltage and resistance are plotted against time, the resulting graphs typically are a curve; the
shape of the curve varies according to the chemistry and internal arrangement employed.
As stated above, the voltage developed across a cell's terminals depends on the energy release of
the chemical reactions of its electrodes and electrolyte. Alkaline and carbon-zinc cells have
different chemistries but approximately the same emf of 1.5 volts; likewise NiCd and NiMH
cells have different chemistries, but approximately the same emf of 1.2 volts. On the other hand
the high electrochemical potential changes in the reactions of lithium compounds give lithium
cells emfs of 3 volts or more.

4.2VOLTAGE REGULATOR 7805


Features
Output Current up to 1A
19

Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V


Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection
Description
The LM78XX/LM78XXA series of three-terminal positive regulators are available in the
TO-220/D-PAK package and with several fixed output voltages, making them useful in a Wide
range of applications. Each type employs internal current limiting, thermal shutdown and safe
operating area protection, making it essentially indestructible. If adequate heat sinking is
provided, they can deliver over 1A output Current. Although designed primarily as fixed voltage
regulators, these devices can be used with external components to obtain adjustable voltages and
currents.
Internal Block Diagram

FIG 4.2(a): BLOCK DIAGRAM OF VOLTAGE REGULATOR

20

Absolute Maximum Ratings

TABLE 4.2(b): RATINGS OF THE VOLTAGE REGULATOR


Typical Performance Characteristics

21

FIG 4.2(c): PERFORMANCE CHARACTERISTICS OF REGULATOR

4.3 MICROCONTROLLER AT89C2051


What is the 2051 microcontroller?
The 2051 is a 20 pin version of the 8051. It is a low-voltage, high-performance CMOS 8-bit
microcomputer with 2K bytes of Flash programmable and erasable read only memory. Atmel
manufactures the chip using high-density nonvolatile memory technology. The 2051 and is
compatible with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit
CPU with Flash on a monolithic chip, the Atmel 2051 is a powerful microcontroller. It provides a
very flexible, cost-effective solution to many embedded control applications.
Operational features of the 2051
The 2051 features Compatibility with MCS-51 Products, 2K Bytes of Reprogrammable
Flash Memory with 1,000 Write/Erase Cycles. The operating range of the 2051 is 2.7V to 6V.
Among these features, the 2051 also contains the following features:

Fully Static Operation: 0 Hz to 24 MHz

Two-level Program Memory Lock


22

128 x 8-bit Internal RAM

15 Programmable I/O Lines

Two 16-bit Timer/Counters

Six Interrupt Sources

Programmable Serial UART Channel

Direct LED Drive Outputs

On-chip Analog Comparator

Low-power Idle and Power-down Modes

2051 Pin-out and Description

Fig:4.6: Pin Diagram of AT89C2051


Pin Description
VCC:
Supplies voltage and power.
GND
23

Ground.
Port 1
Port 1 is an 8-bit bi-directional I/O port. Port pins P1.2 to P1.7 provide internal pull- ups.
P1.0 and P1.1 require external pull-ups. P1.0 and P1.1 also serve as the positive input (AIN0)
and the negative input (AIN1), respectively, of the on-chip precision analog comparator. The Port
1 output buffers can sink 20mA and can drive LED displays directly. When 1s are written to Port
1 pins, they can be used as inputs. When pins P1.2 to P1.7 are used as inputs and are externally
pulled low, they will source current (IIL) because of the internal pull-ups. Port 1 also receives
code data during Flash programming and verification.
Port 3
Port 3 pins P3.0 to P3.5, P3.7 are seven bi-directional I/O pins with internal pull-ups.
P3.6 is hard-wired as an input to the output of the on-chip comparator and is not accessible as a
general purpose I/O pin. The Port 3 output buffers can sink 20mA. When 1s are written to Port 3
pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins
that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also
serves the functions of various special features of the AT89C2051 as listed below:

Port 3 also receives some control signals for Flash programming and verification.
RST
Reset input. All I/O pins are reset to 1s as soon as RST goes high. Holding the RST pin
high for two machine cycles while the oscillator is running resets the device.
Restrictions on Instructions
24

The AT89C2051 and is the economical and cost-effective member of Atmels family of
microcontrollers. Therefore, it contains only 2K bytes of flash program memory. It is fully
compatible with the MCS-51 architecture, and can be programmed using the MCS-51 instruction
set. However, there are a few considerations one must keep in mind when utilizing certain
instructions to program this device. All the instructions related to jumping or branching should
be restricted such that the destination address falls within the physical program memory space of
the device, which is 2K for the AT89C2051. This should be the responsibility of the software
programmer. For example, LJMP 7E0H
would be a valid instruction for the AT89C2051 (with 2K of memory), whereas LJMP 900H
would not.
1. Branching instructions:
LCALL, LJMP, ACALL, AJMP, SJMP, JMP @A+DPTR
These unconditional branching instructions will execute correctly as long as the
programmer keeps in mind that the destination branching address must fall within the physical
boundaries of the program memory size (locations 00H to 7FFH for the 89C2051). Violating the
physical space limits may cause unknown program behavior.
CJNE [...], DJNZ [...], JB, JNB, JC, JNC, JBC, JZ, JNZ
With these conditional branching instructions the same rule above applies. Again, violating the
memory boundaries may cause erratic execution.
For applications involving interrupts the normal interrupt service routine address locations of the
80C51 family architecture have been preserved.
2. MOVX-related instructions, Data Memory:
The 2051 contains 128 bytes of internal data memory. Thus, in the 2051 the stack depth is
limited to 128 bytes, the amount of available RAM. External DATA
memory access is not supported in this device, nor is external PROGRAM memory execution.
Therefore, no MOVX [...] instructions should be included in the program. A typical 80C51
assembler will still assemble instructions,

25

even if they are written in violation of the restrictions mentioned above. It is the responsibility of
the controller user to know the physical features and limitations of the device being used and
adjust the instructions used correspondingly.

BLOCK DIAGRAM OF 2051

26

27

Power-down Mode
In the power down mode the oscillator is stopped, and the instruction that invokes power
down is the last instruction executed. The on-chip RAM and Special Function Registers retain
their values until the power down model is terminated. The only exit from power down is a
hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should
not be activated before VCC is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize.
P1.0 and P1.1 should be set to 0 if no external pull-ups are used, or set to 1 if external pullups are used.
The 2051 is a low voltage (2.7V - 6V), high performance CMOS 8-bit microcontroller with 2
Kbytes of Flash programmable and erasable read only memory (PEROM). This device is
compatible with the industry standard 8051 instruction set and pin-out. The 2051 is a powerful
microcomputer which provides a highly flexible and cost effective solution to many embedded
control applications.
In addition, the 2051 is designed with static logic for operation down to zero frequency and
supports two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The
Power Down Mode saves the RAM contents but freezes the oscillator disabling all other chip
functions until the next hardware reset.
Idle Mode
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active.
The mode is invoked by software. The content of the on-chip RAM and all the special functions
registers remain unchanged during this mode.
The idle mode can be terminated by any enabled interrupt or by a hardware reset. P1.0
and P1.1 should be set to '0' if no external pull ups are used, or set to '1' if external pull ups are
used. It should be noted that when idle is terminated by a hardware reset, the device normally
28

resumes program execution, from where it left off, up to two machine cycles before the internal
reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but
access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a
port pin when Idle is terminated by reset, the instruction following the one that invokes Idle
should not be one that writes to a port pin or to external memory.

4.4 MICROCONTROLLER AT89S52

The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K


bytes of in-system programmable Flash memory. The device is manufactured using Atmels
high-density non volatile memory technology and is compatible with the industry standard
80C51 instruction set and pin out. The on-chip Flash allows the program memory to be
reprogrammed in-system or by a conventional non volatile memory programmer. By combining
a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel
AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective
solution to many embedded control applications. The AT89S52 provides the following standard
features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers,
three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port,
on-chip oscillator, and clock circuitry.
In addition, the AT89S52 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode stops the
CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue
functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling
all other chip functions until the next interrupt or hardware reset.
Features:
Compatible with MCS-51 Products
8K Bytes of In-System Programmable (ISP) Flash Memory
Endurance: 10,000 Write/Erase Cycles
29

4.0V to 5.5V Operating Range


Fully Static Operation: 0 Hz to 33 MHz
Three-level Program Memory Lock
256 x 8-bit Internal RAM
32 Programmable I/O Lines
Three 16-bit Timer/Counters
Eight Interrupt Sources
Full Duplex UART Serial Channel
Low-power Idle and Power-down Modes
Interrupt Recovery from Power-down Mode
Watchdog Timer
Dual Data Pointer
Power-off Flag
Fast Programming Time
Flexible ISP Programming (Byte and Page Mode)
Green (Pb/Halide-free) Packaging Option.

Block Diagram of AT89S52:

30

FIG 4.5(A): BLOCK DIAGRAM OF AT89S52

Pin Configurations of AT89S52

31

FIG 4.5(b): PIN DIAGRAM OF AT89S52

Pin Description:
VCC:
Supply voltage.
GND:
Ground
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink
eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance
inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during
accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also
receives the code bytes during Flash programming and outputs the code bytes during program
verification. External pull-ups are required during program verification.
Port 1:
32

Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers
can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be
configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2
trigger input (P1.1/T2EX).
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers
can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled
low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address
byte during fetches from external program memory and during accesses to external data memory
that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pullups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX
@ RI), Port 2 emits the contents of the P2 Special Function Register.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers
can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the
internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled
low will source current (IIL) because of the pull-ups.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The
DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state
of bit DISRTO, the RESET HIGH out feature is enabled.
ALE/PROG:

33

Address Latch Enable (ALE) is an output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG) during
Flash programming.
In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and
may be used for external timing or clocking purposes. Note, however, that one ALE pulse is
skipped during each access to external data memory.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice each
machine cycle, except that two PSEN activations are skipped during each access to external data
memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH. Note,
however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be
strapped to VCC for internal program executions. This pin also receives the 12-volt
programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
Output from the inverting oscillator amplifier.
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier
which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz
crystal or ceramic resonator may be used. To drive the device from an external clock source,
XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2. There are no
34

requirements on the duty cycle of the external clock signal, since the input to the internal
clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high
and low time specifications must be observed.

FIG 4.5(c): Oscillator Connections

FIG 4.5(d): External Clock Drive Configuration

Idle Mode
In idle mode, the CPU puts itself to sleep while all the on chip peripherals remain active. The
mode is invoked by software. The content of the on-chip RAM and all the special functions
registers remain unchanged during this mode. The idle mode can be terminated by any enabled
interrupt or by a hardware reset.
Power down Mode
In the power down mode the oscillator is stopped, and the instruction that invokes power
down is the last instruction executed. The on-chip RAM and Special Function Registers retain
35

their values until the power down mode is terminated. The only exit from power down is a
hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should
not be activated before VCC is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize

4.5 PUSH BUTTONS

A push-button (also spelled pushbutton) or simply button is a simple switch mechanism


for controlling some aspect of a machine or a process. Buttons are typically made out of hard
material, usually plastic or metal. The surface is usually flat or shaped to accommodate the
human finger or hand, so as to be easily depressed or pushed. Buttons are most often biased
switches, though even many un-biased buttons (due to their physical nature) require a spring to
return to their un-pushed state. Different people use different terms for the "pushing" of the
button, such as press, depress, mash, and punch.
Uses:
In industrial and commercial applications push buttons can be linked together by a mechanical
linkage so that the act of pushing one button causes the other button to be released. In this way, a
stop button can "force" a start button to be released. This method of linkage is used in simple
manual operations in which the machine or process have no electrical circuits for control.
Pushbuttons are often color-coded to associate them with their function so that the
operator will not push the wrong button in error. Commonly used colors are red for stopping the
machine or process and green for starting the machine or process.
Red pushbuttons can also have large heads (mushroom shaped) for easy operation and to
facilitate the stopping of a machine. These pushbuttons are called emergency stop buttons and
36

are mandated by the electrical code in many jurisdictions for increased safety. This large
mushroom shape can also be found in buttons for use with operators who need to wear gloves for
their work and could not actuate a regular flush-mounted push button. As an aid for operators
and users in industrial or commercial applications, a pilot light is commonly added to draw the
attention of the user and to provide feedback if the button is pushed. Typically this light is
included into the center of the pushbutton and a lens replaces the pushbutton hard center disk.
The source of the energy to illuminate the light is not directly tied to the contacts on the
back of the pushbutton but to the action the pushbutton controls. In this way a start button when
pushed will cause the process or machine operation to be started and a secondary contact
designed into the operation or process will close to turn on the pilot light and signify the action
of pushing the button caused the resultant process or action to start.
In popular culture, the phrase "the button" refers to a (usually fictional) button that a
military or government leader could press to launch nuclear weapons.
Push to ON button:

Fig 4.7(a): push on button


Initially the two contacts of the button are open. When the button is pressed they become
connected. This makes the switching operation using the push button.

37

4.6 MOTOR DRIVER (L293D)


Features:
Wide supply-voltage range: 4.5V to 36V
Separate input- logic supply
Internal ESD protection
Thermal shutdown
High-Noise-Immunity input
Functional Replacements for SGS L293 and SGS L293D
Output current 1A per channel (600 mA for L293D)
Peak output current 2 A per channel (1.2 A for L293D)
Output clamp diodes for Inductive Transient Suppression(L293D)

DESCRIPTION:
L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as
current amplifiers since they take a low-current control signal and provide a higher-current
signal. This higher current signal is used to drive the motors.
L293D contains two inbuilt H-bridge driver circuits. In its common mode of operation,
two DC motors can be driven simultaneously, both in forward and reverse direction. The motor
operations of two motors can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic
00 or 11 will stop the corresponding motor. Logic 01 and 10 will rotate it in clockwise and
anticlockwise directions, respectively.
Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start
operating. When an enable input is high, the associated driver gets enabled. As a result, the
outputs become active and work in phase with their inputs. Similarly, when the enable input is
low, that driver is disabled, and their outputs are off and in the high-impedance state.
38

Block diagram:

FIG: BLOCK DIAGRAM OF L293D

Pin Diagram:

39

Pin description:

40

4.7 DC MOTOR
What is DC Motor?
A DC motor is an electric motor that runs on direct current (DC) electricity. In any electric
motor, operation is based on simple electromagnetism. A current-carrying conductor generates a
magnetic field; when this is then placed in an external magnetic field, it will experience a force
proportional to the current in the conductor, and to the strength of the external magnetic field. As
you are well aware of from playing with magnets as a kid, opposite (North and South) polarities
attract, while like polarities (North and North, South and South) repel. The internal configuration
of a DC motor is designed to harness the magnetic interaction between a current-carrying
conductor and an external magnetic field to generate rotational motion.
Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet
or winding with a "North" polarization, while green represents a magnet or winding with a
"South" polarization).

Fig.4.8(c) DC motor

Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator,
field magnet(s), and brushes. In most common DC motors, the external magnetic field is
produced by high-strength permanent magnets1. The stator is the stationary part of the motor -this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor
rotates with respect to the stator. The rotor consists of windings (generally on a core), the
windings being electrically connected to the commutator. The above diagram shows a common
motor layout -- with the rotor inside the stator (field) magnets.
41

The geometry of the brushes, commutator contacts, and rotor windings are such that
when power is applied, the polarities of the energized winding and the stator magnet(s) are
misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As
the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the
next winding. Given our example two-pole motor, the rotation reverses the direction of current
through the rotor winding, leading to a "flip" of the rotor's magnetic field, driving it to continue
rotating.

In real life, though, DC motors will always have more than two poles (three is a very
common number). In particular, this avoids "dead spots" in the commutator. You can imagine
how with our example two-pole motor, if the rotor is exactly at the middle of its rotation
(perfectly aligned with the field magnets), it will get "stuck" there. Meanwhile, with a two-pole
motor, there is a moment where the commutator shorts out the power supply (i.e., both brushes
touch both commutator contacts simultaneously). This would be bad for the power supply, waste
energy, and damage motor components as well. Yet another disadvantage of such a simple motor
is that it would exhibit a high amount of torque "ripple".
So since most small DC motors are of a three-pole design, let's tinker with the workings of one
via an interactive animation (JavaScript required):

42

You'll notice a few things from this -- namely, one pole is fully energized at a time (but
two others are "partially" energized). As each brush transitions from one commutator contact to
the next, one coil's field will rapidly collapse, as the next coil's field will rapidly charge up (this
occurs within a few microsecond). We'll see more about the effects of this later, but in the
meantime you can see that this is a direct result of the coil windings' series wiring.

4.8 RF COMMUNICATION
General physics of radio signals
RF communication works by creating electromagnetic waves at a source and being able to pick
up those electromagnetic waves at a particular destination. These electromagnetic waves travel
through the air at near the speed of light. The wavelength of an electromagnetic signal is
inversely proportional to the frequency; the higher the frequency, the shorter the wavelength.
Frequency is measured in Hertz (cycles per second) and radio frequencies are measured in
kilohertz (KHz or thousands of cycles per second), megahertz (MHz or millions of cycles per
second) and gigahertz (GHz or billions of cycles per second). Higher frequencies result in shorter
wavelengths. The wavelength for a 900 MHz device is longer than that of a 2.4 GHz device.
In general, signals with longer wavelengths travel a greater distance and penetrate through, and
around objects better than signals with shorter wavelengths.
43

How does an RF communication system work?


Imagine an RF transmitter wiggling an electron in one location. This wiggling electron causes a
ripple effect, somewhat akin to dropping a pebble in a pond. The effect is an electromagnetic
(EM) wave that travels out from the initial location resulting in electrons wiggling in remote
locations. An RF receiver can detect this remote electron wiggling.
The RF communication system then utilizes this phenomenon by wiggling electrons in a specific
pattern to represent information. The receiver can make this same information available at a
remote location; communicating with no wires.
In most wireless systems, a designer has two overriding constraints: it must operate over a
certain distance (range) and transfer a certain amount of information within a time frame (data
rate). Then the economics of the system must work out (price) along with acquiring government
agency approvals (regulations and licensing).
How is range determined?
In order to accurately compute range it is essential to understand a few terms:
dB - Decibels
Decibels are logarithmic units that are often used to represent RF power. To convert from watts
to dB: Power in dB = 10* (log x) where x is the power in watts.
Another unit of measure that is encountered often is dBm (dB milliwatts). The conversion
formula for it is Power in dBm = 10* (log x) where x is the power in milliwatts.
Line-of-site (LOS)
Line-of-site when speaking of RF means more than just being able to see the receiving antenna
from the transmitting antenna. In, order to have true line-of-site no objects (including trees,
houses or the ground) can be in the Fresnel zone. The Fresnel zone is the area around the visual

44

line-of-sight that radio waves spread out into after they leave the antenna. This area must be clear
or else signal strength will weaken.
There are essentially two parameters to look at when trying to determine range.

45

Transmit Power
Transmit power refers to the amount of RF power that comes out of the antenna port of the radio.
Transmit power is usually measured in Watts, milliwatts or dBm.
Receiver sensitivity
Receiver sensitivity refers to the minimum level signal the radio can demodulate. It is convenient
to use an example with sound waves; Transmit power is how loud someone is yelling and receive
sensitivity would be how soft a voice someone can hear. Transmit power and receive sensitivity
together constitute what is known as link budget. The link budget is the total amount of signal
attenuation you can have between the transmitter and receiver and still have communication
occur.
Example:
Maxstream
Maxstream

9XStream
9XStream

TXPower:
RXSensitivity:

20dBm
-110dBm

Total Link budget: 130dBm.


For line-of-site situations, a mathematical formula can be used to figure out the approximate
range for a given link budget. For non line-of-site applications range calculations are more
complex because of the various ways the signal can be attenuated.
RF communications and data rate
Data rates are usually dictated by the system - how much data must be transferred and how often
does the transfer need to take place. Lower data rates, allow the radio module to have better
receive sensitivity and thus more range. In the XStream modules the 9600 baud module has 3dB
more sensitivity than the 19200 baud module. This means about 30% more distance in line-ofsight conditions. Higher data rates allow the communication to take place in less time, potentially
using less power to transmit.

46

RF MODULES

What is RF?
RF itself has become synonymous with wireless and high-frequency signals, describing
anything from AM radio between 535 kHz and 1605 kHz to computer local area networks
(LANs) at 2.4 GHz. However, RF has traditionally defined frequencies from a few kHz to
roughly 1 GHz. If one considers microwave frequencies as RF, this range extends to 300 GHz.
The following two tables outline the various nomenclatures for the frequency bands. The third
table outlines some of the applications at each of the various frequency bands.
Table 1: Frequency Band Designations

Features
Range in open space(Standard Conditions) : 100 Meters
RX Receiver Frequency : 433 MHz
RX Typical Sensitivity : 105 Dbm
RX Supply Current : 3.5 mA
RX IF Frequency : 1MHz
Low Power Consumption
Easy For Application
RX Operating Voltage : 5V
47

TX Frequency Range : 433.92 MHz


TX Supply Voltage : 3V ~ 6V
TX Out Put Power : 4 ~ 12 Dbm

RF TRANSMITTER:

Fig 4.9(a): 315/433 MHz TRANSMITTER


General Description:
The ST-TX01-ASK is an ASK Hybrid transmitter module. ST-TX01-ASK is designed by the
Saw Resonator, with an effective low cost, small size, and simple-to-use for designing.
Frequency Range: 315 / 433.92 MHZ.
Supply Voltage: 3~12V.
Output Power: 4~16dBm
Circuit Shape: Saw

PIN Description

48

49

Absolute Maximum Ratings


Parameter

Symbol

Specification

Condition
Min.

Operation
Voltage

Output power

3V

Psens

To
n

Temperature

10

16

dBm

Supply
1Kbps Data current
Rate
434MHz

11

20

57

mA

10

16

dBm

11

22

59

mA

DATA 5V

Data start out by Vcc turn


on

Data Rate
Input duty

Max.

315MHz

Supply
current
Tune on Time

Typic
al
5V
12V

Unit

Vcc=5V; 1kbps data rate

10

20

200

1k

ms
3k

bps

40

60

-20

+80

Applications
*Wireless security systems
*Car Alarm systems
*Remote controls.
*Sensor reporting
*Automation systems

50

RF RECEIVER:

Fig.4.9(b):315/434 MHz ASK RECEIVER


General Description:
The ST-RX02-ASK is an ASK Hybrid receiver module. A effective low cost solution for using at
315/433.92 MHZ. The circuit shape of ST-RX02-ASK is L/C. Receiver Frequency: 315 / 433.92 MHZ
Typical sensitivity: -105dBm
Supply Current: 3.5mA IF Frequency: 1MHz

Features:

Low power consumption


Easy for application
Operation temperature range: 2070
Operation voltage: 5 Volts.
Available frequency at: 315/434 MHz

Pin Description

51

RF ENCODER AND DECODER


RF ENCODER HT 12E:
Features

Operating voltage is 2.4V~12V for the HT12E.

Low power and high noise immunity CMOS technology

Low standby current: 0.1_A (typ.) at VDD=5V

HT12A with a 38kHz carrier for infrared transmission medium

Minimum transmission words are Four words for the HT12E

Built-in oscillator needs only 5% resistor

Data code has positive polarity

Minimal external components

HT12A/E: 18-pin DIP/20-pin SOP package

Applications

Burglar alarm system

Smoke and fire alarm system

Garage door controllers

Car door controllers

Car alarm system

Security system

Cordless telephones

Other remote control systems


GENERAL DESCRIPTION:
The RF encoders are a series of CMOS LSIs for remote control system m applications.
They are capable of encoding information which consists of N address bits and 12_N data
bits. Each address/ data input can be set to one of the two logic states. The programmed
52

addresses/data are transmitted together with the header bits via an RF or an infrared
transmission medium. Upon receipt of a trigger signal. The capability to select a TE trigger
on the HT12E or a DATA trigger on the HT12A further enhances the application for
flexibility of the 2^12 series of encoders. The HT12A additionally provides a 38 kHz carrier
for infrared systems.

FIG4.9 (a): BLOCK DIAGRAM OF HT 12E

53

PIN DIAGRAMS

FIG 4.9(b): PIN DIAGRAM OF HT12E


PIN DESCRIPTION:

FIG4.9(c): PIN DESCRIPTION OF HT12E

54

RF DECODER(HT 12D):
Features

Operating voltage: 2.4V~12V.

Low power and high noise immunity CMOS technology.

Low standby current.

Capable of decoding 12 bits of information.

Binary address setting.

Received codes are checked 3 times.

Address/Data number combination for HT12D: 8 address bits and 4 data bits.

Built-in oscillator needs only 5% resistor

Valid transmission indicator

Easy interface with an RF or an infrared transmission medium

Minimal external components

Pair with Holteks 212 series of encoders

18-pin DIP, 20-pin SOP package


Applications

Burglar alarm system

Smoke and fire alarm system

Garage door controllers

Car door controllers

Car alarm system

Security system

Cordless telephones

Other remote control systems


General Description

55

The 212 decoders are a series of CMOS LSIs for remote control system applications.
They are paired with Holteks 212 series of encoders (refer to the encoder/decoder cross
reference table). For proper operation, a pair of encoder/decoder with the same number of
addresses and data format should be chosen. The decoders receive serial addresses and data from
a programmed 212 series of encoders that are transmitted by a carrier using an RF or an IR
transmission medium. They compare the serial input data three times continuously with their
local addresses. If no error or unmatched codes are found; the input data codes are decoded and
then transferred to the output pins. The VT pin also goes high to indicate a valid transmission.
The 212 series of decoders are capable of decoding information that consists of N bits of address
and 12_N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data
bits, and HT12F is used to decode 12 bits of address information.

FIG4.9 (d): BLOCK DIAGRAM OF HT 12D

56

PIN DIAGRAMS:

FIG 4.9(e): PIN DIAGRAM

PIN DESCRIPTION:

FIG 4.9(f): PIN DESCRIPTION


57

4.9 BC 547
TECHNICAL SPECIFICATIONS:
The BC547 transistor is an NPN Epitaxial Silicon Transistor. The BC547 transistor is a
general-purpose transistor in small plastic packages. It is used in general-purpose switching and
amplification BC847/BC547 series 45 V, 100 mA NPN general-purpose transistors.

BC 547 TRANSISTOR PINOUTS

We know that the transistor is a "CURRENT" operated device and that a large current
(Ic) flows freely through the device between the collector and the emitter terminals. However,
this only happens when a small biasing current (Ib) is flowing into the base terminal of the
transistor thus allowing the base to act as a sort of current control input. The ratio of these two
currents (Ic/Ib) is called the DC Current Gain of the device and is given the symbol of hfe or
nowadays Beta, (). Beta has no units as it is a ratio. Also, the current gain from the emitter to
the collector terminal, Ic/Ie, is called Alpha, (), and is a function of the transistor itself. As the
emitter current Ie is the product of a very small base current to a very large collector current the
value of this parameter is very close to unity, and for a typical low-power signal transistor this
value ranges from about 0.950 to 0.999.
58

An NPN Transistor Configuration

4.10 1N4007

Diodes are used to convert AC into DC these are used as half wave rectifier or full wave
rectifier. Three points must he kept in mind while using any type of diode.
1.

Maximum forward current capacity

2.

Maximum reverse voltage capacity

3.

Maximum forward voltage capacity

59

Fig: 1N4007 diodes


The number and voltage capacity of some of the important diodes available in the market
are as follows:

Diodes of number IN4001, IN4002, IN4003, IN4004, IN4005, IN4006 and IN4007 have
maximum reverse bias voltage capacity of 50V and maximum forward current capacity of 1
Amp.

Diode of same capacities can be used in place of one another. Besides this diode of more
capacity can be used in place of diode of low capacity but diode of low capacity cannot be used
in place of diode of high capacity. For example, in place of IN4002; IN4001 or IN4007 can be
used but IN4001 or IN4002 cannot be used in place of IN4007.The diode BY125made by
company BEL is equivalent of diode from IN4001 to IN4003. BY 126 is equivalent to diodes
IN4004 to 4006 and BY 127 is equivalent to diode IN4007.

Fig:PN Junction diode


60

PN JUNCTION OPERATION
Now that you are familiar with P- and N-type materials, how these materials are joined
together to form a diode, and the function of the diode, let us continue our discussion with the
operation of the PN junction. But before we can understand how the PN junction works, we must
first consider current flow in the materials that make up the junction and what happens initially
within the junction when these two materials are joined together.

Current Flow in the N-Type Material


Conduction in the N-type semiconductor, or crystal, is similar to conduction in a copper
wire. That is, with voltage applied across the material, electrons will move through the crystal
just as current would flow in a copper wire. This is shown in figure 1-15. The positive potential
of the battery will attract the free electrons in the crystal. These electrons will leave the crystal
and flow into the positive terminal of the battery. As an electron leaves the crystal, an electron from
the negative terminal of the battery will enter the crystal, thus completing the current path.

Therefore, the majority current carriers in the N-type material (electrons) are repelled by the
negative side of the battery and move through the crystal toward the positive side of the battery.

Current Flow in the P-Type Material


Current flow through the P-type material is illustrated. Conduction in the P material is by
positive holes, instead of negative electrons. A hole moves from the positive terminal of the P
material to the negative terminal. Electrons from the external circuit enter the negative terminal
of the material and fill holes in the vicinity of this terminal. At the positive terminal, electrons are
removed from the covalent bonds, thus creating new holes. This process continues as the steady
stream of holes (hole current) moves toward the negative terminal
61

4.11 RESISTORS

A resistor is a two-terminal electronic component designed to oppose an electric current by


producing a voltage drop between its terminals in proportion to the current, that is, in accordance
with Ohm's law:
V = IR
Resistors are used as part of electrical networks and electronic circuits. They are extremely
commonplace 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 resistors are their resistance and the power they can
dissipate. Other characteristics include temperature coefficient, noise, and inductance. Less wellknown 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 depends
upon the materials constituting the resistor as well as its physical dimensions; it's determined by
design.
Resistors can be integrated into hybrid and printed circuits, as well as integrated circuits. Size,
and position of leads (or terminals) are relevant to equipment designers; resistors must be
physically large enough not to overheat when dissipating their power.

62

A resistor is a two-terminal passive electronic component which implements electrical


resistance as a circuit element. When a voltage V is applied across the terminals of a resistor, a
current I will flow through the resistor in direct proportion to that voltage. The reciprocal of the
constant of proportionality is known as the resistance R, since, with a given voltage V, a larger
value of R further "resists" the flow of current I as given by Ohm's law:

Resistors are common 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 nickelchrome). Resistors are also implemented within integrated circuits, particularly analog devices,
and can also be integrated into hybrid and printed circuits.
The electrical functionality of a resistor is specified by its resistance: common
commercial resistors are manufactured over a range of more than 9 orders of magnitude. When
specifying that resistance in an electronic design, the required precision of the resistance may
require attention to the manufacturing tolerance of the chosen resistor, according to its specific
application. The temperature coefficient of the resistance may also be of concern in some
precision applications. Practical resistors are also specified as having a maximum power rating
which must exceed the anticipated power dissipation of that resistor in a particular circuit: this is
mainly of concern in power electronics applications. Resistors with higher power ratings are
63

physically larger and may require heat sinking. In a high voltage circuit, attention must
sometimes be paid to the rated maximum working voltage of the resistor.
The series inductance of a practical resistor causes its behavior to depart from ohms law;
this specification can be important in some high-frequency applications for smaller values of
resistance. In a low-noise amplifier or pre-amp the noise characteristics of a resistor may be an
issue. The unwanted inductance, excess noise, and temperature coefficient are mainly dependent
on the technology used in manufacturing the resistor. They are not normally specified
individually for a particular family of resistors manufactured using a particular technology. A
family of discrete resistors is also characterized according to its form factor, that is, the size of
the device and position of its leads (or terminals) which is relevant in the practical manufacturing
of circuits using them.

Units
The ohm (symbol: ) is the SI unit of electrical resistance, named after Georg Simon
Ohm. An ohm is equivalent to a volt per ampere. Since resistors are specified and manufactured
over a very large range of values, the derived units of milliohm (1 m = 103 ), kilohm (1 k =
103 ), and megohm (1 M = 106 ) are also in common usage.
The reciprocal of resistance R is called conductance G = 1/R and is measured in Siemens
(SI unit), sometimes referred to as a mho. Thus a Siemens is the reciprocal of an ohm: S = 1.
Although the concept of conductance is often used in circuit analysis, practical resistors are
always specified in terms of their resistance (ohms) rather than conductance.

4.12 CAPACITORS

A capacitor or condenser is a passive electronic component consisting of a pair of conductors


separated by a dielectric. When a voltage potential difference exists between the conductors, an
64

electric field is present in the dielectric. This field stores energy and produces a mechanical force
between the plates. The effect is greatest between wide, flat, parallel, narrowly separated
conductors.
An ideal capacitor is characterized by a single constant value, capacitance, which is
measured in farads. This is the ratio of the electric charge on each conductor to the potential
difference between them. In practice, the dielectric between the plates passes a small amount of
leakage current. The conductors and leads introduce an equivalent series resistance and the
dielectric has an electric field strength limit resulting in a breakdown voltage.
The properties of capacitors in a circuit may determine the resonant frequency and quality factor
of a resonant circuit, power dissipation and operating frequency in a digital logic circuit, energy
capacity in a high-power system, and many other important aspects.

A capacitor (formerly known as condenser) is a device for storing electric charge. The
forms of practical capacitors vary widely, but all contain at least two conductors separated by a
non-conductor. Capacitors used as parts of electrical systems, for example, consist of metal foils
separated by a layer of insulating film.
65

Capacitors are widely used in electronic circuits for blocking direct current while
allowing alternating current to pass, in filter networks, for smoothing the output of power
supplies, in the resonant circuits that tune radios to particular frequencies and for many other
purposes.
A capacitor is a passive electronic component consisting of a pair of conductors separated
by a dielectric (insulator). When there is a potential difference (voltage) across the conductors, a
static electric field develops in the dielectric that stores energy and produces a mechanical force
between the conductors. An ideal capacitor is characterized by a single constant value,
capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the
potential difference between them.
The capacitance is greatest when there is a narrow separation between large areas of
conductor, hence capacitor conductors are often called "plates", referring to an early means of
construction. In practice the dielectric between the plates passes a small amount of leakage
current and also has an electric field strength limit, resulting in a breakdown voltage, while the
conductors and leads introduce an undesired inductance and resistance.

Theory of operation
Capacitance

Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric


(orange) reduces the field and increases the capacitance.
66

A simple demonstration of a parallel-plate capacitor


A capacitor consists of two conductors separated by a non-conductive region. The nonconductive region is called the dielectric or sometimes the dielectric medium. In simpler terms,
the dielectric is just an electrical insulator. Examples of dielectric mediums are glass, air, paper,
vacuum, and even a semiconductor depletion region chemically identical to the conductors. A
capacitor is assumed to be self-contained and isolated, with no net electric charge and no
influence from any external electric field. The conductors thus hold equal and opposite charges
on their facing surfaces, and the dielectric develops an electric field. In SI units, a capacitance of
one farad means that one coulomb of charge on each conductor causes a voltage of one volt
across the device.
The capacitor is a reasonably general model for electric fields within electric circuits. An ideal
capacitor is wholly characterized by a constant capacitance C, defined as the ratio of charge Q
on each conductor to the voltage V between them:

Sometimes charge build-up affects the capacitor mechanically, causing its capacitance to vary. In
this case, capacitance is defined in terms of incremental changes:

67

Energy storage
Work must be done by an external influence to "move" charge between the conductors in a
capacitor. When the external influence is removed the charge separation persists in the electric
field and energy is stored to be released when the charge is allowed to return to its equilibrium
position. The work done in establishing the electric field, and hence the amount of energy stored,
is given by:

Current-voltage relation
The current i(t) through any component in an electric circuit is defined as the rate of flow of a
charge q(t) passing through it, but actual charges, electrons, cannot pass through the dielectric
layer of a capacitor, rather an electron accumulates on the negative plate for each one that leaves
the positive plate, resulting in an electron depletion and consequent positive charge on one
electrode that is equal and opposite to the accumulated negative charge on the other. Thus the
charge on the electrodes is equal to the integral of the current as well as proportional to the
voltage as discussed above. As with any antiderivative, a constant of integration is added to
represent the initial voltage v (t0). This is the integral form of the capacitor equation,

.
Taking the derivative of this, and multiplying by C, yields the derivative form,

.
The dual of the capacitor is the inductor, which stores energy in the magnetic field rather than the
electric field. Its current-voltage relation is obtained by exchanging current and voltage in the
capacitor equations and replacing C with the inductance L.
68

4.15 METAL DETECTOR

The operation of metal detectors is based upon the principles of electromagnetic


induction. Metal detectors contain one or more inductor coils that are used to interact with
metallic elements on the ground. The single-coil detector illustrated below is a simplified version
of one used in a real metal detector. A pulsing current is applied to the coil, which then induces a
magnetic field shown in blue. When the magnetic field of the coil moves across metal, such as
the coin in this illustration, the field induces electric currents (called eddy currents) in the coin.
The eddy currents induce their own magnetic field, shown in red, which generates an opposite
current

in the

coil,

which

induces

a signal

indicating

the

presence

of

metal.

WHAT IS ANDROID?

69

Android is a Linux-based operating system designed primarily for touch


screen mobile devices such as smart phones and tablet computers. Initially
developed by Android, Inc., which Google backed financially and later bought in
2005, Android was unveiled in 2007 along with the founding of the Open Handset
Alliance: a consortium of hardware, software, and telecommunication companies
devoted to advancing open standards for mobile devices. The first Androidpowered phone was sold in October 2008.

70

FACTORS THAT LED ANDROID TO BECOME WORLDS MOST


POPULAR OS
Android is open source and Google releases the code under the Apache
License. This open-source code and permissive licensing allows the software to be
freely modified and distributed by device manufacturers, wireless carriers and
enthusiast developers. Additionally, Android has a large community of developers
writing applications ("apps") that extend the functionality of devices, written
primarily in a customized version of the Java programming language. In October
2012, there were approximately 700,000 apps available for Android, and the
estimated number of applications downloaded from Google Play, Android's
primary app store, was 25 billion. A developer survey conducted in AprilMay
2013 found that Android is the most popular platform for developers, used by 71%
of the mobile developer population.

These factors have contributed towards making Android the world's most widely
used Smartphone platform, overtaking Symbian in the fourth quarter of 2010, and
the software of choice for technology companies who require a low-cost,
customizable, lightweight operating system for high tech devices without
developing one from scratch. As a result, despite being primarily designed for
71

phones and tablets, it has seen additional applications on televisions, games


consoles, digital cameras and other electronics. Android's open nature has further
encouraged a large community of developers and enthusiasts to use the opensource code as a foundation for community-driven projects, which add new
features for advanced users or bring Android to devices which were officially,
released running other operating systems.
Android's share of the global Smartphone market, led by Samsung products, was
64% in March 2013. In July 2013 there were 11,868 models of Android device,
scores of screen sizes and eight OS versions simultaneously in use. The operating
system's success has made it a target for patent litigation as part of the so-called
"Smartphone" between technology companies. As of May 2013, 48 billion apps
have been installed from the Google Play store, and as of September 3, 2013, 1
billion Android devices have been activated.

Interface
Android's user interface is based on manipulation, using touch inputs that loosely
correspond to real-world actions, like swiping, tapping, pinching and reverse
pinching to manipulate on-screen objects. The response to user input is designed to
be immediate and provides a fluid touch interface, often using the vibration
capabilities of the device to provide hap tic feedback to the user. Internal hardware
such as accelerometers, gyroscopes and proximity sensors are used by some
applications to respond to additional user actions, for example adjusting the screen
from portrait to landscape depending on how the device is oriented, or allowing the
user to steer a vehicle in a racing game by rotating the device, simulating control of
a steering wheel.

72

Android devices boot to the home screen, the primary navigation and information
point on the device, which is similar to the desktop found on PCs. Android home
screens are typically made up of app icons and widgets; app icons launch the
associated app, whereas widgets display live, auto-updating content such as the
weather forecast, the user's email inbox, or a news ticker directly on the home
screen. A home screen may be made up of several pages that the user can swipe
back and forth between, though Android's home screen interface is heavily
customizable, allowing the user to adjust the look and feel of the device to their
tastes. Third party apps available on Google Play and other app stores can
extensively re-theme the home screen, and even mimic the look of other operating
systems, such as Windows Phone. Most manufacturers, and some wireless carriers,
customize the look and feel of their Android devices to differentiate themselves
from their competitors.
Present along the top of the screen is a status bar, showing information about the
device and its connectivity. This status bar can be "pulled" down to reveal a
notification screen where apps display important information or updates, such as a
newly received email or SMS text, in a way that does not immediately interrupt or
inconvenience the user. In early versions of Android these notifications could be
tapped to open the relevant app, but recent updates have provided enhanced
functionality, such as the ability to call a number back directly from the missed call
notification without having to open the dialer app first. Notifications are persistent
until read or dismissed by the user.

73

Android has a growing selection of third party applications, which can be acquired
by users either through an app store such as Google Play or the Amazon Appstore,
or by downloading and installing the application's APK file from a third-party
site. The Play Store application allows users to browse, download and update apps
published by Google and third-party developers, and is pre-installed on devices
that comply with Google's compatibility requirements. The app filters the list of
available applications to those that are compatible with the user's device, and
developers may restrict their applications to particular carriers or countries for
business reasons. Purchases of unwanted applications can be refunded within 15
minutes of the time of download, and some carriers offer direct carrier billing for
Google Play application purchases, where the cost of the application is added to
the user's monthly bill. As of September 2012, there were more than 675,000 apps
available for Android, and the estimated number of applications downloaded from
the Play Store was 25 billion.

74

Applications are developed in the Java language using the Android software
development kit (SDK). The SDK includes a comprehensive set of development
tools, including a debugger, software libraries, a handset emulator based
on QEMU, documentation, sample code, and tutorials. The officially supported
integrated development environment (IDE) is Eclipse using the Android
Development Tools (ADT) plug-in. Other development tools are available,
including a Native Development Kit for applications or extensions in C or C+
+, Google App Inventor, a visual environment for novice programmers, and
various cross platform mobile web applications frameworks.
DEVELOPMENT OF ANDROID APPS
Android is developed in private by Google until the latest changes and updates are
ready to be released, at which point the source code is made available
publicly. This source code will only run without modification on select devices,
usually the Nexus series of devices. With others, there are
proprietary binaries which have to be provided by the manufacturer in order for
Android to work. The green Android logo was designed by graphic designer Irina
Blok.
Linux

75

Architecture diagram
Android consists of a kernel based on Linux kernel version 3.x (version 2.6 prior to
Android 4.0 Ice Cream Sandwich), with middleware, libraries and APIs written
in C, and application software running on an application framework which
includes Java-compatible libraries based on Apache Harmony. Android uses
the Dalvik virtual machine with just-in-time compilation to run Dalvik 'dex-code'
(Dalvik Executable), which is usually translated from code. The main hardware
platform for Android is the ARM architecture. There is support for x86from
the Android-x86 project, and Google TV uses a special x86 version of Android. In
2013, free scale announced Android on its i.MX processor, i.MX5X and i.MX6X
series. In 2012 Intel processors began to appear on more mainstream Android
platforms, such as phones.
Android's Linux kernel has further architecture changes by Google outside the
typical Linux kernel development cycle. Android does not have a native X
Window System by default nor does it support the full set of
standard GNU libraries, and this makes it difficult to port existing Linux
applications or libraries to Android. Support for simple C and SDL applications is
possible by injection of a small Java shim and usage of the JNI[74] like, for
example, in the Jagged Alliance 2 port for Android.[75]

Memory management
Since Android devices are usually battery-powered, Android is designed to manage
memory (RAM) to keep power consumption at a minimum, in contrast to desktop
operating systems which generally assume they are connected to unlimited mains
electricity. When an Android app is no longer in use, the system will automatically
suspend it in memory while the app is still technically "open," suspended apps
76

consume no resources (e.g. battery power or processing power) and sit idly in the
background until needed again. This has the dual benefit of increasing the general
responsiveness of Android devices, since apps don't need to be closed and
reopened from scratch each time, but also ensuring background apps don't waste
power needlessly.
Android manages the apps stored in memory automatically: when memory is low,
the system will begin killing apps and processes that have been inactive for a
while, in reverse order since they were last used (i.e. oldest first). This process is
designed to be invisible to the user, such that users do not need to manage memory
or the killing of apps themselves. However, confusion over Android memory
management has resulted in third-party task killers becoming popular on
the Google Play store; these third-party task killers are generally regarded as doing
more harm than good.
Update schedule

From left to right: HTC Dream (G1),Nexus One, Nexus S, Galaxy Nexus
See also: Android version history
Google provides major updates, incremental in nature, to Android every six to nine
months, which most devices are capable of receiving over the air. The latest major
update is Android 4.3 Jelly Bean.
Compared to its chief rival mobile operating system, namely iOS, Android updates
are typically slow to reach actual devices. For devices not under the Nexus brand,
77

updates often arrive months from the time the given version is officially
released. This is caused partly due to the extensive variation in hardware of
Android devices, to which each update must be specifically tailored, as the official
Google source code only runs on their flagship Nexus devices. Porting Android to
specific hardware is a time- and resource-consuming process for device
manufacturers, who prioritize their newest devices and often leave older ones
behind. Hence, older smart phones are frequently not updated if the manufacturer
decides it is not worth their time, regardless of whether the phone is capable of
running the update. This problem is compounded when manufacturers customize
Android with their own interface and apps, which must be reapplied to each new
release. Additional delays can be introduced by wireless carriers who, after
receiving updates from manufacturers, further customize and brand Android to
their needs and conduct extensive testing on their networks before sending the
update out to users.
The lack of after-sale support from manufacturers and carriers has been widely
criticized by consumer groups and the technology media. Some commentators
have noted that the industry has a financial incentive not to update their devices, as
the lack of updates for existing devices fuels the purchase of newer ones, an
attitude described as "insulting". The Guardian has complained that the
complicated method of distribution for updates is only complicated because
manufacturers and carriers have designed it that way. In 2011, Google partnered
with a number of industry players to announce an "Android Update Alliance",
pledging to deliver timely updates for every device for 18 months after its
release. As of 2013, this alliance has never been mentioned since.
To combat this, Google began updating many of its services, including Google
Maps and Google Play Music independently of Android itself through Google Play
78

Services, a system-level component providing APIs for Google services, which is


installed automatically and updated directly by Google, and supports nearly all
devices running version 2.2 and higher.[102]
Open-source community
Android has an active community of developers and enthusiasts who use the
Android source code to develop and distribute their own modified versions of the
operating system. These community-developed releases often bring new features
and updates to devices faster than through the official manufacturer/carrier
channels, albeit without as extensive testing or quality assurance; provide
continued support for older devices that no longer receive official updates; or bring
Android to devices that were officially released running other operating systems,
such as the HP Touchpad. Community releases often come pre-rooted and contain
modifications unsuitable for non-technical users, such as the ability to over
clock or over/under volt the device's processor. CyanogenMod is the most widely
used community firmware, and acts as a foundation for numerous others.
Historically, device manufacturers and mobile carriers have typically been
unsupportive of third-party firmware development. Manufacturers express concern
about improper functioning of devices running unofficial software and the support
costs resulting from this. moreover, modified firmware such as CyanogenMod
sometimes offer features, such as tethering, for which carriers would otherwise
charge a premium. As a result, technical obstacles including locked boot
loaders and restricted access to root permissions are common in many devices.
However, as community-developed software has grown more popular, and
following a statement by the Librarian of Congress in the United States that
permits the "jail breaking" of mobile devices, manufacturers and carriers have
softened their position regarding third party development, with some,
79

including HTC, Motorola Samsung and Sony, providing support and encouraging
development. As a result of this, over time the need to circumvent hardware
restrictions to install unofficial firmware has lessened as an increasing number of
devices are shipped with unlocked or unlock able boot loaders, similar to the
Nexus series of phones, although usually requiring that users waive their devices'
warranties to do so, However, despite manufacturer acceptance, some carriers in
the US still require that phones are locked down.
The unlocking and "hack ability" of smart phones and tablets remains a source of
tension between the community and industry, with the community arguing that
unofficial development is increasingly important given the failure of industry to
provide timely updates and/or continued support to their devices.
Security and privacy

Permissions are used to control a particular application's access to system


functions.
Android applications run in a sandbox, an isolated area of the system that does not
have access to the rest of the system's resources, unless access permissions are
80

explicitly granted by the user when the application is installed. Before installing an
application, the Play Store displays all required permissions: a game may need to
enable vibration or save data to an SD card, for example, but should not need to
read SMS messages or access the phonebook. After reviewing these permissions,
the user can choose to accept or refuse them, installing the application only if they
accept. The sandboxing and permissions system lessens the impact of
vulnerabilities and bugs in applications, but developer confusion and limited
documentation has resulted in applications routinely requesting unnecessary
permissions, reducing its effectiveness. Several security firms, such as Lookout
Mobile Security, AVG Technologies, and McAfee, have released antivirus software
for Android devices. This software is ineffective as sandboxing also applies to such
applications, limiting their ability to scan the deeper system for threats.
Research from security company Trend Micro lists premium service abuse as the
most common type of Android malware, where text messages are sent from
infected phones to premium-rate telephone numbers without the consent or even
knowledge of the user. Other malware displays unwanted and intrusive adverts on
the device, or sends personal information to unauthorized third parties. Security
threats on Android are reportedly growing exponentially; however, Google
engineers have argued that the malware and virus threat on Android is being
exaggerated by security companies for commercial reasons, and have accused the
security industry of playing on fears to sell virus protection software to
users. Google maintains that dangerous malware is actually extremely rare, and a
survey conducted by F-Secure showed that only 0.5% of Android malware
reported had come from the Google Play store.
Google currently uses their Google Bouncer malware scanner to watch over and
scan the Google Play store apps. It is intended to flag up suspicious apps and warn
81

users of any potential issues with an application before they download it. Android
version 4.2 Jelly Bean was released in 2012 with enhanced security features,
including a malware scanner built into the system, which works in combination
with Google Play but can scan apps installed from third party sources as well, and
an alert system which notifies the user when an app tries to send a premium-rate
text message, blocking the message unless the user explicitly authorizes it.
Android smart phones have the ability to report the location of Wi-Fi access points,
encountered as phone users move around, to build databases containing the
physical locations of hundreds of millions of such access points. These databases
form electronic maps to locate smart phones, allowing them to run apps
like Foursquare, Google Latitude, and Face book Places, and to deliver locationbased ads.[126] Third party monitoring software such as Taint Droid, an academic
research-funded project, can, in some cases, detect when personal information is
being sent from applications to remote servers.[128] In August 2013, Google released
the Android Device Manager, a component that allows users to remotely track,
locate, and wipe their Android device through an online interface. As it is
implemented through Google Play Services instead of within Android itself, it is
available to most Android devices with version 2.2 and higher.
The open-source nature of Android allows security contractors to take existing
devices and adapt them for highly secure uses. For example Samsung has worked
with General Dynamics through their Open Kernel Labs acquisition to
rebuild Jelly Bean on top of their hardened micro visor for the "Knox" project.
As part of the broader 2013 mass surveillance disclosures it was revealed in
September 2013 that the American and British intelligence agencies, the NSA
and Government Communications Headquarters (GCHQ) respectively, have access
82

to the user data in phones, Blackberries, and Android phones. They are able to read
almost all Smartphone information, including SMS, location, emails, and notes.[132]

MARKET SHARE OF ANDROID BASED SMART


PHONES
Research Company Canalys estimated in the second quarter of 2009 that Android
had a 2.8% share of worldwide Smartphone shipments. By the fourth quarter of
2010 this had grown to 33% of the market, becoming the top-selling Smartphone
platform.[19] By the third quarter of 2011 Gartner estimated that more than half
(52.5%) of the Smartphone market belongs to Android. By the third quarter of
2012 Android had a 75% share of the global Smartphone market according to the
research firm IDC.
In July 2011, Google said that 550,000 new Android devices were being activated
every day, up from 400,000 per day in May, and more than 100 million devices had
been activated with 4.4% growth per week. In September 2012, 500 million
devices had been activated with 1.3 million activations per day. In May 2013,
at Google I/O, Sundar Pichai announced that 900 million Android devices had been
activated.
Android market share varies by location. In July 2012, Android's market share in
the United States was 52%, and rose to 90% in China. During the third quarter of
2012, Android's worldwide Smartphone market share was 75%, with 750 million
devices activated in total and 1.5 million activations per day.
83

As of March 2013, Android's share of the global Smartphone market, led by


Samsung products, was 64%. The Kantar market research company reported that
Googles platform accounted for over 70% of all Smartphone device sales in China
during this period and that Samsung's loyalty rate in Britain (59%) is second to that
of Apple (79%).

84

VERSIONS OF ANDROID-OS

This chart provides data about the relative number of devices accessing the Play
Store recently and running a given version of the Android platform as of October 2,
2013.
Version

Code name

Release date

API level

Distribution

4.4

Kit Kat

TBA

TBA

0%

4.3

Jelly Bean

July 24, 2013

18

1.5%

4.2.x

Jelly Bean November 13, 2012

17

10.6%

4.1.x

Jelly Bean

July 9, 2012

16

36.5%

4.0.34.0.4 Ice Cream Sandwich December 16, 2011

15

20.6%

3.2

Honeycomb

July 15, 2011

13

0.1%

3.1

Honeycomb

May 10, 2011

12

0%

2.3.32.3.7

Gingerbread

February 9, 2011

10

28.5%

2.32.3.2

Gingerbread

December 6, 2010

0%
85

Version

Code name

Release date

API level

Distribution

2.2

Froyo

May 20, 2010

2.2%

2.02.1

Eclair

October 26, 2009

0%

Donut September 15, 2009

0%

0%

1.6
1.5

Cupcake

April 30, 2009

Application piracy
There has been some concern about the ease with which paid Android apps can
be pirated. In a May 2012 interview with Euro gamer, the developers of Football
Manager stated that the ratio of pirated players vs legitimate players was 9:1 for
their game Football Manager Handheld. However, not every developer agreed that
piracy rates were an issue; for example, in July 2012 the developers of the game
Wind-up Knight said that piracy levels of their game were only 12%, and most of
the piracy came from China, where people cannot purchase apps from Google Play.
In 2010, Google released a tool for validating authorized purchases for use within
apps, but developers complained that this was insufficient and trivial to crack.
Google responded that the tool, especially its initial release, was intended as a
sample framework for developers to modify and build upon depending on their
needs, not as a finished piracy solution. In 2012 Google released a feature in
Android 4.1 that encrypted paid applications so that they would only work on the
device on which they were purchased, but this feature has been temporarily
deactivated due to technical issues.
86

The Sony Smart Watch: an example of how Android is used on electronics other
than smart phones and tablets
The open and customizable nature of Android allows it to be used on other
electronics aside from smart phones and tablets,

APPLICATIONS OF ANDROID OS IN OTHER DEVICES


Including laptops and net books, smart books smart TVs (Google TV) and
cameras (Nikon Coolpix S800c and Galaxy Camera). In addition, the Android
operating system has seen applications on smart glasses (Google Glass),
wristwatches, headphones, car CD and DVD players, mirrors, portable media
players and landlines and Voice over IP phones. Ouya, a video game console
87

running Android, became one of the most successful Kick


starter campaigns, crowd funding US$8.5m for its development,[201][202] and was
later followed by other Android-based consoles, such as Nvidia's Project Shield
an Android device in a video game controller form factor.
In 2011, Google demonstrated "Android@Home", a home automation technology
which uses Android to control a range of household devices including light
switches, power sockets and thermostats.[204]Prototype light bulbs were announced
that could be controlled from an Android phone or tablet, but Android head Andy
Rubin was cautious to note that "turning a lightbulb on and off is nothing new,"
pointing to numerous failed home automation services. Google, he said, was
thinking more ambitiously and the intention was to use their position as
a cloud services provider to bring Google products into customers' homes.[205][206]

COMPARISION OF OTHER OPERATING SYSTEM WITH ANDROID

Android:
Android the most popular Smartphone OS, but it's also now positioned to be the
dominant tablet and hybrid OS by the middle of 2013. It's no wonder, because
Android is (in many ways) the "Windows" of mobile OS platforms. With multiple
device manufacturers competing on price, quality, features and other positions,
88

Android devices offer a flexibility that iOS cannot match. There's something for
every budget, goal, and desire among Android-based devices.
Android is the middle ground. With many of the features (and liabilities) of a true
mobile OS, Google has tried to walk a line in offering the same kind of intuitive,
light-weight mobile experience as iOS but with the power and flexibility of a
traditional Windows desktop OS. They've done a pretty good job at this, which is
reflected in the popularity of this platform.
However, the process has not been without compromise. In making a more flexible
and powerful platform that supports more devices, Android has become less of a
consumer appliance and more of a power user's playground. While that may sound
good to a lot of potential users, it means that Android is not as stable, predictable,
or well designed as iOS. Things are just a little less polished.
At the same time, for true power users, Android falls just short of being able to
deliver a completely satisfying experience. I've been using Android daily for
several years, chasing a replacement for my Windows laptop. Part of my shock that
iOS users are chasing this goal is my disappointment with Android in this regard. I
can leave the PC notebook at home for trips and travel, but I've had to adjust and
learn "work-around" methods that include saving the heavy lifting for a real PC.
For some users, this is good enough. If you want a little more power on the road
but are still okay with needing a PC to finish things up when you return, Android
may be a good solution for you

89

Windows 8:

Microsoft has positioned them-selves to compete with


the encroachment of mobile OS platforms on the traditional PC, but Windows 8 is
a complex platform in all its myriad forms. Windows delivers much of the mobile
OS platform nearly as well as the previously mentioned platforms, but it retains a
distinct focus on corporate business productivity as its primary role. Even the
ARM-based Windows RT is aimed at users who are strongly invested in
Microsoft's business platforms. If you want the strongest integration with Windows
domains, Exchange, Office, and Microsoft's cloud and intranet solutions, Windows
8 is simply worlds ahead of either iOS or Android. The business-oriented apps are
also far more advanced for enterprise-oriented goals, content creation, and
organization.
The sacrifice here is that Windows 8 reflects Microsoft's philosophy on enabling
powerful business applications that reward a steep learning curve with tremendous
competitive advantage. This is the least intuitive touch-screen platform, the social
integration is the most uneven, and the apps and consumer content are the sparsest
(at least on the mobile side of the OS). You've also got some platform fracturing
that can be confusing.

90

Windows RT is aimed at people who want a very lightweight device that offers a
lot of the hardware features of competitive tablets, with a somewhat crippled
version of Microsoft's "Classic" Windows mode. The crippled Classic mode still
offers the best corporate productivity platform of any mobile tablet device in this
class for professionals in Microsoft shops.
Windows Pro devices are really just full-fledged traditional PCs with a touchoriented GUI. They can do everything a PC can do, but they offer mobile, touchoriented features too. These devices do not generally deliver the same true instanton and true 8+ hour battery life as mobile OS platforms, nor the quiet fanless
operation. But if you're a heavy professional content creator in a Microsoft
business and you want a device that offers many benefits of touch-screen mobile
devices, there may be no better choice for you.
Remember, there's no platform that's truly superior to the others in this roundup.
They all have benefits and compromises, so you need to select the platform that
appeals the most to you. Depending on your needs and tastes, however, you might
end up picking a platform that isn't the best solution for you.
Which device platform best fits your needs? Let us hear your questions and
feedback in the discussion thread below.

91

ANDROID APPLICATION OPERATED BLUETOOTH


The Android platform includes support for the Bluetooth network stack, which
allows a device to wirelessly exchange data with other Bluetooth devices. The
application framework provides access to the Bluetooth functionality through the
Android Bluetooth APIs. These APIs let applications wirelessly connect to other
Bluetooth devices, enabling point-to-point and multipoint wireless features.
Using the Bluetooth APIs, an Android application can perform the following:

Scan for other Bluetooth devices

Query the local Bluetooth adapter for paired Bluetooth devices

Establish RFCOMM channels

Connect to other devices through service discovery

Transfer data to and from other devices

Manage multiple connections

This document describes how to use Classic Bluetooth. Classic Bluetooth is the
right choice for more battery-intensive operations such as streaming and
communicating between Android devices. For Bluetooth devices with low power
requirements, Android 4.3 (API Level 18) introduces API support for Bluetooth
Low Energy. To learn more, see Bluetooth Low Energy.
This document describes how to use the Android Bluetooth APIs to accomplish the
four major tasks necessary to communicate using Bluetooth: setting up Bluetooth,
finding devices that are either paired or available in the local area, connecting
devices, and transferring data between devices.

92

All of the Bluetooth APIs is available in the android.bluetooth package. Here's a


summary of
application permissions.
Setting Up Bluetooth

Figure 1: The enabling Bluetooth


dialog.
Before your application can communicate over Bluetooth, you need to verify that
Bluetooth is supported on the device, and if so, ensure that it is enabled.If
Bluetooth is not supported, then you should gracefully disable any Bluetooth
features. If Bluetooth is supported, but disabled, then you can request that the user
enable Bluetooth without leaving your application.
Finding Devices
you can find remote Bluetooth devices either through device discovery or by
querying the list of paired (bonded) devices.Device discovery is a scanning
procedure that searches the local area for Bluetooth enabled devices and then
93

requesting some information about each one (this is sometimes referred to as


"discovering," "inquiring" or "scanning"). However, a Bluetooth device within the
local area will respond to a discovery request only if it is currently enabled to be
discoverable. If a device is discoverable, it will respond to the discovery request by
sharing some information, such as the device name, class, and its unique MAC
address. Using this information, the device performing discovery can then choose
to initiate a connection to the discovered device.
Once a connection is made with a remote device for the first time, a pairing request
is automatically presented to the user. When a device is paired, the basic
information about that device (such as the device name, class, and MAC address)
is saved and can be read using the Bluetooth APIs. Using the known MAC address
for a remote device, a connection can be initiated with it at any time without
performing discovery (assuming the device is within range).
Remember there is a difference between being paired and being connected. To be
paired means that two devices are aware of each other's existence, have a shared
link-key that can be used for authentication, and are capable of establishing an
encrypted connection with each other. To be connected means that the devices
currently share an RFCOMM channel and are able to transmit data with each other.
The current Android Bluetooth API's require devices to be paired before an
RFCOMM connection can be established. (Pairing is automatically performed
when you initiate an encrypted connection with the Bluetooth APIs.)
The following sections describe how to find devices that have been paired, or
discover new devices using device discovery.
Note: Android-powered devices are not discoverable by default. A user can make
the device discoverable for a limited time through the system settings, or an
94

application can request that the user enable discoverability without leaving the
Application. How to enable discoverability is discussed below.
Querying paired devices
Before performing device discovery, its worth querying the set of paired devices to
see if the desired device is already known. To do so, call getBondedDevices(). This
will return a Set of BluetoothDevices representing paired devices. For example,
you can query all paired devices and then show the name of each device to the
user, using an ArrayAdapter:

Set<BluetoothDevice>
pairedDevices

mBluetoothAdapter.getBondedDe
vices();
// If there are paired devices
if (pairedDevices.size() > 0) {
// Loop through paired devices
for (BluetoothDevice device :
pairedDevices)

// Add the name and address


to an array adapter to show in a
ListView
mArrayAdapter.add(device.getNa
me()

"\n"

+
95

device.getAddress());
}
}
All that's needed from the BluetoothDevice object in order to initiate a connection
is the MAC address. In this example, it's saved as a part of an ArrayAdapter that's
shown to the user. The MAC address can later be extracted in order to initiate the
connection. You can learn more about creating a connection in the section
about Connecting Devices.
Discovering devices
To start discovering devices, simply call startDiscovery(). The process is
asynchronous and the method will immediately return with a boolean indicating
whether discovery has successfully started. The discovery process usually involves
an inquiry scan of about 12 seconds, followed by a page scan of each found device
to retrieve its Bluetooth name.
Your

application

must

register

BroadcastReceiver

for

the ACTION_FOUND Intent in order to receive information about each device


discovered.

For

each

the ACTION_FOUND Intent.

device,
This

the
Intent

system
carries

will

broadcast
the

extra

fields EXTRA_DEVICE and EXTRA_CLASS, containing a BluetoothDevice and


aBluetoothClass, respectively. For example, here's how you can register to handle
the broadcast when devices are discovered:

96

// Create a BroadcastReceiver for


ACTION_FOUND
private final BroadcastReceiver
mReceiver

new

BroadcastReceiver()

public void onReceive(Context


context,

Intent

intent)

String

action

{
=

intent.getAction();
// When discovery finds a
device
if
(BluetoothDevice.ACTION_FOU
ND.equals(action))

// Get the BluetoothDevice


object

from

the

Intent

BluetoothDevice device =
intent.getParcelableExtra(Bluetoot
hDevice.EXTRA_DEVICE);
// Add the name and
address to an array adapter to show
in

ListView

mArrayAdapter.add(device.getNa
me()

"\n"

+
97

device.getAddress());
}
}
};
// Register the BroadcastReceiver
IntentFilter

filter

new

IntentFilter(BluetoothDevice.ACT
ION_FOUND);
registerReceiver(mReceiver,
filter); // Don't forget to unregister
during onDestroy
Managing a Connection

When you have successfully connected two (or more) devices, each one will have
a connectedBluetoothSocket. This is where the fun begins because you can share
data between devices. Using theBluetoothSocket, the general procedure to transfer
arbitrary data is simple:
1.Get the InputStream and OutputStream that handle transmissions through the
socket, viagetInputStream() and getOutputStream(), respectively.Read and write
data to the streams with read(byte[]) and write(byte[]).That's it.There are, of
course, implementation details to consider. First and foremost, you should use a
dedicated thread for all stream reading and writing. This is important because
both read(byte[]) and write(byte[])methods are blocking calls. read(byte[]) will
98

block until there is something to read from the stream.write(byte[]) does not
usually block, but can block for flow control if the remote device is not
callingread(byte[]) quickly enough and the intermediate buffers are full. So,
your main loop in the thread should be dedicated to reading from
the InputStream. A separate public method in the thread can be used to initiate
writes to the OutputStream.
Example
Here's an example of how this might look:

private
class
ConnectedThread
extends
Thread
{
private final BluetoothSocket
mmSocket;
private final InputStream
mmInStream;
private final OutputStream
mmOutStream;
public
ConnectedThread(BluetoothSocket
socket)
{
mmSocket = socket;
InputStream tmpIn = null;
OutputStream tmpOut =
null;

output
objects

// Get the input and


streams,
using
temp
because
// member streams are

final
try
tmpIn
socket.getInputStream();
tmpOut
socket.getOutputStream();

{
=
=

99

} catch (IOException e) {
}
mmInStream = tmpIn;
mmOutStream = tmpOut;
}
public
void
run()
{
byte[] buffer = new
byte[1024]; // buffer store for
the
stream
int bytes; // bytes
returned
from
read()
// Keep listening to the
InputStream until an exception
occurs
while
(true)
{
try
{
// Read from the
InputStream
bytes =
mmInStream.read(buffer);
// Send the
obtained bytes to the UI activity
mHandler.obtainMessage(MESSAGE_RE
AD,
bytes,
-1,
buffer)
.sendToTarget();
} catch (IOException
e)
{
break;
}
}
}
/* Call this from the main
activity to send data to the
remote
device
*/
public void write(byte[]
bytes)
{
try
{

100

mmOutStream.write(bytes);
} catch (IOException e) {
}
}
/* Call this from the main
activity
to
shutdown
the
connection
*/
public void cancel() {
try
{
mmSocket.close();
} catch (IOException e) {
}
}
}

FEATURES OF BLUETOOTH

Super simple and easy way to interface using Bluetooth stack.


Bluetooth Stack 2.0 compatible.
Bluetooth Class 2 device, Has a built-in 2.4GHz antenna
Has the external 8Mbit FLASH
3.3V Device, Should not be used with 5V power supplies, device will work
for sometime but become hot.
All the programmable Input/output pins are available for tinkering.
Can also supports USB protocol is Full Speed USB1.1, and compliant with
2.0. Pins are made available.
Can also support SPI Protocol, pins are made available.
Low power consumption
Has high-performance wireless transceiver system
Low Cost
Can be used to interface with PC, Mac or Android phones/tablets.
101

NOTE: Please connect RX from Freeduino to RX for Bluetooth Breakout board


and TX from Freeduino to TX for Bluetooth Serial Breakout board. The
connections are internally swapped and hardwired on the board.
Connecting in normal NULL Modem
Connection will not result in successful pairing.
Generic Default Visibility at Software side:
HC-06 or Linvor
Default Pairing code is not '0000' but '1234'.
Please use Baud Rate with 8-N-1 connectivity from other device.
Most importantly enjoy playing and tinkering with Bluetooth
devices

102

5. SOFTWARE REQUIREMENTS

103

5.1 INTRODUCTION TO KEIL MICRO VISION (IDE)


Keil an ARM Company makes C compilers, macro assemblers, real-time kernels,
debuggers, simulators, integrated environments, evaluation boards, and emulators for
ARM7/ARM9/Cortex-M3, XC16x/C16x/ST10, 251, and 8051 MCU families.
Keil development tools for the 8051 Microcontroller Architecture support every level of
software developer from the professional applications engineer to the student just learning about
embedded software development. When starting a new project, simply select the microcontroller
you use from the Device Database and the Vision IDE sets all compiler, assembler, linker, and
memory options for you.

Keil is a cross compiler. So first we have to understand the concept of compilers and
cross compilers. After then we shall learn how to work with keil.

5.2 CONCEPT OF COMPILER


104

Compilers are programs used to convert a High Level Language to object code. Desktop
compilers produce an output object code for the underlying microprocessor, but not for other
microprocessors. I.E the programs written in one of the HLL like C will compile the code to
run on the system for a particular processor like x86 (underlying microprocessor in the
computer). For example compilers for Dos platform is different from the Compilers for Unix
platform So if one wants to define a compiler then compiler is a program that translates source
code into object code.

The compiler derives its name from the way it works, looking at the entire piece of
source code and collecting and reorganizing the instruction. See there is a bit little difference
between compiler and an interpreter. Interpreter just interprets whole program at a time while
compiler analyses and execute each line of source code in succession, without looking at the
entire program.
The advantage of interpreters is that they can execute a program immediately. Secondly
programs produced by compilers run much faster than the same programs executed by an
interpreter. However compilers require some time before an executable program emerges. Now
as compilers translate source code into object code, which is unique for each type of computer,
many compilers are available for the same language.

5.3 CONCEPT OF CROSS COMPILER

A cross compiler is similar to the compilers but we write a program for the target
processor (like 8051 and its derivatives) on the host processors (like computer of x86). It means
being in one environment you are writing a code for another environment is called cross
105

development. And the compiler used for cross development is called cross compiler. So the
definition of cross compiler is a compiler that runs on one computer but produces object code for
a different type of computer.

5.4 KEIL C CROSS COMPILER

Keil is a German based Software development company. It provides several


development tools like

IDE (Integrated Development environment)

Project Manager

Simulator

Debugger

C Cross Compiler, Cross Assembler, Locator/Linker

The Keil ARM tool kit includes three main tools, assembler, compiler and linker. An
assembler is used to assemble the ARM assembly program. A compiler is used to compile the C
source code into an object file. A linker is used to create an absolute object module suitable for
our in-circuit emulator.

5.5 Building an Application in Vision2


To build (compile, assemble, and link) an application in Vision2, you must:
1

Select Project (forexample,166\EXAMPLES\HELLO\HELLO.UV2).


106

Select Project - Rebuild all target files or Build target.Vision2 compiles, assembles, and
links the files in your project.

5.6 Creating Your Own Application in Vision2


To create a new project in Vision2, you must:
1

Select Project - New Project.

Select a directory and enter the name of the project file.

Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the
Device Database.

Create source files to add to the project.

Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the
source files to the project.

Select Project - Options and set the tool options. Note when you select the target device
from the Device Database all special options are set automatically. You typically only
need to configure the memory map of your target hardware. Default memory model
settings are optimal for most applications.

Select Project - Rebuild all target files or Build target.

5.7 Debugging an Application in Vision2


To debug an application created using Vision2, you must:
1

Select Debug - Start/Stop Debug Session.

Use the Step toolbar buttons to single-step through your program. You may enter G, main
in the Output Window to execute to the main C function.

Open the Serial Window using the Serial #1 button on the toolbar.

Debug your program using standard options like Step, Go, Break, and so on.

5.8 Starting Vision2 and Creating a Project


107

Vision2 is a standard Windows application and started by clicking on the program icon.
To create a new project file select from the Vision2 menu Project New Project. This opens
a standard Windows dialog that asks you for the new project file name. We suggest that you use a
separate folder for each project. You can simply use the icon Create New Folder in this dialog to
get a new empty folder. Then select this folder and enter the file name for the new project, i.e.
Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a
default target and file group name. You can see these names in the Project.

5.9 Window Files.


Now use from the menu Project Select Device for Target and select a CPU for your
project. The Select Device dialog box shows the Vision2 device data base. Just select the
microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This
selection sets necessary tool Options for the 80C51RD+ device and simplifies in this way the
tool Configuration.

5.10 Building Projects and Creating a HEX Files


Typical, the tool settings under Options Target are all you need to start a new
application. You may translate all source files and line the application with a click on the Build
Target toolbar icon. When you build an application with syntax errors, Vision2 will display
errors and warning messages in the Output Window Build page. A double click on a message
line opens the source file on the correct location in a Vision2 editor window. Once you have
successfully generated your application you can start debugging.
After you have tested your application, it is required to create an Intel HEX file to
download the software into an EPROM programmer or simulator. Vision2 creates HEX files
with each build process when Create HEX files under Options for Target Output is enabled.
You may start your PROM programming utility after the make process when you specify the
program under the option Run User Program #1.

5.11 CPU Simulation


108

Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for
read, write, or code execution access. The Vision2 simulator traps
and reports illegal memory accesses. In addition to memory mapping, the simulator also provides
support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of
the CPU you have selected are configured from the Device.

5.12 Database selection


You have made when you create your project target. Refer to page 58 for more
Information about selecting a device. You may select and display the on-chip peripheral
components using the Debug menu. You can also change the aspects of each peripheral using the
controls in the dialog boxes.

5.13 Start Debugging


You start the debug mode of Vision2 with the Debug Start/Stop Debug
Session Command. Depending on the Options for Target Debug Configuration, Vision2 will
load the application program and run the startup code Vision2 saves the editor screen layout
and restores the screen layout of the last debug session. If the program execution stops, Vision2
opens an editor window with the source text or shows CPU instructions in the disassembly
window. The next executable statement is marked with a yellow arrow. During debugging, most
editor features are still available.
For example, you can use the find command or correct program errors. Program source
text of your application is shown in the same windows. The Vision2 debug mode differs from
the edit mode in the following aspects:
_ The Debug Menu and Debug Commands described on page 28 are available. The additional
debug windows are discussed in the following.
_The project structure or tool parameters cannot be modified. All build commands are disabled.

5.14 Disassembly Window


109

The Disassembly window shows your target program as mixed source and assembly
program or just assembly code. A trace history of previously executed instructions may be
displayed with Debug View Trace Records. To enable the trace history, set Debug
Enable/Disable Trace Recording.
If you select the Disassembly Window as the active window all program step commands
work on CPU instruction level rather than program source lines. You can select a text line and set
or modify code breakpoints using toolbar buttons or the context menu commands.
You may use the dialog Debug Inline Assembly to modify the CPU instructions. That
allows you to correct mistakes or to make temporary changes to the target program you are
debugging. Numerous example programs are included to help you get started with the most
popular embedded 8051 devices.
The Keil Vision Debugger accurately simulates on-chip peripherals (IC, CAN, UART,
SPI, Interrupts, I/O Ports, A/D Converter, D/A Converter, and PWM Modules) of your 8051
device. Simulation helps you understand hardware configurations and avoids time wasted on
setup problems. Additionally, with simulation, you can write and test applications before target
hardware is available.

5.15 EMBEDDED C
Use of embedded processors in passenger cars, mobile phones, medical equipment,
aerospace systems and defense systems is widespread, and even everyday domestic appliances
such as dish washers, televisions, washing machines and video recorders now include at least one
such device.

Because most embedded projects have severe cost constraints, they tend to use low-cost
processors like the 8051 family of devices considered in this book. These popular chips have
very limited resources available most such devices have around 256 bytes (not megabytes!) of
RAM, and the available processor power is around 1000 times less than that of a desktop
110

processor. As a result, developing embedded software presents significant new challenges, even
for experienced desktop programmers. If you have some programming experience - in C, C++
or Java - then this book and its accompanying CD will help make your move to the embedded
world as quick and painless as possible.

111

6. SCHEMATIC DIAGRAM

112

Fig 6: SCHEMATIC DIAGRAM

113

6.1 DESCRIPTION
POWER SUPPLY
This project uses a 6V battery for power supply. A diode is used to get about 5V DC
supply. One LED is connected of this 5V point in series with a resistor of 330 to the ground
i.e., negative voltage to indicate 5V power supply availability.
STANDARD CONNECTIONS TO 8051 SERIES MICRO CONTROLLER
ATMEL series of 8051 family of micro controllers need certain standard connections.
The actual number of the Microcontroller could be 89C51 , 89C52, 89S51, 89S52, and
as regards to 20 pin configuration a number of 89C2051. The 4 set of I/O ports are used based
on the project requirement. Every microcontroller requires a timing reference for its internal
program execution therefore an oscillator needs to be functional with a desired frequency to
obtain the timing reference as t =1/f.
A crystal ranging from 2 to 20 MHz is required to be used at its pin number 18 and 19 for
the internal oscillator. It may be noted here the crystal is not to be understood as crystal oscillator
It is just a crystal, while connected to the appropriate pin of the microcontroller it results in
oscillator function inside the microcontroller. Typically 11.0592 MHz crystal is used in general
for most of the circuits using 8051 series microcontroller. Two small value ceramic capacitors of
33pF each is used as a standard connection for the crystal as shown in the circuit diagram.

RESET
Pin no 9 is provided with an re-set arrangement by a combination of an electrolytic
capacitor and a register forming RC time constant. At the time of switch on, the capacitor gets
charged, and it behaves as a full short circuit from the positive to the pin number 9. After the
114

capacitor gets fully charged the current stops flowing and pin number 9 goes low which is pulled
down by a 10k resistor to the ground. This arrangement of reset at pin 9 going high initially and
then to logic 0 i.e., low helps the program execution to start from the beginning. In absence of
this the program execution could have taken place arbitrarily anywhere from the program cycle.
A pushbutton switch is connected across the capacitor so that at any given time as desired it can
be pressed such that it discharges the capacitor and while released the capacitor starts charging
again and then pin number 9 goes to high and then back to low, to enable the program execution
from the beginning. This operation of high to low of the reset pin takes place in fraction of a
second as decided by the time constant R and C.
For example: A 10F capacitor and a 10k resistor would render a 100ms time to pin number 9
from logic high to low, there after the pin number 9 remains low.
External Access(EA):
Pin no 31 of 40 pin 8051 microcontroller termed as EA is required to be connected to 5V for
accessing the program form the on-chip program memory. If it is connected to ground then the
controller accesses the program from external memory. However as we are using the internal
memory it is always connected to +5V.
L293D MOTOR DRIVER
L293D has 2 set of arrangements where one set has input 1, input 2, output 1
and output 2 and other set has input 3, input 4, output 3 and output 4, according to block
diagram if pin no 2 & 7 are high then pin no 3 & 6 are also high.
If enable 1

and pin number 2 are high leaving pin number 7 as low then the

motor rotates in forward direction.


If enable 2 and pin number 10 are high leaving pin number 15 as low then the
motor rotates in forward direction.
If enable 1 and pin number 2 are low leaving pin number 7 as high then the motor
rotates in reverse direction.
If enable 2 and pin number 15 are high leaving pin number 10 as low then the
motor rotates in forward direction.

115

OPERATION EXPLANATION
WORKING:

116

L293D MOTOR DRIVER

functioning as seen above

L293D has 2 set of arrangements where one set has input 1, input 2, output 1
and output 2 and other set has input 3, input 4, output 3 and output 4, according to block
diagram if pin no 2 & 7 are high then pin no 3 & 6 are also high.
If enable 1

and pin number 2 are high leaving pin number 7 as low then the

motor rotates in forward direction.


If enable 2 and pin number 10 are high leaving pin number 15 as low then the
motor rotates in forward direction.
If enable 1 and pin number 2 are low leaving pin number 7 as high then the motor
rotates in reverse direction.

117

If enable 2 and pin number 15 are high leaving pin number 10 as low then the
motor rotates in forward direction.

The program is so written i.e., while executed it sends commands to the motor driver IC
as per its requirement for running the motor for the movement of the robot as explained in the
subject above in L293D. The android phone screen is used for sending voice commands to
control the robot ( left, right ,forward & backward and stop) using BT control application that is
installed in anroid phone.
6V battery powers the circuit in series with a diode D2 that nearly provides 5 volt ( 60.6) for the microcontroller which has standard connections like crystal, reset arrangement
indication LED etc.
A blue tooth device being powered from a reversed biased Zennor diode

D1 ,is

interfaced to the microcontroller that after being paired with any smart phone communicates with
this bluetooth device for taking appropriate action as per the touch operation made on the smart
phone.

118

119

7. LAYOUT
TRNSMITTER:

RECIEVER:

120

8. BILL OF MATERIALS
{PLEASE REFER CD}

121

9.CODING

122

9.1 PROGRAM CODE

1.

Click on the Keil Vision Icon on Desktop

2.

The following fig will appear

123

3.

Click on the Project menu from the title bar

4.

Then Click on New Project

5.

Save the Project by typing suitable project name with no extension in u r own folder
sited in either C:\ or D:\

124

6.

Then Click on Save button above.

7.

Select the component for u r project. i.e. Atmel

8.

Click on the + Symbol beside of Atmel

9.

Select AT89C51 as shown below

125

10.

Then Click on OK

11.

The Following fig will appear

12.

Then Click either YES or NOmostly NO.

13.

Now your project is ready to USE.

14.

Now double click on the Target1, you would get another option Source group 1 as
shown in next page.
126

15.

Click on the file option from menu bar and select new.

16.

The next screen will be as shown in next page, and just maximize it by double
clicking on its blue boarder.

127

17.

Now start writing program in either in EMBEDDED C or ASM.

18.

For a program written in Assembly, then save it with extension . asm and for
EMBEDDED C based program save it with extension .C

19.

Now right click on Source group 1 and click on Add files to Group Source.

128

20.

Now you will get another window, on which by default EMBEDDED C files will
appear.

21.

Now select as per your file extension given while saving the file

22.

Click only one time on option ADD.

23.

Now Press function key F7 to compile. Any error will appear if so happen.
129

24.

If the file contains no error, then press Control+F5 simultaneously.

25.

The new window is as follows

26.

Then Click OK.

27.

Now click on the Peripherals from menu bar, and check your required port as shown
in fig below.

130

28.

Drag the port a side and click in the program file.

29.

Now keep Pressing function key F11 slowly and observe.

30.

You are running your program successfully.

131

10.HARDWARE TESTING
10.1 CONTINUITY TEST:

In electronics, a continuity test is the checking of an electric circuit to see if current flows
(that it is in fact a complete circuit). A continuity test is performed by placing a small voltage
(wired in series with an LED or noise-producing component such as a piezoelectric speaker)
across the chosen path. If electron flow is inhibited by broken conductors, damaged components,
or excessive resistance, the circuit is "open".

Devices that can be used to perform continuity tests include multi meters which measure
current and specialized continuity testers which are cheaper, more basic devices, generally with a
simple light bulb that lights up when current flows.
An important application is the continuity test of a bundle of wires so as to find the two ends
belonging to a particular one of these wires; there will be a negligible resistance between the
"right" ends, and only between the "right" ends.

This test is the performed just after the hardware soldering and configuration has been
completed. This test aims at finding any electrical open paths in the circuit after the soldering.
Many a times, the electrical continuity in the circuit is lost due to improper soldering, wrong and
rough handling of the PCB, improper usage of the soldering iron, component failures and
presence of bugs in the circuit diagram. We use a multi meter to perform this test. We keep the
multi meter in buzzer mode and connect the ground terminal of the multi meter to the ground.
We connect both the terminals across the path that needs to be checked. If there is continuation
then you will hear the beep sound.

132

10.2 POWER ON TEST:


This test is performed to check whether the voltage at different terminals is according to
the requirement or not. We take a multi meter and put it in voltage mode. First of all check the
voltage across the battery terminal whether it is fully charged or not, the battery used in this
project is 12V, so touch the red terminal of battery with red probe of multi meter and touch
black terminal of battery with black probe of multi meter, if 12V is being displayed on multi
meter screen then we can proceed for next steps.
Now that the power supply is available, no IC should be inserted in the base, first apply
power and check whether proper voltage is reaching at vcc and gnd pins of each IC base or
not. If proper voltages appear at the supply pins of IC bases then insert IC and check the required
output.
Now we have to check whether the LEDs are in working condition or not, Red LED or IR
LED or Photo diode has got one longer leg and one shorter leg. Longer leg is positive
terminal of LED and shorter leg is negative terminal.
Now keep the multi meter in buzzer mode or continuity mode and touch red probe of multi
meter to the longer leg of LED and black probe of multi meter to the shorter leg of LED, if
LED glows in such case that means its working.
Now solder Red LED into PCB, remember longer leg of LED should be inserted into
positive marking on PCB and shorter leg should be inserted into other hole of LED marking on
PCB. Now after soldering LED with a series resistor apply battery voltage to the board and see
whether the LED is glowing or not.
The black LED is photodiode and white LED is IR diode even these components have
got longer leg and shorter leg, insert longer leg into +ve marking hole on PCB and insert shorter
leg into other hole of LED marking on PCB .
133

11.RESULT

134

12.CONCLUSION

135

13.BIBLIOGRAPHY
TEXT BOOKS REFERED:
1. The 8051 Microcontroller and Embedded systems by Muhammad Ali Mazidi and Janice
Gillispie Mazidi , Pearson Education.
2. ATMEL 89S52 Data Sheets.
WEBSITES

www.atmel.com

www.beyondlogic.org

www.wikipedia.org

www.howstuffworks.com

www.alldatasheets.com

136

Potrebbero piacerti anche