You are on page 1of 150

WELCOME

Tuesday, July 10, 2012

BASIC ELECTRICAL AND ELECTRONIC COMPONENTS



RESISTORS DIODES CAPACITORS INDUCTORS TRANSISTORS BATTERY TRANSFORMER VOLTAGE REGULATORS LDR (LIGHT DEPENDENT RESISTOR) RELAYS

Tuesday, July 10, 2012

RESISTOR:
A resistor is a device which opposes the flow of current.

The first band gives the first digit The second band gives the second digit The third band indicates the number of zeroes.

Tuesday, July 10, 2012

Colour Black Brown Red Orange

Number 0

1
2 3

Yellow
Green Blue Violet Grey White
Tuesday, July 10, 2012

4
5 6

7
8 9

DIODE:
A Diode is a two terminal electronic component that conducts electric current only in one direction. Based on applications diodes are divided into two types -> PN junction -> ZENER diode

Tuesday, July 10, 2012

PN junction diode:
The most common function of a diode is to allow an electric current in one direction (called the forward direction) while blocking current in the opposite direction (the reverse direction).

Tuesday, July 10, 2012

ZENER DIODE:
A Zener diode is a type of diode that permits current in the forward direction like a normal diode, but also in the reverse direction if the voltage is larger than the breakdown voltage known as "Zener knee voltage" or "Zener voltage".

Tuesday, July 10, 2012

LIGHT EMITTING DIODE (LED)


A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in many devices, and are increasingly used for lighting.
k

Tuesday, July 10, 2012

CAPACITOR:

capacitor block DC (constant) signals.

capacitors easily pass AC (changing) signals.


s

Tuesday, July 10, 2012

INDUCTOR:
An inductor or a reactor can store energy in a
magnetic field created by the electric current passing through it. It is denoted in Henry.

Typically an inductor is a conducting wire shaped


as a coil, the loops helping to create a strong magnetic field inside the coil due to Faraday's Law of Induction.

Tuesday, July 10, 2012

TRANSISTORS:
A transistor is a semi conductor device commonly used to amplify or switch electronic signals. A voltage or current applied to one pair of the transistor's terminals changes the current flowing through another pair of terminals. Because the controlled (output) power can be much more than the controlling (input) power, the transistor provides amplification of a signal.

Tuesday, July 10, 2012

Tuesday, July 10, 2012

Transformer:

Tuesday, July 10, 2012

VOLTAGE REGULATOR:
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.

Tuesday, July 10, 2012

The voltage regulators are classified into two types. positive series(7805) negative series(7905)

7805

7905

7805
SERIES Output voltage
O/P

I/P GND

O/P

GND

I/P

Tuesday, July 10, 2012

Light Dependent Resistor (LDR):


An LDR is an input transducer (sensor) which converts brightness (light) to resistance. It is made from cadmium sulphide (CdS) and the resistance decreases as the brightness of light falling on the LDR increases.

Tuesday, July 10, 2012

RELAY:
A Relay is an electrically controllable switch widely used in industrial controls, automobiles, etc

inductor

Tuesday, July 10, 2012

OPERATION OF RELAY:
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.
Tuesday, July 10, 2012

Diagrammatic explanation:

N/C
IRON ARM

AC 230V

Tuesday, July 10, 2012

INDUCTOR

COM ON

N/O

BULB
OFF

REGULATED POWER SUPPLY:

WINE YARD
Tuesday, July 10, 2012

TECHNOLOGIES

REGULATED POWER SUPPLY CIRCUIT:


7812 12V

R1

C1

C2 C
R2

7805

5V
Tuesday, July 10, 2012

C=1000uF C1,C2=104pF R1,R2=330

RECTIFIER:
The primary application of rectifiers is to derive usable
DC power from an AC supply. Virtually all electronics except simple motor circuits such as fans require a DC supply but mains power is AC so rectifiers find uses inside the power supplies of virtually all electronic equipment.

Tuesday, July 10, 2012

FILTERS:
Electronic filters are electronic circuits which
perform signal processing functions, specifically to remove unwanted frequency components from the signal, to enhance wanted ones, or both.

AC+DC

DC
AC

RECTIFIER OUTPUT

FILTER

PURE DC

Tuesday, July 10, 2012

How the Transistor act as a switch ?


what is a transistor?
A transistor is a semi conductor device commonly used to amplify or switch electronic signals.

Tuesday, July 10, 2012

What is a switch?
In electronics, a switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another.

Tuesday, July 10, 2012

