wireless chatting system using rf communication

78
CONTENTS: Pg.No CHAPTER 1: ABSTRACT CHAPTER 2: BLOCK DIAGRAM CHAPTER 3: INTRODUCTION TO EMBEDDED SYSTEMS CHAPTER 4: MICROCONTROLLER VS MICROPROCESSOR CHAPTER 5: INTRODUCTION TO PIC MICROCONTROLLER CHAPTER 6: PIC 18F258 A) PIN DIAGRAM B) PIN DESCRIPTION C) ARCHITECTURE D) FEATURES E) MEMORY ORGANIZATION CHAPTER 7: RF COMMNICATION A) RF TRANSMITTER B) RF RECEIVER C) ENCODER D) DECODER CHAPTER 8: KEYPAD CHAPTER 9: ENCRYPTION AND DECRYPTION CHAPTER 10: LCD CHAPTER 11: POWER SUPLY CHAPTER 12: CONCLUSION CHAPTER 13: SOFTWARE A) OVERVIEW OF COMPILER AND KEIL IDE CHAPTER 14: ADVANTAGES CHAPTER 15: BIBLIOGRAPHY

Upload: hareesh-thantanapally

Post on 04-Apr-2015

1.262 views

Category:

Documents


14 download

TRANSCRIPT

Page 1: Wireless Chatting System Using Rf Communication

CONTENTS: Pg.No

CHAPTER 1: ABSTRACT

CHAPTER 2: BLOCK DIAGRAM

CHAPTER 3: INTRODUCTION TO EMBEDDED SYSTEMS

CHAPTER 4: MICROCONTROLLER VS MICROPROCESSOR

CHAPTER 5: INTRODUCTION TO PIC MICROCONTROLLER

CHAPTER 6: PIC 18F258

A) PIN DIAGRAM

B) PIN DESCRIPTION

C) ARCHITECTURE

D) FEATURES

E) MEMORY ORGANIZATION

CHAPTER 7: RF COMMNICATION

A) RF TRANSMITTER

B) RF RECEIVER

C) ENCODER

D) DECODER

CHAPTER 8: KEYPAD

CHAPTER 9: ENCRYPTION AND DECRYPTION

CHAPTER 10: LCD

CHAPTER 11: POWER SUPLY

CHAPTER 12: CONCLUSION

CHAPTER 13: SOFTWARE

A) OVERVIEW OF COMPILER AND KEIL IDE

CHAPTER 14: ADVANTAGES

CHAPTER 15: BIBLIOGRAPHY

Page 2: Wireless Chatting System Using Rf Communication

CHAPTER 1: 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 key for encryption and decryption.

The source information is generated by a keypad 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 key 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 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 output of secondary of 230/12V step down transformer.

Page 3: Wireless Chatting System Using Rf Communication

CHAPTER 2: BLOCK DIAGRAM

TRANSMITTER:

RECEIVER:

Power Supply

RF Encoder RF Transmitter

Micro Controller

Keypad (4*3)

Micro Controller

RF Decode

r

RF Receiver

Power Supply

LCD DISPLAY

Page 4: Wireless Chatting System Using Rf Communication

CHAPTER 3: 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 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.

Page 5: Wireless Chatting System Using Rf Communication

Examples of embedded systems are:

Calculators Laser Printer Security Systems Musical Instruments Medical Equipments Automatic Teller Machines (ATMs) Cellular telephones and telephone switches Inertial guidance systems for aircraft and missiles Computer peripherals such as routers and printers engine controllers and antilock brake controllers for automobiles

Page 6: Wireless Chatting System Using Rf Communication

CHAPTER 4: MICROCONTROLLER VS MICROPROCESSOR

Essentially these two devices are similar, but with a little bit of difference. A CPU

which is the heart of these devices needs a host of external devices to make it communicate with

real-world. A typical system would need a system to read the inputs from keyboard, and write

outputs to a terminal, store intermediate processing data into some memory, and to keep

permanent information into some safe place. These devices which are independent circuits, work

in harmony with the CPU, to make one system. In a typical Personal Computer these devices are

attached to the CPU, using hard-wired connections.

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.

Page 7: Wireless Chatting System Using Rf Communication

The Intel 8051 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 8051-

compatible processor cores that are manufactured by more than 20 independent manufacturers

including Atmel, Infineon Technologies and Maxim Integrated Products.

This makes the system more flexible ,that means you can add more memory, change

capacity of hard drives, add or remove CD-ROMs, sound cards etc. A microcontroller on the

other hand is made up of most of these devices built exactly within the same package. Your

microcontroller will therefore contain, the CPU, RAM, ROM, Timers, I/O etc. all packed within

one integrated circuit. This facilitates the development process, as well as reduce the

requirements of external components, however this also means you cannot change, the number

and type of integrated devices. The applications where a microcontroller will be used, vary. They

are usually quite simple, and do not require as much processing power as a PC does, so the

microcontrollers with varying amounts of RAM, ROM, I/O lines and timers etc have been made

available. Essentially all are almost same, and they only vary in the number of resources

available on them. So for a particular application you chose a microcontroller, not the one which

has maximum resources, but the one which has just enough to do the job. Thus a microcontroller

is a complete, small scale computer with all the necessary devices on-board. All you

need is the external hardware, which you want to drive, like sensors and motors etc.

Page 8: Wireless Chatting System Using Rf Communication

INTERNAL ARCHITECTURE

All upgraded microcontrollers use one of two basic design models called Harvard and von-

Neumann architecture. What is it about? Briefly, it is about two different ways of data exchange

between CPU and memory.

VON-NEUMANN ARCHITECTURE

