You are on page 1of 37

WIRELESS ENCRYPTED DATA TRANSMISSION

A Dissertation submitted for the partial fulfillment of the degree of


Bachelor of Engineering in
Electronics and Telecommunication Engineering

(Session 2008-09)

Guided By: Submitted By:

Mr. Vaibhav Neema Abhash Nigam (5T801)


Arpit Gupta (5T816)
Rahil Hamid (5T845)
Saurabh Jain (5T853)

Vinay Lakhera
(5T858)

Department of Electronic and Telecommunication Engineering


Institute of Engineering And Technology
Devi Ahilya Vishwavidyalaya, Indore (M.P.)
(www.iet.dauniv.ac.in)
APRIL 2009

Institute of Engineering and Technology


Devi Ahilya Vishwavidyalaya, Indore

Recommendation

The dissertation entitled “ Wireless encrypted Data Transmission” submitted by


Mr. Abhash Nigam, Mr. Arpit Gupta, Mr. Rahil Hamid, Mr. Saurabh Jain, Mr.
Vinay Lakhera a satisfactory account of the bonafide work done under my
supervision is recommended towards the partial fulfillment for the award of the
bachelor of engineering (Electronics And Telecommunication engineering), degree
by Devi Ahilya Vishwavidyalaya Indore

Date: Mr. Vaibhav Neema

Project Guide

Endorsed By
Dr. Sanjeev K. Tokekar,
HOD, Department of Electronics and
Telecommunication Engineering.
Institute of Engineering and Technology
Devi Ahilya Vishwavidyalaya, Indore

Dissertation Approval Sheet

The Dissertation entitled “WIRELESS ENCRYPTED DATA TRANSMISSION”


submitted by Abhash Nigam (5T801) Arpit Gupta(5T816), Rahil Hamid(5T845),
Saurabh Jain(5T853), Vinay Lakhera(8T558) is approved as partial fulfillment for
the award of B.E. (Electronics And Telecommunication Engineering) degree by
Devi Ahilya Vishwavidyalaya, Indore.

Internal Examiner External Examiner

Director

Institute of Engineering & Technology


Devi Ahilya Vishwavidyalaya, Indore (M.P)
Candidate Declaration

I hereby declare that the work which has been presented in this project
entitled “WIRELESS ENCRYPTED DATA TRANSMISSION” in partial
fulfillment for the award of degree of Bachelor of Engineering (B.E.) Electronic
And Telecommunication Engineering is an authentic record of my own work
carried out under the supervision and guidance of Mr. Vaibhav Neema ,
Institute of Engineering and Technology Devi Ahilya Vishwa Vidhaylaya Indore.

We are fully responsible for matter embodied in this project in case of any
discrepancy found in the project and project has not been submitted for the award
of any other degree.

DATED: Signature of Student

PLACE: Indore Signature of Student

Signature of Student

Signature of Student

Signature of Student
ACKNOWLEDGEMENT

We express our heartfelt thanks to Dr. Manohar Chandwani, Director (Institute of


Engineering and Technology, Indore) for his invaluable encouragement and nice
suggestions.

We would specially like to thank Dr. Sanjeev V Tokekar (HOD, Electronic and
Telecommunication Engineering) as he has been instrumental in the preparation of
this thesis report and kept on encouraging us to submit the project deliverables on
time. We wish to express our sincere gratitude to our guide Mr. Vaibhav Neema
(Faculty Member of Electronics Dept.), for his encouragement and guidance
throughout the work on this project. The invaluable suggestions given by our guide
have helped us to improve the quality of our project and deliver the project in time.

We would also like to thank all the people in the Department of Electronic And
Telecommunication Engineering in I.E.T, who was always there with help
whenever we needed it.

Here we think from the core, everybody who has helped us at work when it started
as an unknown ocean to swim though, we needed more than sense of words. In true
sense, we are indebted to all our teachers during graduation at I.E.T, without them
we hardly ever thought of, the project we did.

Finally thanks to all our friends, our colleagues and classmates for their nice
cooperation.

Project conceived and developed by:

Abhash Nigam (5T801)


Arpit Gupta (5T816)
Rahil Hamid (5T845)
Saurabh Jain (5T853)
Vinay Lakhera (5T858)
Abstract:

The project is based on the concept of setting up wireless data link between
Personal computers. There are about a dozen different communication interfaces
integrated in PCs on the market today to tackle almost any conceivable
communication task. With this increasing interface variety it becomes more
complicated to pick the "right" interface for the task at hand. Each of the available
interfaces has its advantages and disadvantages and is better suited at some tasks
than others.
The aim of this project is to setup wireless data link between PC’s to enable them
to communicate with each other. Encryption of the messages will add extra
security from interception and hacking.
Table of Contents

