You are on page 1of 54

A hardware project on

Wireless Communication through Microcontroller


submitted by

Satish Chandra Dixit-2009

Himanshu Verma-20095026

Shardool Upadhaya-2009

Shiv Kumar Sharma-2009

B.tech V Semester, Electronics and Communication Engineering (2009-2013)

Under guidance of

Asim Mukherjee

Assistant Professor

ELECTRONICS AND COMMUNICATION ENGINEERING DEPARTMENT

MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY ALLAHABAD-211004


Department of electronics and Communication Engineering

Motilal Nehru National Institute of Technology

Allahabad-211004, India

CERTIFICATE

This is to certify that the term project entitled Wireless Communication through
Microcontroller submitted by Satish Chandra Dixit (2009), Himanshu Verma (20095026),
Shardool upadhaya (2009) and Shiv Kumar Sharma (2009) of B.Tech, Third Year
,Electronics and Communication Engineering of Motilal Nehru National Institute of Technology
Allahabad is a bonafide record of students own work carried out under my supervision.

Date: Asim Mukherjee


Acknowledgement

It is our greatest privilege to express our deep gratitude to our guide, Asim Mukherjee Assistant
Professor of Electronics and Communication Engineering Department, MNNIT for his
stimulating guidance and profound assistant. We are deeply indebted to them all for their kind
help. We shall always cherish our association with him for his consistent encouragement, kind
support and freedom. We also feel great pleasure to thank all the staff members of the
department for their cooperation which led to the successful completion of our project work. We
are also thankful to our friends and colleagues for their support. Needless to say, without all the
above helps and support mentioned, the project could not have been completed.

Satish Chandra Dixit-20095079

Himanshu Verma-20095105

Shardool Upadhaya-20095083

Shiv Kumar Sharma-20095003


Abstract

It is a wireless communication project in which a text message is communicated from one place
to another place through wireless. The text message is encoded with the help of microcontroller
and the encoded message is transmitted through wireless. The transmitted signal is received by a
standard receiver, from where the analog signal is fed to another microcontroller where it is
decoded and the message is displayed over the LCD display. We can also use many receivers
and the message from the transmitter can be sent to all the receivers at the same time. Each of the
receivers can be accessed separately knowing their address with the help of microcontroller. The
data can be sent through input device such as keyboard. The given data can be encrypted with an
algorithm and can be decrypted at the receiver end with the same algorithm using a
microcontroller. The decoded data can be displayed over an LCD display. This project can find
its application in nearly all areas where data transfer is needed as since wireless communication
is fast process and requires less resource.
Contents

Title Page

CERTIFICATE .i

ACKNOWLEDGEMENTii

ABSTRACTiii

CONTENTSiv

CHAPTER 1 INTRODUCTION

1.1 GENERALv
1.2 Succession of processes involved in Commincation

CHAPTER 2 WIRELESS COMMUNICATION

2.1 WIRELESS COMMUNICATION..

2.1.1 Free space, fixed transmitting and receive antennas.............

2.1.2 Modes of Wireless Transmission..............

2.2 RADIO FREQUENCY COMMUNICATION................

2.1.1 Radio wave Production................................

2.1.2 Radio wave Propagation...........

2.1.3 Radio wave Reception..................

CHAPTER 3 PROJECT DESCRIPTION

3.1 BLOCK DIAGRAM..

iv
3.2 Understanding Components..

3.2.1 MICROCONTROLLER.

3.2.2 TRANSMITTER MODULE..

3.2.3 RECEIVER MODULE..

3.2.4 ANTENNA..

3.3 CIRCUIT DIAGRAM

3.4 Principles involved in Communication.

3.4.1 Serial Communication.

3.4.2 Amplitude Shift Keying.

3.5 C CODING

CHAPTER 4 RESULT AND CONCLUSION

4.1 SIMULATION RESULT..

4.2 Future scope of microcontroller in Communication..

REFERENCES.

v
CHAPTER 1

INTRODUCTION

1
1.1 General Introduction

Today, communication enters our daily lives in so many different ways that it is very easy
to overlook the multitude of its facets. The telephones at our hands, the radios and televisions in
our living rooms, the computer terminals in our offices and homes, and our newspapers are all
capable of providing rapid communications from every corner of the globe. Communication
provides the senses for ships on the high seas, aircraft in flight, and rockets and satellites in
space. Communication through a cordless telephone keeps a car driver in touch with the office or
home miles away. Communication keeps a weather forecast informed of conditions measured by
a multitude of sensors. Indeed the list of applications involving the use of communication in one
way or another is almost endless.

