Sei sulla pagina 1di 81

CHAPTER 1

INTRODUCTION
This project is an embedded project in which we are designing the Agriculture Conditions on
Planet using the microcontroller. Embedded is the combination of both the hardware and
software so we have designed the required hardware as well as programmed the
microcontroller.
This project involves controlling of temperature, humidity and light, these three things are
essential for developing Agriculture Conditions on Planet. For this purpose the system utilize a
humidity sensor, a temperature sensor and LDR which can sense humidity, temperature and
light respectively in atmosphere and compare it with the reference humidity, temperature and
light level if the sensed values are not up to that level as that was

expected it cause the

motor to on and which in turn pumps the water and spread it in atmosphere and thus control
humidity. For controlling temperature it will make the heater or fan to turn on as per the
requirement and for controlling light in will turn on an artificial light .All these conditions are
controlled through a microcontroller.

1.1

Platform used

1.1.1 Software requirements:

Assembler of MICROCHIP microcontroller series

PADS for PCB designing

1.1.2 Hardware requirements:

Microcontroller PIC 16F72

LM7805

Resistors

Regulator

Capacitors

Transistors

Connectors

PCB developing equipments

Humidity sensor
Temperature sensor
LDR
Bulb
LCD display

1.2 Aim of the project


Aim of this project is to design a system that can sense the temperature ,humidity and light in
a room and thus control them upto a reference value .
Using the power of microcontroller we are Developing Agriculture Conditions On Planet. In
our project we are controlling three conditions humidity, temperature , light using the inbuilt
ADC of the PIC microcontroller.

1.3 Block diagram

Humidity
sensor

Temperatu
re sensor

BUZZER

Microcontroller
PIC16F72

Ac
interfac
e

ARTIFICIAL
LIGHT

heater

LCD DISPLAY

Light
sensor

Motor

1.4

Working of the Project

Here we have used a temperature sensor, humidity sensor and a LDR which will sense the
temperature of the room, humidity and light in the room respectively. On sensing temperature,
humidity and light it will forward the measured temperature and all other values to the
microcontroller which control the entire operation of controlling temperature, humidity and
light. The microcontroller compare the sensed temperature, humidity and light with the
reference values which is either maximum or minimum temperature, humidity and light of the
room and thus control it. If the temperature of room increases the maximum limit,
microcontroller will control the temperature by running a fan, if light seems to decrease then it
will glow a bulb connected to pin of microcontroller through relay. An LCD display and a
buzzer used here for better understanding of temperature, humidity and light conditions.
a) For Controlling temperature:
If in case the temperature of the greenhouse increases or decreases than a set reference
value the corresponding voltage signal from the thermistor will not be equal to the
reference set inside the microcontroller. In such a case the microcontroller on
comparing the values would generate a 1 or high signal. This high signal would then
be passed on from the output pin of the microcontroller to the transistor. The transistor
on receiving the high would become forward biased and the relay would get a groung.
As the relay gets a ground the coil inside the relay would move from the rsting position
to ON position and the circuit to start the blower fan to control the temperature would
become ON.
b) For controlling humidity :
If in case the humidity inside the greenhouse decreases than a set reference value the
corresponding voltage signal from the humidity sensor will not be equal to the
reference set inside the microcontroller. In such a case the microcontroller on
comparing the values would generate a 1 or high signal. This high signal would then
be passed on from the output pin of the microcontroller to the transistor. The transistor

on receiving the high would become forward biased and the relay would get a ground.
As the relay gets a ground the coil inside the relay would move from the resting
position to ON position and the circuit to start the water pump to control the humidity
inside the greenhouse would become ON.
c) For controlling the Light Intensity:
If in case the light intensity inside the greenhouse decreases than a set reference value
the corresponding voltage signal from the Light Dependant Resistor will not be equal
to the reference set inside the microcontroller. In such a case the microcontroller on
comparing the values would generate a 1 or high signal. This high signal would then
be passed on from the output pin of the microcontroller to the transistor. The transistor
on receiving the high would become forward biased and the relay would get a ground.
As the relay gets a ground the coil inside the relay would move from the resting
position to ON position and the circuit to start the electric bulb to control the light
intensity would become ON.

1.5

Circuit Diagram

1.6

Component List

Circuit Description

1.7
1.7.1

Power supply section:

Consists of:
a) RLMT Connector--- It is a connector used to connect the step down transformer to
the bridge rectifier.
b) Bridge Rectifier --- It is a full wave rectifier used to convert ac into dc , 9-15v ac
made by transformer is converted into dc with the help of rectifier.
c) Capacitor ---It is an electrolytic capacitor of rating 1000M/35V used to remove the
ripples. Capacitor is the component used to pass the ac and block the dc.
d) Regulator ---LM7 805 is used to give a fixed 5v regulated supply.
e) Capacitor ---It is again an electrolytic capacitor 10M/65v used for filtering to give
pure dc.
f) Capacitor --- It is an ceramic capacitor used to remove the spikes generated when
frequency is high (spikes).
So the output of supply section is 5v regulated dc.

1.8

Microcontroller section
8

Requires three connections to be successfully done for its operation to begin.


a) +5v supply: This +5v supply is required for the controller to get start which is
provided from the power supply section.
b) Crystal Oscillator: A crystal oscillator of 4 MHz is connected to generate the
frequency for the controller. The crystal oscillator works on piezoelectric effect. The
clock generated is used to determine the processing speed of the controller. Two
capacitors are also connected one end with the oscillator while the other end is
connected with the ground. As it is recommended in the book to connect two ceramic
capacitor of 20 pf40pf to stabilize the clock generated.
c) Reset section: It consists of an RC network consisting of 1M/35V capacitor and one
resistance of 1k. This section is used to reset the controller.

1.9
1.9.1

Display Section
LCD (Liquid Crystal Display)

MICROCONTROLLER BASED LCD DISPLAY ,this project is an embedded project .


Embedded is the combination of software and hardware before designing any embedded
project it is the first step to design the proper hardware for the desired application. Here we are
interfacing the LCD, LIQUID CRYSTAL DISPLAY with the Microcontroller, the first step
while designing hardware is to design the required power supply as the controller operates on
+5 v supply so first we have to design the regulated supply with the help of transformer,
regulator and filtering capacitor.
Next step is the necessary connections of the controller like reset and the crystal oscillator for
resetting and speed respectively.

Then comes the LCD interfacing ,we are using 16x2 LCD for display, pin no. 7 to 14 are the
data lines of the LCD which has to be interfaced with the microcontroller input/output pins.
Port p0 has been used for the interfacing of data lines.
Since the display becomes very easy when we use microcontroller hence we have made this
project and we have tried to show different display using the switch.

1.10 Relay Section


RELAY is an isolator and an electrical switch. The relay used is 12V-5A.To control the
operation of relay an NPN transistor BC547 has been used. Whenever high signal comes at the
base of NPN transistor it is switched on and whenever low arrives it is switched off. Base of
the transistor is connected with the I/O pin of the microcontroller. Base resistance of 1k5 is
connected at the base of the transistor. Whenever low is sensed at the pin of microcontroller
transistor gets off and the output of the collector becomes high and the relay which is
connected at the output of the collector becomes off. The reverse action of it takes place when
high is sensed at the pin of microcontroller.
This section also consists of pull up & pull down resistance. A 2k2 resistance is used as pull
up. In any case when more than 5v comes then pull up resistance sinks the excess voltage &
maintains 5v. If pull up is not used then the 12v of relay can damage the processor when the
transistor BC547 is on. A pull down resistor of value 2k2 is also used.

1.11 PCB Layout

10

11

12

1.11.1 Steps for making PCB

Prepare the layout of the circuit (positive).

