Anda di halaman 1dari 91

An Industry-oriented Mini-Project Report

On WIRELESS DATA ENCRYPTION AND DECRYPTION FOR SECURED COMMUNICATION USING RF


Submitted to

Department of Electronics and Communication Engineering Mahaveer Institute of Science and Technology
(Approved by AICTE) and affiliated to

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY


Hyderabad (A.P.)

In partial fulfillment of the Requirement for the award of Degree of BACHELOR OF TECHNOLOGY
In

Electronics & Communication Engineering


By . 08E31A0405 08E31A0406 08E31A0407 08E31A0408 08E31A0442

M.ANJALI DEVI B.ANNAPURNA G.ARCHANA B.MAHESH G.RAHUL

GUIDE U.Deva Kumari

MINI-PROJECT COORDINATOR Sridhar Chitta

HEAD OF DEPT. Dr. B. Visvesvara Rao

MAHAVEER INSTITUTE OF SCIENCE & TECHNOLOGY


Bandlaguda Post, Keshavgiri, Hyderabad 500 005 2011 -2012

CERTIFICATE
This is to certify that the Mini-project report titled WIRELESS DATA ENCRYPTION AND DECRYPTION FOR SECURED USING RF is submitted by
Names M.ANJALI DEVI B.ANNAPURNA G.ARCHANA B.MAHESH G.RAHUL Roll Nos. 08E31A0405 08E31A0406 08E31A0407 08E31A0408 08E31A0442

in partial fulfilment for the award of Degree of Bachelor of Technology in Electronics and Communication Engineering to the Mahaveer Institute of Science and Technology, affiliated to Jawaharlal Nehru Technological University and is a bonafide record of work carried out by them under our supervision.

The results embodied in this mini-project report have not been submitted to any other University or Institute for the award of any degree or diploma.

Guide U. Deva Kumari Asst. Professor

Mini-Project Coordinator Sridhar Chitta Associate Professor

Head of Department Dr. B. Visvesvara Rao Professor

Acknowledgement
We express our sincere thanks to U.Deva Kumari, Asst. Professor, ECE Dept. for her guidance throughout the implementation of our project.

We are grateful to Dr. B. Visvesvara Rao, Professor and HOD, Dept of ECE, for his suggestions and encouragement.

We express our profound sense of gratitude to the Management and Principal of the college for their perennial support.

M.ANJALI DEVI B.ANNAPURNA G.ARCHANA B.MAHESH G.RAHUL

08E31A0405 08E31A0406 08E31A0407 08E31A0408 08E31A0442

INDEX
Page No CHAPTER-1 Introduction 1.1 Introduction to embedded systems 1.1.1 Application areas 1.2 Wireless communication. 1.2.1 Radio frequency... 1.2.1 Properties of RF 1.2.3 Brief description of RF. 1.2.4 RF advantages and disadvantages...

CHAPTER-2 Block diagram Explanation of each block 2.1 Microcontrollers 2.1.2 Features of AT89S52 2.1.3 Description of AT89S52 2.1.4 Pin description of AT89S52 2.2 RF Transmitter STT-433Mhz 2.2.1 Pin description of RF Transmitter STT-433Mhz 2.3 Encoder HT640 2.3.1 Pin description of Encoder HT640 2.3.2 Transmission enable 6.2.3 Circuit: Transmission circuit 2.4 RF Receiver STR-433Mhz 2.4.1 Pin description of Receiver STR-433Mhz. 2.5 Decoder. 2.5.1 Circuit: Reception circuit 2.6 Liquid crystal display 2.6.1 LCD screen. 2.7 Key pad 2.8 Working of the project CHAPTER-3 Power supply design 3.1 Power supply 3.1.1 Transformer..
3

3.1.2 Rectifier. 3.1.3 Filter. 3.1.4 Voltage regulator..

CHAPTER-4 Interfacing with microcontroller 4.1 LCD interfacing with the microcontroller 4.1.2 Pin functions of LCD.. 4.2 Interfacing the keypad with microcontroller

CHAPTER-5 Advantages and applications 5.1 Advantages.. 5.2 Applications. CHAPTER-6 Software Tools 6.1 Keil software.. 8.1.1 Steps to write a program in keil software 6.2 Proload 8.2.1 Steps to write a program in proload CHAPTER-7 Source code 7.1 Receiver section program 7.2 Transmitter section program Conclusion. Appendix.. Reference

List of Figures
2.1 2.1.3 2.2 : Module of AT89S52 microcontroller. : Pin diagram of 8052 : STT- 433 Mhz Transmitter.

Page No:

2.2.1.(a) : Pin description of transmitter. 2.2.1.(b) : Transmitter connection with microcontroller.. 2.3.(a) : HT640 encoder 2.3.(b) 2.3.1 2.3.4 2.4 :Transmission timing : Address/data programming : Demo transmission circuit : RF receiver STR 433Mhz.

2.4.1.(a) : Pin out.. 2.4.1.(b) :Module of RF receiver 2.5 2.5.1 2.6 2.7 2.7 3.1.1 3.1.2 3.1.3 3.1.4 4.1 4.2 : HT648L decoder. : Demo circuit:reception circuit... :LCD display.. : Module of LCD screen.. : Keypads :Architecture of transformer :Rectifier circuit : Filter circuit : Voltage regulator : LCD interfacing with microcontroller : 4*3 Matrix keypad connections to ports

List of Tables
2.1.4.(a) :Alternate functions of port pins 2.1.4.(b) : Alternate functions of port pins 2.3.1 2.4 4.1.2 : Pin description of HT640 encoder.. : Pin description of RF Receiver... :Pin functions of LCD..

Page No:

WIRELESS DATA ENCRYPTION AND DECRYPTION FOR COMMUNICATION USING RF


ABSTRACT:
Data Security is primary concern for every communication system. There are many ways to provide security data that is being communicated. However, what if the security is assured irrespective of the hackers are from the noise. This Project describes a design of effective security for data communication by designing standard algorithm for encryption and decryption. The source information is generated by a key pad and this will be encrypted and is sent to destination through RF communication. The receiving system will check the data and decrypt according to a specific algorithm and displays on the LCD. The RF modules used here are STT-433 MHz Transmitter, STR-433 MHz Receiver, HT640 RF Encoder and HT648 RF Decoder. RF Transmitter is connected to the different sensors through RF Encoder. This encoder converts the 8-bit data into a single bit and sends it to the transmitter which will be transmitting. The data which is in the air is an analog value. At the receiving end, the receiver receives this analog value on a single data line and passes this data to the decoder. The decoder does the opposite functioning of the encoder i.e., it converts the single bit data into eight bit data and gives it to the microcontroller which does the further processing.

This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/12V step down transformer.

CHAPTER -1

INTRODUCTION
An embedded system is a combination of software and hardware to perform a dedicated task.Some of the main devices used in embedded products are Microprocessors and Microcontrollers.Microprocessors are commonly referred to as general purpose processors as they simply accept the inputs, process it and give the output. In contrast, a microcontroller not only accepts the data as inputs but also manipulates it, interfaces the data with various devices, controls the data and thus finally gives the result.As everyone in this competitive world prefers to make the things easy and simple to handle, this project sets an example to some extent. This project uses microcontroller which is the heart of the project .we use four magnetic sensors in order to sense the level of the water in the dam placing the fourth magnetic sensor in the topmost level when ever water reaches the fourth level then the dam gate is opened automatically using stepper motor.