There are many other forms of communication that do not directly involve the human
mind in real time. For example, in computer communications involving communication between
two or more computers, human decisions may enter only in setting up the programs or
commands for the computer, or in monitoring the results.

For every communication system there are three basic elements namely, transmitter ,
channel, and receiver as depicted in figure 1.1 The transmitter is located on one side and
receiver is located on other side and the channel is the physical medium that connects them
together. The purpose of the transmitter is to transform the message signal in source of
information suitable for transmission over the channel. During its transmission the signal may
get attenuated by factors such as noise and interfering signals. The receiver receives the
transmitted signal and converts it into the original form and then it is transmitted to the user
destination. The signal processing role of the receiver is thus the reverse of that of the
transmitter.

2
Figure 1.1 Elements of a communication system.

1.2 Succession of processes involved in communication

In the most fundamental sense, communication involves simplicity the transmission of


information from one point to another through a succession of processes, as described here:

1. The generation of a thought pattern or image in the mind of an originator.


2. The description of that image, with a certain measure of precision, by a set of aural or
visual symbols.
3. The encoding of these symbols in a form that is suitable for transmission over a physical
medium of interest.
4. The transmission of the encoded symbols to the desired destination.
5. The decoding and reproduction of the original symbols.
6. The recreation of the original thought pattern or image with a definable degradation in
quality, in the mind of the recipient; the degradation is caused by imperfections in the
system.

3
CHAPTER 2

WIRELESS COMMUNICATION

4
2.1 Wireless Communication

The development of wireless communication arose from the works of Oersted, Faraday,
Gauss, Maxwell, and Hertz. In 1820, Oersted demonstrated that an electric current produces a
magnetic field. In 1831, Michael Faraday showed that an induced current is produced by moving
a magnet in the vicinity of a conductor. Thus he demonstrated that a changing magnetic field
produces an electric field. With this early work as background, James C. Maxwell in 1864
predicted the existence of electromagnetic radiation and formulated the basic theory that has
been in use for over a century. Maxwells theory was verified experimentally by Hertz in 1887.

5
Base Station: A fixed station in a mobile radio system used for radio communication
with mobile stations. Base stations are located at the center or on the
edge of the coverage region and consist of radio channels and
transmitter and receiver antennas mounted on a tower.
Control Channel: Radio channels used for transmission of call set up, call request, call
Initiation and and other control purposes.
Forward Channel: Radio channel used for transmission of information from the base
Station to the mobile.
Full Duplex: Communication system which allow simultaneous two way
systems communication. Transmission and reception is typically on two
different channels (FDD).
Half Duplex: Communication system which allow two way communication by using
systems the same radio channel for both transmission and reception. At any
given time, the user can only either transmit or receive information.
Handoff: The process of transferring a mobile station from one channel or
Base station to another.
Mobile Station: A station in cellular radio service intended for use while in motion at
Unspecified locations. Mobile stations may be hand held personal
Units (portables) or installed in vehicles (mobiles).
Reverse Channel: Radio channel used for transmission of information from the
mobile to base station.
Simplex Systems: Communication system which provide only one-way
Communication.
Subscriber: A user who pays subscription charges for using a mobile
communication system.
Transceiver: A device capable of simultaneously transmitting and receiving
Radio signals.
Table 2.1 Basic definitions of Wireless Communication

6
2.1.1 Free space, fixed transmitting and receive antennas

In the far field, the electric field and magnetic field at any given location are perpendicular
both to each other and to the direction of propagation from the antenna. They are also
proportional to each other, so it is sufficient to know only one of them (just as in wired
communication, where we view a signal as simply a voltage waveform or a current waveform).
In response to a transmitted sinusoid cos 2 ft, we can express the electric far field at time t as

E (f, t, (r, , )) = (2.1)

Here, (r; , ) represents the point u in space at which the electric field is being measured, where
r is the distance from the transmitting antenna to u and where (, ) represents the vertical and
horizontal angles from the antenna to u, respectively. The constant c is the speed of light, and
(r, , ) is the radiation pattern of the sending antenna at frequency f in the direction (, ); it
also contains a scaling factor to account for antenna losses. Note that the phase of the field varies

with , corresponding to the delay caused by the radiation travelling at the speed of light. Next,

suppose there is a fixed receive antenna at the location u = (r; , ). The received waveform (in
the absence of noise) in response to the above transmitted sinusoid is then

Er (f, t, u) = (2.2)

Where the product of the antenna is patterns of transmitting and receives