Cut the photo-film (slightly bigger) of the size of the layout.

Place the layout in the photo-printer machine with the photo-film above it. Make sure that
the bromide (dark) side of the film is in contact with the layout.

Switch on the machine by pressing the push button for 5 sec.

Dip the film in the solution prepared (developer) by mixing the chemicals A & B in equal
quantities in water.

Now clean the film by placing it in the tray containing water for 1 min.

After this, dip the film in the fixer solution for 1 min. now the negative of the
Circuit is ready.

Now wash it under the flowing water.

Dry the negative in the photo-cure machine.

Take the PCB board of the size of the layout and clean it with steel wool to make the
surface smooth.

Now dip the PCB in the liquid photo-resist, with the help of dip coat machine.

13

Now clip the PCB next to the negative in the photo cure machine, drying for approximate
10-12 minute.

Now place the negative on the top of the PCB in the UV machine, set the timer for about
2.5 minute and switch on the UV light at the top.

Take the LPR developer in a container and rigorously move the PCB in it.

After this, wash it with water very gently.

Then apply LPR dye on it with the help of a dropper so that it is completely covered by it.

Now clamp the PCB in the etching machine that contains ferric chloride solution for about
10 minutes.

After etching, wash the PCB with water, wipe it a dry cloth softly.

Finally rub the PCB with a steel wool, and the PCB is ready.

14

CHAPTER 2
PROGRAMMING
#INCLUDE

<P16F72.INC>

; PROCESSOR SPECIFIC VARIABLE

DEFINITIONS
#DEFINE

RS

PORTC,7

#DEFINE

EN

PORTC,6

#DEFINE

RELAYHUMIDITY

#DEFINE

RELAYLIGHT

PORTC,3

#DEFINE

BUZZER

PORTC,0

#DEFINE

RELAYTEMPLOW

PORTC,5

PORTC,1

MAIN
BCF

RELAYHUMIDITY

BCF

RELAYLIGHT

BSF

BUZZER

BCF

RELAYTEMPLOW

MAINLOOP
CALL DISPLAY
L_CJNL

OUTPUT_VOLTAGE,.40,GA1

BSF

RELAYHUMIDITY

BCF

BUZZER

GOTO GA2
GA1:

15

BCF

RELAYHUMIDITY

L_CJNG

TEMP,.65,GA3

BSF

RELAYTEMP

BCF

BUZZER

GOTO GA4

GA2:

GA3:
BCF

RELAYTEMP

L_CJNG

LIGHT,.20,GA5

BCF

RELAYLIGHT

GA4:

GOTO GA6
GA5:
BSF

RELAYLIGHT

BCF

BUZZER

L_CJNL

TEMP,.35,GA9

BSF

RELAYTEMPLOW

BCF

BUZZER

GA6:

GOTO GA10
GA9:
BCF

RELAYTEMPLOW

BSF

BUZZER

GA10:

GOTO MAINLOOP
DISPLAY
MOVLW

0X80

CALL LCD_COMMAND

16

MOVLW

"H"

CALL LCD_DATA
MOVLW

":"

MOVLW

0X82

CALL LCD_COMMAND
MOVFW

HUM_DITY

CALL LCD_DATA
CALL LCD_DATA
MOVLW

0X86

CALL LCD_COMMAND
MOVLW

"T"

CALL LCD_DATA
MOVLW

":"

CALL LCD_DATA
MOVLW

0X88

CALL LCD_COMMAND
MOVFW

TEMPERATURE

CALL LCD_DATA
MOVLW

0X8B

CALL LCD_COMMAND
MOVLW

"L"

CALL LCD_DATA
MOVLW

":"

CALL LCD_DATA
MOVLW

0X8D

CALL LCD_COMMAND
MOVFW

AD_RESC3

CALL LCD_DATA
MOVLW

0XC0

17

CALL LCD_COMMAND
MOVLW

"C"

CALL LCD_DATA
MOVLW

":"

CALL LCD_DATA
MOVLW

"4"

CALL LCD_DATA
MOVLW

"0"

CALL LCD_DATA
MOVLW

"C"

CALL LCD_DATA
MOVLW

":"

CALL LCD_DATA
MOVLW

"3"

CALL LCD_DATA
MOVLW

"5"

CALL LCD_DATA
MOVLW

"-"

CALL LCD_DATA
MOVLW

"6"

CALL LCD_DATA
MOVLW

"5"

CALL LCD_DATA
MOVLW

"C"

CALL LCD_DATA
MOVLW

":"

CALL LCD_DATA
MOVLW

"0"

CALL LCD_DATA
MOVLW

"2"

18

CALL LCD_DATA
MOVLW

"0"

CALL LCD_DATA
RETURN
ADINTR:
MOVWF

AD_RESC1

MOVWF

OUTPUTVOLTAGE

MOVWF

AD_RESC2

MOVWF

TEMP

MOVWF

AD_RESC3

MOVWF

LIGHT

RETURN
;
***************************************************************************
***
;SUBROUTINE FOR SEND LCD COMMAND
;COMMAND IN W REGISTER
;
***************************************************************************
***
LCD_COMMAND
BCF

RS

MOVWF

PORTB

BSF

EN

BCF

EN

RETURN

19

;
***************************************************************************
***
;SUBROUTINE FOR SEND LCD DATA
;
***************************************************************************
***
LCD_DATA
BSF

RS

MOVWF

PORTB

BSF

EN

BCF

EN

RETURN
END

20

CHAPTER 3
TRANSDUCERS & SENSORS
A transducer is a device which measures a physical quantity and converts it into a signal
which can be read by an observer or by an instrument. Monitoring and controlling of
greenhouse environment involves sensing the changes occurring inside it which can influence
the rate of growth in plants. The parameters which are of importance are the temperature
inside the greenhouse which affect the photosynthetic and transpiration processes are
humidity, the illumination etc. Since all these parameters are interlinked, a closed loop
(feedback) control system is employed in monitoring it.
The sensors used in this system are:
1. Light Sensor (LDR, Light Dependent Resistor)
2. Humidity Sensor (SY-HS-220)
3. Temperature Sensor (LM335)

3.1 Light Sensor

21

Light Dependent Resistor (LDR) also known as photoconductor or photocell, is a device


which has a resistance which varies according to the amount of light falling on its surface.
Since LDR is extremely sensitive in visible light range, it is well suited for the proposed
application.

Fig. 3.1 Light Dependent Resistor

3.1.1 Features of the light sensor:


The Light Dependent Resistor (LDR) is made using the semiconductor Cadmium Sulphide
(CdS).
The light falling on the brown zigzag lines on the sensor causes the resistance of the device
to fall. This is known as a negative co-efficient. There are some LDRs that work in the
opposite way i.e. their resistance increases with light (called positive coefficient).

22

The resistance of the LDR decreases as the intensity of the light falling on it increases.
Incident photons drive electrons from the valence band into the conduction band.

Fig. 3.2 Structure of a Light Dependent Resistor,


showing Cadmium Sulphide track and an atom to
illustrate electrons in the valence and conduction bands

23

3.1.2 Functional description


An LDR and a normal resistor are wired in series across a voltage, as shown in the circuit
below. Depending on which is tied to the 5V and which to 0V, the voltage at the point between
them, call it the sensor node, will either rise or fall with increasing light. If the LDR is the
component tied directly to the 5V, the sensor node will increase in voltage with increasing
light
The LDR's resistance can reach 10 k ohms in dark conditions and about 100 ohms in full
brightness.
The circuit used for sensing light in our system uses a 10 k fixed resistor which is tied to
+5V. Hence the voltage value in this case decreases with increase in light intensity.

24

Fig. 3.3 Light sensor circuit