Microcontrollers using this architecture have only one memory block and one 8-bit data bus. As

all data are exchanged by using these 8 lines, this bus is overloaded and communication itself is

very slow and inefficient. The CPU can either read an instruction or read/write data from/to the

memory. Both cannot occur at the same time since the instructions and data use the same bus

system.

For example, if some program line says that RAM memory register called “SUM” should be

incremented by one (instruction: incf SUM), the microcontroller will do the following:

1. Read the part of the program instruction specifying WHAT should be done (in this very case it

is the “incf” instruction for increment).

2. Read further the same instruction specifying upon WHICH data it should be performed (in this

very case it is the “SUM” register).

Page 9: Wireless Chatting System Using Rf Communication

3. After being incremented, the contents of this register should be written to the register from

which it was read (“SUM” register address). The same data bus is used for all these intermediate

operations.

HARVARD ARCHITECTUREMicrocontrollers using this architecture have two different data buses. One is 8-bit wide

and connects CPU to RAM memory. Another one consists of several lines (12, 14 or 16) and

connects CPU to ROM memory. Accordingly, the CPU can read an instruction and perform a

data memory access at the same time. Since all RAM memory registers are 8- bit wide, all data

within the microcontroller are exchanged in the same such format. Additionally, during program

writing, only 8-bit data are considered. In other words, all you can ever change from within the

program and all you can affect will be 8- bit wide. A program written for some of these

microcontrollers will be stored in the microcontroller

internal ROM memory upon having being compiled into machine language. However, these

memory locations do not have 8, but 12, 14 or 16 bits. The rest of bits- 4, 6 or 8- represents the

instruction itself specifying to CPU what to do with an 8-bit data.

Page 10: Wireless Chatting System Using Rf Communication

The advantages of such design are the following:

All data in a program are one byte (8 bit) wide. As data bus used for program reading has several

lines (12, 14 or 16), both instruction and data can be read simultaneously by using these spare

bits (it is familiar at once WHAT and upon WHICH). Because of that, all instructions are

executed in only one instruction cycle. The only exception is jump instructions which are

executed in two cycles.

Owing to the fact that a program (ROM memory) and temporary data (RAM memory) are

separate, the CPU can execute two instructions simultaneously. Simply, while RAM memory

read or write is in progress (end of one instruction), the next program instruction is being read

via another bus. When using microcontrollers with von-Neumann architecture one never knows

how much memory is to be occupied by some program. In average, each program instruction

occupies two memory locations (one contains information on WHAT should be done, whereas

another contains information upon WHICH data it should be done). However, it is not a rule, but

the most common case. In microcontrollers with Harvard architecture, program bus is wider than

one byte, which allows each program word to consist of instruction and data. In other words: one

program word- one instruction.

INSTRUCTION SET

All instructions that can be understood by the microcontroller are known as instruction

set. When you write a program in assembly language, you actually “tell a story” by specifying

instructions in order they should be executed. The main restriction in this process is a number of

available instructions. The manufacturers stick to one of the two following strategies:

Page 11: Wireless Chatting System Using Rf Communication

RISC (Reduced Instruction Set Computer)

In this case, the idea is that the microcontroller recognizes and executes only basic

operations (addition, subtraction, copying etc.). All other more complicated operations are

performed by combining these (for example, multiplication is performed by performing

successive addition). The constrains are obvious (as if you try, by using only a few words, to

explain to someone how to reach the airport in some other city). However, there are also some

great advantages. First of all, this language is easy to learn. Besides, the microcontroller is very

fast so that it is not possible to see all the arithmetic “acrobatics” it performs. The user can only

see the final result of all those operations. At last, it is not so difficult to explain where the airport

is if you use the right words. For example: left, right, kilometer etc.

CISC (Complex Instruction Set Computer)

You already catch it- CISC is the opposite of RISC! Microcontrollers designed to

recognize more than 200 different instructions can do really much and are very fast. However,

one should know how to take all that such a rich language offers, which is not easy at all.

Page 12: Wireless Chatting System Using Rf Communication

CHAPTER 5: PIC INTRODUCTION

PIC stands for Peripheral Interface Controller given by Microchip Technology to

identify its single-chip microcontrollers. These devices have been very successful in 8-bit

microcontrollers. The main reason is that Microchip Technology has continuously upgraded the

device architecture and added needed peripherals to the microcontroller to suit customers'

requirements. The development tools such as assembler and simulator are freely available on the

internet at www.microchip.com .

The architectures of various PIC microcontrollers can be divided as follows.

Low - end PIC Architectures:

Microchip PIC microcontrollers are available in various types. When PIC microcontroller MCU

was first available from General Instruments in early 1980's, the microcontroller consisted of a

simple processor executing 12-bit wide instructions with basic I/O functions. These devices are

known as low-end architectures. They have limited program memory and are meant for

applications requiring simple interface functions and small program & data memories. Some of

the low-end device numbers are

12C5XX

16C5X

16C505

Mid range PIC Architectures:

Mid range PIC architectures are built by upgrading low-end architectures with more number of

peripherals, more number of registers and more data/program memory. Some of the mid-range

devices are

Page 13: Wireless Chatting System Using Rf Communication

16C6X

16C7X

16F87X

Program memory type is indicated by an alphabet.

C = EPROM

F = Flash

RC = Mask ROM

Popularity of the PIC microcontrollers is due to the following factors.

1. Speed: Harvard Architecture, RISC architecture, 1 instruction cycle = 4 clock cycles.

2. Instruction set simplicity: The instruction set consists of just 35 instructions (as opposed

to 111 instructions for 8051).

3. Power-on-reset and brown-out reset. Brown-out-reset means when the power supply goes