Transistor as a switch:
Transistor can be used as an electronic switch, in
grounded-emitter configuration. Transistors are commonly used as electronic switches, for both high power applications including switched mode power supply and low power applications such as logic gates.

Tuesday, July 10, 2012

In a grounded-emitter transistor circuit, such as


the light-switch circuit shown, as the base voltage rises the base and collector current rise exponentially, and the collector voltage drops because of the collector load resistor. If the emitter-base and base-collector are in forward bias then it act as a switch. At that instant the collector to emitter is shorted, it act as a closed switch.

Tuesday, July 10, 2012

Transistor as a switch
example

Vcc

N/C
330 COM

100K PRESET

LED
LOAD

T-OFF
LIGHT
NO LIGHT

N/O

VB<0.7V

LDR

VB>0.7V T-ON

relay

Tuesday, July 10, 2012

Tuesday, July 10, 2012

In general, "embedded system" is not a strictly


definable term, as most systems have some element of extensibility or programmability.

For example, handheld computers share some


elements with embedded systems such as the operating systems and microprocessors which power

them, but they allow different applications to be


loaded and peripherals to be connected or a few dedicated functions", and is thus appropriate to call "embedded".
Tuesday, July 10, 2012

Moreover, even systems which don't expose


programmability as a primary feature generally
need to support software updates. On a continuum from "general purpose" to "embedded", large application systems will have subcomponents at most points even if the system as a whole is "designed to perform one or a few dedicated functions", and is thus appropriate to call

"embedded".
Tuesday, July 10, 2012

Embedded system
An embedded system is a special purpose computer
system designed to perform one or a few dedicated functions, often with real time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. Embedded systems span all aspects of modern life.

Tuesday, July 10, 2012

Characteristics:

Embedded systems are designed to do some specific task, rather than be a general-purpose computer for multiple tasks. Embedded systems are not always standalone devices. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. The program instructions written for embedded systems are referred to as firmware, and are stored in read-only memory or Flash memory chips.

Tuesday, July 10, 2012

Applications:
Telecommunications Consumer electronics like PDAs, mp3 players,
mobile phones, digital cameras, DVD's, ovens, washing machine, to control lights, to provide security, climate, etc..

Tuesday, July 10, 2012

User Interface
Embedded systems range from no user interface
at all dedicated only to one task to complex graphical user interfaces that resemble modern computer desktop operating systems.

Simple embedded devices use buttons, LEDs,


graphic or character LCDs (for example popular

HD44780 LCD) with a simple menu system.


Tuesday, July 10, 2012

A more sophisticated devices use graphical


screen with touch sensing or screen-edge buttons provide flexibility while minimizing space used: the meaning of the buttons can change with the screen, and selection involves the

natural behavior of pointing at what's desired.

Tuesday, July 10, 2012

Peripherals
Serial Communication Interfaces (SCI): RS-232,
RS-422, RS-485 etc

Synchronous Serial Communication Interface: I2C,


SPI, SSC and ESSI (Enhanced Synchronous Serial Interface)

Universal Serial Bus (USB) Multi Media Cards (SD Cards, Compact Flash etc)

Tuesday, July 10, 2012

Peripherals
Networks: Ethernet, Controller Area Network,
LanWorks, etc

Timers:

PLL(s), Processing Units (GPIO)

Capture/Compare

and

Time

Discrete IO: aka General Purpose Input/Output


Analog to Digital/Digital to Analog (ADC/DAC) Debugging: JTAG, ISP, ICSP, BDM Port, BITP DP9
port
Tuesday, July 10, 2012

Overview of Embedded System


Embedded system means the processor is embedded
into that application.

An embedded product uses a microprocessor or


microcontroller to do one task only.

In an embedded system, there is only one application


software that is typically burned into ROM.

Example: printer, keyboard, video game player.


Tuesday, July 10, 2012

Tuesday, July 10, 2012

Contents
Introduction Block Diagram and Pin Description of the 8051 I/O Port Description Led Interfacing Switch Interfacing Led And switch Interfacing LCD Interfacing Serial communication Relay Interfacing

Tuesday, July 10, 2012

Why do we need to learn Microprocessors/controllers?


The microprocessor is the core of computer
systems. Nowadays many communication, digital entertainment, portable devices, are controlled by them. A designer should know what types of components he needs, ways to reduce production costs and product reliable.

Tuesday, July 10, 2012

Aspects of a microprocessor/controller