1. Introduction……………………………………………………… 8
1.1 Overview and involved………………………………. 8
1.2 Problem definition…………………………………… 8
1.3 Proposed solution……………………………………. 8

2. Requirement Gathering………………………………………… 9
2.1 Hardware Requirements ……………………………… 9
2.2 Hardware Details……………………………………... 10
2.3 Software Requirements …………..… ……………… 19
2.4 Software coding……………………………………… 19

3. Implementation………………………………………………… 21
4.1 Block Diagram………………………………………… 21
4.2 Circuit Diagram……………………………………… 22

4. Working…………………………………………………….......... 23

5. Microcontroller programming.………………………………… 26
6. Conclusion………………………………………………………. 31

Appendix………………………………………………………… 32

Bibliography…………………………………………………….. 36

Chapter 1
INTRODUCTION

1.1 Overview and issues involved

In the present era of communication where mobility along with communication has
become an indispensible and inevitable part, there is an urgent need for the mode
of communication which is flexible in nature in context to mobility i.e.
communication could be set up when the two communicating node are at a
considerable distance without any physical connection. Such type of
communication is defined as wireless communication. One more fact which should
be considered while developing such communication is that it should be secure. It
should not have any eavesdropping or interception by an unintended user. So the
suitable encryption should be done before transmission and hence the projected
targeted towards encrypted wireless transmission.

1.2 Problem Definition

To design a module by which data can be encrypted using pc, microcontroller to


prevent it from being intercepted successfully by other nodes working at same
frequency and to achieve the successful transmission.
1.3 Problem Solution

So considering all these problems we tried to develop a module which could be


effective in providing secure transmission and free from any interference.

Chapter 2

Requirement Gathering

2.1 Hardware Requirements

• Microcontroller 8051
• Crystal oscillator
• Max 232
• RS 232
• Transistor BC547
• RF modem

2.2 Hardware Details

Microcontroller (AT89C51):

The 8051, Intel's second generation of microcontrollers, rules the microcontroller


market at the present time. Although featuring a somewhat bizarre design, it is a
very powerful and easy to program chip.
Split memory architecture with separate address spaces for program memory
and data memory. The program memory can be up to 64K. The lower portion (4K
or 8K depending on type) may reside on chip. The 8051 can address up to 64K of
external data memory, and is accessed only by indirect addressing. The 8051 has
128 bytes (256 bytes for the 8052) of on-chip RAM, plus a number of special
functions register (SFRs). I/O is mapped in its own space.

The 8051 features the so-called "Boolean processor". This refers to the way
instructions can single out bits just about anywhere (RAM, accumulators, I/O
registers, etc.), perform complex bit tests and comparisons, and then execute
relative jumps based on the results.
Piles of software, both commercial and free, are available for the 8051 line. Many
manufacturers supply what must be a hundred different variants of this chip for any
requirement. Often featured in construction projects in the popular hobbyist
magazines.

Crystal Oscillator:
The 8051 operates based on an external crystal. This is an electrical device which,
when energy is applied, emits pulses at a fixed frequency. One can find crystals of
virtually any frequency depending on the application requirements. When using an
8051, the most common crystal frequencies are 12 megahertz and 11.059
megahertz--with 11.059 being much more common. Microcontrollers (and many
other electrical systems) use crystals to synchronize operations. The 8051 uses the
crystal for precisely that: to synchronize its operation. Effectively, the 8051
operates using what are called "machine cycles." A single machine cycle is the
minimum amount of time in which a single 8051 instruction can be executed.
although many instructions take multiple cycles.
A cycle is, in reality, 12 pulses of the crystal. That is to say, if an instruction takes
one machine cycle to execute, it will take 12 pulses of the crystal to execute. Since
we know the crystal is pulsing 11,059,000 times per second and that one machine
cycle is 12 pulses, we can calculate how many instruction cycles the 8051 can
execute per second:
11,059,000 / 12 = 921,583
This means that the 8051 can execute 921,583 single-cycle instructions per second.
Since a large number of 8051 instructions are single-cycle instructions it is often
considered that the 8051 can execute roughly 1 million instructions per second,
although in reality it is less--and, depending on the instructions being used, an
estimate of about 600,000 instructions per second is more realistic.
MAX 232