below a specified voltage (say 4V), it causes PIC to reset; hence malfunction is avoided.

A watch dog timer (user programmable) resets the processor if the software/program ever

malfunctions and deviates from its normal operation.

4. PIC microcontroller has four optional clock sources.

Low power crystal 

Mid range crystal

High range crystal

RC oscillator (low cost).

5. Programmable timers and on-chip ADC.

6. Up to 12 independent interrupt sources.

7. Powerful output pin control (25 mA (max.) current sourcing capability per pin.)

8. EPROM/OTP/ROM/Flash memory option.

9. I/O ports

10. TO expansion capability.

Page 14: Wireless Chatting System Using Rf Communication

CHAPTER 6: PIC18F258

A) PIN DIAGRAM:

Page 15: Wireless Chatting System Using Rf Communication

A) PIN DESCRIPTION

Page 16: Wireless Chatting System Using Rf Communication
Page 17: Wireless Chatting System Using Rf Communication
Page 18: Wireless Chatting System Using Rf Communication
Page 19: Wireless Chatting System Using Rf Communication

B) ARCHITECTURE

Page 20: Wireless Chatting System Using Rf Communication

C) FEATURES

PERIPHERAL FEATURES:

• High current sink/source 25 mA/25 mA. Three external interrupt pins. Timer0module:

8-bit/16-bit timer/counter with 8-bit programmable prescaler

• Timer1module: 16-bit timer/counter

• Timer2module: 8-bit timer/counter with 8-bit period register (time base for PWM)

• Timer3module: 16-bit timer/counter

• Secondary oscillator clock option – Timer1/Timer3

• Capture/Compare/PWM (CCP) modules;

CCP pins can be configured as:

Capture input: 16-bit, max resolution 6.25 ns

Compare: 16-bit, max resolution 100 ns (TCY)

PWM output: PWM resolution is 1 to 10-bit

Max. PWM freq. @:8-bit resolution = 156 kHz 10-bit resolution = 39 kHz

• Enhanced CCP module which has all the features of the standard CCP module, but also

has the following features for advanced motor control:

1, 2 or 4 PWM outputs

Selectable PWM polarity

Programmable PWM dead time

• Master Synchronous Serial Port (MSSP) with two modes of operation:

3-wire SPI™ (Supports all 4 SPI modes)

I2C™ Master and Slave mode

• Addressable USART module:

Page 21: Wireless Chatting System Using Rf Communication

Supports interrupt-on-address bit

Advanced Analog Features:

• 10-bit, 5-channel Analog-to-Digital Converter module (A/D) with:

Conversion available during Sleep

Up to 5channels available

• Analog Comparator module:

Programmable input and output multiplexing

• Comparator Voltage Reference module

• Programmable Low-Voltage Detection (LVD) module:

Supports interrupt-on-Low-Voltage Detection

• Programmable Brown-out Reset (BOR)

CAN bus Module Features:

• Complies with ISO CAN Conformance Test

• Message bit rates up to 1 Mbps

• Conforms to CAN 2.0B Active Spec with:

29-bit Identifier Fields

8-byte message length

3 Transmit Message Buffers with prioritization

2 Receive Message Buffers

6 full, 29-bit Acceptance Filters

Prioritization of Acceptance Filters

Multiple Receive Buffers for High Priority

Page 22: Wireless Chatting System Using Rf Communication

SPECIAL MICROCONTROLLER FEATURES:

• Power-on Reset (POR), Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)

• Watchdog Timer (WDT) with its own on-chip RC oscillator

• Programmable code protection

• Power-saving Sleep mode

• Selectable oscillator options, including:

- 4x Phase Lock Loop (PLL) of primary oscillator

- Secondary Oscillator (32 kHz) clock input

• In-Circuit Serial Programming TM (ICSPTM) via two pins

OSCILLATOR TYPES:

The PIC18F258 can be operated in one of eight oscillator modes, programmable by three

configuration bits (FOSC2, FOSC1 and FOSC0).

1. LP Low-Power Crystal

2. XT Crystal/Resonator

3. HS High-Speed Crystal/Resonator

4. HS4 High-Speed Crystal/Resonator with PLL enabled

5. RC External Resistor/Capacitor

6. RCIO External Resistor/Capacitor with I/O pin enabled

7. EC External Clock

8. ECIO External Clock with I/O pin enabled

Page 23: Wireless Chatting System Using Rf Communication

RESET:

The PIC18F258 differentiates between various kinds of RESET:

a) Power-on Reset (POR)

b) MCLR Reset during normal operation

c) MCLR Reset during Sleep

d) Watchdog Timer (WDT) Reset during normal operation

e) Programmable Brown-out Reset (PBOR)

f) RESET Instruction

g) Stack Full Reset

h) Stack Underflow Reset

RCON Register

The Reset Control (RCON) register contains flag bits that allow differentiation between the

sources of a device Reset. These flags include the TO, PD, POR, BOR and RI bits.

This register is readable and writable.

Page 24: Wireless Chatting System Using Rf Communication

MCLR (Master Clear):On every PIC microcontroller you will find a pin labeled as MCLR. This pin has two

basic functions. It is used to reset the microcontroller, like soft-boot. As well as to put the

microcontroller into programming mode. The MCLR pin when connected to ground, will reset

the microcontroller, and keep it in reset state, till the ground connection is released. After that the

microcontroller will have all its RAM reset, and program execution will begin, just like the

system has been just powered on. A 10K pull up resistor is usually connected with the pin, to

keep it high when reset switch is released.

Page 25: Wireless Chatting System Using Rf Communication

The same pin will also work as

program mode pin. When a new

software is to be downloaded into the