The sensor node voltage is compared with the threshold voltages for different levels of light
intensity corresponding to the four conditions- Optimum, dim, dark and night.
The relationship between the resistance RL and light intensity Lux for a
typical LDR is:
RL = 500 / Lux k
With the LDR connected to 5V through a 10K resistor, the output voltage of the LDR is
Vo = 5*RL / (RL+10)
In order to increase the sensitivity of the sensor we must reduce the value of the fixed resistor
in series with the sensor. This may be done by putting other resistors in parallel with it.

25

Table 3.1 Light sensor readings

26

3.2 Humidity Sensor


The humidity sensor SY-HS-220, manufactured by Synitech Co. Ltd is used for sensing the
humidity. It delivers instrumentation quality RH (Relative Humidity) sensing performance in a
low cost, solderable SIP (Single In-line Package). Relative humidity is a measure, in
percentage, of the vapor in the air compared to the total amount of vapor that could be held in
the air at a given temperature.

27

Fig. 3.4 SY-HS-220 Humidity Sensor

3.2.1 Features:
Linear voltage output vs. %RH
Laser trimmed interchange ability
Low power design
High accuracy
Fast response time
Stable, low drift performance
Chemically resistant
The RH sensor is a laser trimmed, thermostat polymer capacitive sensing element with onchip integrated signal conditioning. The sensing element's multilayer construction provides
excellent resistance to most application hazards such as wetting, dust, dirt, oils and common
environmental chemicals.

28

Fig. 3.5 Humidity sensor circuit

3.2.2 Functional description


The sensor develops a linear voltage vs. RH output that is ratio-metric to the supply voltage.
That is, when the supply voltage varies, the sensor output voltage follows in the same
proportion. It can operate over a 4-5.8 supply voltage range. At 5V supply voltage, and room
temperature, the output voltage ranges from 0.8 to 3.9V as the humidity varies from 0% to
100% (non-condensing).
The humidity sensor functions with a resolution of up to 0.5% of relative humidity (RH).

29

With a typical current draw of only 200 A, This Series is ideally suited for low drain,
battery operated systems.
The change in the RH of the surroundings causes an equivalent change in the voltage output.
The output is an analog voltage proportional to the supply voltage.
Consequently, converting it to relative humidity (RH) requires that both the supply and sensor
output voltages be taken into account according to the formula:
RH = ((Vout / Vsupply) 0.16) /0.0062, typical at 25C
This voltage is converted to the digital form by microcontroller which reads the data.

3.2.3 Humidity sensor readings


FORMULA:
RH = ((Vout / Vcc) 0.16)/0.0062, typical at 25C
Where, V Supply = 4.98V
Tolerance= 0.1V
Table 3.2 Humidity sensor readings

30

3.3.1 Temperature Sensor


National Semiconductors LM335 IC has been used for sensing the temperature. It is an
integrated circuit sensor that can be used to measure temperature with an electrical output
proportional to the temperature (in oC). The temperature can be measured more accurately
with it than using a thermistor. The sensor circuitry is sealed and not subject to oxidation, etc.

Fig. 3.6 LM335 temperature sensor

3.3.1 Features:
Calibrated directly in Celsius (Centigrade)
Linear + 10.0 mV/C scale factor
0.5C accuracy guaranteed (at +25C)
Rated for full 55 to +150C range

31

Suitable for remote applications


Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 A current drain

Fig. 3.7 Temperature sensor circuit

3.3.2 Functional description:


32

The sensor has a sensitivity of 10mV / oC.


The output of LM35 is amplified using a single power supply (+5V) op-amp.
The op-amp is designed to have a gain of 5.
The circuitry measures temperatures with a resolution of up to 0.5 degree Celsius.
The output voltage is converted to temperature by a simple conversion factor.
The general equation used to convert output voltage to temperature is:
Temperature ( oC) = (Vout * 100 ) / 5 oC (4.4)
So if Vout is 5V, then, Temperature = 100 oC
The output voltage varies linearly with temperature.

3.3.3 Temperature sensor readings


FORMULA:

Temperature ( Oc ) = (Vout/5) *100( Oc/V)


Table 3.3 Temperature Sensor Readings

33

34

CHAPTER 4
MICROCONTROLLER UNIT
4.1 MICROCONTROLLER (PIC16F72)
4.1.1 CRITERIA FOR CHOOSING A MICROCONTROLLER
The basic criteria for choosing a microcontroller suitable for the application are:

35

1) The first and foremost criterion is that it must meet the task at hand efficiently and cost
effectively. In analyzing the needs of a microcontroller-based project, it is seen whether an 8bit, 16-bit or 32-bit microcontroller can best handle the computing needs of the task most
effectively. Among the other considerations in this category are:
(a) Speed: The highest speed that the microcontroller supports.
(b) Packaging: It may be a 28-pin DIP (dual inline package) or a QFP (quad flat package), or
some other packaging format. This is important in terms of space, assembling, and prototyping
the end product.
(c) Power consumption: This is especially critical for battery-powered products.
(d) The number of I/O pins and the timer on the chip.
(e) How easy it is to upgrade to higher performance or lower consumption versions.
(f) Cost per unit: This is important in terms of the final cost of the product in which a
microcontroller is used.
2) The second criterion in choosing a microcontroller is how easy it is to develop products
around it. Key considerations include the availability of an assembler, debugger, compiler,
technical support.
3) The third criterion in choosing a microcontroller is its ready availability in needed
quantities both now and in the future.

4.1.2 Description
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single
word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful
PIC architecture into an 28-pin package and is upwards compatible with the PIC16C5X,
PIC12CXXX and PIC16C7X devices. The PIC16F72 features 5 channels of 8-bit Analog-toDigital (A/D) converter with 2 additional timers, capture/compare/PWM function and the
synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI)
or the 2-wire Inter-Integrated Circuit (IC) bus. All of these features make it ideal for more

36

advanced level A/D applications in automotive, industrial, appliances and consumer


applications.

4.1.3 Device Specification


4.1.3.1 High Performance RISC CPU:
Only 35 single word instructions to learn.
All single cycle instructions except for program branches, which are two-cycle.
Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle.
2K x 14 words of Program Memory, 128 x 8 bytes of Data Memory (RAM).
Pin out compatible to PIC16C72/72A and PIC16F872.
Interrupt capability.
Eight-level deep hardware stack.
Direct, Indirect and Relative Addressing modes.
4.1.3.2 Peripheral Features:
High Sink/Source Current: 25 mA
Timer0: 8-bit timer/counter with 8-bit prescaler
Timer1: 16-bit timer/counter with pre-scalar, can be incremented during SLEEP via
external crystal/clock
Timer2: 8-bit timer/counter with 8-bit period register, pre-scalar and post-scalar
Capture, Compare, PWM (CCP) module
- Capture is 16-bit, maximum resolution is 12.5 ns
- Compare is 16-bit, maximum resolution is 200 ns
- PWM maximum resolution is 10-bit
8-bit, 5-channel analog-to-digital converter
Synchronous Serial Port (SSP) with SPI (Master/Slave) and I2C (Slave)
Brown-out detection circuitry for Brown-out Reset (BOR)

37

4.1.3.3 CMOS Technology:


Low power, high speed CMOS FLASH technology
Fully static design
Wide operating voltage range: 2.0V to 5.5V
Industrial temperature range
Low power consumption:
- < 0.6 mA typical @ 3V, 4 MHz
- 20 micro A typical @ 3V, 32 kHz
- < 1 micro A typical standby current
4.1.3.4 Special Microcontroller Features:
1,000 erase/write cycle FLASH program memory typical
Power-on Reset (POR), Power-up Timer (PWRT) and Oscillator Start-up Timer
(OST)
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
Programmable code protection
Power saving SLEEP mode
Selectable oscillator options
In-Circuit Serial Programming (ICSP) via 2 pins
Processor read access to program memory

