You are on page 1of 38

Project report

On
AUTOMATIC INDUSTRIAL APPLIANCES CONTROL USING PC

A Project/Seminar report submission in partial fulfillment for the degree of


Bachelor of Technology
In
Electronics & Communication Engineering
By

AAMIR ALAMGIR 08248003035


KRISHNA KUMAR 08248003031
ANURAG SHARAN 08248003023
SUMIT KUMAR MANDAL 08248003041

Under the guidance of


Prof. R.R.PANDEY
H.O.D
DEPARTMENT OF E.C.E
(IE&IT)

INSTITUTE OF ENGINEERING & INDUSTRIAL


TECHNOLOGY (IE&IT)
(SANAKA EDUCATIONAL TRUST’S GROUP OF INSTITUTIONS)
VILL – MALANDIGHI, P.O.-KANKSA
DURGAPUR -713212, WEST BENGAL, INDIA
MAY, 2012
INSTITUTE OF ENGINEERING & INDUSTRIAL
TECHNOLOGY
DURGAPUR -12
DEPARTMENT OF ELECTRONICS & COMMUNICATION
ENGINEERING

CERTIFICATE OF RECOMENDATION

This is to certify that the Project/Seminar topic entitled, “AUTOMATIC


INDUSTRIAL APPLIANCES CONTROL USING PC” submitted by AAMIR
ALAMGIR ,KRISHNA KUMAR ,ANURAG SHARAN ,SUMIT KUMAR
MANDAL in partial fulfillment for the award of Bachelor of Technology in
Department of Electronics & Communication Engineering during session 2008 -
2012 at Institute of Engineering & Industrial Technology (IE&IT), Durgapur – 12
is an authentic work carried out by them under my supervision and guidance to the
best of my knowledge.

_______________________ _______________________
PROJECT GUIDE (Head of the Department)
Prof. R.R.Pandey (Department of E.C.E)
H.O.D (IE&IT)
(Dept. of E.C.E)
ACKNOWLEDGEMENT

I am deeply indebted to Prof. R.R.PANDEY, Head of the Department of


Electronics And Communication Engineering, Institute of Engineering &
Industrial Technology (Durgapur) for his sincere and dedicated cooperation
and encouragement for the seminar.
I would also like to thank our guide all the faculty of Department of
ECE, for their invaluable advice and whole-hearted cooperation.
Gracious gratitude to all the faculty of the department of ECE for their
valuable advice and encouragement.
Last but not the least, I thank all other, and especially our classmates
and our family member who in one way or another help me in the successful
completion of this work.

Aamir Alamgir
Anurag Sharan
Krishna Kumar
Sumit Sumar Mandal
CONTENTS

SL NO. TOPIC PAGE NO.


1 ABSTRACT
2 INTRODUCTION
3 LITERATURE SURVEY
3.1 ATMEL 89C51 MICROCONTROLLER

4 MATERIALS & METHODOLOGY


4.1 CIRCUIT IMPLEMENTATION
4.2 PROGRAM
5 RESULT & DISCUSSION
6 REVIEW & CONCLUSION
7 FUTURE WORK
8 REFERENCE
LIST OF FIGURE :

SL NO. FIGURE NAME PAGE


NO.
layout of gate crossing
Micro controller interfacing unit
pin diagram of 8051
Block diagram of 8051 micro controller
pin diagram of AT89C51
Block diagram of AT 89C51 micro controller
Port diagram of AT89C51
Connections of port 3
Power on reset circuit
A 16*2 LCD Display/ LCD CONNECTION AND
CONTROLING
Regulated IC 7812 & 7805

Automaticappliances Control With Temp Sensor


