Sei sulla pagina 1di 45

ABSTRACT

The main aim behind making this project is to make a system of security in which card is the identity of user like ATM . But In case of ATM and other electronic cards we have to store some information In the cards (i.e. in magnetic strip , bar code etc.) . In this project it is shown that without storing any information to the card how it can be identified . We have implemented by identifying the patterns present in the card using IR Leds and PhotoTransistor . In this project a pair of IR led and Phototransistor is placed in front of each other . There is a passage of IR rays between the pair which when obstructed by some thing can be sensed by microcontroller . Here we have set 3 pair of IR led and phototransistor . so they will have total 8 combinations of states which are assigned identity according to our choice . In this way the cards are identified just by their construction and not by any information stored in the card . To implement it Professionally , it need some modifications , But can be safely and easily used for security purposes in offices , workstations , hotels etc. and also for providing different access rights or services to different people . This project is developed using Atmel 89S51 microcontroller and the programming is done in C language on Keil uVision 4.0 software .

Project Description
This project can be used in house , offices , warehouses , colleges etc in which security and record is a concern .It can be mainly used in the areas where only authorized access is allowed . Every authorized person has its own Identity Card through which it is recognized by the system . All the functions are controlled by the 8051 microcontroller . It uses IR sensors and detectors . Every card is first inserted in provided slot then checked for its access . If validation of card expired then no access . After checking if the card is found valid , access is allowed to it .

Introduction