antennas in the given direction. Our approach to (2.2) is a bit odd since we started
with the free space field at u in the absence of an antenna. Placing a receive antenna
there changes the electric field in the vicinity of u, but this is taken into account by
the antenna pattern of the receive antenna.

Now suppose, for the given u, that we define


7
H(f) = (2.3)

We then have Er (f; t; u) = H (f) exp (j2 ft). We have not mentioned it yet, but (2.1) and (2.2)
are both linear in the input. That is, the received field (waveform) at u in response to a weighted
sum of transmitted waveforms is simply the weighted sum of responses to those individual
waveforms. Thus, H (f) is the system function for an LTI (linear time-invariant) channel, and its
inverse Fourier transform is the impulse response. The need for understanding electromagnetism
is to determine what this system function is. We will find in what follows that linearity is a good
assumption for all the wireless channels we consider, but that the time invariance does not hold
when either the antennas or obstructions are in relative motion.

2.1.2 Modes of wireless transmission:

Wireless communication has become quite prevalent all around the world. Every business
and communication depends on the wireless technologies that form the major part of the
telecommunication systems. Be it the phone, the internet or the radio, every gadget seen today
use wireless communication in one form or the other. There are many modes of wireless
communication.

Radio Frequency Communication:


Radio is the transmission of signals through free space by modulation of
electromagnetic waves with frequencies below those of visible light.
Electromagnetic radiation travels by means of oscillating electromagnetic fields
that pass through the air and the vacuum of space. Information is carried by
systematically changing (modulating) some property of the radiated waves, such as
amplitude, frequency, phase, or pulse width. When radio waves pass an electrical
conductor, the oscillating fields induce an alternating current in the conductor. This
can be detected and transformed into sound or other signals that carry information.

Microwave Communication:
Microwaves, a subset of radio waves, have wavelengths ranging from as long as
one meter to as short as one millimeter, or equivalently, with frequencies between
300 MHz (0.3 GHz) and 300 GHz. This broad definition includes both UHF and
EHF (millimeter waves), and various sources use different boundaries. In all cases,
microwave includes the entire SHF band (3 to 30 GHz, or 10 to 1 cm) at minimum,
with RF engineering often putting the lower boundary at 1 GHz (30 cm), and the
upper around 100 GHz (3 mm).
Microwave radio is used in broadcasting and telecommunication transmissions
because, due to their short wavelength, highly directional antennas are smaller and
therefore more practical than they would be at longer wavelengths (lower
frequencies). There is also more bandwidth in the microwave spectrum than in the
rest of the radio spectrum; the usable bandwidth below 300 MHz is less than
300 MHz while many GHz can be used above 300 MHz Typically, microwaves
are used in television news to transmit a signal from a remote location to a
television station from a specially equipped van. See broadcast auxiliary service
(BAS), remote pickup unit (RPU), and studio/transmitter link (STL).

Infrared short range communication:


Infrared (IR) light is electromagnetic radiation with a wavelength longer than that
of visible light, measured from the nominal edge of visible red light at 0.74
micrometers ( m), and extending conventionally to 300 m. These wavelengths
correspond to a frequency range of approximately 1 to 400 THz, and include most
of the thermal radiation emitted by objects near room temperature.
Microscopically, IR light is typically emitted or absorbed by molecules when they
change their rotational-vibrational movements.

8
2.2 Radio Frequency Communication

RF is the wireless transmission of data by digital radio signals at a particular frequency. It


maintains a two-way, online radio connection between a mobile terminal and the host computer.
The mobile terminal, which can be portable, even worn by the worker, or mounted on a forklift
truck, collects and displays data at the point of activity. The host computer can be a PC, a
minicomputer or a much larger mainframe.
A basic RF system consists of up to three components:
A mobile RF terminal;
A base station (sender/receiver); and
A network controller.

Figure 2.1 Electromagnetic waves

9
2.2.1 Radio wave Production:

The four fundamental ways in which radio waves are produced are:

Nonthermal or Synchrotron emission - Synchrotron emission is the most common form


of radio emission from outside our solar system and is why the Milky Way appears so
bright at radio wavelengths. It is associated with relativistic electrons or cosmic ray
electrons, so named because they travel at speeds comparable with that of light.
Thermal emission - This is emission caused by the collisions of non-relativistic electrons,
whose speed is determined purely by the kinetic temperature. This raises an important
point in temperature measurement. Often in radio astronomy temperature will be talked
about in terms of kinetic temperature a measure of the kinetic motions of the particles in
an object and not the same as the temperature a thermometer would read.
Plasma oscillations - In areas of space where plasma exists, for example in stars, the
electrons can oscillate at a rate determined by the density. The motion of the charged
particles produces a wave whose wavelength is determined by the oscillation frequency.
Spectral line (monochromatic) emission - An atom or molecule can absorb or emit
radiation by changing its state of motion and subsequently energy level. The change of
state can be in the form of an electron changing the level of its orbit or even the spin
about its own axis, in the case of molecules also the rotation and relative vibrations.