1.1

Introduction to embedded systems: An embedded system can be defined as a computing device that does a specific

focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called firm ware. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below: Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In
8

some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

1.1.1 Application areas Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very market segment- consumer electronics, office automation, industrial automation, biomedical engineering, wireless communication, data communication, telecommunications, transportation, military and so on.

Consumer appliances: At home we use a number of embedded systems which include digital camera, digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO player, video game consoles, video recorders etc. Todays high-tech car has about 20 embedded systems for transmission control, engine spark control, air-conditioning, navigation etc. Even wristwatches are now becoming embedded systems. The palmtops are powerful embedded systems using which we can carry out many general-purpose tasks such as playing games and word processing.

Office automation: The office automation products using em embedded systems are copying machine, fax machine, key telephone, modem, printer, scanner etc.

Industrial automation: Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station. In hazardous industrial environment, where
9

human presence has to be avoided, robots are used, which are programmed to do specific jobs. The robots are now becoming very powerful and carry out many interesting and complicated tasks such as hardware assembly.

Medical electronics: Almost every medical equipment in the hospital is an embedded system. These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc. Developments in medical electronics have paved way for more accurate diagnosis of diseases.

Computer networking: Computer networking products such as bridges, routers, Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded systems which implement the necessary data communication protocols. For example, a router interconnects two networks. The two networks may be running different protocol stacks. The routers function is to obtain the data packets from incoming pores, analyze the packets and send them towards the destination after doing necessary protocol conversion. Most networking equipments, other than the end systems (desktop computers) we use to access the networks, are embedded systems . Telecommunications: In the field of telecommunications, the embedded systems can be categorized as subscriber terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice communication over the Internet. Wireless technologies: Advances in mobile communications are paving way for many interesting applications using embedded systems. The mobile phone is one of the marvels of the last decade of the 20h century. It is a very powerful embedded system that provides voice communication while we are on the move. The Personal Digital Assistants and the palmtops can now be used to access multimedia services over the Internet. Mobile communication infrastructure such as base station controllers, mobile switching centers are also powerful embedded systems.
10

1.2 WIRELESS COMMUNICATION USING RF:

Wireless communication, as the term implies, allows information to be exchanged between two devices without the use of wire or cable. A wireless keyboard sends information to the computer without the use of a keyboard cable; a cellular telephone sends information to another telephone without the use of a telephone cable. Changing television channels, opening and closing a garage door, and transferring a file from one computer to another can all be accomplished using wireless technology. In all such cases, information is being transmitted and received using electromagnetic energy, also referred to as electromagnetic radiation. One of the most familiar sources of electromagnetic radiation is the sun; other common sources include TV and radio signals, light bulbs and microwaves. To provide background information in understanding wireless technology, the electromagnetic spectrum is first presented and some basic terminology defined.

1.2.1 RADIO FREQUENCY (RF) Radio frequency (RF) is a frequency or rate of oscillation within the range of about 3 Hz to 300 GHz. This range corresponds to frequency of alternating current electrical signals used to produce and detect radio waves. Since most of this range is beyond the vibration rate that most mechanical systems can respond to, RF usually refers to oscillations in electrical circuits or electromagnetic radiation. RF is widely used because it does not require any line of sight, less distortions and no interference. 1.2.2 PROPERTIES OF RF: Electrical currents that oscillate at RF have special properties not shared by direct current signals. One such property is the ease with which it can ionize air to create a conductive path through air. This property is exploited by 'high frequency' units used in electric arc welding. Another special property is an electromagnetic force that drives the RF current to the surface of conductors, known as the skin effect. Another property is the ability to appear to flow through paths that contain insulating material, like the dielectric insulator of a capacitor. The degree of effect of these properties depends on the frequency of the signals.

11

