Beruflich Dokumente
Kultur Dokumente
ABSTRACT
Wireless sensor networks are one of the highly emerging areas and found really useful in
environmental studies and military applications. In sensor networks a set of nodes randomly
deployed communicate through wireless links and provide the information as on when required.
Since these nodes run with little power mostly running with batteries the hardware and software
must be designed appropriately.
This gives importance for less weight and secure encryption and decryption algorithms
especially for defense applications. The Tiny Encryption Algorithm (TEA) is becoming very useful
in this context. TEA is a preferred choice due to its low memory and less hardware requirements in
these applications. It was designed by David Wheeler and Roger Needham of the Cambridge
Computer Laboratory, and first presented at the Fast Software Encryption workshop in 1994.
TEA is a 64-bit block network with a 128-bit key and a suggested 64 rounds. In this project
TEA is implemented for 434 MHz Amplitude shift keying based wireless link. The wireless link
will be designed and will be implemented with TLP434A transmitter and RLP434A receiver
circuit. Two Philips 89C51 microcontrollers (8051 architecture) will be used for interfacing with
the transmitter and receiver chips at the two ends of communication. The TEA encryption
algorithm will be developed on transmitter and decryption algorithm will be developed on receiver
side.
B.V.R.I.T. Page 1
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
INDEX
Introduction 9
1. Introduction
10
1.1 Context of the project 10
1.2 Block diagram 11
1.3 Project Study 11
1.4 Basic principle 12
2. Tools and hardware 12
3. Motivation 12
4. State of the Art 13
Chapter 1: Encryption 14
B.V.R.I.T. Page 2
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Chapter 4: Sensors 57
4.1 Sensors 58
4.1.1 Types 58
4.1.2 Classification of measurement errors 59
4.1.3 Resolution 59
4.2 Temperature Sensor 60
4.2.1 Features 60
B.V.R.I.T. Page 3
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
4.2.2 Description 60
4.2.3 Overview 61
4.2.4 Operation-Measuring Temperature 63
4.2.5 Operation Alarm Signaling 64
4.2.6 Memory 65
4.2.7 CRC Generation 66
4.2.8 1-Wire Bus System 67
4.2.9 Transaction Sequence 67
4.2.10 1-Wire Signaling 68
Chapter 5: Transceiver 69
5.1 General Description 70
5.1.1 Features 70
5.1.2 Applications 70
5.1.3 Mechanical Appearance 71
5.1.4 Pin Definition 71
5.2 Module Application 72
B.V.R.I.T. Page 4
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Chapter 7: Implementation 82
7.1 Data Transmission 83
7.1.1 Program for Data Transmission 83
7.2 Data Reception 89
7.2.1 Program for Data Reception 89
Chapter 8: Results and Conclusion 94
8.1 Results 95
8.2 Applications 98
8.3 Advantages 98
8.4 Disadvantages 99
8.5 Conclusion 99
8.6 Contributions of the Project 99
8.7 Future Work 99
References: 101
Appendix: 102
A. Interfacing TX8 with PSoC Micro Controller 103
B.Interfacing RX8 with PSoC Micro Controller 104
C. Interfacing Temperature Sensor with PSoC Micro Controller 105
B.V.R.I.T. Page 5
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
List of Figures
Figure 1.1: Block Diagram of Existing Model using 89C51 Micro Controller 16
B.V.R.I.T. Page 6
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
List of Figures
B.V.R.I.T. Page 7
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
List of Tables
B.V.R.I.T. Page 8
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Introduction
1. Introduction
1.1 Context of the project
1.2 Block diagram
1.3 Project Study
1.4 Basic principle
2. Tools and hardware
3. Motivation
4. State of the Art
B.V.R.I.T. Page 9
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
1. Introduction:
Many symmetric block ciphers have been presented in recent years. The Tiny Encryption
Algorithm (TEA) (Wheeler et al., 1994) is a compromise for safety, ease of implementation, lack
of specialized tables, and reasonable performance. TEA can replace 1 DES in software, and is short
enough to integrate into almost any program on any computer. Some attempts have been made to
find weakness of the Tiny Encryption Algorithm. The motivation of this project is to study and
implement the proposed algorithm.
When the physical quantities like temperature, humidity, pressure etc.. are sensed by the
sensors, this data should be transmitted to the other side wirelessly. Here, we encounter with the
problems like security issues.
So, to over these issues the data should be encrypted to provide security for secret data.
Here, in this project we implement Tiny Encryption Algorithm (TEA) at the either nodes.
B.V.R.I.T. Page 10
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
PSoC PC
Microcontroller
B.V.R.I.T. Page 11
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
UART
Micro controller is interfaced with sensors. PSoC controller is programmed with the Tiny
Encryption Algorithm. The sensor information processed by the controller can be rooted to the
other nodes by power on controller sends the data to the other nodes.The encrypted data as well as
the actual data can be displayed on LCD simultaneously.
B.V.R.I.T. Page 12
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The following are the software tools used in the project. PSoC Designer suite, from
Cypress Semiconductors, for building and configuring the required blocks and to develop the code.
PSoC programmer, to dump the code on the Microcontroller.
The following are the hardware modules used in the project development.
PSoC microcontroller,
Temperature sensors,
Transceivers,
LCDs.
3. Motivation:
Cryptography is the art and science behind the principles, means, and methods for keeping
messages secure. Cryptanalysis is a study of how to compromise (defeat) cryptographic
mechanism. There are two classes of key-based encryption algorithms: symmetric (or
B.V.R.I.T. Page 13
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
secret-key) and asymmetric (or public-key) algorithms. Symmetric algorithms use the same
key for encryption and decryption, whereas asymmetric algorithms use different keys for
encryption and decryption. Ideally it is infeasible to compute the decryption key from the
encryption key.
Symmetric algorithms can be divided into stream ciphers and block ciphers. Stream ciphers
encrypt a single bit of plain text at a time, whereas block ciphers take a number of bits (say
64 bits), and encrypt them as a single unit. Symmetric encryption is the backbone of many
secure communication systems. Dozens of symmetric algorithms have been invented and
implemented, both in hardware and software.
B.V.R.I.T. Page 14
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
CHAPTER 1
Encryption
B.V.R.I.T. Page 15
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
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.
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.
In recent years, a controversy has arisen over so-called strong encryption. This refers to
ciphers that are essentially unbreakable without the decryption keys. While most companies and
their customers view it as a means of keeping secrets and minimizing fraud, some governments
view strong encryption as a potential vehicle by which terrorists might evade authorities. These
B.V.R.I.T. Page 16
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
governments, including that of the United States, want to set up a key-escrow arrangement. This
means everyone who uses a cipher would be required to provide the government with a copy of the
key. Decryption keys would be stored in a supposedly secure place, used only by authorities, and
used only if backed up by a court order. Opponents of this scheme argue that criminals could hack
into the key-escrow database and illegally obtain, steal, or alter the keys. Supporters claim that
while this is a possibility, implementing the key escrow scheme would be better than doing nothing
to prevent criminals from freely using encryption/decryption.
In the earlier days, the wireless communication link was developed using 89C51 Micro
Controller. But, this micro controller needed extra peripherals like ADCs, filters, amplifiers etc..
More over, it is not programmable and it occupies very large space. The other reason for not going
for microcontroller is that the code for implementation is very large. So, it is very complex and
cant be understood easily.
Here, we are introducing PSoC Micro Controller which has programmable analog and
digital blocks and it needs minimal code for implementation. In sensor networks a set of nodes
randomly deployed communicate through wireless links and provide the information as on when
required. Since these nodes run with little power (mostly running with batteries), the hardware and
software must be designed appropriately.
This gives importance for less weight and secure encryption and decryption algorithms
especially for defense applications. The Tiny Encryption Algorithm (TEA) is becoming very useful
in this context. TEA is a preferred choice due to its low memory and less hardware requirements in
these applications. It was designed by David Wheeler and Roger Needham of the Cambridge
Computer Laboratory, and first presented at the Fast Software Encryption workshop in 1994.
B.V.R.I.T. Page 17
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
When developing more complex projects, there is often a need for additional peripheral
units, such as operational and instrument amplifiers, filters, timers, digital logic circuits, AD and
DA converters, etc. As a general rule, implementation of the extra peripherals brings in additional
difficulties: new components take space, require additional attention during production of a printed
circuit board, and increase power consumption. All of these factors can significantly affect the
price and development cycle of the project.
The introduction of PSoC microcontrollers has made many engineers dream come true of
having all their project needs covered in one chip.
B.V.R.I.T. Page 18
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
MAC unit, hardware 8x8 multiplication, with result stored in 32-bit accumulator,
Changeable working voltage, 3.3V or 5V,
B.V.R.I.T. Page 19
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Option for programming only the specified memory regions and write protection,
For every pin there is an option of Pull up, Pull down, High Z, Strong, or Open pin state,
B.V.R.I.T. Page 20
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Perhaps the best way to recognize the true value of PSoC microcontrollers is through
comparison with other options.
B.V.R.I.T. Page 21
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Having the advantage of changeable working voltage doesnt really need a comment. This
feature is particularly important for development of new devices as it eliminates the need
for redesigning the PCB and implementing the level translator;
Option for low voltage supply (~1V) is a tremendous advantage in battery operated
systems;
Timers, counters, and PWM units are more flexible than the usual implementation;
In case you need a larger array of components, there is an option for dynamic
reconfiguration, allowing you to change peripherals during run-time. In this way, its
possible to minimize the processor workload at an time, leaving the largest part of the job
to the specialized hardware.
On the other hand, there are certain limitations of PSoC that could influence the choice of
microcontroller for the design.
In systems which require highly precise or fast measurement, problems may occur
with analog device characteristics. In this case, you should analyze if speed of AD
converters and offset/noise of analog amplifiers are able to satisfy the project
demands.
Analog components do not have the ability to work with usual negative supply
voltage. For example, zero voltage for inverting amplifiers is taken to be the analog
ground AGND (usually 2.5V). All voltages above AGND are taken as positive,
while voltages below AGND are taken as negative.
B.V.R.I.T. Page 22
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Most PSoC microcontrollers have 256 bytes of RAM, which could prove to be
insufficient for some projects.
CHAPTER 2
PSoC Microcontroller
B.V.R.I.T. Page 23
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
This section provides an introduction to most common word in the embedded system
microcontroller. It is written to familiarize you with microcontroller terminology and basic
microcontroller architecture.
Its hard to imagine the present world of electronic tools and toys without the
microprocessor or Microcontroller. Yet this single chip wonder has barely reached thirtieth
birthday. In 1971 Intel corporation introduced the 8080, the first successful microprocessor.
Shortly thereafter, Motorola, RCA and then MOS technology and Zilog introduced similar devices:
the 6800, 1801, 6502 and Z80 respectively. Alone these integrated circuits (ICs) were rather
helpless (and they remain so); but as a part of a single board computer (SBC) they become the
central component in useful products for learning and designing with microprocessors. These
SBCs of which SDK-85 by Intel etc. Are the most memorable, quickly found their way into design
labs at colleges, universities and electronics companies.
A microcontroller is a single chip, self-contained computer which incorporates all the basic
components of a personal computer on a much smaller scale. Microcontrollers are often referred to
as single chip devices or single chip computers. The main consequence of the microcontrollers
B.V.R.I.T. Page 24
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
small size is that its resources are far more limited than those of a desktop personal computer. In
functional terms, a microcontroller is a programmable single chip which controls a process or
system.
Microcontrollers are typically used as embedded controllers where they control part of a
larger system such as an appliance, automobile, scientific instrument or a computer peripheral.
Microcontrollers are designed to be low cost solutions; therefore using them can drastically reduce
part and design costs for a project. Physically, a microcontroller is an integrated circuit with pins
along each side. The pins presented by a microcontroller are used for power, ground, oscillator, I/O
ports, interrupt request signals, reset and control. In contrast, the pins exposed by a microprocessor
are most often memory bus signals (rather than I/O ports).
The target platform is the platform on which the finished program will be run. For example,
consider a developer who is creating a program for a 8051 microcontroller. The developer writes,
edits, and tests the program on a Pentium personal computer the development platform. The
developer will use software which runs on a Pentium but whose target device is the 8051. When
the program is ready it is programmed in the target platform, the 8051.
B.V.R.I.T. Page 25
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Microcontrollers do not function in isolation. As their name suggests they are designed to
control other devices. The microcontroller can accept inputs from some devices and provide
outputs to other devices within any given system. For example, a microcontroller may accept input
from a switch and may send output to an LED. If the switch is pressed the microcontroller can be
instructed to illuminate the LED. The microcontroller is often part of a larger system. For example,
the switch and LED may be part of a compact disc player in a car stereo system. When a
microcontroller is part of a larger system it is often referred to as an embedded controller because
it is embedded within the larger system.
B.V.R.I.T. Page 26
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
2.2.1 Introduction:
When developing more complex projects, there is often a need for additional
peripheral units, such as operational and instrument amplifiers, filters, timers, digital logic
circuits, AD and DA convertors, etc. As a general rule, implementation of the extra
peripherals brings in additional difficulties: new components take space, require additional
attention during production of a printed circuit board, and increase power consumption. All
of these factors can significantly affect the price and development cycle of the project.
The introduction of PSoC microcontrollers has made many engineers dream come
true of having all their project needs covered in one chip.
There are a number of different PSoC families you can base your project upon,
depending on the project requirements. Basic difference between PSoC families is the
number of available programmable blocks and the number of input/output pins.
B.V.R.I.T. Page 27
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
PSoC microcontrollers are based on 8-bit CISC architecture. Their general structure
with basic blocks is presented in the following image:
CPU unit is the main part of a microcontroller whose purpose is to execute program
instructions and control workflow of other blocks.
B.V.R.I.T. Page 28
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Sleep timer can periodically wake up microcontroller from power saving modes. It
could be also used as a regular timer.
Input-Output pins enable communication between the CPU unit, digital and analog
programmable blocks and outside world.
Voltage reference is vital for the work of analog components that reside inside of
analog programmable blocks.
SMP is a system which can be used as a part of a voltage regulator. For example, it
is possible to supply power to a PSoC microcontroller from a single 1.5V battery.
B.V.R.I.T. Page 29
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 30
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
SYSCLK is the main internal clock signal with a speed of 24MHz. It is used as a
reference clock for most of other signals.
24V1 is a signal derived by dividing frequency SYSCLK with parameter N1, which
varies in range from 1 to 16. 24V1 frequency equals SYSCLK/N1, with a frequency from
1.5MHz (N1=16) to 24MHz (N1=1).
24V2 is a signal derived by dividing 24MHz frequency with parameter N1, which
varies in range between 1 and 16. 24V2 signal frequency equals SYSCLK/N1N2., which
means that possible frequency ranges from 93.75kHz (N1, N2=16) to 24MHz (N1,N2=1).
24V3 signal is derived by dividing frequency of one of the signals 24V2, 24V1,
SYSCLK or SYSCLKx2, with number N, in the range from 1 to 256.
CPU_CLK is used as a CPU unit frequency which has a direct impact on instruction
execution speed. CPU_CLK can have any of eight frequencies that are in range from
93.75MHz to 24MHz. Frequency 24V1, 24V2, 24V3 and CPUCLK selection is done
easily, by setting appropriate parameters in Device Editor or during program runtime by
selecting three lower bits of OSCCR0 register.
B.V.R.I.T. Page 31
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
mean better overall performances. Main disadvantage in raising the frequency is its
unwanted affect on microcontroller power consumption, which is one of the main problems
it the case of battery supply. Other disadvantage of higher frequency is more intensive
generation of electromagnetic interference, which may affect on surrounding devices.
Because of these problems general rule should be applied, which says that lowest possible
satisfactory frequency should be used. Default value of PSoC microcontroller signal
frequency is 3MHz, which is a compromise between speed and consumption.
Connection between PSoC microcontrollers with an outside world is achieved over input-
output pins. Eight pin groups which could be accessed simultaneously are parts of one port.
Although port number differs from the type of the microcontroller, write and read operations are
done in the same way in any case. Port access registers are stored inside of register address space
noted as PRT0DR, PRT1DR, PRT2DR, PRT3DR, PRT4DR or PRT5DR.
B.V.R.I.T. Page 32
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Writing to port Writing value to PRTxDR initializes register which through init
circuit drives the state of pins. Init circuit can pass the signal from PRTxDR register
directly (strong), over pull-up or pull-down resistors or through open drain output. Beside
that, there is a possibility to isolate value of register from pin state (Hi-Z).
Reading port Reading value from address PRTxDR digital state of voltage on pins
is stored to register A. In case that voltage is dictated by some external device, read value
could differ from voltage on PRTxDR register.
Drive Mode Selection of the way in which init register PRTxDR is connected to
pins can be set inside of Device Editor or during runtime initializing registers PRTxDM2,
PRTxDM1 and PRTxDM0. There is eight methods to initialize pins in total, which enables
connection to different types of devices, with considerate smaller amount of external
components. Pin work modes are defined according to the following table depending on
contents of appropriate bit from registers DM2, DM1 and DM0.
B.V.R.I.T. Page 33
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Strong mode is used when it is needed to connect the state on PRTxDR register
directly to pins. This way of connection is applied when pin is used as an input.
Analog Hi-Z mode is used when connecting analog signals, like AD converter
input. In this case, all internal connections between PRTxDR register and pin are
disconnected, so not to interfere with value of brought voltage.
Pull-up or pull-down resistors are used when connecting with buttons or some
other devices which demand this type of components. These resistors are defining the state
on input when button is not pushed.
Open drain mode is used when it is needed to bring several devices to the same
line, when it is needed to add one external pull-up or pull-down resistor. This mode is
convenient for realization of a line which signals if there has been a mistake to one of the
microcontrollers.
B.V.R.I.T. Page 34
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Digital components, which are stored inside of programmable blocks, arent connected
directly to input or output pins. It is done in a way shown on following picture, which depicts
group of four digital programmable blocks. As it could be seen, pin connection is established using
global connection lines, multiplexer and lines of programmable blocks. PSoC microcontrollers can
have one, two or four digital programmable block groups like this one depending on their family.
Inside of digital programmable blocks user can configure components like timers, counters,
PWM, PRS, CRC generators and devices for SPI, IrDA and UART communication, which enables
custom hardware adjustment of the system for specific uses. The process of setting and connecting
using PSoC Designer is very simple to understand, but at first is necessary to understand the way
those components function. Most components, like counters, PRS and CRC generators can be
stored inside of any free block. On the other side, communication components like Rx, TX, UART
and SPI can be set on the right side of the programmable blocks.
B.V.R.I.T. Page 35
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The number of necessary blocks which are used for component configuration shown in the table:
B.V.R.I.T. Page 36
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
4 Counter32, Timer32
I2C Controller I2C controller implements hardware serial I2C communication, and in
that way minimizes usage of CPU units resources. Most important operations of I2C controller
are:
Master or Slave, sending or receiving data
Byte level data processing
B.V.R.I.T. Page 37
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Program memory is the part of ROM, which is used for storing program code,
which is written in this part of memory written by programming hardware. Program
memory is implemented in FLASH technology, which allows simple development time
change of the program inside of microcontroller. Program memory size depends on the
family of PSoC microcontrollers and is 2, 4, 8, 16 and 32 kB.
RAM enables storing of variables and stack which are used during work of
microcontroller. Size of RAM, in most PSoC microcontrollers, is 256 bytes
B.V.R.I.T. Page 38
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Register address space contains registers used for peripheral's global parameters
and programmable blocks of a PSoC microcontroller. PSoC microcontrollers have 512
registers, which are grouped in two 256 bytes banks.
2.8PSoC Designer:
2.8.1. Introduction:
PSoC Designer is program package that leads user through all stages of developing
project. Version discussed here will be 4.2, but this book will still remain competent in case of
newer versions, because differences are shown only in addition of new programmable
components and some minor improvements. The most important for user is to get familiar with
two main parts of PSoC Designer:
Device Editor
Application Editor
B.V.R.I.T. Page 39
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The rest of the window offers some other useful information. Resource Meter
shows how much space is left for new programmable blocks.
Previously selected components are still unusable, until they are placed in digital or
analog programmable blocks, and until appropriate parameters are set. This important part
of work can be done in Interconnection View window.
B.V.R.I.T. Page 40
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
On the upper left side can be found Global Resources window. It is used for general
parameters selection. This method of setting is similar to configuration words on other
microcontrollers, but with more versatility.
B.V.R.I.T. Page 41
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Lower left side holds pin parameter options. In order to protect external devices
from unexpected signals, default pin state of PSoC microcontrollers is Analog Hi-Z, in
which microcontroller cannot change pin states. Pin drive mode selection can be done
graphically by selecting appropriate parameters in column Drive or software by setting
appropriate registers.
B.V.R.I.T. Page 42
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
For start, the most important thing is to get to know the basic elements of
programmable blocks. Digital blocks are grouped in two entireties of four blocks, as shown
on picture.
Analog blocks are placed on lower side of the graphic part of the window. Four
analog columns and several multiplexers can be noticed. In every of columns, upper block
ACB is used for analog amplifiers realization, while lower two are used for AD and DA
convertors. Routing is done graphically, by connecting frequency signal, and input signal to
B.V.R.I.T. Page 43
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Application Editor is used for writing programs, which can be done using assembly
or C. Application Editor itself, bears much resemblance to IDE-s of other standard 8-bit
microcontrollers. Left side window holds list of files that are contained in current project.
Most important file for users is called main.
B.V.R.I.T. Page 44
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 45
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
CHAPTER 3
Over the years, microcontrollers have become highly integrated and have begun to
offer a large portfolio of peripherals. In many implementations, various features present on
the microcontroller are seldom or never used. For example in the case of a smoke detector, a
microcontroller might be using an ADC to monitor the ionization chamber but resources like
timers and communication interfaces are not being used. Also, in the event of a fire, after the
smoke causes a reduction in voltage output from the ionization chamber, the microcontroller
B.V.R.I.T. Page 46
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
does not need to use the ADC resource anymore but instead requires a PWM output to the
speaker system to issue an alarm. A microcontroller will need to have both, an ADC and a
PWM to allow the smoke detector to scream at the appropriate time, but is only using one or
the other and wasting many more.
In some other designs, a certain set of modules are used only when an exception
occurs. The controller in an emergency lighting system needs modules to run routines to
charge the battery, while constantly monitoring to see if a power failure occurred. Once the
power failure does occur, the modules responsible for charging the battery take the shape of
modules that deliver the right amount of current to the LEDs.
Some of the important user modules that are present in the PSoC are different types of
ADC, different versions of amplifiers, different versions of counters, digital to analog converters,
filters, multiplexers, pulse width modulators, internal temperature sensor, timers.
The user modules that we are going to use in our project are:
Uses the industry standard Hitachi HD44780 LCD display driver chip protocol,
B.V.R.I.T. Page 47
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The LCD Tool Box User Module is a set of library routines that writes text strings
and formatted numbers to a common two- or four-line LCD module. This library uses the
4-bit interface mode to limit the number of I/O pins required.
b) Functional Description:
The LCD User Module uses a single I/O port to interface to an industry standard
Hitachi HD44780A LCD controller. This type of display has a simple interface consisting of 8
data bits, read/write (R/W), register select "RS," and an enable "E" signal. To reduce the
number of pins required, the 4-bit interface mode is used. The LCD to PSoC block diagram and
the table below, describe the 4-bit interface connections.
B.V.R.I.T. Page 48
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
c) LCD Port:
Selects which PSoC I/O port is used to interface to the LCD display module. Bar graph
selects whether the bar graph functions are enabled. If disabled, the bar graph code is not
generated, saving ROM space.
The Application Programming Interface (API) routines are provided as part of the user
module to allow the designer to deal with the module at a higher level. This section specifies
the interface to each function together with related constants provided by the "include" files.
The following are the API programming routines provided for the LCD User Module:
1. LCD_Start:
Description: Initializes LCD to use the multi-line 4-bit interface. This function should be called
prior to all other LCD functions.
2. LCD_Position:
B.V.R.I.T. Page 49
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Description: Moves cursor to a location specified by the parameters. The upper left character is
row 0, column 0. For a two-line by 16 character display, the lower right character is row 1,
column 15.
call LCD_Position
Parameters:
bRow: The row number at which to position the cursor. Zero specifies the first row.
bCol: The column number at which to position the cursor. Zero specifies the first (left most)
column.
3. LCD_PrString:
Description: Prints a null terminated RAM-based character string to the LCD at the present
cursor location.
4. LCD_PrCString:
Description: Prints a null terminated ROM-based character string to the LCD at the present
cursor location.
B.V.R.I.T. Page 50
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The TX8 User Module is an 8-bit RS-232 data-format compliant serial transmitter
with programmable clocking and selectable interrupt or polling style operation. The data
transmitted is framed with a leading start bit, an optional parity bit, and a stop bit.
Transmitter firmware is used to initialize, start, stop, read status, and write data to the TX8.
B.V.R.I.T. Page 51
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
b) Functional Description:
The TX8 User Module implements a serial transmitter. It uses the Buffer, Shift, and
Control registers of a digital communications type PSoC block. The Control register is
initialized and configured, using the TX8 User Module firmware Application Programming
Interface (API) routines. When the Enable bit in the Control register is set, an internal
divide-by-eight bit clock is generated. A data byte to transmit is written by an API routine
into the Buffer register, clearing the Buffer Empty status bit in the Control register. This
status bit can be used to detect and prevent transmit overrun errors.
The rising edge of the next bit clock transfers the data to the Shift register and sets
the Buffer Empty bit of the Control register. If the interrupt enable mask is enabled, an
interrupt will be triggered. This interrupt enables the queuing of the next byte to transmit,
so that upon completion of transmission of the current data byte, the new byte will be
transmitted on the next available transmit clock.
1. Clock TX8 is clocked by one of 16 possible sources. This parameter is set using the
Device Editor in PSoC Designer. The Global I/O busses may be used to connect the
clock input to an external pin or a clock function generated by a different PSoC
block.
B.V.R.I.T. Page 52
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
2. Output The output of the transmitter can be routed to the Global Output Bus. The
Global Output Bus can then be connected to an external pin or to another PSoC
block for further processing.
3. TX Interrupt Mode this option determines when an interrupt will be generated for
the TX block.
4. ClockSync In the PSoC devices, digital blocks may provide clock sources in
addition to the system clocks. Digital clock sources may even be chained in ripple
fashion.
5. Data Clock Out The Data Clock Out signal is a clock signal that corresponds to
the Clock input divided by 8. This clock is active only during the data bits of
the transmit and will be held high all other times. The rising edge of the clock
corresponds to the time when the data is stable and should be sampled. The
Data Clock Out signal can be used to facilitate data checking functions such as
Cyclical Redundancy Checks.
6. Interrupt Generation Control The following two parameters Interrupt API and
Int Dispatch Mode are only accessible by setting the Enable Interrupt
Generation Control check box in PSoC Designer. This is available under
Project > Settings.> Device Editor.
B.V.R.I.T. Page 53
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
"Enable" to generate the interrupt handler and interrupt vector table entry.
Select "Disable" to bypass the generation of the interrupt handler and
interrupt vector table entry.
8. Placement The TX8 User Module uses a single block, designated "TX", which
can map freely onto any of the Digital Communication PSoC blocks.
The RX8 User Module is a RS-232 data-format compliant 8-bit serial receiver
with programmable clocking and selectable interrupt or polling control operation.
The format of the received data consists of a start bit, an optional parity bit, and a
trailing stop bit.
B.V.R.I.T. Page 54
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
b) Functional Description:
The RX8 User Module implements a serial receiver. The RX8 maps onto a single PSoC
block designated "RX" in the PSoC Designer Device Editor. It uses the Buffer, Shift and
Control registers of a digital communications type PSoC block.
Rx Register Full bit in the Control register is set, and if the interrupt for the RX8 is
enabled, then the associated interrupt is triggered.
If the stop bit is not detected at the expected bit position in the data stream, then the
Framing Error bit in the Control register is set.
If the Buffer register has not been read, before the stop bit of the currently received
data, then the Overrun Error bit in the Control register is set.
If a parity error was detected, then the Parity Error bit is set in the Control register.
Clock RX8 is clocked by one of 16 possible sources. The Global I/O busses may be
used to connect the clock input to an external pin or a clock function generated by a
different PSoC block.
ClockSync In the PSoC devices, digital blocks may provide clock sources in
addition to the system clocks. Digital clock sources may even be chained in ripple fashion.
This introduces skew with respect to the system clocks.
RX Output This parameter allows the Input signal to be routed to one of the row
busses. This signal along with the Data Clock Out can be used to facilitate data verification
functions such as Cyclical Redundancy Checks.
B.V.R.I.T. Page 55
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Data Clock Out This parameter allows the bit clock in SPI Mode 3 to be routed to
one of the row busses. The bit clock is the Clock input divided by eight. The rising edge of
the Data Clock
RxCmdBuffer This parameter enables the receive command buffer and firmware
used for command processing. The UART RX interrupt must be enabled for the command
buffer to operate.
RxBufferSize This parameter determines how many RAM locations are reserved
for the receive buffer. The largest command that can be received is one less than the buffer
size selected, since the string must be null terminated. This parameter is only valid when
the RxCmdBuffer is enabled and the UART RX interrupt is enabled.
Invert Input This parameter allows the user to invert the RX input signal.
Command Terminator This parameter selects the character that signals the end of a
command. When received, a flag is set signaling a complete command has been received.
Param_Delimiter This parameter selects the character used to delimit the command
and parameters in the command receiver buffer. For example, if the Param_Delimiter is set
to a space character (32), each substring separated by a space would be a parameter.
The 1-Wire Master User Module is a set of library routines that write and read data as
master using the Dallas Semiconductor 1-Wire protocol. A 1-Wire master may communicate with
one or many slave devices using only one signal wire and a ground.
B.V.R.I.T. Page 56
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Functions provided support reading and writing of both bits and bytes
Optional functions provided for performing 1-Wire search for handling multiple
devices
b) Functional Description:
The 1-Wire User Module uses a single I/O pin to interface to 1-Wire components
over twisted-pair cable. A 1-Wire network consists of a master, the wiring, and one or
more slave devices. Both master and slave devices are open drain. The I/O pin is
configured to provide the resistive pull-up. The CPU is 100% utilized during data
transfers.
DQIOPort Selects which PSoC I/O port is used for the 1-Wire DQ signal below.
DQPin Selects which pin of DQIOPort is used for the 1-Wire interface.
Search Selects whether the 1-Wire search functions are enabled. If disabled, the search
code is not generated to save ROM space.
B.V.R.I.T. Page 57
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Placement and Resources The 1-Wire User Module only uses one I/O pin of one port
and does not use any digital or analog blocks. There are no placement restrictions.
OW_Start:
Description: Initializes OW I/O pin to have a resistive pull-up. This function should be called
once before the other 1-Wire functions.
OW_WriteByte
Call OW_WriteByte
Parameters:
OW_ReadByte:
Chapter 5
B.V.R.I.T. Page 58
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Description
The DS18S20 digital thermometer provides 9-bit Celsius temperature measurements and has an
alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18S20
communicates over a 1-Wire bus that by definition requires only one data line (and ground) for
communication with a central microprocessor. It has an operating temperature range of 55C to
+125C and is accurate to 0.5C over the range of 10C to +85C. In addition, the DS18S20 can
derive power directly from the data line (parasite power), eliminating the need for an external
power supply. Each DS18S20 has a unique 64-bit serial code, which allows multiple DS18S20s to
function on the same 1-Wire bus. Thus, it is simple to use one microprocessor to control many
B.V.R.I.T. Page 59
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
DS18S20s distributed over a large area. Applications that can benefit from this feature include
HVAC environmental controls, temperature monitoring systems inside buildings, equipment, or
machinery, and process monitoring and control systems.
Overview
A block diagram of the DS18S20, and pin descriptions are given in the Pin Description table. The
64-bit ROM stores the devices unique serial code. The scratchpad memory contains the 2-byte
temperature register that stores the digital output from the temperature sensor. In addition, the
scratchpad provides access to the 1-byte upper and lower alarm trigger registers (TH and TL). The
TH and TL registers are nonvolatile (EEPROM), so they will retain data when the device is
powered down.
B.V.R.I.T. Page 60
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The DS18S20 uses Maxims exclusive 1-Wire bus protocol that implements bus communication
using one control signal. The control line requires a weak pullup resistor since all devices are
linked to the bus via a 3-state or open-drain port (the DQ pin in the case of the DS18S20). In this
bus system, the microprocessor (the master device) identifies and addresses devices on the bus
using each devices unique 64-bit code. Because each device has a unique code, the number of
devices that can be addressed on one bus is virtually unlimited. The 1-Wire bus protocol, including
detailed explanations of the commands and time slots, is covered in the 1-Wire Bus System
section.
Another feature of the DS18S20 is the ability to operate without an external power supply. Power
is instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. The
high bus signal also charges an internal capacitor (CPP), which then supplies power to the device
when the bus is low. This method of deriving power from the 1-Wire bus is referred to as parasite
power. As an alternative, the DS18S20 may also be powered by an external supply on VDD.
Operationmeasuring temperature
The core functionality of the DS18S20 is its direct-to-digital temperature sensor. The temperature
sensor output has 9-bit resolution, which corresponds to 0.5C steps. The DS18S20 powers-up in a
low-power idle state; to initiate a temperature measurement and A-to-D conversion, the master
must issue a Convert T [44h] command. Following the conversion, the resulting thermal data is
stored in the 2-byte temperature register in the scratchpad memory and the DS18S20 returns to its
idle state. If the DS18S20 is powered by an external supply, the master can issue read-time slots
(see the 1-Wire Bus System section) after the Convert T command and the DS18S20 will respond
by transmitting 0 while the temperature conversion is in progress and 1 when the conversion is
done. If the DS18S20 is powered with parasite power, this notification technique cannot be used
since the bus must be pulled high by a strong pullup during the entire temperature conversion. The
bus requirements for parasite power are explained in detail in the Powering the DS18S20 section.
B.V.R.I.T. Page 61
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The DS18S20 output data is calibrated in degrees centigrade; for Fahrenheit applications, a lookup
table or conversion routine must be used. The temperature data is stored as a 16-bit sign-extended
twos complement number in the temperature register. The sign bits (S) indicate if the temperature
is positive or negative: for positive numbers S = 0 and for negative numbers S = 1. Resolutions
greater than 9 bits can be calculated using the data from the temperature, COUNT REMAIN and
COUNT PER C registers in the scratchpad. Note that the COUNT PER C register is hard-wired
to 16 (10h). After reading the scratchpad, the TEMP_READ value is obtained by truncating the
0.5C bit (bit 0) from the temperature data. The extended resolution temperature can then be
calculated using the following equation:
Connections:
B.V.R.I.T. Page 62
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
CHAPTER 5
6.1 Introduction
6.1.1 Basics of the Routine
6.1.2 Usage
6.1.3 Selection of Algorithm
6.1.4 Analysis
6.1.5 Preliminaries
6.2 The Key Schedule
6.2.1 Technique Developed by Inventors
6.3 Encryption Routine
6.4 Decryption Routine
B.V.R.I.T. Page 63
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
6.1 Introduction:
We give a short routine which is based on Feistel iteration and uses a large number of
rounds to get security with simplicity.
We design a short program which will run on most machines and encipher safely. It uses a
large number of iterations rather than a complicated program. It is hoped that it can easily be
translated into most languages in a compatible way. The first program is given below. It uses little
set up time and does a weak non linear iteration enough rounds to make it secure. There are no
preset tables or long set up times. It assumes 32 bit words.
It is a Festal type routine although addition and subtraction are used as the reversible
operators rather than XOR. The routine relies on the alternate use of XOR and ADD to provide
nonlinearity. A dual shift causes all bits of the key and data to be mixed repeatedly. The number of
rounds before a single bit change of the data or key has spread very close to 32 is at most six, so
that sixteen cycles may suffice and we suggest 32. The key is set at 128 bits as this is enough to
prevent simple search techniques being effective. The top 5 and bottom four bits are probably
slightly weaker than the middle bits. These bits are generated from only two versions of z (or y)
instead of three, plus the other y or z. Thus the convergence rate to even diffusion is slower.
However the shifting evens this out with perhaps a delay of one or two extra cycles. The
key scheduling uses addition, and is applied to the unshifted z rather than the other uses of the key.
In some tests k[0] etc. were changed by addition, but this version is simpler and seems as effective.
The number delta, derived from the golden number is used where
delta = (sqrt(5)-1)*2^31
A deferent multiple of delta is used in each round so that no bit of the multiple will not
change frequently. We suspect the algorithm is not very sensitive to the value of delta and we
merely need to avoid a bad value. It will be noted that delta turns out to be odd with truncation or
B.V.R.I.T. Page 64
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
nearest rounding, so no extra precautions are needed to ensure that all the digits of sum change.
The use of multiplication is an effective mixer, but needs shifts anyway. It was about twice as slow
per cycle on our implementation and more complicated. The use of a table look up in the cycle was
investigated. There is the possibility of a delay ere one entry of the table is used. For example if k
[z&3] is used instead of k [0], there is a chance one element may not be used of (3=4)32, and a
much higher chance that the use is delayed appreciably. The table also needed preparation from the
key. Large tables were thought to be undesirable due to the set up time and complication.
The algorithm will easily translate into assembly code as long as the exclusive or is an
operation. The hardware implementation is not difficult, and is of the same order of complexity as
DES [1], taking into account the double length key.
6.1.2 Usage:
This type of algorithm can replace DES in software, and is short enough to write into
almost any program on any computer. Although speed is not a strong objective with 32 cycles (64
rounds), on one implementation it is three times as fast as a good software implementation of DES
which has 16 rounds. The modes of use of DES are all applicable. The cycle count can readily be
varied, or even made part of the key. It is expected that security can be enhanced by increasing the
number of iterations.
A considerable number of small algorithms were tried and the selected one is neither the
fastest, nor the shortest but is thought to be the best compromise for safety, ease of
implementation, lack of specialized tables, and reasonable performance. On languages which lack
shifts and XOR it will be difficult to code. Standard C does makes an arithmetic right shift and
overflows implementation dependent so that the right shift is logical and y and z are unsigned.
6.1.4 Analysis:
A few tests were run to detect when a single change had propagated to 32 changes within a
small margin. Also some loop tests were run including a deferential loop test to determine loop
B.V.R.I.T. Page 65
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
closures. These tests failed to show any unexpected behavior. The shifts and XOR cause changes
to be propagated left and right, and a single change will have propagated the full word in about 4
iterations. Measurements showed the diffusion was complete at about six iterations. There was also
a cycle test using up to 34 of the bits to find the lengths of the cycles. A more powerful version
found the cycle length of the deferential function.
6.1.5 Preliminaries:
Bitwise Shifts: The logical shift of x by y bits is denoted by x << y. The logical right shift of x by
y bits is denoted by x >> y.
Exclusive-OR: The operation of addition of n-tuples over the field F 2 (also known as exclusive-or)
is denoted by xy.
Feistel ciphers are a special class of iterated block ciphers where the cipher text is
calculated from the plain text by repeated application of the same transformation or round
function.
In a Feistel cipher, the text being encrypted is split into two halves. The round function, F,
is applied to one half using a sub key and the output of F is (exclusive-or-ed (XORed)) with the
other half. The two halves are then swapped. Each round follows the same pattern except for the
last round where there is often no swap. The focus of this project is the TEA Feistel Cipher.
B.V.R.I.T. Page 66
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
The Tiny Encryption Algorithm is a Feistel type cipher (Feistel, 1973) that uses operations
from mixed (orthogonal) algebraic groups. A dual shift causes all bits of the data and key to be
mixed repeatedly. The key schedule algorithm is simple; the 128-bit key K is split into four 32-bit
blocks K = ( K[0], K[1], K[2], K[3]). TEA seems to be highly resistant to differential cryptanalysis
(Biham et al., 1992) and achieves complete diffusion (where a one bit difference in the plaintext
will cause approximately 32 bit differences in the cipher text). Time performance on a workstation
is very impressive.
Wheeler et al. (1994) at the computer laboratory of Cambridge University developed the
TEA encode routine. Figure 2.1 presents the TEA encode routine in C language where the key
value is stored in k[0] k[2] and data are stored in v[0] v[1].
The inputs to the encryption algorithm are a plaintext block and a key K .The plaintext is
P = (Left[0], Right[0]) and the cipher text is C = (Left[64], Right[64]). The plaintext block is split
into two halves, Left[0] and Right[0]. Each half is used to encrypt the other half over 64 rounds of
processing and then combine to produce the cipher text block.
Each round i has inputs Left[i-1] and Right[i-1], derived from the previous round, as well as a sub
key K[i] derived from the 128 bit overall K.
The sub keys K[i] are different from K and from each other. The constant delta =
, is derived from the golden number ratio to ensure that the sub keys are
distinct and its precise value has no cryptographic significance. The round function differs slightly
from a classical Fiestel cipher structure in that integer addition modulo 2 is used instead of
exclusive-or as the combining operator.
B.V.R.I.T. Page 67
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Encode routine
B.V.R.I.T. Page 68
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Decryption is essentially the same as the encryption process; in the decode routine
the cipher text is used as input to the algorithm, but the sub keys K[i] are used in the reverse order.
The intermediate value of the decryption process is equal to the corresponding value of the
encryption process with the two halves of the value swapped.
B.V.R.I.T. Page 69
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Decode routine
B.V.R.I.T. Page 70
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
CHAPTER 6
Implementation
HM-TRXXX-232 HM-TRXXX-TTL
B.V.R.I.T. Page 71
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
1.9.2. Features
1.9.3. Application
B.V.R.I.T. Page 72
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 73
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Communication Diagram
B.V.R.I.T. Page 74
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 75
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
#include <stdlib.h>
void delay_sec(int);
char TextBuff[5];
B.V.R.I.T. Page 76
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
int TempP;
void main()
char ch[8];
int i=0,j=0;
TX8_1_Start(TX8_PARITY_NONE);
LCD_1_Start();
LCD_1_Position(0,0);
delay_sec(1);
LCD_1_Position(1,0);
LCD_1_PrCString("Tiny Encryption");
delay_sec(2);
LCD_1_Control(0x01);
while(1){
j=0;
i=0;
B.V.R.I.T. Page 77
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
ch[0]='A';
j=1;
while(i<2){
ch[j++]=TextBuff[i++];
LCD_1_Position(0,0);
LCD_1_PrCString("TEMP = ");
LCD_1_PrString(TextBuff);
TempP = (TempP & 0x000f)* 625; // Convert data to decimal point for display.
ch[j++]='.';
ch[j++]='0';
LCD_1_PrCString(".0");
else {
ch[j++]='.';
LCD_1_PrCString(".");
i=0;
while(i<4){
B.V.R.I.T. Page 78
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
ch[j++]=TextBuff[i++];
//ch[j++]='C';
LCD_1_PrString(TextBuff);
LCD_1_PrCString(" C ");
j=0;
LCD_1_Control(0x01);
while(j<8){
LCD_1_Position(0,j);
LCD_1_WriteData(ch[j]);
delay_sec(1);
j++;
delay_sec(2);
encrypt(ch,key);
// TX8_1_CPutString("AA");
TX8_1_PutString(ch);
j=0;
while(j<8){
LCD_1_Position(1,j);
LCD_1_WriteData(ch[j]);
B.V.R.I.T. Page 79
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
delay_sec(1);
j++;
delay_sec(2);
i=0;
LCD_1_Control(0x01);
int i,j,secd;
for (secd=0;secd<=sec;secd++)
for(i=0;i<=2;i++)
B.V.R.I.T. Page 80
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
sum += delta;
} /* end cycle */
v[0]=v0; v[1]=v1; }
B.V.R.I.T. Page 81
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
//----------------------------------------------------------------------------
// C main line
//----------------------------------------------------------------------------
void delay_sec(int);
void cls(void);
void decrypt (unsigned long int *v, unsigned long int *k);
void main()
char * strPtr;
char ch[10];
int i=0;
RX8_1_CmdReset();
TX8_1_Start(TX8_PARITY_NONE ) ;
RX8_1_EnableInt();
RX8_1_Start(RX8_PARITY_NONE);
M8C_EnableGInt ;
LCD_1_Start();
LCD_1_Position(0,0);
B.V.R.I.T. Page 82
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
delay_sec(1);
LCD_1_Position(1,0);
LCD_1_PrCString("TEA SYSTEM");
delay_sec(2);
LCD_1_Control(0x01);
while(1){
LCD_1_Position(0,0);
delay_sec(1);
while(RX8_1_bCmdCheck==0);
if(strPtr = RX8_1_szGetParam())
for(i=0;i<8;i++)
ch[i]= *(strPtr+i);
i=0;
while(i<8){
LCD_1_Position(1,i);
LCD_1_WriteData(ch[i]);
delay_sec(1);
i++;
B.V.R.I.T. Page 83
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
RX8_1_CmdReset();
i=0;
TX8_1_PutString(ch);
TX8_1_PutCRLF();
decrypt(ch,key);
TX8_1_CPutString("After Decryption");
//for(i=0;i<8;i++)
TX8_1_PutString(ch);
TX8_1_PutCRLF();
i=0;
while(i<8){
LCD_1_Position(1,i);
LCD_1_WriteData(ch[i]);
delay_sec(1);
i++;
for(i=0;i<8;i++)
B.V.R.I.T. Page 84
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
ch[i]='\0';
LCD_1_Control(0x01);
delay_sec(2);
int i,j,secd;
for (secd=0;secd<=sec;secd++)
for(i=0;i<=2;i++)
void decrypt (unsigned long int *v, unsigned long int *k) {
B.V.R.I.T. Page 85
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
sum -= delta;
} /* end cycle */
v[0]=v0; v[1]=v1;
CHAPTER 8
8.1 Results
8.2 Applications
8.3 Advantages
8.4 Disadvantages
8.5 Conclusion
B.V.R.I.T. Page 86
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
1.1 Results:
a. When we power ON the transmitter and receiver sections, the welcome note on the LCD
at both the nodes will be displayed.
B.V.R.I.T. Page 87
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
b. At the transmitter side, the temperature sensor senses the surrounding temperature and it
sends to PSoC micro controller for the encryption process. On LCD at the transmitter
side, the original and encrypted data will be displayed.
B.V.R.I.T. Page 88
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
c. At the receiver side, when A comes, it starts receiving the encrypted data and sends to
PSoC micro controller for the decryption process. On LCD, the encrypted and decrypted
data will be displayed.
B.V.R.I.T. Page 89
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
8.2Applications:
i. Defense :
In defense, a code is allotted to each file in which the information is furnished regarding
transport of missiles and machinery. To send this code from one block to the other block,
the code should be encrypted into the other form so as to keep it secret.
B.V.R.I.T. Page 90
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
In the atomic nuclear plants, the physical quantities like temperature and pressure in the
nuclear reactor are measured to maintain certain conditions for the process. The inspection
of these parameters should be done continuously and this data should be sent to the Process
Control Room simultaneously to maintain the threshold values.
In the natural oil and gas plants, the physical quantities like temperature and pressure in the
oil wells are measured to maintain certain conditions for the process. The inspection of
these parameters should be done continuously and this data should be sent to the Process
Control Room simultaneously to maintain the threshold values.
8.3 Advantages:
2. The key is set at 128 bits as this is enough to prevent simple search techniques being
effective.
3. The TEA Algorithm is neither the fastest, nor the shortest but it provides
ease of implementation,
the best compromise for safety,
Reasonable performance.
4. The algorithm can be translated into a number of different languages and assembly
languages very easily.
B.V.R.I.T. Page 91
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
5. It is safe because of the number of cycles in the encoding and length of key.
8.4 Disadvantages:
Relatively less secure with respect to standard (used in internet) encryption and decryption
scheme.
8.5 Conclusion:
We present a simple algorithm which can be translated into a number of different languages
and assembly languages very easily. It is short enough to be programmed from memory or
a copy. It is hoped it is safe because of the number of cycles in the encoding and length of
key. It uses a sequence of word operations rather than wasting the power of a computer by
doing byte or 4 bit operations.
We feel that cryptanalysis of TEA like feistel ciphers is far from complete task. In this
section we present several directions for future project.
B.V.R.I.T. Page 92
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
Increasing number of rounds to make TEA more complex which will improve security
level.
Extensions of TEA like XTEA, Block TEA are proposed which will minimize threats due
to improper keys but they need further research for implementation.
REFERENCES:
B.V.R.I.T. Page 93
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
1. Books:
1. Wheeler,D.J., & Needham, R.J. (1994). TEA, a tiny encryption algorithm. In Fast
Software Encryption Proceedings of the 2nd International Workshop,1008.
2. Wheeler,D.J., & Needham, R.J. (1997). Tea extensions. Unpublished manuscript,
Computer Laboratory, Cambridge University, England.
3. Mirza, F. (1998). Block ciphers and cryptanalysis. England: Royal Holloway University
of London, Department of Mathematics.
6. B. Schneier, Applied Cryptology, John Wiley & sons, New York 1994.
2. Websites:
1. www.cypress.com/psocexampleprojects
2. www.hoperf.com
3. www.scribd.com
B.V.R.I.T. Page 94
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
APPENDIX
Flow Charts
B.V.R.I.T. Page 95
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
FLOW CHARTS:
B.V.R.I.T. Page 96
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 97
SECURED WIRELESS COMMUNICATION LINK FOR SENSOR NETWORK APPLICATIONS
B.V.R.I.T. Page 98