microchip, about 12V are applied to the

MCLR pin, by your programming

device. This can be done right in our

circuit, or by taking the IC out of circuit

and putting it into the IC socket on your

programmer. We shall talk more about

this in section on programming. The 10K resistor is then useful to avoid 12V reaching VCC and

therefore to other devices.

Page 26: Wireless Chatting System Using Rf Communication

D) MEMORY ORGANIZATION

There are three memory blocks in Enhanced MCU devices. These memory blocks are:

• Enhanced Flash Program Memory

• Data Memory

• EEPROM Data Memory

Program Memory OrganizationThe PIC18F258 devices have a 21-bit program

counter that is capable of addressing a 2-Mbyte program

memory space. The Reset vector address is at 0000h and

the interrupt vector addresses are at 0008h and 0018h.

Figure 4-2 shows the diagram for the program memory

map and stack for the PIC18F258.

.Data Memory Organization

The data memory is implemented as static RAM.

Each register in the data memory has a 12-bit address,

allowing up to 4096 bytes of data memory. Figure 4-6

shows the data memory organization for the PIC18F258 devices. The data memory map is

divided into as many as 16 banks that contain 256 bytes each. The lower 4 bits of the Bank

Select Register (BSR<3:0>) select which bank will be accessed. The upper 4 bits for the BSR are

not implemented. The data memory contains Special Function Registers (SFRs) and General

Purpose Registers (GPRs). The SFRs are used for control and status of the controller and

peripheral functions, while GPRs are used for data storage and scratchpad operations in the

user’s application. The SFRs start at the last location of Bank 15 (FFFh) and grow downwards.

Page 27: Wireless Chatting System Using Rf Communication

GPRs start at the first location of Bank 0 and grow upwards. Any read of an unimplemented

location will read as ‘0’s. The entire data memory may be accessed directly or indirectly. Direct

addressing may require the use of the BSR register. Indirect addressing requires the use of the

File Select Register (FSR). Each FSR holds 12-bit address value that can be used to access any

location in the data memory map without banking. The instruction set and architecture allow

operations across all banks. This may be accomplished by indirect addressing or by the use of the

MOVFF instruction. The MOVFF instruction is a two-word/two-cycle instruction, that moves a

value from one register to another. To ensure that commonly used registers (SFRs and select

GPRs) can be accessed in a single cycle, regardless of the current BSR values, an Access Bank is

implemented. A segment of Bank 0 and a segment of Bank 15 comprise the Access RAM.

GENERAL PURPOSE REGISTER FILE

Page 28: Wireless Chatting System Using Rf Communication

The register file can be accessed either directly or indirectly. Indirect addressing operates

through the File Select Registers (FSR). The operation of indirect addressing is shown in Section “Indirect Addressing, INDF and FSR Registers”. Enhanced MCU devices may have banked memory in the GPR area. GPRs are not initialized by a Power-on Reset and are unchanged on all other Resets. Data RAM is available for use as GPR registers by all instructions. Bank 15 (F00h to FFFh) contains SFRs. All other banks of data memory contain GPR registers, starting with Bank 0.

SPECIAL FUNCTION REGISTERS

The Special Function Registers (SFRs) are registers used by the CPU and peripheral

modules for controlling the desired operation of the device. These registers are implemented as

static RAM. A list of these registers is given in Table 4-1. The SFRs can be classified into two

sets: those associated with the “core” function and those related to the peripheral functions.

Those registers related to the “core” are described in this section, while those related to the

operation of the peripheral features are described in the section of that peripheral feature. The

Page 29: Wireless Chatting System Using Rf Communication

SFRs are typically distributed among the peripherals whose functions they control. The unused

SFR locations will be unimplemented and read as ‘0’s. See above figure for addresses for the

SFRs.

DATA EEPROM MEMORY

The data EEPROM is readable and writable during normal operation over the entire VDD

range. The data memory is not directly mapped in the register file space. Instead, it is indirectly

addressed through the Special Function Registers (SFR). There are four SFRs used to read and

write the program and data EEPROM memory. These registers

are: • EECON1

• EECON2

• EEDATA

• EEADR

The EEPROM data memory allows byte read and write. When interfacing to the data

memory block, EEDATA holds the 8-bit data for read/write and EEADR holds the

address of the EEPROM location being accessed. The PIC18F258 devices have 256 bytes of data

EEPROM with an address range from 00h to FFh. The EEPROM data memory is rated for high

erase/write cycles. A byte write automatically erases the location and writes the new data (erase-

before-write). The write time is controlled by an on-chip timer. The write time will vary with

voltage and temperature, as well as from chip-to-chip.

Status Register

Page 30: Wireless Chatting System Using Rf Communication

The Status register, shown in Register 4-2, contains the arithmetic status of the ALU. The

Status register can be the destination for any instruction, as with any other register. If the

Status register is the destination for an instruction that affects the Z, DC, C, OV or N bits, then

the write to these five bits is disabled. These bits are set or cleared according to the device logic.

Therefore, the result of an instruction with the Status register as destination may be different than

intended.

Page 31: Wireless Chatting System Using Rf Communication

CHAPTER 7: RF COMMUNICATION

A) RF TRANSMITTER UNIT

Radio frequency (RF) transmitters are widely used in radio frequency communications

systems. With the increasing availability of efficient, low cost electronic modules, mobile

communication systems are becoming more and more widespread.

A terminal apparatus used in the radio communications system receives a radio frequency

signal transmitted from a base station, by an antenna, inputs the signal to a receiving radio-

frequency unit via an antenna duplexer, high frequency amplifies the signal, removes

unnecessary waves outside the receiving band from the signal, converts the signal to an