Hardware :
Interface to the real world. Ex- LCD, LED, printers, keyboard etc.

Software :
order how to deal with inputs. By using software we can control the hardware to obtain the desired outputs.

Tuesday, July 10, 2012

Tools for a microprocessor/controller:

CPU: Central Processing Unit I/O: Input /Output Bus: Address bus & Data bus Memory: RAM & ROM Timer Interrupt Serial Port Parallel Port

Tuesday, July 10, 2012

Microprocessors:
General-purpose microprocessor:

CPU for Computers. No RAM, ROM, I/O on CPU chip itself. Example: Intel's x86, Motorolas 680x0.
CPU GeneralPurpose Microprocessor

Data Bus

Many chips on mothers board

RAM

ROM

I/O Port

Timer

Serial COM Port

Address Bus

General-Purpose Microprocessor System


Tuesday, July 10, 2012

Microcontroller:
A smaller computer. On-chip RAM, ROM, I/O ports... Example: Motorolas 6811, Intels 8051, Zilogs Z8 and
PIC 16X.

CPU

RAM ROM

A single chip
I/O Port
Serial Timer COM Port

Microcontroller

Tuesday, July 10, 2012

Microprocessor vs Microcontroller

Microprocessor CPU is stand-alone, RAM, ROM, I/O, timer are separate


on the amount of ROM, RAM and I/O ports. Expansive, versatility. Microcontroller CPU, RAM, ROM, I/O and timer are all on a single chip fix amount of on-chip ROM, RAM, I/O ports for applications in which cost, power and space are critical single-purpose

designer can decide

general-purpose
Tuesday, July 10, 2012

Three criteria in Choosing a Microcontroller:


1. Meeting the computing needs of the task efficiently
and cost effectively speed, the amount of ROM and RAM, the number of I/O ports and timers, size, packaging, power consumption easy to upgrade cost per unit 2. Availability of software development tools assemblers, debuggers, C compilers, emulator, simulator, technical support 3. Wide availability and reliable sources of the microcontrollers.
Tuesday, July 10, 2012

Block Diagram:
External interrupts Interrupt Control On-chip ROM for program code
Timer/Counter

On-chip RAM

Timer 1 Timer 0

Counter Inputs

CPU
Serial Port

OSC

Bus Control

4 I/O Ports

P0 P1 P2 P3

TxD RxD

Address/Data
Tuesday, July 10, 2012

Comparison of the 8051 Family Members


Feature 8051 8052 8031

ROM (program space in bytes) RAM (bytes) Timers I/O pins Serial port Interrupt sources

4K 128 2 32 1 6

8K 256 3 32 1 8

0K 128 2 32 1 6

Tuesday, July 10, 2012

Features of 8051:
4K Bytes On Chip ROM 128 bytes On Chip RAM

6 Interrupts
32 I/O channels

Bit Addressability
2 Timers

Tuesday, July 10, 2012

Pin Description of the 8051:


P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND
Tuesday, July 10, 2012

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

8051

40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21

Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG
PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8)

8051 Description:
Vcc, gnd and xtal:

Vcc pin 40

Vcc provides supply voltage to the chip. The voltage source is +5V. GND: pin 20 ground XTAL1 and XTAL2 pins 19,18

Tuesday, July 10, 2012

8051 Description:
Reset: pin 9 reset
It is an input pin and is active high normally low . The high pulse must be high at least 2 machine cycles. It is a power-on reset. Upon applying a high pulse to RST, the microcontroller will reset and all values in registers will be lost. Reset values of some 8051 registers

Tuesday, July 10, 2012

Figure (b). Power-On RESET Circuit:


Vcc

+ 10 uF 30 pF 11.0592 MHz 8.2 K 30 pF 18 9 X2 RST 31 EA/VPP X1

19

Tuesday, July 10, 2012

Pins of 8051:
EA: pin 31 external access
There is no on-chip ROM in 8031 and 8032 . The EA pin is connected to GND to indicate the code is stored externally. PSEN ALE are used for external ROM. For 8051, EA pin is connected to Vcc.

PSEN: pin 29 program store enable


This is an output pin and is connected to the OE pin of the ROM.
Tuesday, July 10, 2012

Pins of 8051:
ALE: pin 30 address latch enable
It is an output pin and is active high. 8051 port 0 provides both address and data. The ALE pin is used for de-multiplexing the address and data by connecting to the G pin of the 74LS373 latch. I/O port pins The four ports P0, P1, P2, and P3. Each port uses 8 pins. All I/O pins are bi-directional.