An identity document (also called a piece of identification or ID, or colloquially as one's 'papers') is any document which may be used to verify aspects of a person's personal identity. If issued in the form of a small, mostly standard-sized card, it is usually called an identity card (IC). In some countries the possession of a government-produced identity card is compulsory while in others it may be voluntary. In countries which do not have formal identity documents, informal ones may in some circumstances be required. In the absence of a formal identity document, some countries accept driving licences as the most effective method of proof of identity. Most countries accept passports as a form of identification. Most countries have the rule that foreign citizens need to have their passport or occasionally a national identity card from their home country available at any time if they do not have residence permit in the country. Presently there are many types of cards available such as punch cards, magnetic cards, optical cards but all are having the disadvantage of performance degradation as we use them. Other disadvantages are: 1. They can not store much information. 2. They lose their data if placed under magnetic field or even on scratching. 3. There is no security to protect card data whereas in our card this is no data stored .
4.

There is no Re-Writable memory for temporary data storage such as railway reservation ticket.

The above-mentioned shortcomings are technical but there are user related problems also when one needs to handle a large number of cards at a time to obtain diverse information (Atm, Credit card, License, Voter Id. etc.). The user is highly inconvenienced as he is required to change over the cards frequently, so we have designed a card which contains some pattern through which it is recognised . Since data is authorized using IR sensors so in many applications we can identify the user easily . We can also lock the card by using passwords. Data is stored in ROM of Microcontroller which checks the authorization of cards .We can use the cards in automatic doors fitted with sensors which read the card and open the door only for authorized card holders.

Applications :
Infrared Data Exchange. Attendance Counting. Security System. For Sending Data through Cards. In Various Commercial sites to give access to certain people.

Working

Microcontroller AT89C51 is at the heart of the circuit. It is a low- power, high-performance, 8-bit microcontroller with 4 kB of flash programmable and erasable read-only memory (PEROM) used as on-chip program memory, 128 bytes of RAM used as internal data memory, 32 individually programmable input/output (I/O) lines divided into four 8-bit ports, two 16-bit programmable timers/counters, a five-vector two-level interrupt architecture, on-chip oscillator and clock circuitry. A 11.0592MHz crystal (XTAL1) is used to provide basic clock frequency for the microcontroller. Capacitor C3 and resistor R3 form the power-on reset circuit, This circuit consists of four infrared transmitters and four photodiode as a receiver. IR led is connected to Vcc +5 V supply through 220E resistance and a photodiode is connected to Vcc +5V supply through a 10 k resistance. When transmitter and receiver are in front of each other then photodiode conducts and gives a low level output. When there is an interruption between Tx & Rx then output of photodiode is high level. Output of photodiode is not in the digital form so LM324 Quad comparator is used for converting analog input signal into digital output. In this circuit there are holes in different places of identity card so that IR Tx & Rx reflects the different signal for each card for example there are two holes in a card at center location then the output from the photodiode is 0110. on the bases of the information received from the photodiodes microcontroller shows the different names on the LCD. Motor driver L-293, receives the signal from the microcontroller to drive the motor. When controller give 5V signal at pin number 3 & 0V at the 7 number of L 293 IC then motor run in clockwise direction and when controller give 5V signal at pin number 7 & 0V at the 3 number of L 293 IC then motor run in anti-clockwise direction.

Components Required

Table : 1
S.no. Name of Component PCB LCD Transformer Diode Capacitor Capacitor Resistor Crystal oscillator Microcontroller Comparator Regulator IR LED PhotoTransistor Potentiometer Resistor Connecting wires Plastic Cards Specification 4 * 6 (2) 16 * 2Lines 9-0-9 V IN4007(4) 2200uF , 25 V 33 pF , 16 V (2) 330 ohm (3) 11.0592Mhz AT89S51 LM 324 LM 7805 5V 5V (3) (3) Cost

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

10 k ohm 10 k (4)

50 110 45 4 2 1 3 10 90 5 10 60 60 2 2 20 10

Block Diagram

Figure 10 : Block diagram of Electronic ID card System

Circuit Diagram

DESCRIPTION OF COMPONENTS USED IN PROJECT

Crystal Oscillator :
A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them were called "crystal oscillators".

Crystal Oscillator

Transformer :
Transformers for use at power or audio frequencies have cores made of many thin laminations of silicon steel. By concentrating the magnetic flux, more of it is usefully linked by both primary and secondary windings. Since the steel core is conductive, it, too, has currents induced in it by the changing magnetic flux. Each layer is insulated from the adjacent layer to reduce the energy lost to eddy current heating of the core. The thin laminations are used to reduce the eddy currents, and the insulation is used to keep the laminations from acting as a solid piece of steel. The thinner the laminations the lower the eddy currents, and the lower the losses. Very thin laminations are generally used on high frequency transformers. The cost goes up when using thinner laminations mainly over the labor in stacking them.

Tranformer

Printed Circuit Boards :

When assembling an electronic circuit, a board is needed on which the components can be mounted and wired together. This board is called a Printed Wiring Board (PWB).In Japan, the printed wiring board used to be called a "Printed Circuit Board." Nowadays in Japan the name "Printed Circuit Board" is not used because the initials of "Printed Circuit Board" are "PCB." PCB also stands for "Polychlorinated Biphenyls (PCBs)," which is a poison. So in Japan, we refer to the boards as "Printed Wiring Boards." In other countries, they are still referred to as "Printed Circuit Boards," or PCBs. In electronics, printed circuit boards, or PCBs, are used to mechanically support and electrically connect electronic components using conductive pathways, or traces, etched from copper sheets laminated onto a non-conductive substrate. PCBs are rugged, inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire-wrapped or point-to-point constructed circuits, but are much cheaper, faster, and consistent in high volume production. Making a PWB takes a lot of work, and can be very difficult.

Regulators :
5 V dc Regulator 3 Output Terminal Current Features : Regulator Up To 100 mA

Internal Thermal-Overload Protection Internal Short-Circuit Current Limiting Input voltage range: 7V to 20V DC Max. output current: 100mA Operating junction temperature range: 0 C to 125 C

Voltage regulator ICs are available with fixed(typically 5, 12 and 15V) or variable output voltages. They are also rated by the maximum current they can pass. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs have 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. They include a hole for attaching a heatsink if necessary.

Voltage Regulator

Infrared Light Emitting Diodes (IRLEDs) :


A light emitting diode (LED) is a semiconductor diode that emits incoherent arrow spectrum light when electricity biased in the forward direction of the p- junction. This effect is a form of electroluminescence. An LED is usually a small area source, often with extra optics added to the chip that shapes its radiation pattern. The color of the emitted light depends on the compostio and condition of the semiconducting material used, and can be infrared, vision or near-ultraviolet. An LED can be used as a regular household light source.

IR Led

It gets so hot in fact that it starts to glow, just like the embers in a fire. An LED does not produce light by dissipating heat. There is some heat produced because nothing is perfect and there is some loss due to efficiency. LEDs produce light by a physical reaction to energy crossing a PN junction in a diode. You still dont need to know all this, but if you want to know more there are lots of sites on the Internet which contain sharp explanations. So, since the LED is not a resistor, its a diode (Light Emitting Diode) there is no Wattage to use as a measure of output.

Power Supply Unit :


Power supply is a reference to a source of electrical power .a device or a system that supplies electrical or other type of energies to an output load or group of loads is called a power supply unit. Regulated Power Supply : A Regulated power supply circuit that is an electronic circuit that is designed to provide a constant voltage of predetermined value across the load terminals irrespective to the main function.A regulated power supply circuit consists of a transformer to step down the ac mains voltage to the required value. The output of the transformer is fed to the rectifier circuit which converts the ac voltage into pulsating dc voltage. In series with the rectifier, the filter circuit is connected which filters out the pulsating dc voltage into pure dc voltage.
STEPDOWN TRANSFORM ER BRIDGE RECTIFIE R

FILTE R CIRCU IT

REGULAT OR

Then the output is connected to the voltage regulator circuit, which regulates the dc output and converts it into constant dc supply, which can be then fed to the electronics circuits. The circuit for the regulated supply circuit is as shown below

D 1 T 2 2 0 51 6 8 V D I N

1 4 0 0 C 1 I N 2 4 0 0 7 0 1

U 1 V

L I

M V

3 O

v J 1 5 N v 2

GND

f / 2

C v 1

1 u 2f / 2 C O

Figure 10 : 5 V Regulated DC Supply

After doing this we have fixed the controller base and its associated circuitry with all the precautions as if reset circuit should be properly bias and crystal should be proper and moreover the pin no.31 should be well short circuited with the controllers pin no 40 to have VCC. Some power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. For example a 5V regulated supply:

Transformer only

The low voltage AC output is suitable for lamps, heaters and special AC motors. It is not suitable for electronic circuits unless they include a rectifier and a smoothing capacitor. Transformer + Rectifier

The varying DC output is suitable for lamps, heaters and standard motors. It is not suitable for electronic circuits unless they include a smoothing capacitor. Transformer + Rectifier + Smoothing

The smooth DC output has a small ripple. It is suitable for most electronic circuits. Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple. It is suitable for all electronic circuits.

Transformer :
Transformers convert AC electricity from one voltage another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. to

Step-up transformers increase voltage, step-down transformers reduce voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage (230V in UK) to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an alternating magnetic field created in the softiron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up.

Rectifier :
There are several ways of connecting diodes to make a rectifier to convert AC to DC. The bridge rectifier is the most important and it produces full-wave varying DC. A fullwave rectifier can also be made from just two diodes if a centre-tap transformer is used, but this method is rarely used now that diodes are cheaper. A single diode can be used as a rectifier but it only uses the positive (+) parts of the AC wave to produce half-wave varying DC.

Bridge rectifier
A bridge rectifier can be made using four individual diodes, but it is also available in special packages containing the four diodes required. It is called a full-wave rectifier because it uses all the AC wave (both positive and negative sections). 1.4V is used up in the bridge rectifier because each diode uses 0.7V when conducting and there are always two diodes conducting, as shown in the diagram below. Bridge rectifiers are rated by the maximum current they can pass and the maximum reverse voltage they can withstand (this must be at least three times the supply rms voltage so the rectifier can withstand the peak voltages).

Figure 11. Schematic of Bridge Rectifier

Output: full-wave varying DC

Smoothing :
Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC (dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.

Note that smoothing significantly increases the average DC voltage to almost the peak value (1.4 rms value). For example 6V RMS AC is rectified to full wave DC of about 4.6V RMS (1.4V is lost in the bridge rectifier), with smoothing this increases to almost the peak value giving 1.4 4.6 = 6.4V smooth DC. Smoothing is not perfect due to the capacitor voltage falling a little as it discharges, giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory and the equation below gives the required value for the smoothing capacitor. A larger capacitor will give less ripple. The capacitor value must be doubled when smoothing half-wave DC. Smoothing capacitor for 10% ripple, C = C = smoothing capacitance in farads (F) Io = output current from the supply in amps (A) Vs = supply voltage in volts (V), this is the peak value of the unsmoothed DC f = frequency of the AC supply in hertz (Hz), 50Hz in the UK 5 Io Vs f

Resistors :
A resistor is a two-terminal electrical or electronic component that resists an electric current by producing a voltage drop between its terminals in accordance with Ohm's law: The electrical resistance is equal to the voltage drop across the resistor divided by the current through the resistor. Resistors are used as part of electrical networks and electronic circuits. Identifying resistors : Most axial resistors use a pattern of colored stripes to indicate resistance. SMT ones follow a numerical pattern. Cases are usually brown, blue, or green, though other colors are occasionally found like dark red or dark gray. One can use a multimeter to test the values of a resistor.

Table 2 : Resistor colour Code

MICROCONTROLLER (89s51): Microcontroller (also MCU or C) is a computer-on-a-chip. It is a type of microprocessor emphasizing high integration, low power consumption, self-sufficiency and costeffectiveness, in contrast to a general-purpose microprocessor (the kind used in a PC). In addition to the usual arithmetic and logic elements of a general purpose microprocessor, the microcontroller typically integrates additional elements such as read-write memory for data storage, read-only memory, such as flash for code storage, EEPROM for permanent data storage, peripheral devices, and input/output interfaces. At clock speeds of as little as a few MHz or even lower, microcontrollers often operate at very low speed compared to modern day microprocessors, but this is adequate for typical applications. They consume relatively little power (milliwatts), and will generally have the ability to sleep while waiting for an interesting peripheral event such as a button press to wake them up again to do something. Description of AT89S51 : The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a fivevector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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 con-tents but

freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset. Pin Description : Port 0 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 highimpedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. Port 1 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 because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification. Port 2 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. In this application, Port 2 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 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 because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 98 oscillator periods after the Watchdog times out. ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. 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.

EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect.

Interfacing a LCD with 8051 microcontroller

Liquid Crystal Display 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 every-day consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. 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. 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. The earliest discoveries leading to the development of LCD technology date from 1888. By 2008, worldwide sales of televisions with LCD screens had surpassed the sale of CRT units.

The most commonly used LCDs found in the market today are 1 line,2 lines or 4 lines LCDs which have only one controller and support at most 80 characters , whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers. Most LCDs with 1 controller has 14 pins and LCDs with 2 controllers have 16 pins.

LCD pin descriptions: The LCD discussed in this section has 14 pins. The function of each pin is given in table.

Figure : 12 Pin Diagram of LCD Vcc, Vss, and VEE: While Vcc and Vss provide +5V and ground, respectively, VEE is used for controlling LCD contrast. RS register select: There are two very important registers inside the LCD. The RS pin is used for their selection as follows. If RS = 0, the instruction command code register is selected, allowing the user to send a command such as clear display, cursor at home, etc. If RS = 1 the data register is selected, allowing the user to send data to be displayed on the LCD. Table 3 : Showing pin description of LCD

R/W read/write: R/W input allows the user to write information to the LCD or read information from it. R/W = 1 when reading; R/W =0 when writing. E Enable: The enable pin is used by the LCD to latch information presented to its data pins. When data is supplied to data pins, a high to low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins. This pulse must be a minimum of 450 ns wide. D0 D7: The 8 bit data pins, D0 D7, are used to send information to the LCD or read the contents of the LCDs internal registers.To display letters and numbers, we send ASCII codes for the letters A Z, a z, and numbers 0 9 to these pins while making RS = 1.There are also instructions command codes that can be sent to the LCD to clear the

display or force the cursor to the home position or blink the cursor. Table below lists the instruction command codes Table 3 : Showing Commands for LCD

We also use RS = 0 to check the busy flag bit to see if the LCD is ready to receive information. The busy flag is D7 and can be read when R/W =1 and RS = 0, as follows: if R/W =1, RS =0. When D7 = 1(busy flag = 1), the LCD busy taking care of internal operations and will not accept any new information. When D7 = 0, the LCD is ready to receive new information. Note: It is recommended to check the busy flag before writing any data to the LCD. Data display: In LCD, one can put data at any location. The following shows address locations and how they are accessed: RS 0 R/W 0 DB7 1 DB6 A DB5 A DB4 A DB3 A DB2 A DB1 A DB0 A

Interfacing LCD to 8051 :

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.If an 8-bit data bus is used, the LCD will require a total of 11 data lines.The three control lines are EN, RS, and RW. Note that the EN line must be raised/lowered before/after each instruction sent to the LCD regardless of whether that instruction is read or write text or instruction. In short, you must always manipulate EN when communicating with the LCD. EN is the LCD's way of knowing that you are talking to it. If you don't raise/lower EN, the LCD doesn't know you're talking to it on the other lines.

Output: The output on the LCD is as shown below. This pattern keeps on repeating letter by letter.

Project Coding :
#include<reg51.h> #define DATA P2 sbit RS = P1^4; sbit RW = P1^5 ; sbit E = P1^6 sbit K = P1^3; sbit M = P1^1; sbit L = P1^2; // declare prototype void lcd_initialize ();

void lcd_show (char []) ; void lcd_busy() ; void lcd_cmd(unsigned char value) ; void lcd_datawrite(unsigned char temp) ; void ms_delay(int n) ; void lcd_show (char str[]) { int i=0 ; for ( ; str[i] != '\0' ; i++) lcd_datawrite( str[i]); } void ms_delay(int n) // do nothing n * 1ms { int i; for ( ; n>0 ; n--) for (i=0; i< 1000 ; i++); } void lcd_busy() { unsigned char x; do { //MSB is 1 if LCD is BUSY // keep looping inside this loop till MSB goes 0 DATA=0xFF; RS=0; x=DATA; E=0; x=x & 0x80; } while(x!=0); DATA=0x00; } void lcd_cmd(unsigned char value) { lcd_busy() ; DATA = value; RS=0; RW=0; E=1; E=0; return; }

RW=1;

E=1;

void lcd_datawrite(unsigned char temp) { lcd_busy() ; RS=1; RW=0; E=1; DATA=temp; E=0; } void lcd_initialize () { lcd_cmd(0x38); // 5x7 matrix and 2 lines lcd_cmd(0x38); lcd_cmd(0x0c); // display on cursor off lcd_cmd(0x01); // clear display screen lcd_cmd(0x06); // display right } void main() { int disp=0 , flg=1 ; char msg[][15]={"Insert Ur card","Wrong Card ","welcome kml","welcome sunit","welcome ISH","Unknown Access"}; lcd_initialize(); while(1) { if(flg ==1 ) { lcd_cmd(0x01); // clear display screen lcd_cmd(0x06); // display right lcd_show("welcome 2 Y4T"); ms_delay(150); lcd_cmd(0xC0); // bring to next line lcd_show(msg[disp]); flg=0; } if(K==0 && M==0 && L==0) //Wrong card inserted { disp=1; flg=1; ms_delay( 40 );

} if(K==0 && M==0 && L==1) // user 1 code { disp=2; flg=1; ms_delay( 40 ); } if(K==0 && M==1 && L==0) // user 2 code { disp=3; flg=1; ms_delay( 40 ); } if(K==1 && M== 0 && L== 0 ) // user 3 code { disp=4; flg=1; ms_delay( 40 ); } if(K==1 && M== 1 && L == 1) { disp=0; flg=1; ms_delay( 30 ); } if(K==0 && M==1 && L==1) { disp=5; flg=1; ms_delay( 30 ) ; } if(K==1 && M==1 && L==0) { disp=5; flg=1; ms_delay( 30 ) ;

} if(K==1 && M==0 && L==1) { disp=5; flg=1; ms_delay( 30 ) ; } } }