intermediate frequency signal, demodulates the intermediate frequency signal by a demodulator,

and converts the signal into a baseband signal.

Generally, a radio transmitter is used for performing a radio transmission operation,

whereby a high frequency signal outputted from a modulator is transmitted to an antenna of the

radio transmitter and is transmitted there from to a remote radio transmitter thereby a signal is

transmitted.

The transmitting baseband signal is subjected to a predetermined signal process, input to

a modulator, which modulates a carrier wave signal. The modulated carrier wave signal is

converted into a radio frequency by a transmitting radio-frequency circuit and amplified to a

predetermined transmitting power, and transmitted to the base station from the antenna via the

duplexer. Communication systems are known to support wireless and wire lined communications

between wireless and/or wire lined communication devices.

The function of a radio frequency (RF) transmitter is to modulate, upconvert, and amplify

signals for transmission into free space. An RF transmitter generally includes a modulator that

modulates an input signal and a radio frequency power amplifier that is coupled to the modulator

to amplify the modulated input signal. The radio frequency power amplifier is coupled to an

antenna that transmits the amplified modulated input signal. Power amplifiers are required in

radio telecommunication systems to amplify signals before transmitting, because a radio signal

attenuates on the radio path.

Page 32: Wireless Chatting System Using Rf Communication

TRANSMITTER MODULE (STT-433):

The STT-433 is an ASK transmitter module .The result is excellent performance in a

simple-to-use .The STT-433 is designed specifically for remote-control , wireless mouse and car

alarm system operating at 315/433.92 MHz in the USA under FCC Part 15 regulation. These are

pre-built 433MHz wireless transmitter / receiver modules. They feature ASK encoding, and

perform very well. They are ideal for devices using short data bursts such as remote controls,

trigger pulses etc.

SPECIFICATIONS:

Output power: 3dBm.

Supply voltage: 3V.

Supply current: 10mA max.

Data rate: 300bps to 10kbps.

PCB measures: 18.5(H) x 14.5(W) mm (excluding pins).

Transmitter Module:  ZW-3100

Receiver Module:      ZW-3102

Ideal for 315/433.92MHz remote keyless-entry transmitter

By SAW resonator

ASK modulation

315/433.92MHz

B) RF RECEIVER UNIT

Page 33: Wireless Chatting System Using Rf Communication

Receivers for communication systems generally are designed such that they are tuned to

receive one of a multiplicity of signals having widely varying bandwidths and which may fall

within a particular frequency range.

The RF receiver receives an RF signal, converts the RF signal to an IF signal, and then

converts the IF signal to a base band signal, which it then provides to the base band

processor. As is also known, RF transceivers typically include sensitive components

susceptible to noise and interference with one another and with external sources.

The RF receiver is coupled to the antenna and includes a low noise amplifier, one or more

intermediate frequency stages, a filtering stage, and a data recovery stage. The low noise

amplifier receives an inbound RF signal via the antenna and amplifies it.

The one or more intermediate frequency stages mix the amplified RF signal with one or more

local oscillations to convert the amplified RF signal into a base band signal or an

intermediate frequency (IF) signal.

RECEIVER MODULE (STR-433)

The receiver module used in our project is ASK Super Heterodyne Receiver Module,

belongs to the category STR-433. The STR-433-ASK is an Ask Super Heterodyne Receiver

Module with PLL Synthesizer and Crystal Oscillator. The circuit shape is PLL.

STR-433

PIN DIAGRAM

Page 34: Wireless Chatting System Using Rf Communication

SPECIFICATIONS:

Frequency Range : 315/434 MHz

Operation Voltage: 5V

IF Frequency: 500k

Typical sensitivity: -105dBm

Supply Current: 2.3Ma

FEATURES:

Low power consumption.

Easy for application.

On-chip VCO with integrated PLL using crystal oscillator reference.

Integrated IF and data filters.

Operation temperature range : -40 °c to +80 °c

C) ENCODER

Page 35: Wireless Chatting System Using Rf Communication

An encoder can be a device used to change a signal (such as a bit stream) or data into a code.

The code serves any of a number of purposes such as compressing information for

transmission or storage, encrypting or adding redundancies to the input code, or translating

from one code to another.

This is usually done by means of a programmed algorithm, especially if any part is digital,

while most analog encoding is done with analog circuitry.

ENCODER HT640:

The HT640 encoder is a CMOS IC built especially for remote control system applications. It

is capable of encoding 8 bits of address (A0-A9) and 4 bits of data (AD1-AD7) information.

Each address input can be set to one of the two logic states, 0 or 1.

Grounding the pins is taken as a 0 while a high can be given by giving +5V or leaving the

pins open (no connection). Upon reception of transmit enable (TE-active high), the

programmed address/data are transmitted together with the header bits via an RF medium.

D) DECODER

Page 36: Wireless Chatting System Using Rf Communication

A decoder is a device which does the reverse of an encoder, undoing the encoding so that

the original information can be retrieved. The same method used to encode is usually just

reversed in order to decode.

In digital electronics this would mean that a decoder is a multiple-input, multiple-output

logic circuit that converts coded inputs into coded outputs.

Enable inputs must be on for the decoder to function, otherwise its outputs assume a

single "disabled" output code word. Decoding is necessary in applications such as data

multiplexing, 7 segment display and memory address decoding.

HT648:

The HT648 is a decoder IC made especially to pair with the HT640 encoder .it is a

CMOS IC made for remote control system application. The decoder is capable of decoding 8 bits

of address (A0-A9) and 4 bits of data (AD1-AD8) information. For proper operation, a pair of

encoder/decoder with the same number of addresses and data format should be chosen.