4.2 Pin Diagram of PIC16F72

38

F
Fig 4.1 Pin Diagram of Microcontroller

4.3 Block Diagram of Microcontroller

39

Fig 4.2 Block Diagram of Microcontroller


4.2.6 PIN DESCRIPTION: Following table shows the pin description of microcontroller
Table 4.1 Pin Description

40

4.4 Analog-to-Digital Converter (A/D) Module


41

The analog-to-digital (A/D) converter module has five inputs for the PIC16F72. The A/D
allows conversion of an analog input signal to a corresponding 8-bit digital number. The
output of the sample and hold is the input into the converter, which generates the result via
successive approximation. The analog reference voltage is software selectable to either the
devices positive supply voltage (VDD) or the voltage level on the RA3/AN3/VREF pin. The
A/D converter has a unique feature of being able to operate while the device is in SLEEP
mode. To operate in SLEEP, the A/D conversion clock must be derived from the A/Ds internal
RC oscillator.
The A/D module has three registers:
A/D Result Register ADRES
A/D Control Register 0 ADCON0
A/D Control Register 1 ADCON1
A device RESET forces all registers to their RESET state. This forces the A/D module to be
turned off and any conversion is aborted. The ADCON0 register, shown in Register 10-1,
controls the operation of the A/D module. The ADCON1 register, shown in Register 10-2,
configures the functions of the port pins. The port pins can be configured as analog inputs
(RA3 can also be a voltage reference) or a digital I/O.

4.5 Instruction Set Summary


Each PIC16F72 instruction is a 14-bit word divided into an OPCODE that specifies the
instruction type and one or more operands that further specify the operation of the instruction.
The PIC16F72 instruction set summary in Table below lists byte-oriented, bit-oriented, and
literal and control operations. Table below shows the op-code field descriptions. For byteoriented instructions, f represents a file register designator and d represents a destination
designator. The file register designator specifies which file register is to be used by the
instruction. The destination designator specifies where the result of the operation is to be

42

placed. If d is zero, the result is placed in the W register. If d is one, the result is placed in
the file register specified in the instruction. For bit-oriented instructions, b represents a bit
field designator which selects the number of the bit affected by the operation, while f
represents the number of the file in which the bit is located. For literal and control operations,
k represents an eight or eleven-bit constant or literal value.
The instruction set is highly orthogonal and is grouped into three basic categories:
Byte-oriented operations
Bit-oriented operations
Literal and control operations
All instructions are executed within one single instruction cycle, unless a conditional test is
true or the program counter is changed as a result of an instruction. In this case, the execution
takes two instruction cycles, with the second cycle executed as a NOP. One instruction cycle
consists of four oscillator periods. Thus, for an oscillator frequency of 4 MHz, the normal
instruction execution time is 1 s. If a conditional test is true, or the program counter is
changed as a result of an instruction, the instruction execution time is 2 seconds.

43

CHAPTER 5
COMPONENT DESCRIPTION
5.1 Transformers
A transformer is a device that transfers electrical energy from one circuit to another by
magnetic coupling without requiring relative motion between its parts. It usually comprises
two or more coupled windings, and, in most cases, a core to concentrate magnetic flux. A
transformer operates from the application of an alternating voltage to one winding, which
creates a time-varying magnetic flux in the core. This varying flux induces a voltage in the
other windings. Varying the relative number of turns between primary and secondary windings
determines the ratio of the input and output voltages, thus transforming the voltage by
stepping it up or down between circuits.

1.11.1

Basic principle

The principles of the transformer are illustrated by consideration of a hypothetical ideal


transformer consisting of two windings of zero resistance around a core of negligible
reluctance. A voltage applied to the primary winding causes a current, which develops a
magnetomotive force (MMF) in the core. The current required to create the MMF is termed
the magnetising current; in the ideal transformer it is considered to be negligible. The MMF
drives flux around the magnetic circuit of the core.

44

Figure 5.1: The ideal transformer as a circuit element

An electromotive force (EMF) is induced across each winding, an effect known as mutual
inductance. The windings in the ideal transformer have no resistance and so the EMFs are
equal in magnitude to the measured terminal voltages. In accordance with Faraday's law of
induction, they are proportional to the rate of change of flux:

and
Equation: EMF induced in primary and secondary windings
where:
and
and
and

are the induced EMFs across primary and secondary windings,


are the numbers of turns in the primary and secondary windings,
are the time derivatives of the flux linking the primary and secondary windings.

In the ideal transformer, all flux produced by the primary winding also links the secondary,
and so

, from which the well-known transformer equation follows:

45

Equation: Transformer Equation


The ratio of primary to secondary voltage is therefore the same as the ratio of the number of
turns; alternatively, that the volts-per-turn is the same in both windings. The conditions that
determine Transformer working in STEP UP or STEP DOWN mode are:
Ns > Np
Equation: Condition for STEP UP
Ns < Np
Equation: Condition for STEP DOWN

5.2 Rectifier
A bridge rectifier is an arrangement of four diodes connected in a bridge circuit as shown
below, that provides the same polarity of output voltage for any polarity of the input voltage.
When used in its most common application, for conversion of alternating current (AC) input
into direct current (DC) output, it is known as a bridge rectifier. The bridge rectifier provides
full wave rectification from a two wire AC input (saving the cost of a center tapped
transformer) but has two diode drops rather than one reducing efficiency over a center tap
based design for the same output voltage.

46

Figure 5.2: Schematic of a bridge rectifier


The essential feature of this arrangement is that for both polarities of the voltage at the bridge
input, the polarity of the output is constant.

5.2.1 Basic Operation


When the input connected at the left corner of the diamond is positive with respect to the one
connected at the right hand corner, current flows to the right along the upper colored path to
the output, and returns to the input supply via the lower one.

47

When the right hand corner is positive relative to the left hand corner, current flows along the
upper colored path and returns to the supply via the lower colored path.

Figure 5.3: AC, half-wave and full wave rectified signals

48

In each case, the upper right output remains positive with respect to the lower right one. Since
this is true whether the input is AC or DC, this circuit not only produces DC power when
supplied with AC power: it also can provide what is sometimes called "reverse polarity
protection". That is, it permits normal functioning when batteries are installed backwards or
DC input-power supply wiring "has its wires crossed" (and protects the circuitry it powers
against damage that might occur without this circuit in place).
Prior to availability of integrated electronics, such a bridge rectifier was always constructed
from discrete components. Since about 1950, a single four-terminal component containing the
four diodes connected in the bridge configuration became a standard commercial component
and is now available with various voltage and current ratings.

5.2.2 Output Smoothing


For many applications, especially with single phase AC where the full-wave bridge serves to
convert an AC input into a DC output, the addition of a capacitor may be important because
the bridge alone supplies an output voltage of fixed polarity but pulsating magnitude.

Figure 5.4: Bridge Rectifier with smoothen output

49

The function of this capacitor, known as a 'smoothing capacitor' (see also filter capacitor) is to
lessen the variation in (or 'smooth') the raw output voltage waveform from the bridge. One
explanation of 'smoothing' is that the capacitor provides a low impedance path to the AC
component of the output, reducing the AC voltage across, and AC current through, the
resistive load. In less technical terms, any drop in the output voltage and current of the bridge
tends to be cancelled by loss of charge in the capacitor. This charge flows out as additional
current through the load. Thus the change of load current and voltage is reduced relative to
what would occur without the capacitor. Increases of voltage correspondingly store excess
charge in the capacitor, thus moderating the change in output voltage / current.
The capacitor and the load resistance have a typical time constant = RC where
C and R are the capacitance and load resistance respectively. As long as the load resistor is
large enough so that this time constant is much longer than the time of one ripple cycle, the
above configuration will produce a well smoothed DC voltage across the load resistance. In
some designs, a series resistor at the load side of the capacitor is added. The smoothing can
then be improved by adding additional stages of capacitorresistor pairs, often done only for
sub-supplies to critical high-gain circuits that tend to be sensitive to supply voltage noise.