MICROCONTROLLERS Introduction:
Circumstances that we find ourselves in today in the field of microcontrollers had their beginnings in the development of technology of integrated circuits. This development has made it possible to store hundreds of thousands of transistors into one chip. That was a prerequisite for production of microprocessors, and the first computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about.

History:

It was year 1969, and a team of Japanese engineers from the BUSICOM Company arrived to United States with a request that a few integrated circuits for calculators be made using their projects. The proposition was set to INTEL, and Marcian Hoff was responsible for the project. Since he was the one who has had experience in working with a computer (PC) PDP8, it occurred to him to suggest a fundamentally different solution instead of the suggested construction. This solution presumed that the function of the integrated circuit is determined by a program stored in it. That meant that configuration would be simpler, but that it would require far more memory than the project that was proposed by Japanese engineers would require. After a while, though Japanese engineers tried finding an easier solution, Marcian's idea won, and the first microprocessor was born. In transforming an idea into a ready made product, Frederico Faggin was a major help to INTEL. He transferred to INTEL, and in only 9 months had succeeded in making a product from its first conception. INTEL obtained the rights to sell this integral block in 1971. First, they bought the license from the BUSICOM Company who had no idea what treasure they had. During that year, there appeared on the market a microprocessor called 4004. That was the first 4-bit microprocessor with the speed of 6 000 operations per second. Not long after that, American company CTC requested from INTEL and Texas Instruments to make an 8-bit microprocessor for use in terminals. Even though CTC gave up this idea in the end, Intel and Texas Instruments kept working on the microprocessor and in April of 1972, first 8-bit microprocessor appeared on the market under a name 8008. It was able to address 16Kb of memory, and it had 45 instructions and the speed of 300 000 operations per second. That microprocessor was the predecessor of all today's microprocessors. Most microcontrollers will also combine other devices such as: A Timer module to allow the microcontroller to perform tasks for certain time periods. A serial I/O port to allow data to flow between the microcontroller and other devices such as a PC or another microcontroller. An ADC to allow the microcontroller to accept analogue input data for processing.