Lm35
Serial Communication With Microcontroller
Relay Interfacing With Micro-Controller
Result& Discussion
ABSTRACT
In today’s world .there is high a demand for PC based control system because of its
various advantages s over manual control system, PC based control systems are
highly reliable , accurate and time saving systems, they provide number of features
like quick data storage , data transfer and data security which help industries to
work in efficient manner In this paper, a PC based system which will
control various devices like Motor, Light, and Fan etc. Designed a GUI (Graphical
User Interface) on the PC and which helps to give command to the
system. Microcontroller is used in order to receive commands from PC and
accordingly control the devices connected to it. In this way this system is
completely controlled by PC.

The system consists of five sections are as follows


1. Power supply
2. Computer
3. RS 232 protocol
4. Microcontroller
5. Relay circuitry
1. POWER SUPPLY
There are many types of power supply. Most are designed to convert high voltage
AC mains electricity to a suitable DC voltage supply for electronic circuits and
other devices. 5 Volt DC power supply require for operation of microcontroller.
2. COMPUTER
Computer is used in order to give commands to the system with the help of RS 232
protocol commands through Graphical User Interface.
3. RS 232 PROTOCOL
It has been used in order to do serial communication with the help of MAX 232 as
level converter.
AUTOMATIC INDUSTRIAL APPLIANCES
CONTROL USING PC
II. SYSTEM DESCRIPTION
For controlling, a number of electrical equipment using a PC from a centralized
location involved development of hardware and software for controlling it. The
block diagram of PC controlled home appliances system as shown in fig.1.

MICROCONTROLLER :
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small
computer on a single integrated circuit containing a processor core, memory, and
programmable input/output peripherals. Program memory in the form of NOR
flash or OTP ROM is also often included on chip, as well as a typically small
amount of RAM. Microcontrollers are designed for embedded applications, in
contrast to the microprocessors used in personal computers or other general
purpose applications.

Microcontrollers are used in automatically controlled products and devices,


such as automobile engine control systems, implantable medical devices, remote
controls, office machines, appliances, power tools, toys and other embedded
systems. By reducing the size and cost compared to a design that uses a separate
microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes

A microcontroller is a general-purpose device, that is meant to read data,


perform limited calculations on that data, and control its environment based on
these calculations. The primary applications of a Microcontroller is to control the
operation of a machine using a fixed program that is stored in its ROM and does
not change over the lifetime of the system.

A typical Microcontroller is a true computer on a chip. The design


incorporates all the components of a Microprocessor CPU-ALU,PC, SP. And
registers .In addition it has the other components needed to make a complete
computer-ROM,RAM, parallel I/O, serial I/O, counters, and a clock circuit.

Programming environments
Microcontrollers were originally programmed only in assembly language,
but various high-level programming languages are now also in common use to
target microcontrollers. These languages are either designed specially for the
purpose, or versions of general purpose languages such as the C programming
language. Compilers for general purpose languages will typically have some
restrictions as well as enhancements to better support the unique characteristics of
microcontrollers. Some microcontrollers have environments to aid developing
certain types of applications. Microcontroller vendors often make tools freely
available to make it easier to adopt their hardware.

Many microcontrollers are so quirky that they effectively require their own non-
standard dialects of C, such as SDCC for the 8051, which prevent using standard

tools (such as code libraries or static analysis tools) even for code
unrelated to hardware features. Interpreters are often used to hide such
low level quirks.
Interpreter firmware is also available for some microcontrollers. For example,
BASIC on the early microcontrollers Intel 8052 .BASIC and FORTH on the Zilog
Z8 as well as some modern devices. Typically these interpreters support interactive
programming

Simulators are available for some microcontrollers. These allow a developer to


analyze what the behavior of the microcontroller and their program should be if
they were using the actual part. A simulator will show the internal processor state
and also that of the outputs, as well as allowing input signals to be generated.
While on the one hand most simulators will be limited from being unable to
simulate much other hardware in a system, they can exercise conditions that may
otherwise be hard to reproduce at will in the physical implementation, and can be
the quickest way to debug and analyze problems.

8051 MICROCONTROLLER
ARCHITECTURE:

Fig-3 pin diagram of 8051