The MAX232 is an integrated circuit that converts signals from an RS-232 serial
port to signals suitable for use in TTL compatible digital logic circuits. The
MAX232 is a dual driver/receiver and typically converts the RX, TX, CTS and
RTS signals.

The drivers provide RS-232 voltage level outputs (approx. ± 7.5 V) from a single
+ 5 V supply via on-chip charge pumps and external capacitors. This makes it
useful for implementing RS-232 in devices that otherwise do not need any voltages
outside the 0 V to + 5 V range, as power supply design does not need to be made
more complicated just for driving the RS-232 in this case.

The receivers reduce RS-232 inputs (which may be as high as ± 25 V), to standard
5 V TTL levels. These receivers have a typical threshold of 1.3 V, and a typical
hysteresis of 0.5 V.

The later MAX232A is backwards compatible with the original MAX232 but may
operate at higher baud rates and can use smaller external capacitors – 0.1 μF in
place of the 1.0 μF capacitors used with the original device
RS 232

In RS-232, user data is sent as a time-series of bits. Both synchronous and


asynchronous transmissions are supported by the standard. In addition to the data
circuits, the standard defines a number of control circuits used to manage the
connection between the DTE and DCE. Each data or control circuit only operates
in one direction that is, signaling from a DTE to the attached DCE or the reverse.
Since transmit data and receive data are separate circuits, the interface can operate
in a full duplex manner, supporting concurrent data flow in both directions. The
standard does not define character framing within the data stream, or character
encoding
Signals:-

Commonly-used signals are:

Transmitted Data (TxD)

Data sent from DTE to DCE.

Received Data (RxD)

Data sent from DCE to DTE.

Request To Send (RTS)


Asserted (set to logic 0, positive voltage) by DTE to prepare DCE to receive
data. This may require action on the part of the DCE, e.g. transmitting a
carrier or reversing the direction of a half-duplex channel. For the modern
usage of "RTS/CTS handshaking," see the section of that name.

Ready To Receive (RTR)

Asserted by DTE to indicate to DCE that DTE is ready to receive data. If in


use, this signal appears on the pin that would otherwise be used for Request
To Send, and the DCE assumes that RTS is always asserted; see RTS/CTS
handshaking for details.

Clear To Send (CTS)

Asserted by DCE to acknowledge RTS and allow DTE to transmit. This


signaling was originally used with half-duplex modems and by slave
terminals on multidrop lines: The DTE would raise RTS to indicate that it
had data to send, and the modem would raise CTS to indicate that
transmission was possible. For the modern usage of "RTS/CTS
handshaking," see the section of that name.

Data Terminal Ready (DTR)

Asserted by DTE to indicate that it is ready to be connected. If the DCE is a


modem, this may "wake up" the modem, bringing it out of a power saving
mode. This behaviour is seen quite often in modern PSTN and GSM
modems. When this signal is de-asserted, the modem may return to its
standby mode, immediately hanging up any calls in progress.

Data Set Ready (DSR)

Asserted by DCE to indicate the DCE is powered on and is ready to receive


commands or data for transmission from the DTE. For example, if the DCE
is a modem, DSR is asserted as soon as the modem is ready to receive
dialing or other commands; DSR is not dependent on the connection to the
remote DCE. If the DCE is not a modem, this signal should be permanently
asserted (set to 0), possibly by a jumper to another signal.

Data carrier Detect (DCD)


Asserted by DCE when a connection has been established with remote
equipment.

Ring Indicator (RI)

Asserted by DCE when it detects a ring signal from the telephone line.

Transistor BC547

It is a npn general purpose transistor which is used for general purpose switching.

FEATURES
· Low current (max. 100 mA)

· Low voltage (max. 65 V).

RF modem, 9600 bps, serial TTL level

RF Modem can be used for applications that need two way wireless data
transmission. It features high data rate (9600bps) and longer transmission distance
(100mts). The communication protocol is self controlled and completely
transparent to user interface. The module can be embedded to your current design
so that wireless communication can be set up easily.
Features

• Automatic switching between TX and RX mode.


• FSK technology, half duplex mode, robust to interference.
• 433 MHz band, no need to apply frequency usage license.
• Protocol translation is self controlled, easy to use.
• High sensitivity, long transmission range.
• Standard UART interface, TTL (3-5V) logic level.
• Very reliable, small size, easier mounting.
• No tuning required, PLL based self tuned.
• Error checking (CRC) of data.
• Range of the device is 8-10 mts.
Applications