Figure 1: Showing a typical microcontroller device and its different subunits The heart of the microcontroller is the CPU core. In the past this has traditionally been based on an 8-bit microprocessor unit.

Microprocessor :
A microprocessor is a general-purpose digital computer central processing unit (CPU). Although popularly known as a computer on a chip is in no sense a complete digital computer. The block diagram of a microprocessor CPU is shown, which contains an arithmetic and logical unit (ALU), a program counter (PC), a stack pointer (SP),some working registers, a clock timing circuit, and interrupt circuits.

Data Bus
Serial COM Port

CPU

RAM

ROM

I/O Port

Timer

Block Diagram of a Microprocessor

Microcontrollers versus Microprocessors :


Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.

The microprocessor must have many additional parts to be operational as a computer whereas microcontroller requires no additional external digital parts. The prime use of microprocessor is to read data, perform extensive calculations on that data and store them in the mass storage device or display it. The prime functions of microcontroller is to read data, perform limited calculations on it, control its environment based on these data. Thus the microprocessor is said to be general-purpose digital computers whereas the microcontroller are intend to be special purpose digital controller. Microprocessor is concerned with the rapid movement of the code and data from

the external addresses to the chip, microcontroller is concerned with the rapid movement of the bits within the chip. Lastly, the microprocessor design accomplishes the goal of flexibility in the hardware configuration by enabling large amounts of memory and I/O that could be connected to the address and data pins on the IC package. The microcontroller design uses much more limited set of single and double byte instructions to move code and data from internal memory to ALU.