Tuesday, July 10, 2012

Pins of I/O Port:


The 8051 has four I/O ports
Port 0: pins 32-39, P0 P0.0-P0.7 Port 1: pins 1-8 , P1 : P1.0-P1.7 Port 2: pins 21-28, P2 : P2.0-P2.7 Port 3: pins 10-17, P3 : P3.0-P3.7 Each port has 8 pins. Named P0.X ,X=0,1,...,7, P1.X, P2.X, P3.X Ex: P0.0 is the bit 0, LSB of P0 Ex: P0.7 is the bit 7, MSB of P0 These 8 bits form a byte. Each port can be used as input or output (bidirection).

Tuesday, July 10, 2012

Other Pins:
P1, P2, and P3 have internal pull-up resisters.

P1, P2, and P3 are not open drain. P0 has no internal pull-up resistors and does not connects to Vcc inside the 8051. P0 is open drain. However, for a programmer, it is the same to program P0, P1, P2 and P3. All the ports upon RESET are configured as output.

Tuesday, July 10, 2012

Port 0 with Pull-Up Resistors:


Pull-up resistors are used in electronic logic circuits to ensure that inputs to logic systems settle at expected logic levels if external devices are disconnected.

Pull-up resistors may also be used at the interface between two different types of logic devices, possibly operating at different power supply voltages.

Tuesday, July 10, 2012

Vcc 10 K

P0.0 DS5000 P0.1 P0.2 8751 P0.3 8951 P0.4 P0.5 P0.6 P0.7

Port

Tuesday, July 10, 2012

Port 3 Alternate Functions:


P3 Bit
P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7
Tuesday, July 10, 2012

Function
RxD TxD INT0 INT1 T0 T1 WR RD

Pin
10 11 12 13 14 15 16 17

Tuesday, July 10, 2012

ADDRESSING MODES:
There are five addressing modes available in the 8051: Register Direct Indirect Immediate Indexed

Tuesday, July 10, 2012

REGISTER ADDRESSING:
8051 has access to eight working registers (R0
to R7) Some instructions are specific to a certain register, such as the accumulator etc. Example: ADD A,R7 Example: MUL AB

Tuesday, July 10, 2012

Direct Addressing:
Direct addressing is so-named because the
value to be stored in memory is obtained by directly retrieving it from another memory location. Example: MOV A,30h

Tuesday, July 10, 2012

Indirect Addressing:
In 8051 assembly language, indirect addressing is
represented by an @ before R0 or R1. Example: MOV A, @R0 Moves a byte of data from internal RAM at location whose address is in R0 to the accumulator.

Tuesday, July 10, 2012

Immediate Addressing:
In assembly language, immediate operands are

preceded by #. Operand my be a numeric constant, a symbolic variable or an arithmetic expression using constants, symbols and operators. Example: MOV A,#12

Tuesday, July 10, 2012

Indexed Addressing:
Indexed addressing uses a base register (either the
program counter or data pointer) and an offset (the accumulator) in forming the effective address for a JMP or MOVC instruction. Example: MOVC A, @A+DPTR

Tuesday, July 10, 2012

Tuesday, July 10, 2012

Tuesday, July 10, 2012

LED (Light Emitting Diode):


Light-emitting diodes are elements for light signalization in electronics. They are manufactured in different shapes, colors and sizes. Low price, low consumption and simple use These LEDs are used for indication purpose i.e., ON & OFF.

Tuesday, July 10, 2012

Symbol of LED:

Tuesday, July 10, 2012

Some different colors of LED:

Tuesday, July 10, 2012

How to interface LED with microcontroller ?


Anode is connected through a resistor to Vcc &
the Cathode is connected to the Microcontroller pin. So when the Port Pin is HIGH the LED is OFF & when the Port Pin is LOW the LED is turned ON.

Tuesday, July 10, 2012

Tuesday, July 10, 2012

Can we connect like this?

Tuesday, July 10, 2012

When the port Pin is HIGH the Anode is positive


with respect to the Cathode so the LED should turn ON right?

But the internal pull-up resistor comes in series


with the resistor thus limiting the current flowing through the LED. This current is not sufficient enough to Turn ON the LED.

Tuesday, July 10, 2012

A Simple Program to glow an LED:


ORG 0000H CLR P1.0 //Turn ON LED CLR P1.1 CLR P1.2 END

Tuesday, July 10, 2012

A program using port to glow an LED :


ORG 0000H
MOV p1,#OOH END //Copy P1 to A