Block diagram
The block diagram of the 8051 in the given figure shows all of the features unique
to microcontrollers :
Internal ROM and RAM.
I/O ports with programmable pins.
Timers And counters.
Serial data communication.
The figure also shows the usual CPU components-Program counter, ALU, working
registers, and clock circuits.
The 8051 architecture consists of these specific features :
 Eight-bit CPU with registers A (the accumulator) and B
 Sixteen-bit program counter(PC) and data pointer (DPTR)
 Eight-bit program status word (PSW)
 Eight-bit stack pointer(SP)
 Internal Rom or EPROM(8751) of 0 (8031) to 4K(8051)
 Internal RAM of 128 bytes :
 Four register banks, each containing eight registers
 Sixteen bytes, which may be addressed at the bit level
 Eighty bytes of general-purpose data memory
 Thirty-two input/output pins arranged as four 8-bit ports : P0-P3
 Two 16-bit timer/counters : T0 & T1
 Full duplex serial data receiver/transmitter ; SBUF
 Control registers : TCON, TMOD, SCON, PCON, IP, & IE
 Two external and three internal interrupt sources
 Oscillator & clock circuits.

Fig- Block diagram of 8051 micro controller


INSTRUCTION SETS:
ATMEL 89C51:
The AT89C51 is a low-power, high-performance CMOS 8-bit
microcomputer with 4K bytes of Flash programmable and erasable read only
memory (EPROM). The device is manufactured using Atmel’s high-density
nonvolatile memory technology and is compatible with the industry-standard
MCS-51 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 Flash on a
monolithic chip, the Atmel AT89C51 is a powerful microcomputer which
provides a highly-flexible and cost-effective solution to many embedded
control applications.
The AT89C51 provides the following standard features: 4K bytes of
Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five
vector two-level interrupt architecture, a full duplex serial port, on-chip
oscillator and clock circuitry. In addition, the AT89C51 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.
Pin Configuration:

Fig- pin diagram of AT89C51

Block diagram
Fig- Block diagram of AT 89C51 micro controller

Pin Description :

VCC: pin-40
Supply voltage.

GND: pin-20
Ground.

Port 0: pin 32-39


Port 0 is an 8-bit open-drain bi-directional 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 may 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.

Fig- Port diagram of AT89C51


Port 1: pin 1 – 8
Port 1 is an 8-bit bi-directional 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. Port 1 also receives the low-order
address bytes during Flash programming and verification.

Port 2: pin 21-28


Port 2 is an 8-bit bi-directional 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, it uses strong internal pull-ups 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 2 also
receives the high-order address bits and some control signals during Flash
programming and verification.
Port 3: pin 10-17
Port 3 is an 8-bit bi-directional 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. Port 3 also serves the functions of
various special features of the AT89C51 as listed below: Port 3 also receives
some control signals for Flash programming and verification.

Fig- Connections of port 3

ALE/PROG: pin-30
Address Latch Enable 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. If desired,
ALE operation can be disabled by setting bit 0 of SFR location 8EH. With
the bit set, ALE is active only during a MOVX or MOVC instruction.
Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no
effect if the microcontroller is in external execution mode.

RESET: pin-09
Reset input. A high on this pin for two machine cycles while the oscillator is
running resets the device.
Fig- .1 Power on reset circuit, .2 Power on reset with debounce

PSEN: pin-29
Program Store Enable is the read strobe to external program memory. When
the AT89C51 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: pin-31
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, for parts that require 12-
volt VPP.

XTAL1: pin-19
Input to the inverting oscillator amplifier and input to the internal clock
operating circuit.

XTAL2: pin-18
Output from the inverting oscillator amplifier.

Fig- Oscillator circuit


Oscillator Characters:
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 2. There are no
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.

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. It should be noted that when idle is terminated by a hard
ware reset, the device normally 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.

Programming the Flash:


The AT89C51 is normally shipped with the on-chip Flash memory array in
the erased state (that is, contents = FFH) and ready to be programmed. The
programming interface accepts either a high-voltage (12-volt) or a low-
voltage (VCC) program enable signal. The low-voltage programming mode
provides a convenient way to program the AT89C51 inside the user’s
system, while the high-voltage programming mode is compatible with
conventional third party Flash or EPROM programmers. The AT89C51 is
shipped with either the high-voltage or low-voltage programming mode
enabled.

The AT89C51 code memory array is programmed byte by byte in either


programming mode. To program any nonblank byte in the on-chip Flash
Memory, the entire memory must be erased using the Chip Erase Mode.

Programming Algorithm:
Before programming the AT89C51, the address, data and control signals
should be set up according to the Flash programming mode table. To
program the AT89C51, take the following steps.
1. Input the desired memory location on the address lines.
2. Input the appropriate data byte on the data lines.
3. Activate the correct combination of control signals.
4. Raise EA/VPP to 12V for the high-voltage programming mode.
5. Pulse ALE/PROG once to program a byte in the Flash array or the lock
bits. The byte-write cycle is self-timed and typically takes no more than 1.5
ms.

Repeat steps 1 through 5, changing the address and data for the entire array
or until the end of the object file is reached.
Data Polling: The AT89C51 features Data Polling to indicate the end of a
write cycle. During a write cycle, an attempted read of the last byte written
will result in the complement of the written datum on PO.7. Once the write
cycle has been completed, true data are valid on all outputs, and the next
cycle may begin. Data Polling may begin any time after a write cycle has
been initiated.

Ready/Busy: The progress of byte programming can also be monitored by


the RDY/BSY output signal. P3.4 is pulled low after ALE goes high during
programming to indicate BUSY. P3.4 is pulled high again when
programming is done to indicate READY.

Program Verify: If lock bits LB1 and LB2 have not been programmed, the
programmed code data can be read back via the address and data lines for
verification. The lock bits cannot be verified directly. Verification of the
lock bits is achieved by observing that their features are enabled.

Chip Erase: The entire Flash array is erased electrically by using the proper
combination of control signals and by holding ALE/PROG low for 10 ms.
The code array is written with all “1”s. The chip erase operation must be
executed before the code memory can be re-programmed.

Reading the Signature Bytes: The signature bytes are read by the same
procedure as a normal verification of locations 030H, 031H, and 032H,
except that P3.6 and P3.7 must be pulled to a logic low. The values returned
are as follows.
(030H) = 1EH indicates manufactured by Atmel
(031H) = 51H indicates 89C51
(032H) = FFH indicates 12V programming
(032H) = 05H indicates 5V programming

Programming the AT89C51:


Fig- diagram of Port used in AT89C51
SERIAL COMMUNICATION:
Computers transfer data in two ways:
Parallel: Often 8 or more lines (wire conductors) are used to transfer data to
a device that is only a few feet away.
Serial: To transfer to a device located many meters away, the serial method
is used. The data is sent one bit at a time.

Fig- Serial and parallel data transfer


At the transmitting end, the byte of data must be converted to serial bits
using parallel-in-serial-out shift register. At the receiving end, there is a
serial in-parallel-out shift register to receive the serial data and pack them
into byte. When the distance is short, the digital signal can be transferred as
it is on a simple wire and requires no modulation. If data is to be transferred
on the telephone line, it must be converted from 0s and 1s to audio tones.
This conversion is performed by a device called a modem,
“Modulator/demodulator”.

Serial data communication uses two methods : Synchronous


method transfers a block of data at a time Asynchronous method transfers a
single byte at a time It is possible to write software to use either of these
methods, but the programs can be tedious and long. There are special IC
chips made by many manufacturers for serial communications UART
(universal asynchronous Receiver transmitter) USART (universal
synchronous asynchronous Receiver-transmitter). If data can be
transmitted and received, it is a duplex transmission. If data transmitted one
way a time, it is referred to as half duplex.

If data can go both ways at a time, it is full duplex.