Memory unit:
Memory is part of the microcontroller whose function is to store data.

The easiest way to explain it is to describe it as one big closet with lots of drawers. If we suppose that we marked the drawers in such a way that they can not be confused, any of their contents will then be easily accessible. It is enough to know the designation of the

drawer_and_so_its_contents_will_be_known_to_us_for_sure.

Figure2 Simplified model of a memory unit Memory components are exactly like that. For a certain input we get the contents of a certain addressed memory location and that's all. Two new concepts are brought to us: addressing and memory location. Memory consists of all memory locations, and addressing is nothing but selecting one of them. This means that we need to select the desired memory location on one hand, and on the other hand we need to wait for the contents of that location. Besides reading from a memory location, memory must also provide for writing onto it. This is done by supplying an additional line called control line. We will designate this line as R/W (read/write). Control line is used in the following way: if r/w=1, reading is done, and if opposite is true then writing is done on the memory location. Memory is the first element, and we need a few operation of our microcontroller.

The amount of memory contained within a microcontroller varies between different microcontrollers. Some may not even have any integrated memory (e.g. Hitachi 6503, now discontinued). However, most modern microcontrollers will have integrated memory. The memory will be divided up into ROM and RAM, with typically more ROM than RAM.Typically, the amount of ROM type memory will vary between around 512 bytes and 4096 bytes, although some 16 bit microcontrollers such as the Hitachi H8/3048 can have as much as 128 Kbytes of ROM type memory. ROM type memory, as has already been mentioned, is used to store the program code. ROM memory can be ROM (as in One

Time Programmable memory), EPROM, or EEPROM . The amount of RAM memory is usually somewhat smaller, typically ranging between 25 bytes to 4 Kbytes. RAM is used for data storage and stack management tasks. It is also used for register stacks (as in the microchip PIC range of microcontrollers).