The decoders receive serial

addresses and data from a

programmed encoders that are

transmitted by a carrier using an

RF or an IR transmission medium.

They compare the serial input data

three times continuously with their

local addresses. If no error or

unmatched codes are found, the

input data codes are decoded and

then transferred to the output pins.

The VT pin also goes high to

indicate a valid transmission.

The decoders are capable of decoding information that consists of N bits of address and

12_N bits of data. Of this series, the HT648 is arranged to provide 8 address bits and 4 data bits,

and HT648 is used to decode 12 bits of address information.

Page 37: Wireless Chatting System Using Rf Communication

CHAPTER 8: KEYPAD

Keypads are a part of HMI or Human Machine Interface and play really important role in a small embedded system where human interaction or human input is needed. Martix keypads are well known for their simple architecture and ease of interfacing with any microcontroller. In this part of tutorial we will learn how to interface a 4x4 matrix keypad with AVR and 8051 microcontroller. Also we will see how to program then in Assembly and C.

Constructions of a keypad are really simple. As per the outline shown in the figure below we have four rows and four columns. In between each overlapping row and column line there is a key.

So keeping this outline we can construct a keypad using simple SPST Switches as shown below:

Now our keypad is ready, all we have to do is connect the rows and columns to a port of microcontroller and program the controller to read the input.

Page 38: Wireless Chatting System Using Rf Communication

There are many methods depending on how you connect your keypad with your controller, but the basic logic is same. We make the columns as i/p and we drive the rows making them o/p, this whole procedure of reading the keyboard is called scanning.

In order to detect which key is pressed from the matrix, we make row lines low one by one and read the columns. Let’s say we first make Row1 low, then read the columns. If any of the key in row1 is pressed will make the corresponding column as low i.e. if second key is pressed in Row1, then column2 will give low. So we come to know that key 2 of Row1 is pressed. This is how scanning is done.

So to scan the keypad completely, we need to make rows low one by one and read the columns. If any of the button is pressed in a row, it will take the corresponding column to a low state which tells us that a key is pressed in that row. If button 1 of a row is pressed then Column 1 will become low, if button 2 then column2 and so on.

Page 39: Wireless Chatting System Using Rf Communication

CHAPTER 9: ENCRYPTION/DECRYPTION

Encryption is the conversion of data into a form, called a cipher text that cannot be easily

understood by unauthorized people. Decryption is the process of converting encrypted data back

into its original form, so it can be understood.

The use of encryption/decryption is as old as the art of communication. In wartime, a cipher,

often incorrectly called a code, can be employed to keep the enemy from obtaining the contents

of transmissions. (Technically, a code is a means of representing a signal without the intent of

keeping it secret; examples are Morse code and ASCII.) Simple ciphers include the substitution

of letters for numbers, the rotation of letters in the alphabet, and the "scrambling" of voice

signals by inverting the sideband frequencies. More complex ciphers work according to

sophisticated computer algorithms that rearrange the data bits in digital signals.

In order to easily recover the contents of an encrypted signal, the correct decryption key is

required. The key is an algorithm that undoes the work of the encryption algorithm.

Alternatively, a computer can be used in an attempt to break the cipher. The more complex the

encryption algorithm, the more difficult it becomes to eavesdrop on the communications without

access to the key.

Encryption/decryption is especially important in wireless communications. This is because

wireless circuits are easier to tap than their hard-wired counterparts. Nevertheless,

encryption/decryption is a good idea when carrying out any kind of sensitive transaction, such as

a credit-card purchase online, or the discussion of a company secret between different

departments in the organization. The stronger the cipher -- that is, the harder it is for

unauthorized people to break it -- the better, in general. However, as the strength of

encryption/decryption increases, so does the cost.

Encryption/Decryption Example:• The first character (“I” or hex 49) is encrypted using the key and “XOR”

• Hex 49 = binary 01001001

• Key = binary 01010101

• XOR = binary 00011100

• So the encrypted character is 00011100

Page 40: Wireless Chatting System Using Rf Communication

• To decrypt, you reverse the process

• XOR = binary 00011100

• Key = binary 01010101

• Character = binary 01001001

Page 41: Wireless Chatting System Using Rf Communication

CHAPTER 10: LCD

This is special section of web-site. In this section we will learn how we can display a character or a message on LCD display. You can choose any standard LCD available in market. I have experimented with 20×2 LCD. It means LCD has 2 lines of 20 characters each. Many other LCDs like  16×2, 24×2, 32×2, 20×4 etc. are available. Functionally all these LCDs are same. To develop a protocol to interface this LCD with 89C51 first we have to understand how they functions.

These displays contains two internal byte-wide registers, one for command and second for characters to be displayed. There are three control signals called R/W, DI/RS and En. The table given below will tell you what is the use of these three signals.

Control Signals It's function

R/W = 0 Writes character in display

 = 1 Reads from display

RS/DI = 0 Selects command register

 = 1 Selects Data register to display character

En = 0 Disables the display

 = 1 Enables the display

LCD COMMAND CODES:

Code Command to LCD Instruction1 Clear Display Screen2 Return Home4 Decrement cursor6 Increment cursor5 Shift display right7 Shift display left8 Display off, cursor offA Display off, cursor onC Display on, cursor offE Display on, cursor blinkingF Display on, cursor blinking10 Shift cursor position to left14 Shift cursor position to right

Page 42: Wireless Chatting System Using Rf Communication

18 Shift the entire display to left1C Shift the entire display to right80 Force cursor to beginning of first lineC0 Force cursor to beginning of second line38 2 lines and 5x7 matrix

The figure shows connections of LCD with 89S52