Fig- data transfer through Simplex, Half duplex and Full duplex
A protocol is a set of rules agreed by both the sender and receiver on; How
the data is packed .How many bits constitute a character When the data begins and
ends. Asynchronous serial data communication is widely used for character-
oriented transmissions; Each character is placed in between start and stop bits, this
is called framing. Block-oriented data transfers use the synchronous method. The
start bit is always one bit, but the stop bit can be one or two bits The start bit is
always a 0 (low) and the stop bit(s) is 1 (high)

Fig-

SBUF is an 8-bit register used solely for serial communication. For a byte
data to be transferred via the TxD line, it must be placed in the SBUF Register.
The moment a byte is written into SBUF, it is framed with the start and stop bits
and transferred serially via the TxD line SBUF holds the byte of data when it is
received by 8051 RxD line. When the bits are received serially via RxD, the 8051
de-frames it by eliminating the stop and start bits, making a byte out of the data
received, and then placing it in SBUF

MOV SBUF,#’D’ ;load SBUF=44h, ASCII for ‘D’


MOV SBUF,A ;copy accumulator into SBUF
MOV A,SBUF ;copy SBUF into accumulator
SCON is an 8-bit register used to program the start bit, stop bit, and
data bits of data framing, among other things.
SM0, SM1: They determine the framing of data by specifying the number of bits
per character, and the start and stop bits
SM2: This enables the multiprocessing capability of the 8051
REN (receive enable): It is a bit-addressable register. When it is high, it allows
8051 to receive data on
RxD pin: If low, the receiver is disable.
TI (transmit interrupt): When 8051 finishes the transfer of 8-bit character. It
raises TI flag to indicate that it is ready to transfer another byte.TI bit is raised at
the beginning of the stop bit
RI (receive interrupt): When 8051 receives data serially via RxD, it gets rid
of the start and stop bits and places the byte in SBUF register. It raises the RI flag
bit to indicate that a byte has been received and should be picked up before it is
lost. RI is raised halfway through the stop bit

Block Diagram:

Fig- ports and their interconnections in 89C51


MATERIALS USED:

1. ATMEL 89C51 Microcontroller


2. Crystal oscillator(12 MHz)
3. LM35
4. LM358
5. IC LM 7812 (for ±12V)
6. IC LM 7805 (for ±5V)
7. RELAY
8. BC548
9. DB9 CONNECTOR
10.max232 IC
11.Buzzer
12.Power supply
13.Transformer (9-0-9)
14.Resistances
15.Capacitances
16.Reset pin
17.Connecting probes and wires.
18.Jumper wires
19.Red LED
20.Green LED
21.Leap switch
22. PRESET
23. Vero board
LCD (LIQUID CRYSTAL DISPLAY):

Liquid Crystal Display Fundamentals:


Liquid Crystal Displays (LCDs) are categorized as none missive display devices,
in that respect, they do not produce any form of light like a Cathode Ray Tube
(CRT). LCDs either pass or block light that is reflected from an external light
source or provided by a back/side lighting system. There are two modes of
operation for LCDs during the absence of an electric field (applied Power); a mode
describes the transmittance state of the liquid crystal elements. Normal White
mode: the display is white or clear and allows light to pass through and Normal
Black Mode: the display is dark and all light is diffused. Virtually all displays in
production for PC/Workstation use are normal white mode to optimize contrast and
speed.

Fig- A 16*2 LCD display

A simplified description of how a dot matrix LCD display works is