2.2.2 Radio wave Propagation:

When the electrons in a conductor, (antenna wire) are made to oscillate back and forth,
Electromagnetic Waves (EM waves) are produced. These waves radiate outwards from the
source at the speed of light, 300 million meters per second. Light waves and radio waves are
both EM waves, differing only in frequency and wavelength. EM waves travel in straight lines,
unless acted upon by some outside force. They travel faster through a vacuum than through
any other medium. As EM waves spread out from a point they decrease in strength in what is
described as an "inverse square relationship".
10
Fig 2.2 Propagation of radio waves

Electromagnetic radiation comprises both an Electric and a Magnetic Field.


The two fields are at right-angles to each other and the direction of propagation is at right
angles to both fields.
The Plane of the Electric Field defines the Polarisation of the wave.

2.2.3 Radio wave Reception:

Any transmitting antenna may serve as a receiving antenna. If a wave propagating in space
acts on an electric dipole, its electric field excites in the dipole current oscillations, which are
then amplified and transformed in frequency and act on the output devices. Dipole radiation
patterns can be shown to be identical in the reception and transmission modesthat is, a dipole
receives better in the directions in which it radiates better.

11
The energy that a dipole extracts from an electromagnetic wave depends on the relation of its
length l, the wavelength , and the angle between the direction v of incidence of the wave and
the dipole. The angle between the direction of the electric wave vector and the dipole is also
significant (Figure 2.3). Receiving conditions are best when = 0. When = /2 no electric
current is excited in the dipolethat is, there is no reception. However, if 0 < /2, then it is
obvious that the energy extracted by the receiving antenna from the field is proportional to (E cos
). In other words, this energy is related to the polarization of the incident wave. It follows from
the above that, in the case of radiating and receiving dipoles, to ensure optimum receiving
conditions both dipoles must lie in one plane and the receiving dipole must be perpendicular to
the direction of wave propagation. Here the receiving dipole extracts from an incoming wave as
much energy as the wave carries in passing through a cross section in the form of a square of
sides /22.

Figure 2.3 Electric and Magnetic Field reception

12
CHAPTER 3

PROJECT DESCRIPTION

13
3.1 BLOCK DIAGRAM

Figure 3.1 Block diagram of Transmitter end

Figure 3.2 Block diagram of Receiver end

14
3.2 Understanding Components

3.2.1 MICROCONTROLLER

A microcontroller (sometimes abbreviated C, uC or MCU) is a small computer on a


single integrated circuit containing a processor core, memory, and programmable input/output
peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on
chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded
applications, in contrast to the microprocessors used in personal computers or other general
purpose applications.

Some microcontrollers may use four-bit words and operate at clock rate frequencies as low
as 4 kHz, for low power consumption (mill watts or microwatts). They will generally have the
ability to retain functionality while waiting for an event such as a button press or other interrupt;
power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts,
making many of them well suited for long lasting battery applications. Other microcontrollers
may serve performance-critical roles, where they may need to act more like a digital signal
processor (DSP), with higher clock speeds and power consumption. Microcontrollers which are
most widely used are 89 series of ATMEL such as ATmega32, AT89C51, AT89S52, etc. We
have used microcontroller ATmega32 in our project.

3.2.1.1 ATmega32

Features

High-performance, Low-power AVR 8-bit Microcontroller


Advanced RISC Architecture
131 Powerful Instructions Most Single-clock Cycle Execution
32 x 8 General Purpose Working Registers
Fully Static Operation
Up to 16 MIPS Throughput at 16 MHz
On-chip 2-cycle Multiplier