5.3 Voltage Regulators


A voltage regulator is an electrical regulator designed to automatically maintain a constant
voltage level. It may use an electromechanical mechanism, or passive or active electronic
components. Depending on the design, it may be used to regulate one or more AC or DC
voltages. With the exception of shunt regulators, all voltage regulators operate by comparing
the actual output voltage to some internal fixed reference voltage. Any difference is amplified
and used to control the regulation element. This forms a negative feedback servo control loop.
If the output voltage is too low, the regulation element is commanded to produce a higher

50

voltage. For some regulators if the output voltage is too high, the regulation element is
commanded to produce a lower voltage; however, many just stop sourcing current and depend
on the current draw of whatever it is driving to pull the voltage back down. In this way, the
output voltage is held roughly constant. The control loop must be carefully designed to
produce the desired tradeoff between stability and speed of response.

5.3.1 LM317 (3-Terminal Adjustable Regulator)


5.3.1.1 Description
The LM317 is an adjustable three-terminal positive-voltage regulator capable of supplying
more than 1.5 A over an output-voltage range of 1.2 V to 37 V. It is exceptionally easy to use
and requires only two external resistors to set the output voltage. Furthermore, both line and
load regulation are better than standard fixed
regulators. The LM317 is packaged in the KC (TO-220AB) and KTE packages, which are
easy to handle and use. In addition to having higher performance than fixed regulators, this
device includes on-chip current limiting, thermal overload protection, and safe-operating-area
protection. All overload protection remains fully functional, even if the ADJUST terminal is
disconnected.

Figure 5.5: TOP IC view of LM 317

51

The LM317 is versatile in its applications, including uses in programmable output regulation
and local on-card regulation. Or, by connecting a fixed resistor between the ADJUST and
OUTPUT terminals, the LM317 can function as a precision current regulator. An optional
output capacitor can be added to improve transient response. The ADJUST terminal can be
bypassed to achieve very high ripple-rejection ratios, which are difficult to achieve with
standard three-terminal regulators. The LM317 is characterized for operation over the
virtual junction temperature range of 0C to 125C.

52

Figure 5.6: Adjustable Voltage Regulator

5.3.2 LM7805 (3-Terminal Fixed Voltage Regulator)


The MC78XX/LM78XX/MC78XXA 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 shut down
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.

53

Figure 5.6: Internal block Diagram

Figure 5.7: Fixed Output Regulator

5.3.3 Features
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection

54

Short Circuit Protection


Output Transistor Safe Operating Area Protection

5.4 Liquid crystal display (LCD)


A liquid crystal display (commonly abbreviated LCD) is a thin, flat display device made up of
any number of color or monochrome pixels arrayed in front of a light source or reflector. It is
prized by engineers because it uses very small amounts of electric power, and is therefore
suitable for use in battery-powered electronic devices. Each pixel of an LCD consists of a
layer of perpendicular molecules aligned between two transparent electrodes, and two
polarizing filters, the axes of polarity of which are perpendicular to each other. With no liquid
crystal between the polarizing filters, light passing through one filter would be blocked by the
electrodes. The surfaces of the electrodes that are in contact with the liquid crystal material are
treated so as to align the liquid crystal molecules in a particular direction. This treatment
typically consists of a thin polymer layer that is unidirectionally rubbed using a cloth (the
direction of the liquid crystal alignment is defined by the direction of rubbing). Before
applying an electric field, the orientation of the liquid crystal molecules is determined by the
alignment at the surfaces. In a twisted nematic device (the most common liquid crystal
device), the surface alignment directions at the two electrodes are perpendicular, and so the
molecules arrange themselves in a helical structure, or twist. Because the liquid crystal
material is birefringent, light passing through one polarizing filter is rotated by the liquid
crystal helix as it passes through the liquid crystal layer, allowing it to pass through the second
polarized filter. Half of the light is absorbed by the first polarizing filter, but otherwise the
entire assembly is transparent. When a voltage is applied across the electrodes, a torque acts to
align the liquid crystal molecules parallel to the electric field, distorting the helical structure
(this is resisted by elastic forces since the molecules are constrained at the surfaces). This
reduces the rotation of the polarization of the incident light, and the device appears gray. If the
applied voltage is large enough, the liquid crystal molecules are completely untwisted and the
polarization of the incident light is not rotated at all as it passes through the liquid crystal
layer. This light will then be polarized perpendicular to the second filter, and thus be

55

completely blocked and the pixel will appear black. By controlling the voltage applied across
the liquid crystal layer in each pixel, light can be allowed to pass through in varying amounts,
correspondingly illuminating the pixel. With a twisted nematic liquid crystal device it is usual
to operate the device between crossed polarizers, such that it appears bright with no applied
voltage. With this setup, the dark voltage-on state is uniform. The device can be operated
between parallel polarizers, in which case the bright and dark states are reversed.
Both the liquid crystal material and the alignment layer material contain
ionic compounds. If an electric field of one particular polarity is applied for a long period of
time, this ionic material is attracted to the surfaces and degrades the device performance. This
is avoided by applying either an alternating current, or by reversing the polarity of the electric
field as the device is addressed (the response of the liquid crystal layer is identical, regardless
of the polarity of the applied field). When a large number of pixels is required in a display, it is
not feasible to drive each directly since then each pixel would require independent electrodes.
Instead, the display is multiplexed. In a multiplexed display, electrodes on one side of the
display are grouped and wired together (typically in columns), and each group gets its own
voltage source. On the other side, the electrodes are also grouped (typically in rows), with
each group getting a voltage sink. The groups are designed so each pixel has a unique,
unshared combination of source and sink. The electronics or the software driving the
electronics then turns on sinks in sequence, and drives sources for the pixels of each sink.

56

Figure 5.8:LCD Pictorial View

5.4.1 LCD Standards


Frequently, an 8051 program must interact with the outside world using input and output
devices that communicate directly with a human being. One of the most common devices
attached to an 8051 is an LCD display. Some of the most common LCDs connected to the
8051 are 16x2 and 20x2 displays. This means 16 characters per line by 2 lines and 20
characters per line by 2 lines, respectively. Fortunately, a very popular standard exists which
allows us to communicate with the vast majority of LCDs regardless of their manufacturer.
The standard is referred to as HD44780U, which refers to the controller chip which receives
data from an external source (in this case, the 8051) and communicates directly with the LCD.

5.4.2 44780 Standards


The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus.
The user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If
a 4-bit data bus is used the LCD will require a total of 7 data lines (3 control lines plus the 4

57

lines for the data bus). If an 8-bit data bus is used the LCD will require a total of 11 data lines
(3 control lines plus the 8 lines for the data bus).
The three control lines are referred to as EN, RS, and RW.
The EN line is called "Enable." This control line is used to tell the LCD that you are sending
it data. To send data to the LCD, your program should make sure this line is low (0) and then
set the other two control lines and/or put data on the data bus. When the other lines are
completely ready, bring EN high (1) and wait for the minimum amount of time required by the
LCD datasheet (this varies from LCD to LCD), and end by bringing it low (0) again. The RS
line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or
special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data
being sent is text data which should be displayed on the screen. For example, to display the
letter "T" on the screen you would set RS high.
The RW line is the "Read/Write" control line. When RW is low (0), the
information on the data bus is being written to the LCD. When RW is high (1), the program is
effectively querying (or reading) the LCD. Only one instruction ("Get LCD status") is a read
command. All others are write commands--so RW will almost always be low.Finally, the data
bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the
case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6,
and DB7.