as follows:
A twisted nematic (TN) LC display consists of two polarizer, two pieces of
glass, some form of switching element or electrode to define pixels, and driver
Integrated Circuits (ICs) to address the rows and columns of pixels. To define a
pixel (or sub pixel element for a color display), a rectangle is constructed out of
Indium Tin Oxide -- a semi-transparent metal oxide (ITO) and charge is applied to
this area in order to change the orientation of the LC material ( change from a
white pixel to a dark pixel). The method utilized to form a pixel in passive and
active matrix displays differs and will be described in later sections. Figure 1
illustrates a cross sectional view of a simple TN LC display. Figure 2 depicts a dot
matrix display as viewed without its metal module/case exposing the IC drivers.
Looking directly at the display the gate or row drivers are located either on
the left or the right side of the display while the data or column drivers are located
on the top (and or bottom) of the display. New thin display module technology
mounts the ICs on conductive tape that allows them to be folded behind the display
further reducing the size of the finished module. An IC will address a number of
rows or columns.

viewer
///////////////////////////////////// Polarizer
_____________________________________ glass
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Liquid Crystal
_____________________________________ glass
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Polarizer

Backlight
Figure : Cross Section of a Simple LCD Display
________________________________________
| |
| IC IC | Source/Column ICs
| | |
| | |
|IC---------------------Pixel |
| |
|IC <---- Gate Line/Row IC |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Figure : LCD panel and IC driver locations

* An IC driver will address a number of row/column lines and not just the single
pixel in the diagram above

Polarizers are an integral part of a LCD display, possessing the unique property of
only passing light if it is oriented in a specific (oriented) direction. To utilize this
phenomenon in TN LC displays, the bottom polarizer orients incoming light in one
direction. The oriented light passes through the LC material and is either unaltered
or "bent" 90 degrees. Depending on the orientation of the top polarizer, this light
will either pass through or be diffused. If the light is diffused, it will appear as a
dark area. Figure 3 is a simple illustration of the sequence of events that occur
when light passes through a simple twisted nematic LC display.
LCD CONNECTION AND CONTROLING:
Fig- Solder a 8 Pin connector to the Data pins and wires to the others

There are 16 pins in all. They are numbered from left to right 1 to 16 (if you are
reading from the backside).

Pin 1 and 2 are the power supply pins. They need to be connected to the negative
rail and the positive rail of a +5v power supply respectively. To get a stable +5v
Power supply, you can use a 7805 voltage regulator. It will regulate any voltage
that you give it into +5v.
Pin 3 is the contrast setting pin. It is said that it must be connected to a
potentiometer to control the contrast. However, we have found that it work if you
just connect a variable resistor in series with it to GND. The lower the resistance,
the greater the contrast. I recommend setting it at around 1.5K – 2K.

If you set the value too low or short the pin directly to ground, you will see
only dark boxes on the screen. As far as I know, doing this does not have any
adverse affect on the LCD.

Pins 4, 5 and 6 are control pins of the LCD.

NOTE : The 3 control pins : R/S , R/W and E

The RS Pin : The LCD has basically two operating modes : Instruction mode and
Character Mode. Depending on the status of this pin , the data on the 8 data pins
(D0-D7) is treated as either an instruction or as character data. You have to activate
the command mode if you want to give a Instruction to the LCD. Example – “Clear
the display” , “Move cursor to home” etc. You have to activate the character mode
if you want to tell the LCD to display some character.

To set the LCD in Instruction mode , you set the 4th pin of the LCD (R/S) to
GND. To put it in character mode , you connect it to Vcc.

The Enable Pin : The enable pin has a very simple function. It is just the clock
input for the LCD.  The instruction or the character data at the data pins (D0-D7) is
processed by the LCD on the falling edge of this pin. The Enable pin should be
normally held at Vcc by a  pull up resistor. When a  momentary button switch is
pressed , the Pin goes low and back to high again when you leave the switch. Your
instruction or character will be executed on the falling edge of the pulse. (ie. The
moment the switch closes)

The RW Pin : Generally , we always use the LCD to show things on the screen.
However , in some cases , we may need to read from the LCD what it is
displaying. In such cases, the R/W pin is used. For all practical purposes , the R/W
pin has to be permanently connected to GND.