Tuesday, July 10, 2012

A program to ON &OFF the LED:


CASE1:

ORG 0000H
MOV P1,#OFFH MOV P1,#OOH END

Tuesday, July 10, 2012

CASE 2:
ORG 0000H

MOV P1,#OFFH MOV A,P1 CPL A //Compliment END

Tuesday, July 10, 2012

Tuesday, July 10, 2012

SWITCH INTERFACING
An electrical switch is any device used to interrupt the flow of electrons in a circuit. Switches are essentially binary devices: they are either completely on ("closed") or completely off ("open").

CPU accesses the switches through ports.


Therefore these switches are connected to a microcontroller. This switch is connected between the supply and ground terminals.

These switches are connected to an input port.


Tuesday, July 10, 2012

In 8051 PORT 1, PORT 2 & PORT 3 have


internal 10k Pull-up resistors whereas this Pull-up resistor is absent in PORT 0. Hence PORT 1, 2 & 3 can be directly used to interface a switch whereas we have to use an external 10k pull-up resistor for PORT 0 to be used for switch interfacing or for any other input. When no switch is pressed, reading the input port will yield 1s since they are all connected to high (Vcc). But if any switch is pressed, one of the input port pins will have 0 since the switch pressed provides the path to ground.

Tuesday, July 10, 2012

Vcc R GND
P2.1

8 0 5 1

Interfacing switch with the microcontroller

Tuesday, July 10, 2012

Thus now the two conditions are to be remembered:


When the switch is open, i.e., when not pressed the
total supply i.e., Vcc appears at the port pin P2.0 P2.0 = 1 When the switch is closed i.e., when it is pressed, the total supply path is provided to ground. Thus the voltage value at the port pin P2.0 will be zero. P2.0 = 0

Tuesday, July 10, 2012

Vcc R
P2.1 P1.0
Vcc

GND

8 0 5 1

Interfacing Led And Switch with the Microcontroller

Tuesday, July 10, 2012

Simple program to turn on led when switch is pressed:


ORG 0000H SETB P1.0
LOOP:

JB P2.1, LOOP CLR P1.0 END

Tuesday, July 10, 2012

Tuesday, July 10, 2012

Liquid crystal display (LCD):


A liquid crystal display (LCD) is a thin, flat panel
used for electronically displaying information such as text, images, and moving pictures. Its uses include monitors for computers, televisions, instrument panels, and other devices ranging from aircraft cockpit displays, to everyday consumer devices such as gaming devices, clocks, watches, calculators, and telephones.

Tuesday, July 10, 2012

Among its major features are its lightweight construction, its portability, and its ability to be produced in much larger screen sizes than are practical for the construction of cathode ray tube (CRT) display technology.

Tuesday, July 10, 2012

Why we are using LCD ?


Its low electrical power consumption enables it to
be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome.

Tuesday, July 10, 2012

Liquid Crystal Display (LCD )is finding wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons: The declining prices of LCDs. The ability to display numbers, characters ,graphics and limited to numbers and a few characters Ease of programming for characters and graphics.

Tuesday, July 10, 2012

Pin Description of LCD:


1.
Ground 2. Vcc +5V 3. Contrast control 4. Register select (RS) 5. Read/Write (RD/WR) 6. Enable (EN) 7 14 pins all are data pins D0 D7 15. Vcc +5V } For backlight purpose 16. Ground }
Tuesday, July 10, 2012

RS (register select): The register select pin is used for the selection of the required register either data or command register If RS=0 ; command register is selected If RS=1 ; data register is selected R/W (read or write): This pin is for the selection of read or write mode If R/W=0 ; write mode is selected If R/W=1 ; read mode is selected EN (enable): Enable pin is a active high to low pin used for writing the data to the LCD.
Tuesday, July 10, 2012

LCD COMMAND CODES:


01 Clear display screen
06 Increment cursor 38 2lines and 5 by 7 matrix 80 Force cursor to beginning of 1st line 0E Display on, cursor blinking C0 Force cursor to beginning 0f 2nd line

Tuesday, July 10, 2012

LCD INTERFACING WITH MICRO CONTROLLER:


LCD
P0.0
P0.1 P0.2 P0.3 P0.4 P0.5 P0.6 P0.7 D0 D1 D2 D3 D4 D5 D6 RS R/W D7 Vss 10k POT

Vee

8 0 5 1

Vss

GND

P2.0 P2.1 P2.2

Tuesday, July 10, 2012