Remote control
• Remote measurement system
• Weather stations
• Sensor Networks
• Wireless metering
• Access control
• Identity discrimination
• Data collection
• IT home appliance
• Smart house products, Security Systems

PIN PIN NAME DETAILS


RX-IN Receive Input Input serial data at 9600 bps of
3 to 5V logic level, Usually
connected
to TXD pin of microcontrollers
TX-OUT Transmit Output Output serial data at 9600 bps
of 3V logic level, Usually
connected to
RXD pin of microcontrollers
GND Ground Ground level of power supply

+5V Power Supply Regulated 5V supply input.

Operations

Module works in half-duplex mode. Means it can either transmit or receive but not
both at same time. Module has packet buffer of 128 bytes. When receiving 128
Bytes from the serial port, it will send data out at once. If the data package
received is below 128 Bytes, the module will wait for about 30 ms and then send it.
In order to send data immediately, 128 Bytes data per transmission is necessary.
After each transmission, module will be switched to receiver mode automatically.
The switch time is about 5ms. The LED for TX and RX indicates whether module
is currently receiving or transmitting data. The data sent is checked for CRC error
if any, the transmitter sends out data up to 15 times till data is correctly received.

2.3 Software Requirement

• C compiler
• Keil C51 compiler
2.4 Software Details

#include <dos.h>
#include <stdio.h>
#include <conio.h>

#define PORT1 0x3F8

/* Defines Serial Ports Base Address */


/* COM1 0x3F8 */
/* COM2 0x2F8 */
/* COM3 0x3E8 */
/* COM4 0x2E8 */

void main(void)
{
int c;
int ch;
outportb(PORT1 + 1 , 0); /* Turn off interrupts - Port1 */

/* PORT 1 - Communication Settings */

outportb(PORT1 + 3 , 0x80); /* SET DLAB ON */


outportb(PORT1 + 0 , 0x0c); /* Set Baud rate - Divisor Latch Low Byte */
/* Default 0x03 = 38,400 BPS */
/* 0x01 = 115,200 BPS */
/* 0x02 = 57,600 BPS */
/* 0x06 = 19,200 BPS */
/* 0x0C = 9,600 BPS */
/* 0x18 = 4,800 BPS */
/* 0x30 = 2,400 BPS */
outportb(PORT1 + 1 , 0x00); /* Set Baud rate - Divisor Latch High Byte */
outportb(PORT1 + 3 , 0x03); /* 8 Bits, No Parity, 1 Stop Bit */
outportb(PORT1 + 2 , 0xC7); /* FIFO Control Register */
outportb(PORT1 + 4 , 0x0B); /* Turn on DTR, RTS, and OUT2 */

printf("\nSample Comm's Program. Press ESC to quit \n");


do { c = inportb(PORT1 + 5); /* Check to see if char has been */
/* received. */
if (c & 1) {ch = inportb(PORT1); /* If so, then get Char */
printf("%c",ch);} /* Print Char to Screen */

if (kbhit()){ch = getch(); /* If key pressed, get Char */


outportb(PORT1, ch);} /* Send Char to Serial Port */

} while (ch !=27); /* Quit when ESC (ASC 27) is pressed */


}

Chapter 3.

Implementation
4.1 Block diagram

4.2 Circuit Diagram

PC AT
89C51
Chapter 4.

Working
PC to Master Microcontroller

The data to be transmitted is given as an input from the keyboard. The entered data
is then transmitted to master microcontroller (the controller connected to pc is here
defined as master microcontroller). The data transmission is in serial mode. PC
communicates via its serial port RS 232 to the microcontroller. Microcontroller not
being compatible to RS 232 voltage levels is connected to PC via a MAX 232 IC.

Master Microcontroller to Slave Microcontroller

The data is then transmitted from master microcontroller to slave microcontroller,


The serial mode of communication is used again to communicate between the
slave microcontroller and the RF modem but since the serial port of the master
controller is utilized with the PC so another microcontroller named as slave
microcontroller is used, whose serial port provides an output to RF modem. Its job
in the forward data propagation is to encrypt it using an encryption algorithm and
on receiving the data it runs a decryption algorithm to obtain the transmitted signal.
Master and slave microcontroller are connected to each other with the help of I2C
protocol.

I2C communication Procedure

• Two bus lines are required:

Serial data line (SDA) pin


Serial clock line (SCL) pin

• STEP 1:

Handshake signal

• STEP 2:
Data is transmitted when the Serial clock pulse is high.

• STEP 3:

Acknowledge signal.

Slave Microcontroller to RF Modem