Pins 7 to 14 are the Data pins of the LCD. Pin 7 is the Least Significant Bit (LSB)
and pin 14 is the Most Significant Bit (MSB) of the data inputs. If you want to
display some number or letter on the display, you have to input the appropriate
‘codes’ for that character on these pins. These pins are also used for giving certain
commands to the display like clearing the display or moving the cursor to a
different location. Upon giving the correct signals to the 3 control pins, the
character codes or the commands that you have given to the Data pins will be
written to the display or executed by the LCD respectively. To make it easier to
give the appropriate inputs to these pins, I recommend wiring up a DIP switch to
these pins.
Pins 15 and 16: Most LCDs have a backlight. A backlight is a light within the
LCD panel which makes seeing the characters on screen easier. When you leave
your cell phone or mp3 player untouched for some time, the screen goes ‘dark’.
That is the backlight turning off. It is possible to use the LCD without the backlight
as well. Many LCDs come without a backlight. If your LCD has only 14 pins, then
it has no backlight. However, the working of the LCD still remains the same even
if your LCD doesn’t have a backlight. The Backlight is nothing but an LED. So , a
resistor must be connected in series with it to limit the current. This link mentions
that the allowable current is 100ma. Then it is best to have a variable resistor (or a
transistor) and adjust the current till it is around 90 ma.

The flowchart for operating the LCD:


Initializing the LCD
To make the LCD show some signs of life, you need to issue an instruction
to it. That instruction is 00001111. Since you are giving an instruction to the LCD,
you have to put it in instruction mode by holding the RS pin to GND. In the board
that you wired up, you can put RS at GND by pressing the RS push and hold
button, such that it remains in a depressed state.

Now, your LCD is in instruction mode and is ready to accept any instruction
that we issue to it. Now, set the DIP switches as 00001111. This instruction tells it
to turn on the display and show a blinking cursor. Once, you have set the DIP
switch to 00001111, press the Enable momentary Button. You should be seeing a
blinking cursor on the screen now. This means that your LCD is initialized and
ready to accept characters to display.

Making characters show up on the display:

Ok , once you have got the cursor blinking , the LCD will now accept character
data to display. Now , we have to put the LCD in character mode to make it accept
characters to display. Press the RS switch to make it ‘under pressed ’. Now set the
DIP switches to 01000001 and then press the Enable button. If everything has gone
right , then you should be seeing a capital A on the screen. But what if you want to
display some other letter , like “M”? The procedure is the same , you only replace
the 01000001 with the code for M , which is 01001101. The LCD automatically
increments the cursor position by 1 everytime you write a character.

After you write to the last location of the first line , you would expect the LCD to
automatically jump to the second line. Sadly , it doesnt happen so. Using the
second line is slightly more tricky.
Table- Instruction Set for the LCD
Regulated power supply 5V and 12V :
The power supply section is the important one. It should deliver constant output
regulated power supply for successful working of the project. A 0-12V/500 mA
transformer is used for this purpose. The primary of this transformer is connected
in to main supply through on/off switch& fuse for protecting from overload and
short circuit protection. The secondary is connected to the diodes to convert 12V
AC to 12V DC voltage. And filtered by the capacitors ,Which is further regulated
to +5v, by using IC 7805.This circuit can give +5V output at about 150 mA
current, but it can be increased to 1 A when good cooling is added to 7805
regulator chip. The circuit has over overload and terminal protected. The capacitors
must have enough high voltage rating to safely handle the input voltage feed to
circuit.

CIRCUIT DIAGRAM:

Fig- Circuit diagram of power supply

There are two ICs LM7805 and LM7812 used in the power supply.

LM 7805 :
The IC LM7805 is connected through the capacitor in the circuit for giving +5V
supply. Initially 230 V AC supply is reduced to (0-9V) with the help of a step
down transformer having a capacity of 500mA. Since the input voltage to the
regulator IC should be more than its output voltage, transformer secondary voltage
is 9V. This low voltage is rectified with the help of bridge rectifier. The ripples are
minimized with the help of capacitor filter to get a smooth DC supply. The rating
of the chosen capacitor filter is1000µF.
The regulated DC voltage is obtained by using a regulator IC 7805. In the case of
IC 7805, the unregulated DC voltage is applied to Pin 1, and the output is taken at
Pin 3 and Pin 2 is grounded. Another capacitor filter of rating 10µF is connected at
the output of regulator IC to eliminate the voltage oscillations at the output due to
the large voltage oscillations at the input of the regulator.The pin diagram of
LM7805 is shown below-

 1. Unregulated voltage in
 2. Ground
 3. Regulated voltage out