58

5.5 RELAYS

Figure 5.9: Relay designs


A relay is an electrically operated switch. Current flowing through the coil of the relay creates
a magnetic field, which attracts a lever and changes the switch contacts. The coil current can
be on or off so relays have two switch positions and they are double throw (changeover)
switches.

59

Relays allow one circuit to switch a second circuit that can be completely separate from the
first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains
circuit. There is no electrical connection inside the relay between the two circuits, the link is
magnetic and mechanical.
The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can
be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips)
cannot provide this current and a transistor is usually used to amplify the small IC current to
the larger value required for the relay coil. The maximum output current for the popular 555
timer IC is 200mA so these devices can supply relay coils directly without amplification.
Relays are usually SPDT or DPDT but they can have many more sets of
switch contacts, for example relays with 4 sets of changeover contacts are readily available.
For further information about switch contacts and the terms used to describe them please see
the page on switches.
Most relays are designed for PCB mounting but you can solder wires directly to the pins
providing you take care to avoid melting the plastic case of the relay.
The supplier's catalogue should show you the relay's connections. The coil will be obvious and
it may be connected either way round. Relay coils produce brief high voltage 'spikes' when
they are switched off and this can destroy transistors and ICs in the circuit. To prevent damage
you must connect a protection diode across the relay coil.
The animated picture shows a working relay with its coil and switch contacts. You can see a
lever on the left being attracted by magnetism when the coil is switched on. This lever moves
the switch contacts. There is one set of contacts (SPDT) in the foreground and another behind
them, making the relay DPDT.
The relay's switch connections are usually labeled COM, NC and NO:

COM = Common, always connect to this, it is the moving part of the switch.

NC = Normally Closed, COM is connected to this when the relay coil is off.

NO = Normally Open, COM is connected to this when the relay coil is on.

Connect to COM and NO if you want the switched circuit to be on when the relay coil is on.

Connect to COM and NC if you want the switched circuit to be on when the relay coil is off.

60

5.5.1 Choosing a relay


You need to consider several features when choosing a relay:
a) Physical size and pin arrangement
If you are choosing a relay for an existing PCB you will need to ensure that its
dimensions and pin arrangement are suitable. You should find this information in the
supplier's catalogue.
b) Coil voltage
The relay's coil voltage rating and resistance must suit the circuit powering the relay
coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also
readily available. Some relays operate perfectly well with a supply voltage which is a
little lower than their rated value.
c) Coil resistance
The circuit must be able to supply the current required by the relay coil. You can use
Ohm's law to calculate the current:
Supply voltage
Coil resistance
e) For example: A 12V supply relay with a coil resistance of 400
Relay coil current =

passes a current of

30mA. This is OK for a 555 timer IC (maximum output current 200mA), but it is too
much for most ICs and they will require a transistor to amplify the current.
f) Switch ratings (voltage and current)
The relay's switch contacts must be suitable for the circuit they are to control. You will
need to check the voltage and current ratings. Note that the voltage rating is usually
higher for AC, for example: "5A at 24V DC or 125V AC".

61

g) Switch contact arrangement (SPDT, DPDT etc)


Most relays are SPDT or DPDT which are often described as "single pole changeover"
(SPCO) or "double pole changeover" (DPCO).

5.5.2 Advantages of relays:

Relays can switch AC and DC, transistors can only switch DC.

Relays can switch high voltages, transistors cannot.

Relays are a better choice for switching large currents (> 5A).

Relays can switch many contacts at once.

5.5.3 Disadvantages of relays:

Relays are bulkier than transistors for switching small currents.

Relays cannot switch rapidly (except reed relays), transistors can switch many times
per second.

Relays use more power due to the current flowing through their coil.
Relays require more current than many chips can provide, so a low power transistor may be
needed to switch the current for the relay's coil.

5.6 Crystal Oscillator


It is often required to produce a signal whose frequency or pulse rate is very stable and exactly
known. This is important in any application where anything to do with time or exact
measurement is crucial. It is relatively simple to make an oscillator that produces some sort of
a signal, but another matter to produce one of relatively precise frequency and stability. AM
radio stations must have a carrier frequency accurate within 10Hz of its assigned frequency,
which may be from 530 to 1710 kHz. SSB radio systems used in the HF range (2-30 MHz)

62

must be within 50 Hz of channel frequency for acceptable voice quality, and within 10 Hz for
best results. Some digital modes used in weak signal communication may require frequency
stability of less than 1 Hz within a period of several minutes. The carrier frequency must be
known to fractions of a hertz in some cases. An ordinary quartz watch must have an oscillator
accurate to better than a few parts per million. One part per million will result in an error of
slightly less than one half second a day, which would be about 3 minutes a year. This might
not sound like much, but an error of 10 parts per million would result in an error of about a
half an hour per year. A clock such as this would need resetting about once a month, and more
often if you are the punctual type. A programmed VCR with a clock this far off could miss the
recording of part of a TV show. Narrow band SSB communications at VHF and UHF
frequencies still need 50 Hz frequency accuracy. At 440 MHz, this is slightly more than 0.1
part per million.
Ordinary L-C oscillators using conventional inductors and capacitors can achieve typically
0.01 to 0.1 percent frequency stability, about 100 to 1000 Hz at 1 MHz. This is OK for AM
and FM broadcast receiver applications and in other low-end analog receivers not requiring
high tuning accuracy. By careful design and component selection, and with rugged mechanical
construction, .01 to 0.001%, or even better (.0005%) stability can be achieved. The better
figures will undoubtedly employ temperature compensation components and regulated power
supplies, together with environmental control (good ventilation and ambient temperature
regulation) and battleship mechanical construction. This has been done in some
communications receivers used by the military and commercial HF communication receivers
built in the 1950-1965 era, before the widespread use of digital frequency synthesis. But these
receivers were extremely expensive, large, and heavy. Many modern consumer grade AM,
FM, and shortwave receivers employing crystal controlled digital frequency synthesis will do
as well or better from a frequency stability standpoint.
An oscillator is basically an amplifier and a frequency selective feedback network (Fig 1).
When, at a particular frequency, the loop gain is unity or more, and the total phaseshift at this
frequency is zero, or some multiple of 360 degrees, the condition for oscillation is satisfied,
and the circuit will produce a periodic waveform of this frequency. This is usually a sine wave,
or square wave, but triangles, impulses, or other waveforms can be produced. In fact, several

63

different waveforms often are simultaneously produced by the same circuit, at different points.
It is also possible to have several frequencies produced as well, although this is generally
undesirable.

5.7 Capacitor
A capacitor or condenser is a passive electronic component consisting of a pair of conductors
separated by a dielectric (insulator). When a potential difference (voltage) exists across the
conductors, an electric field is present in the dielectric. This field stores energy and produces a
mechanical force between the conductors. The effect is greatest when there is a narrow
separation between large areas of conductor, hence capacitor conductors are often called
plates. 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.
Capacitors are widely used in electronic circuits to block the flow of direct current while
allowing alternating current to pass, to filter out interference, to smooth the output of power
supplies, and for many other purposes. They are used in resonant circuits in radio frequency
equipment to select particular frequencies from a signal with many frequencies.

Figure 5.10: Capacitor designs

64

a) Theory of operation
Main article: Capacitance

Figure 5.11: Charge distribution between capacitor plates


Charge separation in a parallel-plate capacitor causes an internal electric field. A dielectric
(orange) reduces the field and increases the capacitance. 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 buildup affects the mechanics of the capacitor, causing the capacitance to
vary. In this case, capacitance is defined in terms of incremental changes:

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.
b) 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 and energy is