15
32K Bytes of In-System Self-programmable Flash program memory
1024 Bytes EEPROM
2K Byte Internal SRAM
Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
Data retention: 20 years at 85C/100 years at 25C
Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
Programming Lock for Software Security
JTAG (IEEE std. 1149.1 Compliant) Interface
Boundary-scan Capabilities According to the JTAG Standard
Extensive On-chip Debug Support
Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
Peripheral Features
Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
Real Time Counter with Separate Oscillator
Four PWM Channels
8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
Byte-oriented Two-wire Serial Interface
Programmable Serial USART
Master/Slave SPI Serial Interface
Programmable Watchdog Timer with Separate On-chip Oscillator
On-chip Analog Comparator
Special Microcontroller Features
Power-on Reset and Programmable Brown-out Detection
Internal Calibrated RC Oscillator
External and Internal Interrupt Sources
Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
I/O and Packages
32 Programmable I/O Lines
40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
Operating Voltages
2.7 - 5.5V for ATmega32L
4.5 - 5.5V for ATmega32
Speed Grades
0 - 8 MHz for ATmega32L
0 - 16 MHz for ATmega32

16
Figure 3.3 Pin Description of ATmega32

3.2.2 TRANSMITTER MODULE:

Features
Complete RF Transmitter
Transmit Range Up To 50m
CMOS / TTL Input
No Adjustable Components
Very Stable Operating Frequency
Low Current Consumption (Typ 11mA)
Wide Operating Voltage (1.5-5v)
17
ASK Modulation
Available as 315 or 433 MHz

Applications

Wireless Security Systems


Car Alarms
Remote Gate Controls
Remote Sensing
Data Capture
Sensor Reporting

Description
The Quasar UK AM hybrid transmitter module provides a complete RF transmitter which can be
used to transmit data at up to 3 KHz from any standard CMOS/TTL source.
The module is very simple to operate and offers low current consumption (typ. 11mA). Data can
be supplied directly from a microprocessor or encoding device, thus keeping the component
count down and ensuring a low hardware cost. The modules are compatible with the Quasar UK
Ltd. range of AM receivers to provide a complete solution.

18
Technical Specifications

Figure 3.3 Pin diagram for Transmitter Module

Dimensions

Pin Measurements(mm)
A 13
B 19
C 3
D 2.54
E 1
F 5.5
19
Pin Descriptions
Pin Name Description
1 GND Ground
2 IN Data Input
3 VCC Supply Voltage
4 ANT External Antenna

Electrical Characteristics
Characteristic Min. Typ. Max. Dimensions
Supply Voltage 1.5 3 5 Vdc
Supply Current (Vcc=5V 2.9 11 22 Ma
IN=1kHz)
Working Frequency 315/433.92 MHz
Time for power onto data 20 Ms
transmission
Data Rate 200 3000 Hz
Operating Temperature -20 +60 K

Table 3.1 Pin description and characteristics of transmitter module

20
3.2.3 RECEIVER MODULE

Features
Super Regenerative Radio Receiver
CMOS / TTL Output
Stable Operating Frequency
Low Current Consumption
5Vdc Operating Voltage
ASK Demodulation
Available as 315 or 433 MHz

Applications
Wireless Security Systems
Garage Door controller
Remote Gate Controls
Remote Sensing
Data Capture
Sensor Reporting

Description
The Quasar UK AM hybrid receiver module provides a complete Radio receiver which can be
used to receive uudecoded data from the range of Quasar (UK) transmitter modules. The module
is very simple to operate and offers a low current consumption, allowing for extended battery life
when used in mobile applications. Data can be fed directly into a microprocessor or decoding
device, thus keeping the component count down and ensuring a low hardware cost. All receivers
are compatible, producing a CMOS/TTL output, and only require connections to power and
antenna.
21
Figure 3.4 Pin diagram for Receiver Module

Technical Specifications

Pin Descriptions

Pin Description
1 External Antenna
2,3,8 Ground
6,7 Data input
4,5 Supply Voltage

22
Electrical Characteristics

Table 3.2 Pin description and characteristics of transmitter module

3.2.4 Antenna:

An antenna can be defined as any wire, or conductor, that carries a pulsing or alternating
current. Such a current will generate an electromagnetic field around the wire and that field will
pulse and vary as the electric current does. If another wire is placed nearby, the electromagnetic
field lines that cross this wire will induce an electric current that is a copy of the original current,
only weaker. If the wire is relatively long, in terms of wavelength, it will radiate much of that
field over long distances.

Figure 3.5 Antenna wave transmission

23
3.3 CIRCUIT DIAGRAM

Microcontroller is connected to the input keys on the transmitter side. In the microcontroller the
input data has been encoded in particular form say complement of some binary data and is
printed on the 16X2 LCD. Encoding can be of any type. When some key such as A has been
printed whose binary data is 01000001 , it is complemented in microcontroller to produce
10111110 which is then transmitted from Tx pin of microcontroller to the receiver circuit with
the help of Transmitter module. On the receiver side, this data is received by Receiver module
and then it is transmitted to microcontroller through Rx pin of it. There it is decoded again to get