Central Processing Unit :


Let add 3 more memory locations to a specific block that will have a built in capability to multiply, divide, subtract, and move its contents from one memory location onto another. The part we just added in is called "central processing unit" (CPU). Its memory locations are called registers.

Figure 3: Simplified central processing unit with three registers Registers are therefore memory locations whose role is to help with performing various mathematical operations or any other operations with data wherever data can be found. Look at the current situation. We have two independent entities (memory and CPU) which are interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for example, we wish to add the contents of two memory locations and return the result

again back to memory, we would need a connection between memory and CPU. Simply stated, we must have some "way" through data goes from one block to another.

Bus:
That way is called bus. Physically, it represents a group of 8, 16, or more wires. There are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory we wish to address and the other one is as wide as data, in our case 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller. As far as functionality, the situation has improved, but a new problem has also appeared: we have a unit that's capable of working by itself, but which does not have any contact with the outside world, or with us!

Figure 4: Showing connection between memory and central unit using buses In order to remove this deficiency, let's add a block which contains several memory locations whose one end is connected to the data bus, and the other has connection with the output lines on the microcontroller which can be seen as pins on the electronic component.

Input-Output unit
Those locations we've just added are called "ports". There are several types of ports: input, output or bidirectional ports. When working with ports, first of all it is necessary to choose which port we need to work with, & then to send data to, or take it from the port.