65

stored in the electric field. If charge is later allowed to return to its equilibrium position, the
energy is released. The work done in establishing the electric field, and hence the amount of
energy stored, is given by:

c) Current-voltage relation
The current i(t) through a component in an electric circuit is defined as the rate of change of
the charge q(t) that has passed through it. Physical charges cannot pass through the dielectric
layer of a capacitor, but rather build up in equal and opposite quantities on the electrodes: as
each electron accumulates on the negative plate, one leaves the positive plate. Thus the
accumulated charge on the electrodes is equal to the integral of the current, as well as being
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,[12]

.
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.

66

5.8 Resistor
Resistors are used to limit the value of current in a circuit. Resistors offer opposition to the
flow of current. They are expressed in ohms for which the symbol is . Resistors are broadly
classified as
(1)

Fixed Resistors

(2)

Variable Resistors

5.8.1 Fixed Resistors:


The most common of low wattage, fixed type resistors is the molded-carbon composition
resistor. The resistive material is of carbon clay composition. The leads are made of tinned
copper. Resistors of this type are readily available in value ranging from few ohms to about
20M, having a tolerance range of 5 to 20%. They are quite inexpensive. The relative size of
all fixed resistors changes with the wattage rating.
Another variety of carbon composition resistors is the metalized type. It is
made by deposition a homogeneous film of pure carbon over a glass, ceramic or other
insulating core. This type of film-resistor is sometimes called the precision type, since it can
be obtained with an accuracy of 1%.

Lead

Colour Coding

Tinned Copper Material

Molded Carbon Clay Composition

67

Figure 5.12: Fixed Resistor

5.8.2 A Wire Wound Resistor:


It uses a length of resistance wire, such as nichrome. This wire is wounded on to a round
hollow porcelain core. The ends of the winding are attached to these metal pieces inserted in
the core. Tinned copper wire leads are attached to these metal pieces. This assembly is coated
with an enamel coating powdered glass. This coating is very smooth and gives mechanical
protection to winding. Commonly available wire wound resistors have resistance values
ranging from 1 to 100K, and wattage rating up to about 200W.

5.8.3 Coding Of Resistor:


Some resistors are large enough in size to have their resistance printed on the body. However
there are some resistors that are too small in size to have numbers printed on them. Therefore,
a system of colour coding is used to indicate their values. For fixed, moulded composition
resistor four colour bands are printed on one end of the outer casing. The colour bands are
always read left to right from the end that has the bands closest to it. The first and second band
represents the first and second significant digits, of the resistance value. The third band is for
the number of zeros that follow the second digit. In case the third band is gold or silver, it
represents a multiplying factor of 0.1to 0.01. The fourth band represents the manufactures
tolerance. Here is the resistor coloring chart:

0 black

0 black

0 black

0 black

1 brown
2 red
3 orange

1 brown
2 red
3 orange

1 brown
2 red
3 orange

1 brown
2 red
3 orange

4 yellow

4 yellow

4 yellow

4 yellow

5 green
6 blue

5 green

6 blue

5 green
6 blue

5 green
6 blue

7 purple

7 purple

7 purple

7 purple

8 silver

8 silver

8 silver

8 silver

9 white

9 white

9 white

9 white

68

For example, if a resistor has a colour band sequence: yellow, violet, orange and gold.Then its
range will be
Yellow=4, violet=7, orange=10,

gold=5% =47K 5% =2.35K

Most resistors have 4 bands:

The first band gives the first digit.

The second band gives the second digit.

The third band indicates the number of zeros.

The fourth band is used to show the tolerance (precision) of the resistor.

This resistor has red (2), violet (7), yellow (4 zeros) and gold bands.
So its value is 270000

= 270 k .

The standard colour code cannot show values of less than 10 . To show these small values
two special colours are used for the third band: gold, which means 0.1 and silver which
means 0.01. The first and second bands represent the digits as normal.

5.9 Transistors
A transistor is an active device. It consists of two PN junctions formed by sandwiching either
p-type or n-type semiconductor between a pair of opposite types.
There are two types of transistor:
1. n-p-n transistor

69

2. p-n-p transistor

An n-p-n transistor is composed of two n-type semiconductors separated by a thin section of


p-type. However a p-n-p type semiconductor is formed by two p-sections separated by a thin
section of n-type. Transistor has two pn junctions one junction is forward biased and other is
reversed biased. The forward junction has a low resistance path whereas a reverse biased
junction has a high resistance path. The weak signal is introduced in the low resistance circuit
and output is taken from the high resistance circuit. Therefore a transistor transfers a signal
from a low resistance to high resistance. Transistor has three sections of doped
semiconductors. The section on one side is emitter and section on the opposite side is
collector. The middle section is base.
a) Emitter : The section on one side that supplies charge carriers is called emitter. The
emitter is always forward biased w.r.t. base.

b) Collector : The section on the other side that collects the charge is called collector. The
collector is always reversed biased.

70

c) Base : The middle section which forms two pn-junctions between the emitter and
collector is called base.
A transistor raises the strength of a weak signal and thus acts as an amplifier. The weak signal
is applied between emitter-base junction and output is taken across the load Rc connected in
the collector circuit. The collector current flowing through a high load resistance Rc produces
a large voltage across it. Thus a weak signal applied in the input appears in the amplified form
in the collector circuit.

5.10 CONNECTORS
Connectors are basically used for interface between two. Here we use connectors for having
interface between PCB and 8051 Microprocessor Kit.
There are two types of connectors they are male and female. The one, which is with pins
inside, is female and other is male.These connectors are having bus wires with them for
connection.
For high frequency operation the average circumference of a coaxial cable must be limited to
about one wavelength, in order to reduce multimodal propagation and eliminate erratic
reflection coefficients, power losses, and signal distortion. The standardization of coaxial
connectors during World War II was mandatory for microwave operation to maintain a low
reflection coefficient or a low voltage standing wave ratio.
Seven types of microwave coaxial connectors are as follows:
a) 1.APC-3.5
b) 2.APC-7
c) 3.BNC
d) 4.SMA
e) 5.SMC
f) 6.TNC
g) 7.Type N

71

5.11 LED (LIGHT EMITTING DIODE)


A junction diode, such as LED, can emit light or exhibit electro luminescence. Electro
luminescence is obtained by injecting minority carriers into the region of a p-n junction where
radiative transition takes place. In radiative transition, there is a transition of electron from the
conduction band to the valence band, which is made possibly by emission of a photon. Thus,
emitted light comes from the hole electron recombination. What is required is that electrons
should make a transition from higher energy level to lower energy level releasing photon of
wavelength corresponding to the energy difference associated with this transition. In LED the
supply of high-energy electron is provided by forward biasing the diode, thus injecting
electrons into the n-region and holes into p-region.
The p-n junction of LED is made from heavily doped material. On forward bias condition,
majority carriers from both sides of the junction cross the potential barrier and enter the
opposite side where they are then minority carrier and cause local minority carrier population
to be larger than normal. This is termed as minority injection. These excess minority carrier
diffuse away from the junction and recombine with majority carriers.
In LED, every injected electron takes part in a radiative recombination and hence gives rise to
an emitted photon. Under reverse bias no carrier injection takes place and consequently no
photon is emitted. For direct transition from conduction band to valence band the emission
wavelength.
In practice, every electron does not take part in radiative recombination and hence, the
efficiency of the device may be described in terms of the quantum efficiency which is defined
as the rate of emission of photons divided by the rate of supply of electrons. The number of
radiative recombination, that take place, is usually proportional to the carrier injection rate and
hence to the total current flowing.
LED Materials:

72