24
original data for example A is again complemented here to produce 01000001. The LCD prints
the original character from the microcontroller and thus the data is transmitted wirelessly from
one place to another.

3.4 Principals involved in Communication

3.4.1 Serial Communication


Serial communications send a single bit at a time between computers. This only requires a
single communication channel, as opposed to 8 channels to send a byte. With only one channel
the costs are lower, but the communication rates are slower. The communication channels are
often wire based, but they may also be can be optical and radio.
To transmit data, the sequence of bits follows a pattern, like that shown in Figure 3.8. The
transmission starts at the left hand side. Each bit will be true or false for a fixed period of time,
determined by the transmission speed. A typical data byte looks like the one below. The
voltage/current on the line is made true or false. The width of the bits determines the possible
bits per second (bps). The value shown before is used to transmit a single byte. Between bytes,
and when the line is idle, the Txd is kept true, this helps the receiver detect when a sender is
present. A single start bit is sent by making the Txd false. In this example the next eight bits are
the transmitted data, a byte with the value 17. The data is followed by a parity bit that can be
used to check the byte. In this example there are two data bits set, and even parity is being used,
so the parity bit is set. The parity bit is followed by two stop bits to help separate this byte from
the next one.

Figure 3.8 Serial data communication


25
Descriptions:
before - this is a period where no bit is being sent and the line is true.
start - a single bit to help get the systems synchronized.
data - this could be 7 or 8 bits, but is almost always 8 now. The value shown here is a
byte with the binary value 00010010 (the least significant bit is sent first).
parity - this lets us check to see if the byte was sent properly. The most common
choices here are no parity bit, an even parity bit, or an odd parity bit. In this case
there are two bits set in the data byte. If we are using even parity the bit would be
true. If we are using odd parity the bit would be false.
stop - the stop bits allow a pause at the end of the data. One or two stop bits can be used.
idle - a period of time where the line is true before the next byte.

3.4.2 Amplitude Shift Keying

The transmission of digital signals is increasing at a rapid rate. Low-frequency analogue


signals are often converted to digital format (PAM) before transmission. The source signals are
generally referred to as baseband signals. Of course, we can send analogue and digital signals
directly over a medium. From electro-magnetic theory, for efficient radiation of electrical energy
from an antenna it must be at least in the order of magnitude of a wavelength in size; c = f,
where c is the velocity of light, f is the signal frequency and is the wavelength. For a 1kHz
audio signal, the wavelength is 300 km. An antenna of this size is not practical for efficient
transmission. The low-frequency signal is often frequency-translated to a higher frequency range
for efficient transmission. The process is called modulation. The use of a higher frequency range
reduces antenna size. In the modulation process, the baseband signals constitute the modulating
signal and the high-frequency carrier signal is a sinusoidal waveform. There are three basic
ways of modulating a sine wave carrier. For binary digital modulation, they are called binary
amplitude-shift keying (BASK), binary frequency-shift keying (BFSK) and binary phase shift
keying (BPSK). Modulation also leads to the possibility of frequency multiplexing. In a
26
frequency-multiplexed system, individual signals are transmitted over adjacent, non overlapping
frequency bands. They are therefore transmitted in parallel and simultaneously in time. If we
operate at higher carrier frequencies, more bandwidth is available for frequency-multiplexing
more signals.

Binary Amplitude-Shift Keying (BASK)

A binary amplitude-shift keying (BASK) signal can be defined by


s(t) = A m(t) cos 2fct, 0 t T
where A is a constant, m(t) = 1 or 0, fc is the carrier frequency, and T is the bit duration. It has a
power P = A2/2, so that A = 2P . Thus equation (22.1) can be written as
s(t) = 2P cos 2fct, 0 t T

= cos 2fct, 0 t T

= cos 2fct, 0 t T

where E = P T is the energy contained in a bit duration. If we take 1(t) = cos 2fctas the

orthonormal basis function, the applicable signal space or constellation diagram of the BASK
signals is shown in Figure 3.9. Figure 3.10 shows the BASK signal sequence generated by the
binary sequence 0 1 0 1 0 0 1. The amplitude of a carrier is switched or keyed by the binary
signal m(t). This is sometimes called on-off keying (OOK).

27
Figure 3.9 BASK signal constellation diagram.

Figure 3.10 (a) Binary modulating signal and (b) BASK signal.