Figure 5: Simplified input-output unit communicating with external world When working with it the port acts like a memory location. Something is simply being written into or read from it, and it could be noticed on the pins of the microcontroller.

Serial communication
Beside stated above we've added to the already existing unit the possibility of communication with an outside world. However, this way of communicating has its drawbacks. One of the basic drawbacks is the number of lines which need to be used in order to transfer data. What if it is being transferred to a distance of several kilometers? The number of lines times number of kilometers doesn't promise the economy of the project. It leaves us having to reduce the number of lines in such a way that we don't lessen its functionality. Suppose we are working with three lines only, and that one line is used for sending data, other for receiving, and the third one is used as a reference line for both the input and the output side. In order for this to work, we need to set the rules of exchange of data. These rules are called protocol. Protocol is therefore defined in advance so there wouldn't be any misunderstanding between the sides that are communicating with each other.

For example, if one man is speaking in French, and the other in English, it is highly unlikely that they will quickly and effectively understand each other. Let's suppose we have the following protocol. The logical unit "1" is set up on the transmitting line until transfer begins. Once the transfer starts, we lower the transmission line to logical "0" for a period of time (which we will designate as T), so the receiving side will know that it is receiving data, and so it will activate its mechanism for reception. Let's go back now to the transmission side and start putting logic zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest value. Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit, let us bring the logical unit "1" back on the line which will mark the end of the transmission of one data. The protocol we've just described is called in professional literature NRZ (Non-Return to Zero).

Figure 6: Serial unit sending data through three lines only As we have separate lines for receiving and sending, it is possible to receive and send data (info.) at the same time. So called full-duplex mode block which enables this way of