One of the first materials used for LED is GaAs. This is a direct band gap material, i.e., it
exhibits very high probability of direct transition of electron from conduction band to valence
band. GaAs has E= 1.44 eV. This works in the infrared region.
Gallium Arsenide Phosphide is a tertiary alloy. This material has a special feature in that it
changes from being direct band gap material.
Blue LEDs are of recent origin. The wide band gap materials such as GaN are one of the most
promising LEDs for blue and green emission. Infrared LEDs are suitable for optical coupler
applications.

5.11.1 ADVANTAGES OF LEDs:


1.

Low operating voltage, current, and power consumption makes Leds compatible with

electronic drive circuits. This also makes easier interfacing as compared to filament
incandescent and electric discharge lamps.
2.

The rugged, sealed packages developed for LEDs exhibit high resistance to mechanical

shock and vibration and allow LEDs to be used in severe environmental conditions where
other light sources would fail.
3.

LED fabrication from solid-state materials ensures a longer operating lifetime, thereby

improving overall reliability and lowering maintenance costs of the equipment in which they
are installed.
4.

The range of available LED colours-from red to orange, yellow, and green-provides the

designer with added versatility.


5.

LEDs have low inherent noise levels and also high immunity to externally generated

noise.
6.

Circuit response of LEDs is fast and stable, without surge currents or the prior warm-

up, period required by filament light sources.


7.

LEDs exhibit linearity of radiant power output with forward current over a wide range.

5.11.2 LEDs Disadvantages:


73

1. Temperature dependence of radiant output power and wave


length.
2. Sensitivity to damages by over voltage or over current.

3. Theoretical overall efficiency is not achieved except in special cooled or pulsed conditions.

5.12 Buzzer

Figure 5.13: A simple buzzer and buzzer symbol


It is an electronic signaling device which produces buzzing sound. It is commonly used in
automobiles, phone alarm systems and household appliances. Buzzers work in the same
manner as an alarm works. They are generally equipped with sensors or switches connected to
a control unit and the control unit illuminates a light on the appropriate button or control
panel, and sound a warning in the form of a continuous or intermittent buzzing or beeping
sound. The word "buzzer" comes from the rasping noise that buzzers made when they were
electromechanical devices, operated from stepped-down AC line voltage at 50 or 60 cycles.
Typical uses of buzzers and beepers include alarms, timers and confirmation of user input such
as a mouse click or keystroke.

5.12.1 Types of Buzzers


The different types of buzzers are electric buzzers, electronic buzzers, mechanical buzzers,
electromechanical, magnetic buzzers, piezoelectric buzzers and piezo buzzers.

74

(i) Electric buzzers


A basic model of electric buzzer usually consists of simple circuit components such as
resistors, a capacitor and 555 timer IC or an integrated circuit with a range of timer and multivibrator functions. It works through small bits of electricity vibrating together which causes
sound.
(ii) Electronic buzzers
An electronic buzzer comprises an acoustic vibrator comprised of a circular metal plate having
its entire periphery rigidly secured to a support, and a piezoelectric element adhered to one
face of the metal plate. A driving circuit applies electric driving signals to the vibrator to
vibrationally drive it at a 1/N multiple of its natural frequency, where N is an integer, so that
the vibrator emits an audible buzzing sound. The metal plate is preferably mounted to undergo
vibration in a natural vibration mode having only one nodal circle. The drive circuit includes
an inductor connected in a closed loop with the vibrator, which functions as a capacitor, and
the circuit applies signals at a selectively variable frequency to the closed loop to accordingly
vary the inductance of the inductor to thereby vary the period of oscillation of the acoustic
vibrator and the resultant frequency of the buzzing sound.
(iii) Mechanical BuzzerA joy buzzer is an example of a purely mechanical buzzer.
(iv) Piezoelectric Buzzers / Piezoelectric Buzzers

A piezoelectric buzzer is made from two conductors that are separated by Piezo crystals.
When a voltage is applied to these crystals, they push on one conductor and pull on the other.

75

The result of this push and pull is a sound wave. These buzzers can be used for many things,
like signaling when a period of time is up or making a sound when a particular button has been
pushed. The process can also be reversed to use as a guitar pickup. When a sound wave is
passed, they create an electric signal that is passed on to an audio amplifier.
Piezoelectric buzzers are small electronic devices that emit sounds when driven by low
voltages and currents. They are also called piezoelectric buzzers. They usually have two
electrodes and a diaphragm. The diaphragm is made from a metal plate and piezoelectric
material such as a ceramic plate.
(v) Magnetic Buzzers
Magnetic buzzers are magnetic audible signal devices with built-in oscillating circuits. The
construction combines an oscillation circuit unit with a detection coil, a drive coil and a
magnetic transducer. Transistors, resistors, diodes and other small devices act as circuit
devices for driving sound generators. With the application of voltage, current flows to the
drive coil on primary side and to the detection coil on the secondary side. The amplification
circuit, including the transistor and the feedback circuit, causes vibration. The oscillation
current excites the coil and the unit generates an AC magnetic field corresponding to an
oscillation frequency. This AC magnetic field magnetizes the yoke comprising the magnetic
circuit. The oscillation from the intermittent magnetization prompts the vibration diaphragm to
vibrate up and down, generating buzzer sounds through the resonator.
In this project, a magnetic buzzer has been used.

5.13 DIODE
5.13.1 SEMICONDUCTOR DIODEA PN junctions is known as a semiconductor or crystal diode. A crystal diode has two terminal
when it is connected in a circuit one thing is decide is weather a diode is forward or reversed

76

biased. There is a easy rule to ascertain it. If the external CKT is trying to push the
conventional current in the direction of error, the diode is forward biased. One the other hand
if the conventional current is trying is trying to flow opposite the error head, the diode is
reversed biased putting in simple words.

1.

If arrowhead of diode symbol is positive W.R.T Bar of the symbol, the diode is
forward biased.

2.

The arrowhead of diode symbol is negative W.R.T bar , the diode is the reverse
bias.

When we used crystal diode it is often necessary to know that which end is arrowhead and
which end is bar. So following method are available.
1. Some manufactures actually point the symbol on the body of the diode e. g By127 by
11 4 crystal diode manufacture by b e b.

77

2. Sometimes red and blue marks are on the body of the crystal diode. Red mark do not
arrow wheres blue mark indicates bar e .g oa80 crystal diode.

5.13.2 ZENER DIODEIt has been already discussed that when the reverse bias on a crystal diode is increased a
critical voltage, called break down voltage. The break down or zener voltage depends upon the
amount of doping. If the diode is heavily doped depletion layer will be thin and consequently
the break down of he junction will occur at a lower reverse voltage. On the other hand, a
lightly doped diode has a higher break down voltage, it is called zener diode

A properly doped crystal diode, which has a sharped break down voltage, is known as a zenor
diode.

78

CONCLUSION

The project was completed successfully with in the given time duration. it was learning
experience through which we gained invaluable on hand practical knowledge with project
enlightened us on the vastness and unique application of micro controller , which forms the
basic framework of our project.
This project gave us the deep understanding of the controller and described us how to use the
controller in different ways as well as provided us the clarity about the different sensors . This
is embedded based project as embedded is the combination of both the software as well as the
hardware so
this system helped us to clear all our doubts related to basic electronic components

79

REFERENCES
1. Mazedi, The 8051 Microcontroller and Embedded Systems, Prentice Hall, 1ST Edition
2. Kenneth J. Ayala, The 8051 Microcontroller, Penram International Publishing,1996,
2nd Edition
3.

Some Websites :
www.alldatasheets.com
www.datasheetcatalog.com
www.electronicscircuits.com
www.scielectronics.com
www.parallax.com

80

Potrebbero piacerti anche