All the data lines of LCD are connected with port P1. En pin is connected with P0.0, DI (RS) is connected with P0.1 and R/W pin is connected with P0.2.

Page 43: Wireless Chatting System Using Rf Communication

CHAPTER 11: POWER SUPPLY

The ac voltage, typically 220V, is connected to a transformer, which steps down that ac voltage down to the level of the desired dc output. A diode rectifier then provides a full-wave rectified voltage that is initially filtered by a simple capacitor filter to produce a dc voltage. This resulting dc voltage usually has some ripple or ac voltage variation.

A regulator circuit removes the ripples and also retains the same dc value even if the input dc voltage varies, or the load connected to the output dc voltage changes. This voltage regulation is usually obtained using one of the popular voltage regulator IC units.

Fig. 3.7 Block Diagram of Power Supply

TRANSFORMER:

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

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 India) 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 soft-iron core of the transformer. 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.

The transformer will step down the power supply voltage (0-230V) to (0-6V) level. Then the secondary of the potential transformer will be connected to the bridge rectifier, which is constructed with the help of PN junction diodes. The advantages of using bridge rectifier are it will give peak voltage output as DC.

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 full-wave rectifier

Page 44: Wireless Chatting System Using Rf Communication

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

When four diodes are connected as shown in figure, the circuit is called as bridge rectifier. The input to the circuit is applied to the diagonally opposite corners of the network, and the output is taken from the remaining two corners. Let us assume that the transformer is working properly and there is a positive potential, at point A and a negative potential at point B. the positive potential at point A will forward bias D3 and reverse bias D4.

The negative potential at point B will forward bias D1 and reverse D2. At this time D3 and D1 are forward biased and will allow current flow to pass through them; D4 and D2 are reverse biased and will block current flow.

One advantage of a bridge rectifier over a conventional full-wave rectifier is that with a given transformer the bridge rectifier produces a voltage output that is nearly twice that of the conventional full-wave circuit.

With both circuits using the same transformer, the bridge rectifier circuit produces a higher output voltage than the conventional full-wave rectifier circuit.

fig. Bridge Rectifier Fig. Output waveform of Bridge Rectifier

SMOOTHING:

Page 45: Wireless Chatting System Using Rf Communication

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.

Fig. Smoothing Capacitor and its Output Waveform

Smoothing is not perfect due to the capacitor voltage falls a little as it discharges, giving a small ripple voltage. For many circuits a ripple which is 10% of the supply voltage is satisfactory. A larger capacitor will give fewer ripples. The capacitor value must be doubled when smoothing half-wave DC.

VOLTAGE REGULATORS:

Voltage regulators comprise a class of widely used ICs. Regulator IC units contain the circuitry for reference source, comparator amplifier, control device, and overload protection all in a single IC. IC units provide regulation of either a fixed positive voltage, a fixed negative voltage, or an adjustably set voltage. The regulators can be selected for operation with load currents from hundreds of milli amperes to tens of amperes, corresponding to power ratings from milli watts to tens of watts.

A fixed three-terminal voltage regulator has an unregulated dc input voltage, Vi, applied to one input terminal, a regulated dc output voltage, Vo, from a second terminal, with the third terminal connected to ground.

The series 78 regulators provide fixed positive regulated voltages from 5 to 24 volts. Similarly, the series 79 regulators provide fixed negative regulated voltages from 5 to 24 volts.

IC VOLTAGE REGULATORS:

Page 46: Wireless Chatting System Using Rf Communication

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 has 3 leads and look like power transistors, such as the 7805 +5V 1Amp regulator. They include a hole for attaching a heat sink if necessary.

Fig. IC Voltage Regulator

CIRCUIT DIAGRAM:

Fig. 3.15 Circuit diagram of Power Supply

Page 47: Wireless Chatting System Using Rf Communication

CHAPTER 12: CONCLUSION

This project was at the same time challenging and exciting. We have both used chat

applications in the past whether to keep in touch with friends across the country or to collaborate

with co workers in different offices. These tools are invaluable whether all that is needed is a one

sentence note or an hour long conversation. The great thing about chat applications is that they

are usually free like AOL’s Instant Messenger or Yahoo Messenger and can therefore cut down

on the cost of communicating via RF COOMUNICATION.

When we began this project, neither of us had much knowledge of what it would take to

complete it and throughout the development process we learned a lot about what it takes to

develop a RF protocol and how to integrate that into an application that could use it efficiently.

it was very worthwhile to see it all come together and work with the message protocol that we

developed.

Page 48: Wireless Chatting System Using Rf Communication

CHAPTER 13: INTRODUCTION TO   MICRO VISION KEIL (IDE)

A) OVERVIEW OF KEIL SOFTWARE

Keil is a cross compiler. So first we have to understand the concept of compilers and cross compilers. After then we shall learn how to work with keil.

Concept of compiler: -

Compilers are programs used to convert a High Level Language to object code. Desktop compilers produce an output object code for the underlying microprocessor, but not for other microprocessors. I.E the programs written in one of the HLL like ‘C’ will compile the code to run on the system for a particular processor like x86 (underlying microprocessor in the computer). For example compilers for Dos platform is different from the Compilers for Unix platform So if one wants to define a compiler then compiler is a program that translates source code into object code. The compiler derives its name from the way it works, looking at the entire piece of source code and collecting and reorganizing the instruction. See there is a bit little difference between compiler and an interpreter. Interpreter just interprets whole program at a time while compiler analyzes and execute each line of source code in succession, without looking at the entire program. The advantage of interpreters is that they can execute a program immediately. Secondly programs produced by compilers run much faster than the same programs executed by an interpreter. However compilers require some time before an executable program emerges. Now as compilers translate source code into object code, which is unique for each type of computer, many compilers are available for the same language. 