28
CHAPTER 4
RESULT AND CONCLUSION
RESULT
Any binary data was perfectly received by the receiver side. Depending upon the range of the
transmitter and receiver module the data was transmitted within the optimum range of transmitter
and receiver module that is 50 m.

CONCLUSION
While transmiting the data through the microcontroller the data is made more secure as
comparision to general transmission. This is because the data can be encoded to a particular form
say for example complement or sum other operations. This encoding makes the data difficult to
edcode for the hackers and thus this data is transmitted safely from one place to other.
Using this wireless transmission through micronroller we can make use of the data from
microcontroller to drive machines such as motors and generators and thus control their
operations.
FUTURE SCOPE OF MICROCONTROLLER IN COMMUNICATION

1- Remote data acquisition using Wireless with the help of microcontroller (SCADA System)
Supervisory Control and Data Acquisition (SCADA) is a process control system that enables a
site operator to monitor and control processes that are distributed among various remote sites. A
properly designed SCADA system saves time and money by eliminating the need for service
personnel to visit each site for inspection, data collection/logging or make adjustments.

2- Use of microcontrollers in automobiles.


Microcontrollers have been at the heart of safety critical systems for many years. Almost all of
the safety critical automotive systems in which they have been used have provided a fail-safe
function. In the near future, there will be an added requirement for fault-tolerant microcontroller
based systems.

3- Internet-Based Remote Control using a Microcontroller and an Embedded Ethernet.


Internet capabilities imparted to a microcontroller by the use of embedded ethernet for data
communication and Java for GUI functionality provides the future way of controlling heavy
machines with the help of microcontroller.
4- Fast track voting which could be used in small scale elections, like resident welfare
association panchayat level election and other society level elections It could also be used to conduct opinion
polls during annual share holders meeting. It could also be used to conduct general assembly elections where
numbers of candidates are less than or equal to eight in the current situation.

REFERENCES
C CODING
Transmitter coding
#include <mega32.h>
#include<delay.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#include <lcd.h>
#define RXB8 1
#define TXB8 0
#define UPE 2
#define OVR 3
#define FE 4
#define UDRE 5
#define RXC 7
#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<OVR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)
// USART Receiver buffer
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];
#if RX_BUFFER_SIZE<256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif
// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;
// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{ char status,data;
status=UCSRA;
data=UDR;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
{
rx_buffer[rx_wr_index]=data;
if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
if (++rx_counter == RX_BUFFER_SIZE)
{
rx_counter=0;
rx_buffer_overflow=1;
};
};
}
#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index];
if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif
// USART Transmitter buffer
#define TX_BUFFER_SIZE 8
char tx_buffer[TX_BUFFER_SIZE];
#if TX_BUFFER_SIZE<256
unsigned char tx_wr_index,tx_rd_index,tx_counter;
#else
unsigned int tx_wr_index,tx_rd_index,tx_counter;
#endif
// USART Transmitter interrupt service routine
interrupt [USART_TXC] void usart_tx_isr(void)
{
if (tx_counter)
{
--tx_counter;
UDR=tx_buffer[tx_rd_index];
if (++tx_rd_index == TX_BUFFER_SIZE) tx_rd_index=0;
};
}
#ifndef _DEBUG_TERMINAL_IO_
// Write a character to the USART Transmitter buffer
#define _ALTERNATE_PUTCHAR_
#pragma used+
void putchar(char c)
{
while (tx_counter == TX_BUFFER_SIZE);
#asm("cli")
if (tx_counter || ((UCSRA & DATA_REGISTER_EMPTY)==0))
{
tx_buffer[tx_wr_index]=c;
if (++tx_wr_index == TX_BUFFER_SIZE) tx_wr_index=0;
++tx_counter;
}
else
UDR=c;
#asm("sei")
}
#pragma used-
#endif
// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
void print(int a) {
if(a == 0) {
lcd_putchar('0');
return;
}
print(a / 8);
lcd_putchar(a % 8 + '0');
}
void main(void)
{
// Declare your local variables here
unsigned char a,b;
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00; // USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600
UCSRA=0x00;
UCSRB=0xD8;
UCSRC=0x86;
UBRRH=0x03;
UBRRL=0x40;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
// Global enable interrupts
#asm("sei")
while (1)
{
// Place your code here
a = PINC;
b = 0b11001000;
//print(a);
//delay_ms(1000);
//lcd_clear();
if(a&0x01)
{
//putchar('k');
putchar(b);
lcd_putchar('A');
}
else if(a&0x02)
{
//putchar('k');
putchar(b + 1);
lcd_putchar('B');
}
//else if(a&0x04)
// {
//putchar('k');
// putchar(b + 2);
// lcd_putchar('C');
// }
else if(a&0x08)
{
//putchar('k');
putchar(b + 3);
lcd_putchar('D');
}
else if(a&0x10)
{
//putchar('k');
putchar(b + 4);
lcd_putchar('E');
}
else if(a&0x20)
{
//putchar('k');
putchar(b + 5);
lcd_putchar('F');
}
else if(a&0x40)
{
//putchar('k');
putchar(b + 6);
lcd_putchar('G');
}
else if(a&0x80)
{
//putchar('k');
putchar(b + 7);
lcd_putchar('H');
}
delay_ms(100);
};
}

