WIRELESS DATA ENCRYPTION AND DECRYPTION USING RADIO FREQUENCY
Project Supervisors: Professor Azhar Hussain Shah Assistant Professor Zulqarnain
Project Members: •
Syed Fahad Raza
Reg. No. L2F07BSEE0627
•
Awais Tanveer Khan
Reg. No. L2F07BSEE0623
•
Arsl Arslan an Saee Saeed d Khan Khan
Reg. Reg. No. No. L2 L2F0 F07B 7BSE SEE0 E063 630 0
Session 2007 FACULTY OF ENGINEERING UNIVERSITY OF CENTRAL PUNJAB LAHORE, PAKISTAN
1
WIRELESS DATA ENCRYPTION AND DECRYPTION USING RADIO FREQUENCY This project report is submitted to the faculty of engineering, University of Central Punjab, Lahore, Pakistan, for the partial fulfillment of requirements for the degree Of Bachelor of Science In Electrical Engineering
Approved on ________________
Internal Examiner:
(Project supervisor):
Sign: ________________________________
Name: Assistant Professor Zulqarnain
External Examiner:
Sign: _________________________ ____________ _________________ ____ Name: ____________________________
Session 2007 FACULTY OF ENGINEERING UNIVERSITY OF CENTRAL PUNJAB LAHORE, PAKISTAN
2
Acknowledgement:
Engineering is not only hard work and perseverance; it is imagination, motivation, dedication; it is keenness to learn and desire to excel; it is planning and managing; and above all it is activity with insight.
Planning is vital for any project. During our project we have suffe suffered red from from diffe differen rentt prob problem lemss in ou ourr proje project ct bu butt by the the grace grace of ALLAH ALMIGHTY, they were overcome and we have completed our project in time due to guidance and suggestions of our Project Supervisor Professor Azhar Hussain Shah who advised us in this project at each stage.
We would like to express our appreciation to Asst Prof. Zulqarnain, who guided us throughout the project.
Finally, we are also thankful to our Parents for their love, support and prayers without which we could not have put our best in the project.
3
Abstract: We have discussed in project the secures wireless communication in detail. This process is very useful in modern applications of wireless communication. First of all, we entered the message from keyboard. This message is encrypted and then it is transmitted transmitted using radio frequency transmitter. transmitter. The characters which are entered at the transmitter transmitter will also be displayed on the LCD for our convenience and so that we can enter our data in easier way. At the recei receive verr when when the the encry encrypt pted ed messa message ge is recei received ved then then this this messa message ge is decrypted by the microcontroller and is displayed on the LCD. Thee mode Th mode of commu communic nicati ation on that that we have have used used in our project project is simpl simplex ex data data transmission over radio frequency.
4
THESIS LAYOUT
This thesis consists of seven chapters. The detailed explanation about the chapters in this thesis is as follows:
Chapter 1:
Introduction of the project and an overview on Data Encryption and Decryption. Besides that, the BLOCK DIAGRAM of the project with explanation of each of its block, the scope of work, the utility and the objective of the project are also included in this chapter. Chapter 2:
Lite Literat ratur uree revie review: w: Th This is descr describ ibes es the diffe differen rentt types types of Data Data En Encry crypti ption on and and Decryption Techniques. Chapter 3:
Is about the details of all the experiments we did for our project:
Chapter 4:
Contains the design of our project. All the parts of the device are presented in detail. Illustr Illustrati ations ons are added added to improve improve reader’s reader’s understa understandin nding. g. That That includes includes;; Design Design Parameters, Requirements and Implementation. Chapter 5:
Presents the full project description and data in detail. Chapter 6:
Present Presentss the detail detail conclusi conclusion on on our project project,, the shot comings comings,, improve improvement ments, s, problem faced, problem resolved and further extensions of it. Chapter 7:
Future advancement in the projects.
5
Table of contents
1. Introduction:
8
1.0
Block Diagram.
10
1.1
Scope of work.
13
1.2
Utility.
13
1.3
Objective.
13 13
2. Literature Review:
14
2.0
Introduction to and Encryption and Decryption
15
2.1
Algorithms/techniques of Encryption and Decryption
16
2.2
Introduction to wireless Radio Modules
21
3. Experimentations:
25
Part 1: Exp#1 (selection of Encryption and Decryption algorithm)
26
Part 2: Exp#2 (selection (selection of radio modules)
31
Part 3: Exp#3 (input output devices)
35
4. Electrical Design
4.0
37
Function of each component. •
RF modules
•
Keyboard
•
LCD
•
Microcontrollers
6
5. Description Descriptio n of the project
49
6. Conclusion.
51
7. Future Advancement. Advancement.
53
REFERENCES
55
7
CHAPTER # 1 INTRODUCTION
8
1. Intr Introd oduc ucti tion on:: This This project project is about about the secure secure wireles wirelesss commun communicat ication ion over RF. The main advantage of this project is that the data cannot be received until and unless you don’t have receiver code that is compatible to transmitter. At the transmitter, keyboard will be attached to microcontroller which is used to input the message. This Th is messa message ge is encry encrypte pted d and then then it is trans transmi mitt tted ed using using radio radio frequ frequen ency cy transm transmit itter ter.. Th Thee data data whic which h will will be enter entered ed at the the transm transmitt itter er will will also also be displayed on LCD for convenient entry. At the receiving end when the encrypted encrypted message is received received then this message is decrypted by the microcontroller and is displayed on the LCD. The mode of communication that we have used in our project is radio frequency channel. In our project we have used two schemes of data encryption and decryption. One is the Monoalphabetic scheme and the other is Polyalphabetic scheme. The RF modules that we have used for data transmission and reception works at 433MHz.
6 . 3 v r e t t a B y
Voltage 9 Regulati on
Filtratio n
Fig. 1-1(a): Project’s (block diagram of transmitter)
10
Fig. 1-1(b): Project’s (block diagram of receiver)
11
Explanation of block diagram
Transmitter section Keyboard:-
The keyboard is used for giving the input. Here we have used a common computer keyboard through which data can be entered. Microcontroller:-
The data which is input through the keyboard is sent to the microcontroller. In this microcontroller the encryption program is implemented which encrypts the input data. RF encoder:-
When the microcontroller encrypts the data then it is sent to the RF encoder. It will create a secure single line data so that it can be transmitted easily through RF transmitter. LCD display:-
The data which entered from the keyboard will be shown on the LCD. RF transmitter:-
This RF transmitter is used to transmit the message which is encrypted.
Receiver section RF receiver:-
The RF receiver receives the encrypted signal/message and sends this to the RF decoder. RF decoder:-
It decodes the received signal and then sends it to the microcontroller for decryption. LCD:-
The message is then displayed on the LCD.
12
1.1
Scope of Work:
The wireless transmission of messages was not a big deal. In today’s era due to advanc advancem ement ent in commu communic nicat ation ion techn technolo ology gy securi security ty is a big issue issue.. If anyone anyone transmits a secret message over wireless, anyone can intercept that signal and can read it. Thus to overcome this problem we designed a communication device which not only can be used as a wireless paging system but it also ensures the security of the users information. The major area in our project is to encrypt the message according to a specific algorithm on the transmitter side and then send this message using RF transmitter. On the receiver side the message is decrypted and is displayed on the LCD.
1.2
Utility: This advanced and secured communication system can be used in different aspects. Following are the main areas where this system can be used: 1) It can be used used by the the security security agenci agencies es for commun communicat ication. ion. 2) It can can also also be used used by by the the polic police. e. 3) This system is of great importance for the politicians. They can send secret
messages.
1.3
Objective:
“The “The main main obje object ctiv ivee of this this proj projec ectt is to ensu ensure re secu securi rity ty alon along g with with bett better er communication.”
13
CHAPTER # 2 LITERATURE REVIEW
14
Literature Review By surfing surfing on interne internett and consulting consulting differen differentt book about how encryption encryption and decryption works and how the communication is done using RF modules. Following is the the lite litera ratur turee that that we revie reviewe wed d and and consul consulte ted d durin during g the imple impleme ment ntati ation on and designing our project. 2.0
Introduction To Encryption And Decryption
Cryptography is a process in which we convert a plain text or clear text message to cipher text message which is based on an algorithm that both sender and receiver know, and in this way the cipher text message can be obtained to its original form. In this way, a message cannot be read by anyone but the authorized receiver. The process of converting a plain message to its cipher text form is called enciphering. Reversing this process is known as deciphering. Enciphering and deciphering are other names of encryption and decryption. There are a number of methods used to perform encryption encryption and decryption. The most usable method uses a key. A key is a parameter of algorithm by which encryption and decrypt decryption ion takes takes place. place. Key-bas Key-based ed cryptog cryptograph raphic ic techniq techniques ues are divided divided into two methods: symmetric and asymmetric. In symmetric cryptography, same key is used for encryption and decryption. In asymmetric cryptography, one key is used for encryption and another for decryption.
Fig. 2-1
15
2.1 2.1
Algo Algori rith thms ms for for Enc Encry rypt ptio ion n and and Decr Decryp ypti tion on There are different classifications of cryptography algorithms. They will be listed on the basis of number of keys that will be used for encryption and decryption, and then they will be defined by their respective applications and uses. The following are the main algorithms that are used in cryptography.
· Secret Key Cryptography (SKC): It uses a a single key for both encryption and decryption. · Public Key Cryptography Cryptography (PKC): This one uses one key for encryption encryption and another for decryption · Hash Functions: Functions: In this type, a mathematical mathematical transformation transformation is employed employed to irreversibly "encrypt" information
Fig 2-2(Three types of cryptography: secret-key, public key, and hash function)
16
a) Symmet Symmetric ric Key Key Crypto Cryptogra graphy phy One of the very well known secret key cryptographic method is the Data Encryption Standard Standard (DES), (DES), published published by the National National Bureau Bureau of Standards, Standards, USA. DES is is the most widely used algorithm. It uses a length of fix bits, 56-bit key and an efficient method to quickly encrypt and decrypt the data which is entered through keyboard. It can be implemented very easily in hardware. In this way, the process of encryption and decryption takes less time. Generally, Generally, by increasing the size of the key will make our system more secure. Another type of DES, which is known as Triple-DES or DES-EDE, uses three applications of DES and two independent DES keys to produce the key of 168 bits.
b) Public/Pri Public/Private vate Key Cryptography Cryptography Asym Asymme metr tric ic key key cryp crypto togr grap aphy hy is used used to over overco come me the the prob proble lem m of the the key key management management by using different types of key pairs. If we know about one key, say the encry encrypt ption ion key, key, it is not suffici sufficien entt enoug enough h to determ determine ine the other other key i.e. i.e. the decryption key. So, the encryption key can be made public, provided the decryption key is held only by the party wishing to receive encrypted messages. Any user can use the public key to encrypt a message, but only the authorized recipient can decrypt it.
Fig 2-3 17
c) Hash Hash fu func ncti tion onss Hash Hash funct function ions,a s,are re chara characte cteriz rized ed and then then solved solved depend dependin ing g on their their abil abilit ity y to withstand an attack by an adversary. For example, suppose we have a message x, if this message is computationally not suitable to find a message y not equal to x such that H(x) H(x) = H(y) H(y) then we can say that H is weakly weakly collisi collision on free hash function function.. A proper collision free hash function H is that for which it is computationally not suitable to find out the two messages i.e. x and y such that H(x) = H(y).
Fig 2-4
18
Substitution Techniques In cryptography, there is a method known as substitution cipher by which the data that entered is replaced with cipher text according according to a system of the units. These units may be single letters or pairs of letters. They can also be of the type of the triplets of letters or the mixtures of the above. On the receiver side, all the action will be reversed. Broadly speaking all substitutions can be categorized in two groups, namely; a) Monoalphabetic substitution b) Polyalphabetic substitution
a) Monoal Monoalpha phabet betic ic substituti substitution: on:-In monoalphabetic monoalphabetic substitution, each plain text alphabet is replaced with same cipher text alphabet during encryption. Hence number of alphabets in plain text must be equal to number of alphabets in cipher text. . For a monoalp monoalphabe habetic tic cipher cipher which which is a simple simple rearrang rearrangeme ement nt of the 26 English English alphabet, we can generate as large as 26! = 403,291,461,126,605,635,584,000,000 ciph cipher er alph alphab abet ets. s. Each Each ciph cipher er alph alphab abet et is call called ed the the key. key. Appa Appare rent ntly ly such such rearrang rearrangeme ements nts can generate generate very large number of combina combination tionss or keys. keys. If the adve advers rsar ary y want wantss to decr decryp yptt our our mess messag age, e, know knowin ing g the the type type of subs substi titu tuti tion on (monoalphabetic substitution cipher) employed, then still he faces the problem of checking all the the possible keys. If If the adversary can can successfully successfully check one of these possible keys every second, then the time consumed in order to check all keys will be one billion times the lifetime of the universe which is very long time. However statistically monoalphabetic cipher can be solved in few minutes.
b) Polyalphabeti Polyalphabeticc substitution substitution::In this type of substitution, there will be the use of multiple substitution alphabets alphabets i.e. every plain text letter will be replaced replaced with new substitute for nnumber of times before the process starts to repeat itself. In other words we can say that the polyalphabetic substitution is more secure than than mono monoal alph phab abet etic ic subs substi titu tuti tion on.. Th This is is beca becaus usee in poly polyal alph phab abet etic ic substitution every alphabet is replaced with different alphabet. If the same alphabet is repeated in the world then both alphabets will be replaced with different alphabets and so it is more secure than monoalphabetic substitution.
19
20
2.2
Introdu oduction to to RF RF Mod Modu ules
RF modules are normally divided into three groups, RF transmitter and RF receiver module. There is another module known as RF transceiver module. Transmitter module is a electronic component using a variety of radio signals to remote control the target device which has a receiver module built-in. The remote distance can be very long and one does not need a line-of-sight remote controlling compared compared to remote controls using infrared technology. technology. RF modules are widely used in garage garage door openers, openers, wireles wirelesss alarm alarm system systems, s, industri industrial al remote remote control controlss and wireless home automation systems.
Fig 2-7 (RF transmitter and receiver)
21
RF signal modulation:-
Three types of signal modulation are commonly used in RF transmitter & receiver modules, which are as follows,
ASK
FSK
OOK
ASK (amplitude shift keying) Amplitude shift keying is a form of modulation of modulation in which digital data is transmitted as the variations in the amplitude of our carrier wave.
FSK (Frequency shift keying) Frequency Frequency shift keying is a frequency modulation modulation in which our digital data will be transmi transmitted tted
through through discret discretee frequen frequency cy changes changes of a carrier carrier wave. wave. The simple simplest st
frequency shift keying is the binary frequency shift keying which uses a pair of discrete frequencies to transmit binary information in the form of 0 or 1.
Fig 2-8 22
OOk (on off keying) On off keying keying is the simplest simplest form of amplitude amplitude shift keying keying in which which our data is is represented as the presence or absence of a carrier wave.
Main factors concerned in RF modules operating distance:Thee transm Th transmit itter ter power power:: the highe higherr power power will will result result in a furthe furtherr remote remote
distance, but also prone to cause interference with other RF devices. The receiver sensitivity: the higher receiver sensitivity will result in a further
remote distance, but also prone to cause malfunction due to interference with other RF devices. The antenna using: for example, a stretched antenna will increase the remote
distance. obstacles: the labeled remote distance is normally measured in open-air, line
of sight distance without any interferences, but often we will have obstacles such as walls, floors to greatly absorb the radio wave signals, so the remote distance will be much nearer
Typical Applications of RF modules
vehicle monitoring
remote control
telemetry
small-range wireless network
wireless meter reading
access control systems
wireless home security systems
area paging
industrial data acquisition system
radio tags reading
RF contactless smart cards 23
wireless data terminals
wireless fire protection systems
biological signal acquisition
hydrological hydrological and meteorological meteorological monitoring
robot remote control
wireless data transmissions
digital video/audio transmission
digital home automation, such as remote light/switch
Remote control and telemetry.
Alarm and wireless transmission transmission systems for various types types digital signal. signal.
Remote control of appliances and electronics electronics devices.
many other applications field related to RF wireless controlling.
24
CHAPTER # 3 EXPERIMENTATIONS
25
EXPERIMENTATIONS PART 1: Exp#1
To implement and design our project we performed different experiments. These experiments experiments were performed performed for the selection of different different Encryption and Decryption Decryption algorithms, RF modules and different electronic components for our project.
Selection of Encryption and Decryption algorithm:After a detailed review of many encryption and decryption schemes and performing series of experiments on these techniques we finalize the following two techniques for our project: a) Monoa Monoalph lphabe abeti ticc subst substit ituti ution on b) Polyal Polyalphab phabetic etic substit substitutio ution n
a) Monoal Monoalpha phabet betic ic substituti substitution: on:-In this technique we used a look up table for allocation of substitutes substitutes according to the following scheme. SMALL_ALPHABETS: Plain a b c d e f
Hex 21 H , 40 H , 23 H , 24 H , 25 H , 5EH,
Cipher ! @ # $ % ^ 26
g h i j k l m n o p q r s t u v w x y z
26 H , 2AH, 28 H , 29 H , 2DH, 5FH, 2BH, 3DH, 7EH, 27 H , 7BH, 7DH, 5BH, 5DH, 3AH, 3BH, 22 H , 27 H , 3EH, 3CH,
& * ( ) _ + = ~ ' { } [ ] : ; " ' > <
CAPITAL_ALPHABETS:
A B C D E F G H I J K L M N O P
3FH, 36 H , 2EH, 2FH, 7CH, 5CH, 20 H , 30 H , 61 H , 62 H , 63 H , 64 H , 65 H , 66 H , 67 H , 68 H ,
? 6 . / | \ (SPACE) 0 a b c d e f g h 27
Q R S T U V W X Y Z
69 H , 6AH, 6BH, 6cH, 6DH, 6EH, 6FH, 70 H , 71 H , 72 H ,
i j k l m n o p q r
NUMERIC_ALPHABETS:
0 1 2 3 4 5 6 7 8 9
73 H , 74 H , 75 H , 76 H , 77 H , 78 H , 79 H , 7AH, 41 H , 42 H ,
s t u v w x y z A B
28
b) Polyalphabeti Polyalphabeticc substitution substitution::We used the following formula for determining polyalphabetic substitution. A1 B2 C3 D4 E5 F6 G7 H8 I9
J 10 K 20 L 30 M 40 N 50 O 60 P 70 Q 80 R 90
S 1 00 T 200 U 300 V 400 W 500 500 X 60 0 Y 700 Z 80 0
a 10 00 b 200 2000 0 c 3000 000 d 4000 000 e 5000 000 f 6 00 0 g 7000 000 h 80 0 0 I 9 00 0
j 10000 s 100000 0 1000000 9 10000000 k 200 20000 00 t 200000 200000 1 200 200000 0000 0 10 200 200000 00000 00 l 3000 30000 0 u 300 300000 000 2 3000 300000 000 0 m 4000 40000 0 v 400000 0000 3 40000 00000 0 n 5000 50000 0 w 50000 00000 0 4 5000 500000 00 o 60000 x 600000 5 6000000 p 7000 70000 0 y 7000 700000 00 6 7000 700000 000 0 q 80000 z 800000 7 8000000 r 90 00 0 8 90 0 0 0 0 0
Then, the rule for encryption is this: a) If the plaintext and key letters are in the same column, they are added e.g.: B (2) + F (6) = H (8) L (30) + J (10) = M (40)
29
b) If the plaintext and key letters are in two different columns, their nonzero digits are added, and the letter located in the next column which contains neither key nor plaintext at the position corresponding to sum obtained is taken as substitute e.g.: D (4) + L (30) = Y (700) W (500) + K (20) = G (7000)
If we had a 27-letter alphabet, we would only have to add that when the sum is greater than 9, subtract 9 (in the appropriate digit place): M (40) + Q (80) = L (30)
For the 26-letter alphabet, it's easy to modify rule (a): if the two letters are in the third column, subtract 800 instead of 900. U (300) + Y (700) = T (200)
Rule (b) is modified in this way: always subtract 9; if the cipher letter and the key letter produce 900 as the result, use instead the letter that would be produced by enciphering a letter with the value 900 with the key letter. Note that same rules can be applied for the small alphabets and the numeric values by adding more 0s accordingly.
30
EXPERIMENTATIONS PART 2: Exp#2
Selection of RF Modules:We performed several experiments for the selection of RF modules. After reviewing several modules we finalize the following RF Modules. The main advantage of these modules is the operating frequency. These modules are operating at a frequency of 433MHz which publically available ISI frequency band. a) FS1000A 433 MHz Wireless Radio Transmitting Module b) PCR1A 433 MHz Wireless Radio Super regeneration Receiver Module
a) FS1000 FS1000A A 433 MHz Wirel Wireless ess Radio Transm Transmittin itting g Module Module This RF transmitter is used to transmit our data up to 100 meters. This wireless transmitter is suitable for short distances but its range can be affected by size of an antenna and voltage that is being applied.
Fig 3-1
31
Technical specifications:• • • •
Input supply (2.5 V to 12V) Easy to integrate (V+, GND and Data) Device will be in deep sleep mode when Data pin grounded Very small dimension
Operating Voltage
2.5 V to 12 V
Operating Current
4mA @ 5V, 15mA @ 9V
Quiescent Current
10uA
Operating Temperature
-10C - 60C
Modulation
ASK
Max. Data Rate
9.6K
Data Input
TTL
RF Power
20 mW@5V
32
b)
PCR1A 433 MHz Wireless Radio Super regeneration Receiver Module
This RF receiver can receive RF signal from any RF transmitter. transmitter. Its latest design has the capability to receive very weak signals.
Fig 3-2
Technical specifications • • • •
Low power consumption (4mA) Easy to integrate (V+, GND and Data) Super regeneration design Very small dimension
Operating Voltage Operating Current Operating Temperature Sensitivity Max. Data Rate Data Output
4.5V to 5.5V 4mA @ 5V -10C - 60C -105dBm 4.8K TTL
33
EXPERIMENTATIONS PART 3: Exp#3 Selection of input and output devices with different electronic components:In our experim experiment entss firstl firstly y we attac attach h a keyp keypad ad for the input input purpos purpose. e. But But afte after r reviewing reviewing our RF modules we decided to attach a computer keyboard to give an input to our system.
Fig 3-3
34
For the output device we decided to attach a 16x2 LCD with our system.
Fig 3-4 Handshaking problem:There There is a big problem problem that that should should be kept in our mind mind that all the RF component componentss transmits or receives data at 433 MHz. So, there should be a correct handshaking for correct correct communi communicati cation. on. Our device should should receive receive the data which is being being sent through our RF transmitter not from the other transmitter. This is the most important factor that should be taken into account. There should be the proper synchronization betwee between n our transmi transmitte tterr and receive receiver. r. Otherwi Otherwise se our communi communicati cation on will will not be efficient.
35
CHAPTER # 4 ELECTRICAL DESIGN
Electrical design 36
Our electrical design is based on certain things:
A) RF modu module less B) Micr Microco ocont ntrol roller lerss C) Key Keyboar board d D) LCD E) Powe Powerr supp supply ly F) Elec Electro tronic nic com compon ponen ents ts
a) RF modu module les: s:-The RF modules that we have used in our project are FS100A RF transmitter and PCR1A RF receiver. The technical specifications of these modules are as follows b) FS1000 FS1000A A 433 MHz MHz Wire Wireless less Radi Radio o Transm Transmitti itting ng Module Module c) PCR1A 433 MHz Wireless Radio Super regeneration Receiver Module
FS1000A 433 MHz Wireless Radio Transmitting Module This RF transmitter is used to transmit our data up to 100 meters. This wireless transmitter is suitable for short distances but its range can be effected by size of an antenna and voltage that is being applied.
37
Technical specifications:• • • •
Wide input supply (2.5 V to 12V) Easy to integrate (V+, GND and Data) Device in deep sleep mode when Data pin is grounded Very small dimension
Operating Voltage
2.5 V to 12 V
Operating Current
4mA @ 5V, 15mA @ 9V
Quiescent Current
10uA
Operating Temperature
-10C - 60C
Modulation
ASK
Max. Data Rate
9.6K
Data Input
TTL
RF Power
20 mW@5V
38
PCR1A 433 MHz Wireless Radio Super regeneration Receiver Module Technical specifications • • • •
Low power consumption (4mA) Easy to integrate (V+, GND and Data) Super regeneration design Very small dimension
Operating Voltage Operating Current Operating Temperature Sensitivity Max. Data Rate Data Output
4.5V to 5.5V 4mA @ 5V -10C - 60C -105dBm 4.8K TTL
B) Microcontrollers The microcontrollers that we have used for our project are:
1) AT89S52 2) AT89C2051
The description of these two microcontrollers is as follows: 1) AT89S52 This Atmel microcontroller AT89S52 has 8051 based Full Static CMOS CMOS controller, , 3 Timers/Counters, 8 Interrupts Sources, Watchdog Timer, 32 I/O lines, 8K Flash Memory, 256 Bytes On-chip RAM, , 2 DPTRs.
39
Fig 4-1
Features Compatible with MCS-51 Products 8K Bytes of In-System Reprogrammable Flash Memory 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 Programmable Serial Channel Low-power Idle and Power-down Modes 4.0V to 5.5V Operating Range Full Duplex UART Serial Channel Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode)
Pin Description
40
Pin Number
Description
1-8
P1.0 - P1.7 - Port 1
9
RST - Reset
10 - 17
P3.0 - P3.7 - Port 3
18
XTAL2 - Crystal
19
XTAL1 - Crystal
20
GND - Ground
21 - 28
P2.0 - P2.7 - Port 2
29
PSEN - Program Store Enable
30
ALE - Address Latch Enable
31
EA - External Access Enable
32 - 39
P0.7 - P0.1 - Port 0
40
Vcc - Positive Power Supply
2) AT80c T80c20 2051 51 The Atmel AT89C2051 is an 8051-based Fully Static 24MHz CMOS controller controller with 15 I/O Lines, 6 Interrupts/2 Priority Levels, Analog Comparator, UART, Two-level Program Memory Lock, 2K Bytes Flash Memory, 128 Bytes On-chip RAM, , 2 Timers/Counters, , LED Drive Outputs.
41
Fig 4-2
Features
Fig 4-3
42
C) Keyboard The keyboard that we have used in our design is ordinary computer keyboard.
Fig 4-4 Interfacing computer keyboard with microcontroller PC keyboard theory The keyboard that we are using is ordinary keyboard that we use in our daily life. What keys you have pressed or released. The scan codes tell you’re Keyboard Bios. Take for example the 'A' Key. The 'A' key has a scan code of 1C (hex). When you press the 'A' key, your keyboard will send 1C to its serial line If you still holding it, it will again send 1C and continue to send until u release the key that is to be located on your ordinary keyboard. When you release the key, then will also be sent some other code. For example you have pressed and released A key again, when released, the keyboard will send another code of F0 (hex) to confirm that the key which is being pressed is now released.
The keyboard has a code for specific key. No matter you have pressed the shift key or not. It will still send the same code. The keyboard BIOS will decide that which action should takes place. Keyboard does not process whether NUM, SCROOL or CAPS key is pressed. If you pressed NUM, CAPS or SCROLL key then it is up to the BIOS of your keyboard to turn ON the LED of CAPS, NUM or SCROLL key to tell whether the key is pressed or not.
43
Keyboards connector Our Our person personal al comput computer er conne connect cted ed with with extern external al device device using using four four wires wires.. Th Thee description of these wires is as under 1.KBD 2.GND 3.KBD 4.NC 5.+5V 6.NC
1.KBD Clock 2.KBD Data 3.N/C 4.GND 5.+5V (VCC)
Clock D a ta (VCC)
Fig 4-5
In some cases there is also present a fifth wire. This wire is used to RESET the keyboard but this wire is not required in modern keyboards. The KBD Clock and DATA pins are bidirectional.
The keyboards protocol As we have discussed earlier that personal computer uses bidirectional protocol. The keyboard will send data to external device and device will sent back the data to the keyboa keyboard. rd. Th Thee Host Host has the the ulti ultima mate te priori priority ty over over direc directi tion. on. It can at anytim anytimee (although the not recommended) send a command to the keyboard. It is up to the keyboard to send data when both the KBD Data and KBD Clock lines are high (Idle). We can use KBD Clock line if we want to Clear the Send line. If the host observes that KBD Clock line is low, the keyboard will buffer any data until the KBD Clock is released. The keyboard will prepare to accept a command from the host. If the Host takes the KBD Data line low, then the data will transmitted in forward direction. direction. i.e. Keyboard Keyboard to Host and this will done with a frame which which consist of 11 bits. The first bit is a Start Bit (Logic 0) followed by 8 data bits (LSB First), one Parity Bit (Odd Parity) and a Stop Bit (Logic 1). Each bit should be read on the falling edge of the clock.
44
Fig 4-6 Serial Communication Keyboard to Host
Above waveform is showing transmission of data which is of 8 bits. The keyboard may not generally change its data line on the rising edge of the clock as shown in the diagram. diagram. On the falling edge of the clock the data line only has to be valid. The clock will be generated through keyboard. The frequency of the clock pulse ranges from 20khz to 30 KHz. The LSB will always be sent first.
Fig 4-7
Liquid crystal Display 45
For the display purpose we have used two 16x2 LCD. One for the transmitter side and the other for receiver section.
Fig 4-8 Interfacing LCD with microcontroller A 16x2 LCD means it can display 16 characters characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers.
1.
Command/Instruction Register - stores the command instructions given to the
LCD. A command is an instruction given to LCD to do a predefined task like initializing, clearing the screen, setting the cursor position, controlling display etc.
2.
Data Register - stores the data to be displayed on the LCD. The data is the
ASCII value of the character to be displayed on the LCD.
Programming the LCD:
46
1.
Dataa pin8 Dat pin8 (DB7) (DB7) of the LCD LCD is is busy fla flag g and is is read read when when R/W = 1 & RS RS = 0. When busy flag=1, it means that LCD is not ready to accept data since it is busy with the internal operations. Therefore before passing any data to LCD, its command register should be read and busy flag should be checked.
2.
To send send data data on the LCD, LCD, data is first first writ written ten to the data data pins pins with with R/W R/W = 0 (to specify the write operation) and RS = 1 (to select the data register). A high to low pulse is given at EN pin when data is sent. Each write operation is performed on the positive edge of the Enable signal.
3.
To send send a comman command d on the LCD, LCD, a particular particular command is first first specifie specified d to the data data pins with R/W = 0 (to specify the write operation) and RS = 0 (to select the command register). A high to low pulse is given at EN pin when data is sent.
Power supply We required power supplies to convert high voltage alternating current to low voltage supply for appliances appliances and other electroni electronicc devices. A power supply supply can split split up into into number of section so that each performs its particular job.
Electronic components The electronic components used in power supply are
Resistors
Capacitors
Switches
Variable resistance
LCD connector
Keyboard connector 47
CHAPTER # 5 DESCRIPTION OF PROJECT
48
Project Description: There is a detailed description in this project about secured wireless communication. This means that our data which is to be sent through wireless medium should be safe. At the transmitter there is attached a keyboard which is used to input our message. This message will be encrypted and then transmitted through RF transmitter. These characters which are to be transmitted will also be displayed on the LCD which is attached to microcontroller. At the receiver end when the encrypted message is received then this message is decrypted by the microcontroller and is displayed on the LCD. The mode of communication that we have used in our project is radio frequency.
Transmitter section The input is given to the system using computer computer keyboard. The input that is entered is also displayed on the LCD. This input is fed into the 80S52 microcontroller. In this microcontroller microcontroller the message which being entered is encrypted according to a specific algorithm. After this it is encoded using RF encoder and finally this encoded signal is sent to the RF transmitter which transmits that message.
Receiver section In the receiver section RF receiver receives the encrypted message and then sends this message to the RF decoder. After decoding that signals the RF decoder then send this signal to the microcontroller which decrypts that message and finally that message is displayed on the LCD.
49
CHAPTER # 6 CONCLUSION
50
Conclusion After so much work out on this project, we finally got our devices work in the way that we specified. It is able to send or receive messages and handle all handshaking problems and errors generated. The data is sent from the transmitter after encryption and at the receiving device the data is decrypted according to the specific algorithm. If we were given this project again, we will definitely definitely search the transmitting transmitting and receiving modules which operates at different frequencies. This would simplify simplify our the logic and the state transition transition of the project because because we will get rid of handshaking problems and errors. We will will also make a chang changee so that that our device device can commu communic nicate ate with with multiple devices. This should not be too difficult but we have to program the target’s identification number. In this way only our desired target will only pick up the transmission.
51
CHAPTER # 7 FUTURE ADVANCEMENT
Future Advancement: This project can be modified in many ways. Some of the additional features that can be added to this project are:
The project that we have designed is based on simplex communication communication.. It can be enhanced to a duplex mode of communication. 52
A proper key management scheme for the encryption and decryption processes can also be implemented on this project to ensure more data security.
This project can also be implemented using long range RF modules.
This device is only a secure text terminal capable of transmitting alphabets and characters. It can be upgraded as data encryption unit capable of transmitting any any data data such such as image imagess and audio audio conte contents nts etc etc secur securely ely,, over over wirel wireless ess channel..
Instead of present one to one communication protocol the device can be enhanced for working with other devices in a local area network..
53
REFERENCES
Websites:
Last accessed
http://www.mcustudy.com/mcu/Interfacing_AT_keyb
20-11-2010
http://en.wikipedia.org/wiki/Rf_module
17-10-2010
http://www.garykessler.net/library/crypto.html
09-11-2010
http://www.robotshop.com/content/PDF/details-de... http://www.robotshop.com/content/PDF/details-de ...
27-11-2010
http://www.answers.com/topic/cryptography-1
02-12-2010
http://www.scribd.com/doc/29695569/Chapter-1
16-12-2010
http://www.ananiahelectronics.com/FS100A.htm
07-01-2011
http://www.vectorsite.net/ttcodep.html
29-01-2011
http://jap.hu/electronic/codec-v4.0.html
20-02-2011
http://www.gnupg.org/gph/en/manual.html
29-02-2011
http://www.ecoustics.com/electronics/forum/home... http://www.ecoustics.com/electronics/forum/home ...
21-03-2011
http://www.scribd.com/doc/60434385/4/ACKNOWLEDG... http://www.scribd.com/doc/60434385/4/ACKNOWLEDG ...
06-04-2011
http://en.wikipedia.org/wiki/Substitution_cipher
15-02-2011
http://www.scribd.com/doc/48050484/Code-Book
04-06-2011
http://en.wikipedia.org/wiki/Frequency-shift_ke... http://en.wikipedia.org/wiki/Frequency-shift_ke ...
11-05-2011
http://www.security.iitk.ac.in/contents/publica... http://www.security.iitk.ac.in/contents/publica ...
16-04-2011
54