1.2.3 BRIEF DESCRIPTION OF RF: Radio frequency (abbreviated RF) is a term that refers to alternating current (AC) having characteristics such that, if the current is input to an antenna, an electromagnetic (EM) field is generated suitable for wireless broadcasting and/or communications. These frequencies cover a significant portion of the electromagnetic radiation spectrum, extending from nine kilohertz (9 kHz),the lowest allocated wireless communications frequency (it's within the range of human hearing), to thousands of gigahertz(GHz). When an RF current is supplied to an antenna, it gives rise to an electromagnetic field that propagates through space. This field is sometimes called an RF field; in less technical jargon it is a "radio wave." Any RF field has a wavelength that is inversely proportional to the frequency. In the atmosphere or in outer space, if f is the frequency in megahertz and s is the wavelength in meters, then s = 300/f The frequency of an RF signal is inversely proportional to the wavelength of the EM field to which it corresponds. At 9 kHz, the free-space wavelength is approximately 33 kilometers (km) or 21 miles (mi). At the highest radio frequencies, the EM wavelengths measure approximately one millimeter (1 mm). As the frequency is increased beyond that of the RF spectrum, EM energy takes the form of infrared (IR), visible, ultraviolet (UV), X rays, and gamma rays. Many types of wireless devices make use of RF fields. Cordless and cellular telephone, radio and television broadcast stations, satellite communications systems, and two-way radio services all operate in the RF spectrum. Some wireless devices operate at IR or visible-light frequencies, whose electromagnetic wavelengths are shorter than those of RF fields. Examples include most television-set remote-control boxes Some cordless computer keyboards and mice, and a few wireless hi-fi stereo headsets. The RF spectrum is divided into several ranges, or bands. With the exception of the lowestfrequency segment, each band represents an increase of frequency corresponding to an order of magnitude (power of 10). The table depicts the eight bands in the RF spectrum, showing frequency and bandwidth ranges. The SHF and EHF bands are often referred to as the microwave spectrum.

12

1.2.4 RF ADVANTAGES AND DISADVANTAGES RF Advantages: No line of sight is needed. Not blocked by common materials: It can penetrate most solids and pass through walls. Longer range. It is not sensitive to the light. It is not much sensitive to the environmental changes and weather conditions.

RF Disadvantages: Interference: communication devices using similar frequencies - wireless phones, scanners, wrist radios and personal locators can interfere with transmission Lack of security: easier to "eavesdrop" on transmissions since signals are spread out in space rather than confined to a wire Higher cost than infrared Federal Communications Commission(FCC) licenses required for some products Lower speed: data rate transmission is lower than wired and infrared transmission.

Main requirements for the communication using RF: RF Transmitter RF Receiver Encoder and Decoder

13

CHAPTER- 2

BLOCK DIAGRAM

Block Diagram: Transmitter Data Encryption

16X2 LCD 89S52 MCU

Key Pad

RF Encoder

RF Transmitter

Step down T/F

Bridge Rectifier

Filter Circuit

Regulator Power supply to all sections

14

Block Diagram: Receiver Data Encryption.

16X2 LCD 89S52 MCU

RF Decoder RF receiver

Step down T/F

Bridge Rectifier

Filter Circuit

Regulator Power supply to all sections

15

EXPLANATION OF EACH BLOCK:

AT89S52 MICROCONTROLLER

2.1

MICROCONTROLLERS: Microprocessors and microcontrollers are widely used in embedded systems products.

Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The Intel 8052 is Harvard architecture, single chip microcontroller (C) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8052compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products.

16

8052 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8052 is available in different memory types such as UV-EPROM, Flash and NV-RAM. The present project is implemented on Keil uVision. In order to program the device, proload tool has been used to burn the program onto the microcontroller. The features, pin description of the microcontroller and the software tools used are discussed in the following sections.

Fig 2.1:Module of AT89S52 microcontroller 2.1.2 FEATURES Compatible with MCS-51 Products 8K Bytes of In-System Programmable (ISP) Flash Memory Endurance: 1000 Write/Erase Cycles 4.0V to 5.5V Operating Range

17

Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources Full Duplex UART Serial Channel Low-power Idle and Power-down Modes Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag

2.1.3

DESCRIPTION OF AT89S52 The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller

with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industrystandard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications.

18

The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.

Fig 2.1.3: Pin diagram of AT89S52

19

2.1.4 PIN DESCRIPTION

VCC Supply voltage.

GND Ground.

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

Port 1 Port 1 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.

20

Table 2.1.4(a): Alternate functions of port pins Port 2 Port 2 is an 8-bit bidirectional I/O port with internal pullups. 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 pullups 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 pullups. Port 2 emits the highorder address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal 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 bidirectional I/O port with internal pullups. 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 pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification.

21

Table 2.1.4.(b): Alternate functions of port pins 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 96 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. 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.

22

PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12volt 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.

XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator, as shown in Figure. 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 the below figure. 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.

23

2.2 RF TRANSMITTER STT-433MHz:

Fig 2.2: STT-433 MHZ TRANSMITTER 2.2.1 PIN DESCRIPTION:

Fig 2.2.1.(a):Pin Description

GND Transmitter ground. Connect to ground plane DATA Digital data input. This input is CMOS compatible and should be driven with CMOS level inputs. Vcc
24

Operating voltage for the transmitter. VCC should be bypassed with a .01uF ceramic capacitor and filtered with a 4.7uF tantalum capacitor. Noise on the power supply will degrade transmitter noise performance. ANT 50 ohm antenna output. The antenna port impedance affects output power and harmonic emissions. Antenna can be single core wire of approximately 17cm length or PCB trace antenna.

APPLICATION:

Fig 2.2.1.(b): Transmitter connection with microcontroller

The typical connection shown in the above figure cannot work exactly at all times because there will be no proper synchronization between the transmitter and the microcontroller unit. i.e., whatever the microcontroller sends the data to the transmitter, the transmitter is not able to accept this data as this will be not in the radio frequency range. Thus, we need an intermediate device which can accept the input from the microcontroller, process it in the range of radio frequency range and then send it to the transmitter. Thus, an encoder is used.

25

2.3

ENCODER HT640:

Fig 2.3.(a): HT640 encoder

Working: HT640 encoder is a part of 3^18 (3 power of 18) series of encoders .The 3^18 (3 power of 18) series of encoders begins a three-word transmission cycle upon receipt of a transmission enable (TE for the HT600/HT640/HT680 or D12~D17 for the

HT6187/HT6207/HT6247, active high). This cycle will repeat itself as long as the transmission enable (TE or D12~D17) is held high. Once the transmission enable falls low, the encoder output completes its final cycle and then stops as shown in the figure.

26

Fig 2.3.(b):Transmission timing

2.3.1 PIN DESCRIPTION:

Table 2.3.1: Pin description of HT640 encoder

Address/data programming (preset) The status of each address/data pin can be individually preset to logic high, logic low, or floating. If a transmission enable signal is applied, the encoder scans and transmits the status of the 18 bits of address/data serially in the order A0 to AD17

27

Fig 2.3.1: Address/data programming (preset)

2.3.2 TRANSMISSION ENABLE: For the TE trigger type of encoders, transmission is enabled by applying a high signal to the TE pin. But for the Data trigger type of encoders, it is enabled by applying a high signal to one of the data pins D12~D17. Flowchart:

Fig 2.3.2: Flow chart for transmission enable

28

2.3.4 CIRCUIT: Transmission Circuit The data sent from the microcontroller is encoded and sent to RF transmitter. The data is transmitted on the antenna pin. Thus, this data should be received on the destination i.e, on RF receiver.

Fig 2.3.4:Demo transmission circuit

2.4

RF RECEIVER STR-433 MHz:

Fig 2.4: RF RECEIVER STR-433 MHz: The data is received by the RF receiver from the antenna pin and this data is available on the data pins. Two Data pins are provided in the receiver module. Thus, this data can be used

29

for further applications. Similarly, as the transmitter requires an encoder, the receiver module requires a decoder.

2.4.1 PIN DESCRIPTION:

Fig 2.4.1.(a): Pin description ANT Antenna input. GND Receiver Ground. Connect to ground plane. VCC (5V) VCC pins are electrically connected and provide operating voltage for the receiver. VCC can be applied to either or both. VCC should be bypassed with a .1F ceramic capacitor. Noise on the power supply will degrade receiver sensitivity. DATA Digital data output. This output is capable of driving one TTL or CMOS load. It is a CMOS compatible output.

30

Table 2.4: Pin description

Fig 2.4.1.(b): Module of RF receiver

31

2.5 DECODER

Fig 2.5: HT648L decoder

Working of decoder HT648L decoder is a part of 3^18 series of decoders. HT648L decoder is a series of CMOS LSIs for remote control system applications. They are paired with the 3^18 series of encoders. For proper operation, a pair of encoder/decoder pair with the same number of address and data format should be selected. The HT648L decoder receives serial address and data from that series of encoders that are transmitted by a carrier using an RF medium. A signal on the DIN pin then activates the oscillator which in turns decodes the incoming address and data. It then compares the serial input data twice continuously with its local address. If no errors or unmatched codes are encountered, the input data codes are decoded and then transferred to the output pins.
32

The VT pin also goes high to indicate a valid transmission. That will last until the address code is incorrect or no signal has been received. The 18 decoders are capable of decoding 18 bits of information that consists of N bits of address and 18N bits of data.

2.5.1 CIRCUIT: Reception circuit

Fig 2.5.1:DEMO CIRCUIT: Reception circuit

The data transmitted into the air is received by the receiver. The received data is taken from the data line of the receiver and is fed to the decoder .The output of decoder is given to microcontroller and then data is processed according to the applications. 2.6 LIQUID CRYSTAL DISPLAY: LCD stands for 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 and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep displaying the data. Ease of programming for characters and graphics.
33

These components are specialized for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.

Fig 2.6: LCD display

A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each . It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics. 2.6.1 LCD screen: LCD screen consists of two lines with 16 characters each. Each character consists of 5x7 dot matrix. Contrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have built in backlight (blue or green diodes). When used during operating, a resistor for current limitation should be used (like with any LE diode).

34

Fig 2.6.1: Module of LCD screen

2.7 KEYPAD: Keypads and LCDs are the most widely used input/output devices of the 8051 and a basic understanding of them is essential. The keypads are mainly three types: 4*3 keypad 4*4 keypad 4*8 keypad.

The keypad used in this project is 4*3 keypad.

Fig 2.7: Keypads

35

2.8 Working of the project:

The source information is generated by a key pad and this will be encrypted and is sent to destination through RF communication. The receiving system will check the data and decrypt according to a specific algorithm and displays on the LCD.

The RF modules used here are STT-433 MHz Transmitter, STR-433 MHz Receiver, HT640 RF Encoder and HT648 RF Decoder. RF Transmitter is connected to the different sensors through RF Encoder. This encoder converts the 8-bit data into a single bit and sends it to the transmitter which will be transmitting. The data which is in the air is an analog value. At the receiving end, the receiver receives this analog value on a single data line and passes this data to the decoder. The decoder does the opposite functioning of the encoder i.e., it converts the single bit data into eight bit data and gives it to the microcontroller which does the further processing.

36

CHAPTER-3

POWER SUPPLY DESIGN


3.1 POWER SUPPLY The power supply to the device is supplied via a 9v battery. A 5V 100 mA voltage regulator reduces the voltage to about 5 volts. Capacitors span both sides of the regulator to reduce circuit noise. A power supply that maintains the output voltage constant irrespective of AC mains fluctuations or load variations is known as regulated power supply.

230V, 50HZ

D.C Output

Step down transformer

Bridge Rectifier

Filter
Regulator

Fig 3.1.(a): Block diagram of Power supply

Fig 3.1.(b): Power Supply Circuit


37

Fig 3.1.(c):Module of Power Supply

3.1.1: Transformer

Fig 3.1.1: Architecture of Transformer

38

Usually DC voltages required for the operation of various electronic equipment is 6V, 9V or 12V. This voltage is quite small than the A.C. mains voltage. Therefore before rectification a step down transformer is employed to decrease the voltage to the required level.

3.1.2 Rectifier:

Fig 3.1.2: Rectifier Circuit Rectifier converts A.C. into pulsating D.C. the rectifier may be half wave or full wave. Mostly bridge type full wave rectifier is preferred because of its unchallenging merits.

3.1.3 Filter:

Fig 3.1.3: Filter Circuit It removes the ripples from the output of rectifier and smoothens the D.C. Output received from the filter is constant till the mains voltage and load is kept constant. However, if
39

either of the two is varied D.C. Voltage received at this point changes therefore a regulator is applied at the output stage.

3.1.4 VOLTAGE REGULATOR: As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels. The L78xx series of threeterminal positive regulators is available in TO-220, TO-220FP, TO-3, D2PAK and DPAK packages and several fixed output voltages, making it useful in a wide range of applications. These regulators can provide local on-card regulation, eliminating the distribution problems associated with single point regulation.

Each type employs internal current limiting, thermal shut-down and safe area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1 A output current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltage and currents.

Fig 3.1.4: Voltage regulator

40

CHAPTER 4

INTERFACING WITH MICRO CONTROLLER


4.1 LCD INTERFACING WITH THE MICROCONTROLLER:

P2.0 P2.1 P2.2

4 (RS) 5 (R/W) 6(EN)

1 2 3

Vcc

Gnd

LCD PRESET (CONTRAST CONTROL)

89S52

P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7

D0 D1 D2 D3 D4 D5 D6 D7

15 16 Vcc FOR BACKLIGHT PURPOSE

Fig 4.1: LCD interfacing with microcontroller LCD Connection Depending on how many lines are used for connection to the microcontroller, there are 8bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the process in a phase called initialization. In the first case, the data are transferred through outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for communication, while other may be left unconnected. Consequently, each data is sent to LCD in two steps: four higher bits are sent first (that normally would be sent through lines D4-D7), four lower bits are sent afterwards. With the help

41

of initialization, LCD will correctly connect and interpret each data received. Besides, with regards to the fact that data are rarely read from LCD (data mainly are transferred from microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to the Ground. Such saving has its price. Even though message displaying will be normally performed, it will not be possible to read from busy flag since it is not possible to read from display. 4.1.2 Pin Functions: There are pins along one side of the small printed board used for connection to the microcontroller. There are total of 14 pins marked with numbers (16 in case the background light is built in). Their function is described in the table below:

Function Ground Power supply Contrast

Pin Number 1 2 3 4

Name Vss Vdd Vee RS R/W

Logic State -

Control of operating

6 7 8 9 10 11 12 13 14

E D0 D1 D2 D3 D4 D5 D6 D7

Data / commands

Description 0V +5V 0 - Vdd D0 D7 are interpreted as 0 commands 1 D0 D7 are interpreted as data 0 Write data (from controller to LCD) 1 Read data (from LCD to controller) Access to LCD disabled 0 Normal operating 1 Data/commands are transferred to From 1 to 0 LCD 0/1 Bit 0 LSB 0/1 Bit 1 0/1 Bit 2 0/1 Bit 3 0/1 Bit 4 0/1 Bit 5 0/1 Bit 6 0/1 Bit 7 MSB

Table 4.1.2: Pin functions of LCD

42

Fig 4.1.2: Module of LCD interfacing with microcontroller

4.2 INTERFACING THE KEYPAD WITH MICROCONTOLLER At the lowest level, keyboards are organized in a matrix of rows and columns. The CPU accesses both rows and columns through ports. Therefore, with two 8-bit ports, an 8*8 matrix of keys can be connected to a microprocessor. When a key is pressed, a row and a column make a contact, otherwise there is no connection between rows and columns. A single microcontroller (consisting of a microprocessor, RAM, EPROM and several ports all on a single chip) takes care of hardware and software interfacing of the keypad. In such systems, it is the function of programs stored in EPROM of the microcontroller to scan the keys continuously, identify which one has been activated and present it to the motherboard. Scanning and identifying the key: The rows are connected to an output port and the columns are connected to an input port. If no key has been pressed, reading the input port will yield 1s for all columns since they are all connected to high (Vcc). If all the rows are grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the path to ground. It is the function of the microcontroller to scan the keypad continuously to detect and identify the key pressed.

43

Fig 4.2: 4*3 Matrix Keypad Connections to Ports Grounding rows and reading the columns: To detect a pressed key, the microcontroller grounds all rows by providing 0 (zero) to the output latch, then it reads the columns. If the data read from the columns is D2-D0 =111, no key has been pressed and the process continues until a key press is detected. However, if one of the column bits has a zero, this means that a key press has occurred i.e., for example, if D2D0=110, this means that a key in the D0 column has been pressed. After a key press is detected, the microcontroller will go through a process of identifying the key. Starting with the top row, the microcontroller grounds it by providing a low to row D0 only and then it reads the columns. If the data read is all 1s, no key in that row is activated and the process is moved to the next row. It grounds the next row, reads the columns and checks for any zero. This process continues until the row is identified. After identification of the row in which the key has been pressed, the next task is to find out which column the pressed key belongs to. Now this will be easy since the microcontroller knows at any time which row and column are being accessed.
44

CHAPTER 5

ADVANTAGES AND APPLICATIONS


5.1 ADVANTAGES: 1. Not line of sight 2. Not blocked by common materials: can penetrate most solids and pass through walls 3. Longer range 4. Not light sensitive 5. Not as sensitive to weather/environmental conditions 5.2 APPLICATIONS: 1) Industries are using RF solutions for monitoring, control, process, inventory tracking, data links and bar code reading devices.

2) Commercial wireless applications such as door announcers, security and access systems, gate control, remote activation, score board and paging systems.