How To Send Commands To LCD:


COMMAND:
CLR RS CLR R/W SETB EN CLR EN

Tuesday, July 10, 2012

How to send Data to LCD:


DATA:
SETB RS CLR R/W SETB EN CLR EN

Tuesday, July 10, 2012

A Simple Program Of LCD:


ORG OOH MOV A,#38H ACALL COMMAND MOV A,#0EH ACALL COMMAND MOV A,# H ACALL DATA MOV A,# I ACALL DATA

Tuesday, July 10, 2012

COMMAND :

CLR RS CLR R/W SETB EN CLR EN RET SETB RS CLR R/W SETB EN CLR EN RET END

DATA:

Tuesday, July 10, 2012

Tuesday, July 10, 2012

Relay Interfacing With Microcontroller


Relay: It can be defined as an electrical switch that opens and closes under the control of another electrical circuit. The switch is operated by an electromagnet to open or close one or more of contacts. A relay is able to control an output circuit of higher power than the input circuit. Relays are devices which allow low power circuits to switch a relatively high Current/Voltage ON/OFF. For a relay to operate a suitable pull-in & holding current should be passed through its coil. Generally relay coils are designed to operate from a particular voltage often its 5V or 12V.
Tuesday, July 10, 2012

Types:
There are many types of relays which are as follows: SPDT DPDT Symbol Of Relay:

Tuesday, July 10, 2012

The relay's switch connections are usually labelled


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.

Tuesday, July 10, 2012

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.

Tuesday, July 10, 2012

Disadvantages Of Relay:

Relays are bulkier than transistors for


switching small currents. Relays cannot switch rapidly , transistors can switch many times per second. Relays use more power due to the current flowing through their coil.

Tuesday, July 10, 2012

SPDT Relay (Single Pole Double Throw) :


An electromagnetic switch, consist of a coil , 1 common terminal , 1 normally closed terminal , and one normally open terminal. When the coil of the relay is at rest (not energized), the common terminal and the normally closed terminal have continuity. When the coil is energized, the common terminal and the normally open terminal have continuity.

Tuesday, July 10, 2012

DPDT (Double Pole Double Throw): Can be used to isolate float switches from spiking voltage or excessive current. Avoids risk that spiking pump voltage will hurt float switches. Specifications: Coil voltage: 12VDC Coil resistance: 160 Ohms

Contact rating: 10A at 250VAC or 30VDC.

Tuesday, July 10, 2012

Why do I want to use a relay and do I really need to?


The coil of an SPDT relay that we most commonly
use draws very little current (less than 200 milliamps) and the amount of current that you can pass through a relay's common, normally closed, and normally open contacts will handle up to 30 or 40 amps. This allows you to switch devices such as headlights, parking lights, horns, etc.,

Tuesday, July 10, 2012

SPDT & DPDT:

Tuesday, July 10, 2012

Relay Interfacing with the Microcontroller:

AT 89S52
P1.0

1 2 3 4 5 6 7 8

U L N 2 8 0 3

16 15 14 13 12 11 10 9

RELAY

LOAD

Ground

Vcc

Tuesday, July 10, 2012

ULN2003 CURRENT DRIVER:


The ULN2003 current driver is a high voltage, high
current Darlington arrays each containing seven open collector Darlington pairs with common emitters. Each channel is rated at 500mA and can withstand peak currents of 600mA.

Tuesday, July 10, 2012

ULN DRIVER CIRCUIT

This ULN2003 driver can drive seven relays at a time. The pins 8 and 9 provide ground and Vcc respectively.
Tuesday, July 10, 2012

Working Of ULN Driver:


It can accept seven inputs at a time and produces
seven corresponding outputs. If the input to any one of the seven input pins is high, then the value at its corresponding output pin will be low, for example if the input at pin 6 is high, then the value at the corresponding output i.e., output at pin 11 will be low. Similarly if the input at a particular pin is low, then the corresponding output will be high.
Tuesday, July 10, 2012

Thus for the output to be low, the input applied at


that corresponding input pin should be high. The input to the ULN driver is provided by the microcontroller. Thus the instruction required to operate the relay through the microcontroller is SETB PX.Y Where X is the port number (P0, P1, P2 and P3). And Y is the pin number of Port X.

Tuesday, July 10, 2012

Applications:
To control a high-voltage circuit with a low
voltage signal To control a high-current circuit with a lowcurrent signal, To detect and isolate faults on transmission and distribution lines by opening and closing circuit breakers.