The data is then transferred via serial port of slave Microcontroller to the RF
modem which then transmits the data using FSK modulation Technique.

Frequency-shift keying (FSK)

Frequency-shift keying (FSK) is a frequency modulation scheme in which digital


information is transmitted through discrete frequency changes of a carrier wave.
The simplest FSK is binary FSK (BFSK). BFSK literally implies using a couple of
discrete frequencies to transmit binary (0s and 1s) information. With this scheme,
the "1" is called the mark frequency and the "0" is called the space frequency.

Reception of Signal

The transmitted signal is received at receiving end by RF Modem which then


demodulates the signals and transfer it to slave microcontroller which decrypts it
and then send it to master microcontroller following the I2C protocol. The
controller then sends it to the RS232 port of PC which is then displayed on screen.

Chapter 5.

Microcontroller programming
Programming of controller connected to pc

org 00h

mov p1,#03h
mov p2,#00h
mov p3,#03h
mov p0,#00h
mov tmod,#20h
mov scon,#50h
mov th1,#-3
setb tr1

main: jb ri,pc_recv
jb p2.2,i2c_rec
sjmp main

trns_1: mov a,sbuf


clr ri
lcall delay_10mls
jb ri,rec_again
out: sjmp main

trn: mov sbuf,a


stay: jnb ti,stay
clr ti
ret

i2c_rec: setb p1.2


setb p1.1
sty: jnb p1.0,sty
mov a,#00h
mov r0,#08
st: jb p1.0,st
lcall delay_500us
mov c,p1.1
rlc a
djnz r0,st
mov sbuf,a
wait: jnb ti,wait
clr ti
clr p1.1
sjmp rf_rec

recv: mov a,sbuf


clr ri
cjne a,#0aah,next
ljmp main
next: mov 30h,a
lcall i2c_trnc
ljmp main

i2c_trnc:
setb p1.2
jnb p1.0,out
clr p1.0
lcall delay_500us
wit: jnb p1.2,wit
mov r0,#08
mov a,30h
con_i2c_tr:
rlc
setb p1.0
lcall delay_clk
mov p1.1,c
clr p1.0
lcall delay_clk
djnz r0,con_i2c_tr
sjmp main
delay:
mov r2,#100
here0: mov r3,#125
here: djnz r3,here
djnz r2,here0
ret

Programming of controller connected to other controller

org 00h
mov p1,#03h
mov p2,#00h
mov p3,#03h
mov p0,#00h
mov tmod,#20h
mov scon,#50h
mov th1,#-3
setb tr1

main:
clr p1.2
nop
jnb p1.0,i2c_rec

rf_rec: jb ri,rec
sjmp main

trns_1: mov a,sbuf


clr ri
cjne a,#0aah,out
lcall delay_10mls
jb ri,rec_again

out: sjmp main


trn: mov sbuf,a
stay: jnb ti,stay
clr ti
ret

i2c_rec:
setb p1.2
setb p1.1

sty: jnb p1.0,sty


mov a,#00h
mov r0,#08

st: jb p1.0,st
lcall delay_500us
mov c,p1.1
rlc a
djnz r0,st
mov sbuf,a

wait: jnb ti,wait


clr ti
clr p1.1
sjmp rf_rec

recv: mov a,sbuf


clr ri
cjne a,#0aah,next
ljmp main

next: mov 30h,a


lcall i2c_trnc
ljmp main

i2c_trnc:
setb p1.2
jnb p1.0,out
clr p1.0
lcall delay_500us
wit: jnb p1.2,wit
mov r0,#08
mov a,30h

con_i2c_tr:
rlc
setb p1.0
lcall delay_clk
mov p1.1,c
clr p1.0
lcall delay_clk
djnz r0,con_i2c_tr
sjmp main

delay:
mov r2,#100

here0:
mov r3,#125

here:
djnz r3,here
djnz r2,here0
ret

end

Chapter 6.
Conclusions

The project which we have designed is working properly. The utility of the project
lies in short range secured communication. The device can be used as an
alternative of wired network in offices, school and in all application which requires
the communication between two communicating nodes.

Appendix
Transistor BC547 datasheet

MAX 232 datasheet


RF Modem
Bibliography

1. The 8051 microcontroller and embedded system by Muhammad Ali Mazidi and
Janice Gillespie Mazidi.

2. Modern Digital and Analog communication system by B.P.Lathi

3. www.wikipedia.org

4. www.sunrom.com

5. www.alldatasheet.com

6. www.atmel.com