3) Automotive companies employing RF for wireless remote control, remote keyless entry and safety applications.

4) Consumer products including electronic toys, home security, gate and garage door openers, Intercom, fire and safety systems, and irrigation controllers.

5) Medical products like patient call and monitoring, handicap assistance device, surgery 6) Communication system, remote patient data logging and ECG monitor.

45

CHAPTER-6

SOFTWARE TOOLS
6.1 KEIL SOFTWARE: Keil compiler is a software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports C language code. 6.1.1 STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL AND HOW TO COMPILE IT: 1. Install the Keil Software in the PC in any of the drives. 2. After installation, an icon will be created with the name Keil uVision3. Just drag this icon onto the desktop so that it becomes easy whenever you try to write programs in keil. 3. Double click on this icon to start the keil compiler. 4. A page opens with different options in it showing the project workspace at the leftmost corner side, output window in the bottom and an ash coloured space for the program to be written. 5. Now to start using the keil, click on the option project. 6. A small window opens showing the options like new project, import project, open project etc. Click on New project. 7. A small window with the title bar Create new project opens. The window asks the user to give the project name with which it should be created and the destination location. The project can be created in any of the drives available. You can create a new folder and then a new file or can create directly a new file. 8. After the file is saved in the given destination location, a window opens where a list of vendors will be displayed and you have to select the device for the target you have created. 9. The most widely used vendor is Atmel. So click on Atmel and now the family of microcontrollers manufactured by Atmel opens. You can select any one of the microcontrollers according to the requirement.
46