Concept of cross compiler: -

A cross compiler is similar to the compilers but we write a program for the target processor (like 8051 and its derivatives) on the host processors (like computer of x86)It means being in one environment you are writing a code for another environment is called cross development. And the compiler used for cross development is called cross compiler Cross compilers are beneficial whenever the host machine has more resources (memory, disk, I/O etc) than the target.  Keil C Compiler is one such compiler that supports a huge number of host and target combinations. It supports as a target to 8 bit microcontrollers like Atmel and Motorola etc.

 

Why do we need cross compiler?

Page 49: Wireless Chatting System Using Rf Communication

There are several advantages of using cross compiler. Some of them are described as follows•         By using this compilers not only can development of complex embedded systems

be completed in a fraction of the time, but reliability is improved, and maintenance is easy.

•         Knowledge of the processor instruction set is not required. •         A rudimentary knowledge of the 8051’s memory architecture is desirable but not

necessary.•         Register allocation and addressing mode details are managed by the compiler.•         The ability to combine variable selection with specific operations improves

program readability.•         Keywords and operational functions that more nearly resemble the human thought

process can be used.•         Program development and debugging times are dramatically reduced when

compared to assembly language programming.•         The library files that are supplied provide many standard routines (such as

formatted output, data conversions, and floating-point arithmetic) that may be incorporated into your application.

•         Existing routine can be reused in new programs by utilizing the modular programming techniques available with C.

•         The C language is very portable and very popular. C compilers are available for almost all target systems. Existing software investments can be quickly and easily converted from or adapted to other processors or environments.

Keil C cross compiler: -

Keil is a German based Software development company. It provides several development tools like

•         IDE (Integrated Development environment)•         Project Manager•         Simulator•         Debugger•         C Cross Compiler, Cross Assembler, Locator/Linker

Keil Software provides you with software development tools for the 8051 family of microcontrollers. With these tools, you can generate embedded applications for the multitude of 8051 derivatives. Keil provides following tools for 8051 development

1.     C51 Optimizing C Cross Compiler,2.     A51 Macro Assembler,3.     8051 Utilities (linker, object file converter, library manager),4.     Source-Level Debugger/Simulator,5.     µVision for Windows Integrated Development Environment.

The keil 8051 tool kit includes three main tools, assembler, compiler and linker. An assembler is used to assemble your 8051 assembly programA compiler is used to compile your C source code into an object fileA linker is used to create an absolute object module suitable for your in-circuit emulator.

 

Page 50: Wireless Chatting System Using Rf Communication

8051 project development cycle: - these are the steps to develop 8051 project using keil1. Create source files in C or assembly.2. Compile or assemble source files.3. Correct errors in source files.4. Link object files from compiler and assembler.5. Test linked application.

now let us start how to work with keil.

STEPS FOR EXECUTING THE KEIL PROGRAMS:

1. Click on the Keil uVision Icon on Desktop

2. The following fig will appear

3. Click on the Project menu from the title bar

4. Then Click on New Project

Page 51: Wireless Chatting System Using Rf Communication

5. Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\

6. Then Click on Save button above.

7. Select the component for u r project. i.e. Atmel……

8. Click on the + Symbol beside of Atmel

Page 52: Wireless Chatting System Using Rf Communication

9. Select AT89S52 as shown below

10. Then Click on “OK”

11. The Following fig will appear

Page 53: Wireless Chatting System Using Rf Communication

12. Then Click either YES or NO………mostly “NO”

13. Now your project is ready to USE

14. Now double click on the Target1, you would get another option “Source group 1” as shown in next page.

15. Click on the file option from menu bar and select “new”

Page 54: Wireless Chatting System Using Rf Communication

16. The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.

17. Now start writing program in either in “C” or “ASM”

18. For a program written in Assembly, then save it with extension “. asm” and for “C” based program save it with extension “ .C”

Page 55: Wireless Chatting System Using Rf Communication

19. Now right click on Source group 1 and click on “Add files to Group Source”

20. Now you will get another window, on which by default “C” files will appear.

Page 56: Wireless Chatting System Using Rf Communication

21. Now select as per your file extension given while saving the file

22. Click only one time on option “ADD”

23. Now Press function key F7 to compile. Any error will appear if so happen.

24. If the file contains no error, then press Control+F5 simultaneously.

25. The new window is as follows

Page 57: Wireless Chatting System Using Rf Communication

26. Then Click “OK”

27. Now Click on the Peripherals from menu bar, and check your required port as shown in fig below

28. Drag the port a side and click in the program file.

Page 58: Wireless Chatting System Using Rf Communication

29. Now keep Pressing function key “F11” slowly and observe.

30. You are running your program successfully

Page 59: Wireless Chatting System Using Rf Communication

CHAPTER 14: ADVANTAGES

The students, who have used CHAT as part of their online learning process, feel it is

effective

Students on online courses feel their participation would be enhanced by the use of

live, inter-active learning amongst themselves, other students and the tutor?

Live chat unique features help operators respond faster and more accurately.

CHAT system will pull down your cost by cutting down the monthly toll fee and

telephone cost.

With instant online support one agent can handle multiple chats and thus assist

several online visitors simultaneously which reduces customer hold times

Page 60: Wireless Chatting System Using Rf Communication

CHAPTER 15: BIBLIOGRAPHY

www.discovercircuits.com/R/rftrans.htm

www.8052.com/tutlcd

www.hobbyprojects.com/microcontroller_tutorials.html

http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm

http://www.kpsec.freeuk.com/powersup.htm

http://www.glolab.com/encdec/gl/app.html