Receiver coding
#include <mega32.h>
#include<delay.h>
unsigned char a, b;
char getchar(void);
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
#include <lcd.h>
#define RXB8 1
#define TXB8 0
#define UPE 2
#define OVR 3
#define FE 4
#define UDRE 5
#define RXC 7
#define FRAMING_ERROR (1<<FE)
#define PARITY_ERROR (1<<UPE)
#define DATA_OVERRUN (1<<OVR)
#define DATA_REGISTER_EMPTY (1<<UDRE)
#define RX_COMPLETE (1<<RXC)
// USART Receiver buffer
#define RX_BUFFER_SIZE 8
char rx_buffer[RX_BUFFER_SIZE];
#if RX_BUFFER_SIZE<256
unsigned char rx_wr_index,rx_rd_index,rx_counter;
#else
unsigned int rx_wr_index,rx_rd_index,rx_counter;
#endif
// This flag is set on USART Receiver buffer overflow
bit rx_buffer_overflow;
// USART Receiver interrupt service routine
interrupt [USART_RXC] void usart_rx_isr(void)
{
char status,data;
status=UCSRA;
data=UDR;
if ((status & (FRAMING_ERROR | PARITY_ERROR | DATA_OVERRUN))==0)
{
rx_buffer[rx_wr_index]=data;
if (++rx_wr_index == RX_BUFFER_SIZE) rx_wr_index=0;
if (++rx_counter == RX_BUFFER_SIZE)
{
rx_counter=0;
rx_buffer_overflow=1;
};
};
}
#ifndef _DEBUG_TERMINAL_IO_
// Get a character from the USART Receiver buffer
#define _ALTERNATE_GETCHAR_
#pragma used+
char getchar(void)
{
char data;
while (rx_counter==0);
data=rx_buffer[rx_rd_index];
if (++rx_rd_index == RX_BUFFER_SIZE) rx_rd_index=0;
#asm("cli")
--rx_counter;
#asm("sei")
return data;
}
#pragma used-
#endif
// USART Transmitter buffer
#define TX_BUFFER_SIZE 8
char tx_buffer[TX_BUFFER_SIZE];
#if TX_BUFFER_SIZE<256
unsigned char tx_wr_index,tx_rd_index,tx_counter;
#else
unsigned int tx_wr_index,tx_rd_index,tx_counter;
#endif

// USART Transmitter interrupt service routine


interrupt [USART_TXC] void usart_tx_isr(void)
{
if (tx_counter)
{
--tx_counter;
UDR=tx_buffer[tx_rd_index];
if (++tx_rd_index == TX_BUFFER_SIZE) tx_rd_index=0;
};
}
#ifndef _DEBUG_TERMINAL_IO_
// Write a character to the USART Transmitter buffer
#define _ALTERNATE_PUTCHAR_
#pragma used+
void putchar(char c)
{
while (tx_counter == TX_BUFFER_SIZE);
#asm("cli")
if (tx_counter || ((UCSRA & DATA_REGISTER_EMPTY)==0))
{
tx_buffer[tx_wr_index]=c;
if (++tx_wr_index == TX_BUFFER_SIZE) tx_wr_index=0;
++tx_counter;
}
else
UDR=c;
#asm("sei")
}
#pragma used-
#endif
// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
void main(void)
{// Declare your local variables here

// Input/Output Ports initialization


// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization


TIMSK=0x00;
// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud rate: 9600
UCSRA=0x00;
UCSRB=0xD8;
UCSRC=0x86;
UBRRH=0x03;
UBRRL=0x40;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
// Global enable interrupts
#asm("sei")
lcd_clear();
lcd_putsf("welcome");
delay_ms(1000);
lcd_clear();
while (1)
{
// Place your code here
a=getchar();
b = a >> 3;
if(b == 0b00011001)
lcd_putchar((a & 0b00000111) + 'A');
//delay_ms(10);
};
}

You might also like