Tuesday, July 10, 2012

Tuesday, July 10, 2012

What is communication?
Communication is nothing but sharing of data or
transferring the data from one system to another.

system1

system2

Tuesday, July 10, 2012

Types of communication:
In Serial communications means information is transmitted from source to destination over a single pathway. In Parallel Communication, often 8 or more lines are used to transfer data to a device that is only a few feet.

Tuesday, July 10, 2012

COMPUTERS TRANSFER DATA IN TWO WAYS:

Serial Transfer
D0 Sender Receiver

Parallel Transfer
D0-D7 Sender Receiver

Other control lines

Other control lines

Tuesday, July 10, 2012

Why we prefer serial transmission over parallel transmission?


In Parallel data transfers, often 8 or more lines are used to transfer data to a device that is only a few feet. Where as serial transmission uses only single line to transmit the same data over long distances There are chances of loosing data in parallel communication rather than in serial communication.
Tuesday, July 10, 2012

Simplex vs. Duplex Transmission


Simplex transmission: the data can sent in one
direction. Example: the computer only sends data to the printer.

Duplex transmission: the data can be transmitted


and received.
Transmitter Receiver
Tuesday, July 10, 2012

Transmitter

Receiver

Transmitter Receiver

Half vs. Full Duplex


Half duplex: if the data is transmitted one way at
a time.
Transmitter Receiver

Receiver

Transmitter

Full duplex: if the data can go both ways at the


same time. Two wire conductors for the data lines.
Transmitter
Tuesday, July 10, 2012

Receiver

Receiver

Transmitter

Registers Used in Serial Transfer Circuit

SBUF (Serial data buffer) SCON (Serial control register) TMOD (Timer mode register)

Tuesday, July 10, 2012

SBUF
This is an 8-bit register used for serial
communication in 8051.For a byte of data to be transferred it must be placed in sbuf register and in similar way sbuf holds the data when it is received.

Tuesday, July 10, 2012

SCON Register (serial control)


It used to program the start bit, stop bit and data bits of data framing
SM0 SM1 SM2 REN TB8 RB8 TI RI

SM0 , SM1: These two bits determine the framing of data by specifying the number of bits per character, and the start and stop bits.

Tuesday, July 10, 2012

SM0 SM1 0 0 Serial Mode 0 0 1 Serial Mode 1, 8-bit data, 1 stop bit, 1 start bit 1 0 Serial Mode 2 1 1 Serial Mode 3

Tuesday, July 10, 2012

RECEIVE - Data receive through the RXD pin starts upon the two following conditions are met: bit REN=1 and RI=0 (both of them are stored in the SCON register). When all 8 bits have been received, the RI bit of the SCON register is automatically set indicating that one byte receive is complete.

TRANSMIT - Data transmit is initiated by writing data to the SBUF register. In fact, this process starts after any instruction being performed upon this register. When all 8 bits have been sent, the TI bit of the SCON register is automatically set.
Tuesday, July 10, 2012

TMOD
TMOD is an 8 bit register in which the lower 4 bits
are set aside for Timer0 and the upper 4 bits for Timer1.
GATE C/T M0 M1 GATE C/T M1 M0

Tuesday, July 10, 2012

TMOD -Timers
Bit Number 7 Type GATE1 Working Timer Type Gating Control when 1 set

C/T1

To decide whether timer is used as a delay generator or as an event counter


Timer mode bit

M1

4
3

M0
GATE0

Timer mode bit


Gating Control Purpose To decide whether timer is used as a delay generator or as an event counter Timer mode bit Timer mode bit

1
0

C/T0

1 0
Tuesday, July 10, 2012

M1 M0

0 0

M1

M0

Description Timer Mode of Mode 0 1 2 13-bit Timer. 16-bit Timer 8-bit autoreload Split timer mode

0 0 1

0 1 0

Tuesday, July 10, 2012

RS232
To ensure fast and reliable data transmission between two devices In RS232 it consists of 9 pins but we generally use only three pins 2,3 and 5 namely TXD RXD GND respectively.

Tuesday, July 10, 2012

MAX232
To convert TTL or CMOS voltages to RS232 voltages, and vice versa

Complementary metaloxidesemiconductor (CMOS)


CMOS uses complementary and symmetrical pairs of p-type and n-type metal oxide semiconductor field effect transistors (MOSFETs) for logic functions. Two important characteristics of CMOS devices are high noise immunity and low static power consumption.
Tuesday, July 10, 2012