10. When you click on any one of the microcontrollers, the features of that particular microcontroller will be displayed on the right side of the page. The most appropriate microcontroller with which most of the projects can be implemented is the AT89C51. Click on this microcontroller and have a look at its features. Now click on OK to select this microcontroller. 11. A small window opens asking whether to copy the startup code into the file you have created just now. Just click on No to proceed further. 12. Now you can see the TARGET and SOURCE GROUP created in the project workspace. 13. Now click on File and in that New. A new page opens and you can start writing program in it. 14. After the program is completed, save it with any name but with the .asm extension. Save the program in the file you have created earlier. 15. You can notice that after you save the program, the predefined keywords will be highlighted in bold letters. 16. Now add this file to the target by giving a right click on the source group. A list of options open and in that select Add files to the source group. Check for this file where you have saved and add it. 17. Right click on the target and select the first option Options for target. A window opens with different options like device, target, output etc. First click on target. 18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the PC, just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use onchip ROM. This is because the program what we write here in the keil will later be dumped into the microcontroller and will be stored in the inbuilt ROM in the microcontroller. 19. Now click the option Output and give any name to the hex file to be created in the Name of executable text area and put a tick to the Create HEX file option present in the same window. The hex file can be created in any of the drives. You can change the folder by clicking on Select folder for Objects. 20. Now to check whether the program you have written is errorless or not, click on the icon exactly below the Open file icon which is nothing but Build Target icon. You can even use the shortcut key F7 to compile the program written.
47

21. To check for the output, there are several windows like serial window, memory window, project window etc. Depending on the program you have written, select the appropriate window to see the output by entering into debug mode. 22. The icon with the letter d indicates the debug mode. 23. Click on this icon and now click on the option View and select the appropriate window to check for the output. 24. After this is done, click the icon debug again to come out of the debug mode. 25. The hex file created as shown earlier will be dumped into the microcontroller with the help of another software called Proload.

6.2

PROLOAD: Proload is a software which accepts only hex files. Once the machine code is converted

into hex code, that hex code has to be dumped into the microcontroller placed in the programmer kit and this is done by the Proload. Programmer kit contains a microcontroller on it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller which is to be programmed. As this programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply, a source is required. Thus this is accomplished from the power supply board with an output of 12volts or from an adapter connected to 230 V AC.

6.2.1 STEPS TO WRITE PROGRAM ON PROLOAD: 1. Install the Proload Software in the PC. 2. Now connect the Programmer kit to the PC (CPU) through serial cable. 3. Power up the programmer kit from the ac supply through adapter. 4. Now place the microcontroller in the GIF socket provided in the programmer kit. 5. Click on the Proload icon in the PC. A window appears providing the information like Hardware model, com port, device type, Flash size etc. Click on browse option to select

48

the hex file to be dumped into the microcontroller and then click on Auto program to program the microcontroller with that particular hex file. 6. The status of the microcontroller can be seen in the small status window in the bottom of the page. After this process is completed, remove the microcontroller from the programmer kit and place it in your system board. Now the system board behaves according to the program written in the microcontroller.

49

CHAPTER 7

SOURCE CODE
7.1 Transmitter section program:

#include<reg51.h> #include<lcd.h> sbit sbit sbit sbit sbit sbit sbit sbit bit bit bit bit key7_0 key6_0 key5_0 key4_0 key3_0 key2_0 key1_0 key0_0 bank1; bank2; bank3; bank4; =P0^0; =P0^1; =P0^2; =P0^3; =P0^4; =P0^5; =P0^6; =P0^7;

sbit key7 =P2^0; sbit key6 sbit key5 =P2^2; sbit key4 sbit key3 =P2^4; sbit key2 sbit key1 =P2^6; sbit key0 sbit d0 =P3^0; sbit d1 =P3^1; sbit d2 sbit d3 sbit d4 bit bit bit bit bit bit bit bit bit bit9; bit bit10; bit bit11; bit bit12; data r0; data r1; data r2=0; void timer_0_load(); RELOAD FUCTION*/

=P2^1; =P2^3; =P2^5; =P2^7;

=P3^2; =P3^3; =P3^4; bit1; bit2; bit3; bit4; bit5; bit6; bit7; bit8;