Fig- LM 7805 pin diagram

LM 7812:
The IC LM7812 is used as second IC for obtaining a voltage of +12V from the
circuit. The voltage is necessary for the stepper motor operation. Initially 230 V
AC supply is reduced to (15V-0-15V) with the help of a step down transformer
having a capacity of 1A and the center tap of the transformer is grounded. This low
voltage is rectified with the help of bridge rectifier. Since the input voltage to the
regulator IC should be more than its output voltage, transformer secondary voltage
is 15V-0-15V.The ripples are minimized with the help of capacitor filter to get a
smooth DC supply. The rating of the chosen capacitor filter is 1000µF.
The regulated DC output voltage is obtained by using regulator ICs. For regulated
+12V DC supply, IC 7812 is used and for regulated -12V DC supply, IC 7912 is
used.

The pin diagram of LM7812 is shown below:


 Pin 1- Unregulated voltage in
 Pin 2- Ground
 Pin 3- Regulated voltage output

fig- pin diagram of LM 7812


AUTOMATIC DEVICE CONTROL WITH TEMP
SENSOR
This is the another application of a comparator. This can save the power
and we don't need to switch ON and OFF the ceiling FAN manually.
here we can set the threshold voltage to our desired value. The ceiling
fan will be switched ON when the temperature increases the threshold
value. We are using LM35 sensor to sense the room temperature. The
sensitivity of this LM35 sensor is 10mv/ 'C. I want that fan to be
switched on when the temperature increases more than 27'C. so set my
threshold voltage to
                                 Vthreshold = 27'C x 10mv = 270mv = 0.27V
here the room temperature is 26'c so the output voltage is < 0.27V ;
Fan off

when the temperature increases to 27'c or more, the output voltage of


LM35 will increases to more than 0.27V. so that opamp output will goes
to +Vsat=+5v. This will switch ON the transistor and so relay connects.
This will switch ON the ceiling fan.
here the temperature is 28'c so the output voltage >0.27v; fan
ON      LM35 sensor
SERIAL PORT INTERFACING WITH MICROCONTROLLER:

RELAY INTERFACING WITH MICTROCONTROLLER:


RESULT AND DISCUSSION :

REVIEW AND CONCLUSION :

FUTURE WORK :

REFERENCE :

BOOKS REFERRED

 Adler, R. B., A. C. Smith, and R. L. Longani: “Introduction to


Semiconductor Physics,” vol. 1, p. 78, Semiconductor Electronics
Education Comitee, John Wiley & Sons, Inc., New York ,1964.

 Schade, O. H.: “Analysis of Rectifier Operation”, proc. IRE, vol.31, pp. 341-
361, July, 1943.

 Stout, M. B.: “Analysis of Rectifier Circuits”, Elec. Eng., vol. 54,


September, 1935.
 Jacob Millman Christos C. Halkias.: “Electronic Devices And Circuits”,
Tata McGraw-Hill Publishing Company Ltd. Sep, 2003.

 The 8051 Microcontroller and Embedded Systems using Assembly and


 C by Muhammad Ali Mazidi, Janice Gillispie, Rolin D.Mckinlay.

 Part of stepping motors by Douglas W.Jones, the university of IOWA


Department of computer science.

 A complete reference of Micro Controllers- Kenneth.J.Ayala

WEBSITES

 www.8051.com

 www.8051microcontroller.com

 www.8051faq.com.

 www.microchip.com

 www.etext.org

You might also like