TTL (Transistor transistor logic)


TTL integrated circuits were a standard method
of construction for the processors of minicomputer and mainframe processors Transistortransistor logic (TTL) is a class of digital circuits built from bipolar junction transistors (BJT) and resistors. It is called transistortransistor logic because both the logic gating function (e.g., AND) and the amplifying function are performed by transistors

Tuesday, July 10, 2012

Baud Rates in the 8051:

Baud rate is the number of signal changes per


second The 8051 transfers and receives data serially at many different baud rates by using UART. UART divides the machine cycle frequency by 32 and sends it to Timer 1 to set the baud rate. Signal change for each roll over of timer 1.
Machine cycle frequency 921.6 kHz

11.0592 MHz

XTAL oscillator
Tuesday, July 10, 2012

12

32

28800 Hz

By UART To timer 1
To set the Baud rate

Timer 1

MAX 232 INTERFACING WITH MICRO CONTROLLER


TxD0(P3.1) 11 RxD0(P3.0)
10 11 12 14 2 3

M A

13

D B 9

GND

8 0 5 1

X
2 3

Tuesday, July 10, 2012

Tuesday, July 10, 2012

ANALOG TO DIGITAL CONVERTER


Analog-to-digital converters are among the most
widely used devices for data acquisition. Digital systems use binary values, but in the physical world everything is continuous i.e., analog values. Temperature, pressure (wind or liquid), humidity and velocity are the physical analog quantities. These physical quantities are to be converted into digital values for further processing. Thus, an analog-to-digital converter is needed to convert these electrical signals into digital values so that the microcontroller can read and process them.
Tuesday, July 10, 2012

ADC0804:
The ADC chip that is used in this project is
ADC0804. The ADC0804 IC is an 8-bit parallel ADC in the family of the ADC0800 series from National Semiconductor. It works with +5 volts and has a resolution of 8 bits. In the ADC0804, the conversion time varies depending on the clocking signals applied to the CLK IN pin, but it cannot be faster than 110s.

Tuesday, July 10, 2012

PIN Diagram of ADC

Tuesday, July 10, 2012

Pin description of ADC


CS (Chip selection): Chip select is a active low input used to activate the ADC 0804. RD (read): This is also a active low pin used to get the converted data out of the ADC 0804. WR (write): This is also active low used to inform the ADC to start the conversion process.

Tuesday, July 10, 2012

CLK IN & CLK R: CLK IN is connected to external clock when external clock is used and if internal clock is used both clocks are connected to capacitor and a resistor. INTR (INTERRUPT): It is an active low output pin using for stop the conversion. Vin(+) & Vin(-): Vin(+) is used for the conversion of analog to digital by connecting Vin(-) to the ground.
Tuesday, July 10, 2012

Vcc: It is the +5v power supply to the chip. Vref/2: Pin 9 is used for the reference voltage. If we need the input range 0-4V, Vref/2 is connected to 2V. D0-D7: These are the digital data output pins. D7 is the MSB. Analog ground & Digital ground: Analog ground is connected to ground of analog Vin while taking the inputs in the same way digital ground is also used for the digital outputs.

Tuesday, July 10, 2012

ADC INTERFACE WITH MICROCONTROLLER


89C51
20 P2.5 P2.6 P2.7 P1.7 P1.6 P1.5 P1.4 P1.3 P1.2 P1.1 P1.0

A D C 0 8 0 4

Tuesday, July 10, 2012

KEYPAD INTERFACING
Keypads are a part of HMI or Human Machine Interface and play really important role in a small embedded system where human interaction or human input is needed. Matrix keypads are well known for their simple architecture and ease of interfacing with any microcontroller. Interfacing the Keyboard to the 8051 At the lowest level, keypads are organized in a matrix of rows and columns. The CPU accesses both rows and column through ports; therefore, an 4*4 matrix of keys can be connected to a microprocessor. When a key pressed, a row and column make a connect; otherwise, there is no connection between row and column.
Tuesday, July 10, 2012

Constructing a Matrix Keypad:


Construction of a keypad is really simple. As per the outline shown in the figure below we have four rows and four columns. In between each overlapping row and column line there is a key.keeping this outline we can construct a keypad using simple SPST Switches as shown below:

Tuesday, July 10, 2012

Consider an example
Row4-row1 = 1110 Col4-col1 = 1011 That means the row 1 and the col 3 intersected i.e. sw3 is pressed.

Tuesday, July 10, 2012

Tuesday, July 10, 2012

You might also like