/* TIMER0 ENABLE AND

50

void input_scaning(); /* INPUT SCANING FUCTION*/ void output_enable(); void control_key(); /* EXTERNAL OUTPUT FEXED KEY FUCTION*/ void start_data(); void key_pad(); void delay(); /********************************************************************** / TIMER0 INTERRUPT AREA **********************************************************************/ void timet0(void) interrupt 1 using 2 {

input_scaning(); timer_0_load(); RELOAD CALL */ output_enable(); control_key(); CALL*/

/* INPUT SCANING CALL */ /* TIMER TIMER0 /* OUTPUT ENABLE CALL*/ /* CONTROL KEY

/********************************************************************** / MAIN SUBPROGRAM **********************************************************************/ void main() { lcd_init(); start_data(); timer_0_load(); while(1) { if(r0==0x90) { r0=0xC0; } /* TIMER0 LOAD*/ /* INFINAT LOOP*/

51

/******************************************************************************** * * TIMER0 RELOAD SUB PROGRAM * ********************************************************************************/ void timer_0_load(void)

{ TR0= 0; TMOD=0X21; /*ENABLE TR0 TIMER AND TR1 AT AUTO RELOAD MODE*/ TH0=0X0EC; /*ENABLE 1ms INERRUPT*/ TL0=0X78; TH1=0X0FA; SCON=0X50; TR1=1; TR0=1; /* TIMER0 START*/ ET0=1; /* INTERRUPT ENABLE*/ EA=1; /* ALL INTERRUPT ENABLE*/ }

/***********************************************************/ void start_data() { bank1=1; bank2=0; bank3=0; bank4=0; r0=0x80; r1=0x00; bit1=1; }

52

/********************************************************************************* * * INPUTS SCANING SUB PROGRAM * *********************************************************************************/

void input_scaning ()

{ key_pad(); } /************************************************************************ * * OUTPUT ENABLE SUB PROG * ************************************************************************/

void output_enable() {

r1++; if(r1==100) { r1=0x00; bit1=1; }

} /******************************************************************** / Control_key used by external control signals ********************************************************************/

void control_key() { } /*************************************************************************/

53

void key_pad() { lcd_init1(); if(bit1==1) { if(bank1==1) { key7 = 1; key6 = 1; key1 = 1; key0 = 0; key7_0 = 1; key6_0 = 1; key1_0 = 1; key0_0 = 0; if(key2==0) { d0=1; d1=0; d2=0; d3=0; d4=0; send_command(r0); send_data('Y'); bit1=0; r1=0x00; r0++; } if(key3==0) { d0=0; d1=1; d2=0; d3=0; d4=0; send_command(r0); send_data('Z'); r0++; bit1=0; r1=0x00; } if(key4==0) { d0=1; d1=1; d2=0; d3=0; d4=0; send_command(r0); send_data('0'); 54

r0++; bit1=0; r1=0x00; } if(key5==0) { d0=0; d1=0; d2=1; d3=0; d4=0; send_command(r0); send_data('1'); r0++; bit1=0; r1=0x00; }

if(key2_0==0) { d0=1; d1=0; d2=1; d3=0; d4=0; send_command(r0); send_data('2'); r0++; bit1=0; r1=0x00; } if(key3_0==0) { d0=0; d1=1; d2=1; d3=0; d4=0;

bit1=0; r1=0x00; } if(key4_0==0) { d0=1; d1=1; d2=1; d3=0; d4=0; 55

bit1=0; r1=0x00; } if(key5_0==0) { d0=0; d1=0; d2=0; d3=1; d4=0; r0++; send_command(r0);

bit1=0; r1=0x00; } bank1=0; bank2=1; } if(bank2==1) { key7 = 1; key6 = 1; key0 = 1; key1 = 0; key7_0 = 1; key6_0 = 1; key0_0 = 1; key1_0 = 0; if(key2==0) { d0=1; d1=0; d2=0; d3=1; d4=0; send_command(r0); send_data('Q'); r0++; bit1=0; r1=0x00; } if(key3==0) { d0=0; d1=1; d2=0; 56

d3=1; d4=0; send_command(r0); send_data('R'); r0++; bit1=0; r1=0x00; } if(key4==0) { d0=1; d1=1; d2=0; d3=1; d4=0; send_command(r0); send_data('S'); r0++; bit1=0; r1=0x00; } if(key5==0) { d0=0; d1=0; d2=1; d3=1; d4=0; send_command(r0); send_data('T'); r0++; bit1=0; r1=0x00; }

if(key2_0==0) { d0=1; d1=0; d2=1; d3=1; d4=0; send_command(r0); send_data('U'); r0++; bit1=0; r1=0x00; } if(key3_0==0) { 57

d0=0; d1=1; d2=1; d3=1; d4=0; send_command(r0); send_data('V'); r0++; bit1=0; r1=0x00; } if(key4_0==0) { d0=1; d1=1; d2=1; d3=1; d4=0; send_command(r0); send_data('W'); r0++; bit1=0; r1=0x00; } if(key5_0==0) { d0=0; d1=0; d2=0; d3=0; d4=1; send_command(r0); send_data('X'); r0++; bit1=0; r1=0x00; }

bank2=0; bank3=1; } if(bank3==1) { key7 = 1; 58

key1 = 1; key0 = 1; key6 = 0; key7_0 = 1; key1_0 = 1; key0_0 = 1; key6_0 = 0; if(key2==0) { d0=1; d1=0; d2=0; d3=0; d4=1; send_command(r0); send_data('I'); r0++; bit1=0; r1=0x00; } if(key3==0) { d0=0; d1=1; d2=0; d3=0; d4=1; send_command(r0); send_data('J'); r0++; bit1=0; r1=0x00; } if(key4==0) { d0=1; d1=1; d2=0; d3=0; d4=1; send_command(r0); send_data('K'); r0++; bit1=0; r1=0x00; } if(key5==0) { d0=0; d1=0; d2=1; 59

d3=0; d4=1; send_command(r0); send_data('L'); r0++; bit1=0; r1=0x00; }

if(key2_0==0) { d0=1; d1=0; d2=1; d3=0; d4=1; send_command(r0); send_data('M'); r0++; bit1=0; r1=0x00; } if(key3_0==0) { d0=0; d1=1; d2=1; d3=0; d4=1; send_command(r0); send_data('N'); r0++; bit1=0; r1=0x00; } if(key4_0==0) { d0=1; d1=1; d2=1; d3=0; d4=1; send_command(r0); send_data('O'); r0++; bit1=0; r1=0x00; } if(key5_0==0) { d0=0; d1=0; 60

d2=0; d3=1; d4=1; send_command(r0); send_data('P'); r0++; bit1=0; r1=0x00; } bank3=0; bank4=1; } if(bank4==1) {

key6 = 1; key1 = 1; key0 = 1; key7 = 0; key6_0 = 1; key1_0 = 1; key0_0 = 1; key7_0 = 0; if(key2==0) { d0=1; d1=0; d2=0; d3=1; d4=1; send_command(r0); send_data('A'); r0++; bit1=0; r1=0x00; } if(key3==0) { d0=0; d1=1; d2=0; d3=1; d4=1; send_command(r0); send_data('B'); r0++; bit1=0; r1=0x00; 61

} if(key4==0) { d0=1; d1=1; d2=0; d3=1; d4=1; send_command(r0); send_data('C'); r0++; bit1=0; r1=0x00; } if(key5==0) { d0=0; d1=0; d2=1; d3=1; d4=1; send_command(r0); send_data('D'); r0++; bit1=0; r1=0x00;

} if(key2_0==0) { d0=1; d1=0; d2=1; d3=1; d4=1; send_command(r0); send_data('E'); r0++; bit1=0; r1=0x00; } if(key3_0==0) { d0=0; d1=1; d2=1; d3=1; d4=1; send_command(r0); 62

send_data('F'); r0++; bit1=0; r1=0x00; } if(key4_0==0) { d0=1; d1=1; d2=1; d3=1; d4=1; send_command(r0); send_data('G'); r0++; bit1=0; r1=0x00; } if(key5_0==0) { d0=0; d1=0; d2=0; d3=0; d4=0; send_command(r0); send_data('H'); r0++; bit1=0; r1=0x00; } bank4=0; bank1=1; } } }

/*********************/ void delay() { int j; for(j=0;j<25;j++) { } }

63

7.2 Receiver section program:


#include<reg51.h> #include"lcd.h" sbit sbit sbit sbit sbit sbit sbit sbit sbit bit bit bit bit input20 key6_0 key5_0 key4_0 key3_0 res tem fire data0 =P3^0; =P0^1; =P0^2; =P0^3; =P0^4; =P3^1; =P0^6; =P0^7; =P2; bank1; bank2; bank3; bank4;

bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit

bit1=1; bit2=1; bit3=1; bit4=1; bit5=1; bit6=1; bit7=1; bit8=1; bit9=1; bit10=1; bit11=1; bit12=1; bit13=1; bit14=1; bit15=1; bit16=1; bit17=1; bit18=1; bit19=1; bit20=1; bit21=1; bit22=1; bit23=1; bit24=1; bit25=1; bit26=1; bit27=1; bit28=1; bit29=1; bit30=1; bit31=1; bit32=1; bit33=1; bit34=1;

64

bit

bit40=1;

/********************/ bit bit bit bit bit bit bit bit bit bit9z=1; bit bit10z=1; bit bit11z=1; bit bit12z=1; bit bit bit bit bit bit00=1; bit bit000=1; bit bit0000=1;

bit1z=0; bit2z=1; bit3z=1; bit4z=1; bit5z=1; bit6z=1; bit7z=1; bit8z=1;

bit13z=1; bit14z=1; bit15z=1; bit16z=1;

data data data

r0; r1; r2=0; /* TIMER0 ENABLE AND /* INPUT SCANING

void timer_0_load(); RELOAD FUCTION*/ void input_scaning(); FUCTION*/ void output_enable(); void control_key(); FEXED KEY FUCTION*/ void start_data(); void output(); void delay(); void output1(); void save(); int a=0,a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0; int a9=0,a10=0,a11=0,a12=0,a13=0,a14=0,a15=0; int b=' ',b1=' ',b2=' ',b3=' ',b4=' ',b5=' ',b6=' ',b7=' ',b8=' '; int b9=' ',b10=' ',b11=' ',b12=' ',b13=' ',b14=' ',b15=' '; int d=0;

/* EXTERNAL OUTPUT

/********************************************************************** / TIMER0 INTERRUPT AREA **********************************************************************/

65

void timet0(void) interrupt 1 using 2 {

lcd_init1(); timer_0_load(); RELOAD CALL */ output_enable(); control_key(); CALL*/ /* INPUT SCANING CALL */ /* TIMER TIMER0 /* OUTPUT ENABLE CALL*/ /* CONTROL KEY

/********************************************************************** / MAIN SUBPROGRAM **********************************************************************/ void main() { lcd_init(); start_data(); timer_0_load(); while(1) { if(r0==0x90) { r0=0xC0; bit0000=1; } /* TIMER0 LOAD*/ /* INFINAT LOOP*/

if(input20==0) { output1(); } delay(); delay(); if(bit0000==1) { if(r0==0x8f) { output1(); bit0000=0; }

66

if(input20==1) { bit000=1; }

input_scaning(); delay(); output(); }

/******************************************************************************** * * TIMER0 RELOAD SUB PROGRAM * ********************************************************************************/ void timer_0_load(void)

{ TR0= 0; TMOD=0X21; /*ENABLE TR0 TIMER AND TR1 AT AUTO RELOAD MODE*/ TH0=0X0EC; /*ENABLE 1ms INERRUPT*/ TL0=0X78; TH1=0X0FA; SCON=0X50; TR1=1; TR0=1; /* TIMER0 START*/ ET0=1; /* INTERRUPT ENABLE*/ EA=1; /* ALL INTERRUPT ENABLE*/ }

/***********************************************************/ void start_data() { bank1=1; 67

bank2=0; bank3=0; bank4=0; r0=0x80; r1=0x00; bit1=1; }

/********************************************************************************* * * INPUTS SCANING SUB PROGRAM * *********************************************************************************/

void input_scaning ()

{ delay();

if(P1==0x19) { bit25=0; } delay();

if(P1==0x1a) { bit26=0; } delay(); if(P1==0x1b) {

68

bit27=0; } delay(); if(bit40==0) { if(P1==0X00) { bit32=0; }} if(P1==0x1c) { bit28=0; } delay(); if(P1==0x1d) { bit29=0; } delay(); if(P1==0x1e) { bit30=0; }

delay(); if(P1==0x11) { bit17=0; } delay(); if(P1==0x12) { bit18=0; } delay(); if(P1==0x13) { 69

bit19=0; } delay(); if(P1==0x14) { bit20=0; } delay(); if(P1==0x15) { bit21=0; } delay(); if(P1==0x16) { bit22=0; } delay(); if(P1==0x17) { bit23=0; } delay(); if(P1==0x18) { bit24=0; } delay(); if(P1==0x09) { bit9=0; } delay(); if(P1==0x0a) { bit10=0; } delay(); 70

if(P1==0x0b) { bit11=0; } delay();

if(P1==0x0c) { bit12=0; } delay(); if(P1==0x0d) { bit13=0; } delay(); if(P1==0x0e) { bit14=0; } delay();

if(P1==0x0f) { bit15=0; } delay(); if(P1==0x10) { bit16=0; } delay(); if(P1==0x01) { bit1=0; } delay(); if(P1==0x02) { bit2=0; 71

} delay(); if(P1==0x03) { bit3=0; } delay(); if(P1==0x04) { bit4=0; } delay(); if(P1==0x05) { bit5=0; } delay(); if(P1==0x06) {

} delay();

if(P1==0x07) { bit34=0; } delay(); if(P1==0x08) { bit8=0; } delay(); if(bit40==0) { if(P1==0x1f) { bit31=0; }} delay(); if(P1==0x0FE) 72

{ tem = 0; } delay(); if(P1==0x0FD) { fire = 0; } delay(); if(res==0) { } delay();

} /************************************************************************ * * OUTPUT ENABLE SUB PROG * ************************************************************************/

void output_enable() {

r1++; if(r1==100) { r1=0x00; bit1=1; }

} /******************************************************************** / Control_key used by external control signals ********************************************************************/

void control_key() { } 73

/*************************************************************************/

void output() {

if(bit34==0) { bit33=0; bit34=1; bit40=0; if(bit1==0) { a=r0; d='Y'; save(); send_command(r0); send_data('1'); bit1=1; r1=0x00; r0++; } if(bit2==0) { a=r0; d='Z'; save(); send_command(r0); send_data('2'); r0++; bit2=1; r1=0x00; } if(bit3==0) { a=r0; d='0'; save(); send_command(r0); send_data('3'); r0++; bit3=1; r1=0x00; } if(bit4==0) { a=r0; d='1'; save();

74

send_command(r0); send_data('4'); r0++; bit4=1; r1=0x00; }

if(bit5==0) { a=r0; d='2'; save(); send_command(r0); send_data('5'); r0++; bit5=1; r1=0x00; } if(bit6==0) { a=r0; d=' '; save(); send_command(r0); send_data('6'); bit6=1; r1=0x00; } if(bit7==0) { a=r0; d=' '; save(); r0--; send_command(r0); bit7=1; r1=0x00; } if(bit8==0) { a=r0; d=' '; save(); r0++; send_command(r0); bit8=1;

r1=0x00; } 75

/***********************************/

if(bit9==0) {a=r0; d='Q'; save(); send_command(r0); send_data('8'); r0++; bit9=1; r1=0x00; } if(bit10==0) { a=r0; d='R'; save(); send_command(r0); send_data('9'); r0++; bit10=1; r1=0x00; } if(bit11==0) { a=r0; d='S'; save(); send_command(r0); send_data('Q'); r0++; bit11=1; r1=0x00; } if(bit12==0) { a=r0; d='T'; save(); send_command(r0); send_data('W'); r0++; bit12=1; r1=0x00; }

76

if(bit13==0) {a=r0; d='U'; save(); bit13=1; send_command(r0); send_data('E'); r0++; r1=0x00; } if(bit14==0) { a=r0; d='V'; save(); bit14=1; send_command(r0); send_data('R'); r0++; r1=0x00; } if(bit15==0) { a=r0; d='W'; save(); bit15=1; send_command(r0); send_data('T'); r0++; r1=0x00; } if(bit16==0) { a=r0; d='X'; save(); bit16=1; send_command(r0); send_data('U'); r0++; r1=0x00; }

77

/**********************************/ if(bit17==0) { a=r0; d='I'; save(); send_command(r0); send_data('P'); r0++; bit17=1; r1=0x00; } if(bit18==0) { a=r0; d='J'; save(); send_command(r0); send_data('A'); r0++; bit18=1; r1=0x00; } if(bit19==0) { a=r0; d='K'; save(); send_command(r0); send_data('S'); r0++; bit19=1; r1=0x00; } if(bit20==0) { a=r0; d='L'; save(); send_command(r0); send_data('D'); r0++; bit20=1; r1=0x00; }

78

if(bit21==0) { a=r0; d='M'; save(); send_command(r0); send_data('F'); r0++; bit21=1; r1=0x00; } if(bit22==0) { a=r0; d='N'; save(); send_command(r0); send_data('G'); r0++; bit22=1; r1=0x00; } if(bit23==0) { a=r0; d='O'; save(); send_command(r0); send_data('H'); r0++; bit23=1; r1=0x00; } if(bit24==0) { a=r0; d='P'; save(); send_command(r0); send_data('J'); r0++; bit24=1; r1=0x00; }

/***********************************/

79

if(bit25==0) { a=r0; d='A'; save(); send_command(r0); send_data('X'); r0++; bit25=1; r1=0x00; } if(bit26==0) { a=r0; d='B'; save(); send_command(r0); send_data('C'); r0++; bit26=1; r1=0x00; } if(bit27==0) { a=r0; d='C'; save();

send_command(r0); send_data('N'); r0++; bit27=1; r1=0x00; } if(bit28==0) { a=r0; d='D'; save();

send_command(r0); send_data('M'); r0++; bit28=1; r1=0x00;

} if(bit29==0) { 80

a=r0; d='E'; save();

send_command(r0); send_data('G'); r0++; bit29=1; r1=0x00; } if(bit30==0) { a=r0; d='F'; save();

send_command(r0); send_data('O'); r0++; bit30=1; r1=0x00; } if(bit31==0) { a=r0; d='G'; save(); send_command(r0); send_data('E'); r0++; bit31=1; r1=0x00; } if(bit32==0) { a=r0; d='H'; save(); send_command(r0); send_data('Q'); r0++; bit32=1; r1=0x00; } } }

81

/****************************/ void output1() { if(bit000==1) { lcd_init1(); send_command(a1); delay(); send_data(b1); delay(); send_command(a2); delay(); send_data(b2); delay(); send_command(a3); delay(); send_data(b3); delay(); send_command(a4); delay(); send_data(b4); delay(); send_command(a5); delay(); send_data(b5); delay(); send_command(a6); delay(); send_data(b6); delay(); send_command(a7); delay(); send_data(b7); delay(); send_command(a8); delay(); send_data(b8); delay(); send_command(a9); delay(); send_data(b9); delay(); send_command(a10); delay(); send_data(b10); delay(); send_command(a11); delay(); send_data(b11); 82

delay(); send_command(a12); delay(); send_data(b12); delay(); send_command(a13); delay(); send_data(b13); delay(); send_command(a14); delay(); send_data(b14); delay(); send_command(a15); delay(); send_data(b15);

/*************/ bit1z=0; bit2z=1; bit3z=1; bit4z=1; bit5z=1; bit6z=1; bit7z=1; bit8z=1; bit9z=1; bit10z=1; bit11z=1; bit12z=1; bit13z=1; bit14z=1; bit15z=1; bit16z=1; a=0,a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a7=0,a8=0; a9=0,a10=0,a11=0,a12=0,a13=0,a14=0,a15=0; b=' ',b1=' ',b2=' ',b3=' ',b4=' ',b5=' ',b6=' ',b7=' ',b8=' '; b9=' ',b10=' ',b11=' ',b12=' ',b13=' ',b14=' ',b15=' '; d=0; bit000=0; }

} /*******************************/ void delay() { int j; for(j=0;j<10;j++) { 83

} }

/************************************/

void save() { bit00=0; start: if(bit00==0) { if(bit1z==0) { a1=a; b1=d; bit1z=1; bit2z=0; bit00=1; goto start; }

if(bit2z==0) { a2=a; b2=d; bit2z=1; bit3z=0; bit00=1; goto start; } if(bit3z==0) { a3=a; b3=d; bit3z=1; bit4z=0; bit00=1; goto start; } if(bit4z==0) { a4=a; b4=d; bit4z=1; bit5z=0; 84

bit00=1; goto start; } if(bit5z==0) { a5=a; b5=d; bit5z=1; bit6z=0; bit00=1; goto start; } if(bit6z==0) { a6=a; b6=d; bit6z=1; bit7z=0; bit00=1; goto start; } if(bit7z==0) { a7=a; b7=d; bit7z=1; bit8z=0; bit00=1; goto start; } if(bit8z==0) { a8=a; b8=d; bit8z=1; bit9z=0; bit00=1; goto start; } if(bit9z==0) { a9=a; b9=d; bit9z=1; bit10z=0; bit00=1; goto start; } if(bit10z==0) 85

{ a10=a; b10=d; bit10z=1; bit11z=0; bit00=1; goto start; } if(bit11z==0) { a11=a; b11=d; bit11z=1; bit12z=0; bit00=1; goto start; } if(bit12z==0) { a12=a; b12=d; bit12z=1; bit13z=0; bit00=1; goto start; } if(bit13z==0) { a13=a; b13=d; bit13z=1; bit14z=0; bit00=1; goto start; } if(bit14z==0) { a14=a; b14=d; bit14z=1; bit15z=0; bit00=1; goto start; } if(bit15z==0) { a15=a; b15=d; bit15z=1; bit16z=0; bit00=1; 86

goto start; }

87

CONCLUSION: Hence by this we can say that it is provided with a effective security for data communication by designing standard algorithm for encryption and decryption.

Scope of the Project :


The focus of this reserch will be on the advancement in digital communication and also in mobile communications. The Project will be concentrating on the Personal Digital Assistants and the palmtops which can be used to access multimedia services over the Internet.

88

APPENDIX:
Technical specifications of the project:

Title of the project

Wireless Data Encryption & Decryption for secured Communication using RF

Domain Software Microcontroller Power Supply Transmitter Display Receiver Display Input Source Crystal Communication Device Applications

: : : : : : : : : :

Embedded Systems Design Embedded C, Keil, Proload AT89S52 +5V, 500mA Regulated Power Supply LED 5mm, 16 X 2 LCD LED 5mm, 16 X 2 LCD Key Pad 11.0592MHz RF Module Mobile communication, Wireless Communication

89

REFERENCE: www.howstuffworks.com EMBEDDED SYSTEM BY RAJ KAMAL 8051 MICROCONTROLLER AND EMBEDDED SYSTEMS BY MAZZIDI Magazines: Electronics for you Electrikindia

90

Anda mungkin juga menyukai