communication is called a serial communication block. Unlike the parallel transmission, data moves here bit by bit, or in a series of bits what defines the term serial communication comes from. After the reception of data we need to read it from the receiving location and store it in memory as opposed to sending where the process is reversed. Data goes from memory through the bus to the sending location, and then to the receiving unit according to the protocol.

Timer unit
Since we have the serial communication explained, we can receive, send and process data. However, in order to utilize it in industry we need a few additionally blocks. One of those is the timer block which is significant to us because it can give us information about time, duration, protocol etc.

Figure 7: Timer unit generating signals in regular time intervals The basic unit of the timer is a free-run counter which is in fact a register whose numeric value increments by one in even intervals, so that by taking its value during periods T1 and T2 and on the basis of their difference we can determine how much time has elapsed. This is a very important part of the microcontroller whose understanding requires most of our time.

Watchdog

One more thing is requiring our attention is a flawless functioning of the microcontroller during its run-time. Suppose that as a result of some interference (which often does occur in industry) our microcontroller stops executing the program, or worse, it starts working incorrectly.

Figure 8: Watchdog Of course, when this happens with a computer, we simply reset it and it will keep working. However, there is no reset button we can push on the microcontroller and thus solve our problem. To overcome this obstacle, we need to introduce one more block called watchdog. This block is in fact another free-run counter where our program needs to write a zero in every time it executes correctly. In case that program gets "stuck", zero will not be written in, and counter alone will reset the microcontroller upon achieving its maximum value. This will result in executing the program again, and correctly this time around. That is an important element of every program to be reliable without man's supervision.

Analog to Digital Converter


As the peripheral signals usually are substantially different from the ones that microcontroller can understand (zero and one), they have to be converted into a pattern which can be comprehended by a microcontroller. This task is performed by a block for analog to digital conversion or by an ADC. This block is responsible for converting an information about some analog value to a binary number and for follow it through to a CPU block so that CPU block can further process it.

Block for converting an analog input to digital output Finally, the microcontroller is now completed, and all we need to do now is to assemble it into an electronic component where it will access inner blocks through the outside pins. The picture below shows what a microcontroller looks like inside.

Physical configuration of the interior of a microcontroller Thin lines which lead from the center towards the sides of the microcontroller represent wires connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines. Chart on the following page represents the center section of a Microcontroller

Figure 9 : Microcontroller outline with basic elements and internal connections

CONCLUSION

With the theoretical inclination of our syllabus it becomes very essential to take utmost advantage of any opportunity of gaining practical experience that comes along . The construction of Minor project was one of the oppurtunities . Thus in last we conclude that using such a PCB designing techniques any type of complex circuit can be implemented easily and with the above used circuit of Electronic ID Card System Using 89S52 Microcontroller we can secure our access rights wherever needed .

Future Scope

This project is developed with a vision to make a secure system which donot store any numerical or alphabetic information i.e. no electronic device needed to be fit in the card As stored information in the cards may be leaked out . Number of users can be increased and the size of card can be decreased by increasing the no. of holes and also by using leds of small sizes like 3mm , 1 mm etc . In future this type of system can be easily and safely implemented for private areas having a limited no. of users like in offices , colleges , godowns etc . Some modifications can be made like using UV led and Sensors instead of IR . Although UV is visible but it can pass almost every thing except some . Those reflecting substances are applied on the cards and placed in front of UV led and sensed by UV sensors to obtain a specific image which can be matched with stored images and used to identify the users .

BIBLOGRAPHY

Muhammad Ali Mazidi, Janice Gillispie Mazidi, Rosin D. Mc Kinlay, the 8051 Microcontroller & Embedded Systems, Pearson Education Inc. 2nd Edition, 2008.

Kenneth J Ayala, the 8051 Microcontroller Architecture, Programming & Applications Penram International, 2nd Edition, 1996.

J B Gupta, Electronics Devices and Circuits, KATSON Books, India

Electronics for You Electronics devices and circuits Electronics manufacturing Technique serials Electronics components and materials

WEB RESOURCES:

http://www.8051projects.net/forum http://www.datasheetdirect.com http://www.medicaid.co.in www.electronicsforyou.com http://www.google.com www.alldatasheets.com www.wikipedia.com www.ehow.com

Potrebbero piacerti anche