You are on page 1of 91

Coexistence of zigbee-based wban and

Wifi for health telemonitoring systems

CHAPTER 1

1.1 INTRODUCTION

One of the most widely used wireless technologies in WBANs is ZigBee because it is
targeted at applications that require a low data rate and long battery life. However,
ZigBeebased WBANs face severe interference problems in the presence of WiFi networks.
This problem is caused by the fact that most ZigBee channels overlap with WiFi channels,
severely affecting the ability of healthcare monitoring systems to guarantee reliable delivery
of physiological signals. To solve this problem, we have developed an algorithm that controls
the load in WiFi networks to guarantee the delay requirement for physiological signals,
especially for emergency messages, in environments with coexistence of ZigBee based
WBAN and WiFi. Since WiFi applications generate traffic with different delay requirements,
we focus only on WiFi traffic that does not have stringent timing requirements. Therefore an
adaptive load control algorithm for ZigBee-based WBAN/WiFi coexistence environments,
with the aim of guaranteeing that the delay experienced by ZigBee sensors does not exceed a
maximally tolerable period of time. Zigbee is subject to interference from coexisting from
wifi devices. This is because the transmit power of wifi is 5-20 dB stronger than that of
zigbee

Wifi for health telemonitoring systems

1.2 ORGANIZATION OF THESIS

CHAPTER 1

Chapter 1 includes the introduction of coexistence of zigbee based wban and wifi for health
telemonitoring systems.
Coexistence of zigbee-based Wban and

CHAPTER 2

Chapter 2 deals with the concept of aim, components, proposed method of the project.

CHAPTER 3

Chapter 3 deals with the literature survey.

CHAPTER 4

Chapter 4 deals with the hardware implementation of project development and project
designLPC2148 microcontroller, ARM processor overview, history and development of
microcontroller and LPC2148 ADC features, operation and interrupts, LCD, pin functions
and LCD basic commands and ZIGBEE introduction, key features, characteristics, traffic
types and applications and ECG introduction and PR, QT intervals and wifi module
introduction, description. It also deals with the softwares used i.e., Keil (MDK474) and steps
to write an assembly language program in Keil and how to compile it.

CHAPTER 5

Chapter 5 deals with source code.

CHAPTER 6

Chapter 6 deals with results and discussion.

CHAPTER 7

Chapter 7 deals with advantages, applications, conclusion and bibliography

Wifi for health telemonitoring systems

2
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

CHAPTER 2

2.1 AIM:

The main aim of this project is to send the patient information to the cloud.

2.2 COMPONENTS:

Microcontroller board, ECG, zigbee, wifi module, Access point.

2.3 PROPOSED METHOD:

Here a WBAN system which consists of different sensors attached to a human body
need to update its data to remote place. Thus to send the information to the remote area we
are developing a WBAN consists of co-ordinator which accepts all the data and send that to
the cloud. And from the cloud it again can be viewed by any mobile device like mobile or
tablet. To demonstrate this, here we are developing a node consists of ECG and temperature
sensor which takes and sends the data to the co-ordinator, through which the data will be
updated to the cloud. As the internet is provided to this wifi from the Access point and push
to the IOT cloud, where the cloud will produce analytic based dashboard in real-time, which
can be accessed from any-where of the world by web. And each patient is recognized from
his ID and different channel in IOT cloud.

Wifi for health telemonitoring systems

CHAPTER 3

3
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

3.1 LITERATURE SURVEY

The development of telemonitoring via wireless body area networks (WBANs) is an evolving
direction in personalized medicine and home-based mobile health. A WBAN consists of
small, intelligent medical sensors which collect physiological parameters such as EKG
(electrocardiogram), EEG (electroencephalography) and blood pressure. The recorded
physiological signals are sent to a coordinator via wireless technologies, and are then
transmitted to a healthcare monitoring center. One of the most widely used wireless
technologies in WBANs is ZigBee because it is targeted at applications that require a low
data rate and long battery life. However, ZigBee-based WBANs face severe interference
problems in the presence of WiFi networks. This problem is caused by the fact that most
ZigBee channels overlap with WiFi channels, severely affecting the ability of healthcare
monitoring systems to guarantee reliable delivery of physiological signals. To solve this
problem, we have developed an algorithm that controls the load in WiFi networks to
guarantee the delay requirement for physiological signals, especially for emergency
messages, in environments with coexistence of ZigBee based WBAN and WiFi. Since WiFi
applications generate traffic with different delay requirements, we focus only on WiFi traffic
that does not have stringent timing requirements. Therefore, an adaptive load control
algorithm for ZigBee-based WBAN/WiFi coexistence environments, with the aim of
guaranteeing that the delay experienced by ZigBee sensors does not exceed a maximally
tolerable period of time. Simulation results show that our proposed algorithm guarantees the
delay performance of ZigBee-based WBANs by mitigating the effects of WiFi interference in
various scenarios.

Wifi for health telemonitoring systems

4
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

CHAPTER 4

DESIGN IMPLEMENTATION

(HARDWARE OR SOFTWARE)
4.1 BLOCK DIAGRAM

Fig 4.1 block diagram- transmitter section

5
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

4.2 RECEIVER SECTION

Fig 4.2 Receiver section

4.3 Power Supply:

The input to the circuit is applied from the regulated power


supply. The a.c input i.e., 230V from the mains supply is step down by the transformer to
12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c
voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to
a filter to remove any a.c components present even after rectification. Now, this voltage is
given to a voltage regulator to obtain a pure constant dc voltage. The block diagram of
regulated power supply

6
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

is shown in the figure 4.3

Fig 4.3 Block diagram of DC power( www.circuitstoday.com/dc


supply - power
- supplies)

6
DEPT OF ECE, SBIT KMM
Wifi for health telemonitoring systems

Transformer:

Usually, DC voltages are required to operate various electronic equipment and


these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the
a.c input available at the mains supply i.e., 230V is to be brought down to the required
voltage level. This is done by a transformer. Thus, a step down transformer is employed to
decrease the voltage to a required level.

Rectifier:

The output from the transformer is fed to the rectifier. It converts A.C. into
pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a
bridge rectifier is used because of its merits like good stability and full wave rectification.

7
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Filter:

Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output received from this filter is constant until the
mains voltage and load is maintained constant. However, if either of the two is varied,
D.C. voltage received at this point changes. Therefore a regulator is applied at the output
stage.

Voltage regulator:

As the name itself implies, it regulates the input applied to it. A voltage regulator is
an electrical regulator designed to automatically maintain a constant voltage level. In this
project, power supply of 5V and 12V are required. In order to obtain these voltage levels,
7805 and 7812 voltage regulators are to be used. The first number 78 represents positive
supply and the numbers 05, 12 represent the required output voltage levels

7
DEPT OF ECE, SBIT KMM
4.4 Embedded systems:

An embedded system is a specialized computer system that is part of a larger system or


machine. An embedded system usually contains an embedded processor. Many appliances
that have a digital interface -- microwaves, VCRs, cars -- utilize embedded systems. Some
embedded systems include an operating system. These systems are embedded into some
device for some specific purpose other than to provide general purpose computing.

8
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.4: A typical embedded system (www.engineersgarage.com)

Embedded systems provide several functions (Figure 5.1):

Monitor the environment; embedded systems read data from input sensors. This data is then
processed and the results displayed in some format to a user or users

Control the environment; embedded systems generate and transmit commands for actuators.

Transform the information; embedded systems transform the data collected in some

Meaningful way, such as data compression/decompression

Although interaction with the external world via sensors and actuators is an important
aspect of embedded systems, these systems also provide functionality specific to their
applications. Embedded systems typically execute applications such as control laws,
finite state machines, and signal processing algorithms.

based Wban and

9
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Fig 4.5: Sensors and actuators in embedded system (www.researchgate.net)

There are many categories of embedded systems, from communication devices to home
appliances to control systems. Examples include;

Communication devices

o modems, cellular phones

Home Appliances

o CD player, VCR, microwave oven

Control Systems

Automobile anti-lock braking systems, robotics, satellite control.

4.5 Characteristics of Embedded Systems:

Embedded systems are characterized by a unique set of characteristics. Each of


these characteristics imposed a specific set of design constraints on embedded systems
designers. The challenge to designing embedded systems is to confirm to the specific set of
constraints for the application

4.5.1. Application Specific Systems:

10
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Embedded systems are not general-purpose computers. Embedded system


designs are optimized for a specific application. Many of the job characteristics are known
before the hardware is designed. This allows the designer to focus on the specific design
constraints of a well-defined application. As such, there is limited user re-programmability.
Some embedded systems, however, require the flexibility of re-programmability.
Programmable DSPs are common for such applications.

9
DEPT OF ECE, SBIT KMM

4.5.2 Reactive Systems:

As mentioned earlier, a typical embedded systems model responds to the


environment via sensors and control the environment using actuators. This requires
embedded systems to run at the speed of the environment. This characteristic of embedded
system is called reactive. Reactive computation means that the system (primarily the
software component) executes in response to external events. External events can be either
periodic or aperiodic. Periodic events make it easier to schedule processing to guarantee
performance. Aperiodic events are harder to schedule.

4.5.3 Distributed Systems:

A common characteristic of an embedded system is one that consists of


communicating processes executing on several CPUs or ASICs which are connected by
communication links. The reason for this is economy. Economical 4 8-bit microcontrollers
may be cheaper than a 32-bit processors. Even after adding the cost of the communication
links, this approach may be preferable. In this approach, multiple processors are usually

11
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

required to handle multiple time-critical tasks. Devices under control of embedded systems
may also be physically distributed.

4.5.4 Heterogeneous Architectures:

Embedded systems often are composed of heterogeneous architectures. They


may contain different processors in the same system solution. They may also be mixed signal
systems. The combination of I/O interfaces, local and remote memories, and sensors and
actuators makes embedded system design truly unique. Embedded systems also have tight
design constraints, and heterogeneity provides better design flexibility.

Fig 4.6: Embedded systems have heterogonous architecture


(http://www.radioelectronics.com/info/processing-embedded/)

4.5.5 Harsh environment:

Many embedded systems do not operate in a controlled environment. Excessive


heat is often a problem, especially in applications involving combustion (e.g., many
transportation applications). Additional problems can be caused for embedded computing by
a need for protection from vibration, shock, lightning, power supply fluctuations, water,
corrosion, fire, and general physical abuse. For example, in the Mission Critical example
application the computer must function for a guaranteed, but brief, period of time even under

12
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

non-survivable fire conditions. These constraints present a unique set of challenges to the
embedded system designer, including accurately modeling the thermal conditions of these
systems.

DEPT OF ECE, SBIT KMM


11

4.5.6 System safety and reliability:

As embedded system complexity and computing power continue to grow, they


are starting to control more and more of the safety aspects of the overall system. These safety
measures may be in the form of software as well as hardware control. Mechanical safety
backups are normally activated when the computer system loses control in order to safely
shut down system operation. Software safety and reliability is a bigger issue. Software
doesn't normally "break" in the sense of hardware. However software may be so complex that
a set of unexpected circumstances can cause software failures leading to unsafe situations.
Discussion of this topic is outside the scope of this book, but the challenges for embedded
designers include designing reliable software and building cheap, available systems using
unreliable components. The main challenge for embedded system designers is to obtain low-
cost reliability with minimal redundancy.

4.5.7 Control of physical systems:

One of the main reasons for embedding a computer is to interact with the
environment. This is often done by monitoring and controlling external machinery.
Embedded computers transform the analog signals from sensors into digital form for
processing. Outputs must be transformed back to analog signal levels. When controlling

13
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

physical equipment, large current loads may need to be switched in order to operate motors
and other actuators. To meet these needs, embedded systems may need large computer circuit
boards with many non-digital components. Embedded system designers must carefully
balance system tradeoffs among analog components, power, mechanical, network, and digital
hardware with corresponding software.

4.5.8 Small and low weight:

Many embedded computers are physically located within some larger system.
The form factor for the embedded system may be dictated by aesthetics. For example, the
form factor for a missile may have to fit inside the nose of the missile. One of the challenges
for embedded systems designers is to develop non-rectangular geometries for certain
solutions. Weight can also be a critical constraint. Embedded automobile control systems, for
example, must be light weight for fuel economy. Portable CD players must be light weight
for portability purposes.

4.5.9 Cost sensitivity

Cost is an issue in most systems, but the sensitivity to cost changes can vary
dramatically in embedded systems. This is mainly due to the effect of computer costs have on
profitability and is more a function of the proportion of cost changes compared to the total
system cost.

4.5.10 Power management

Embedded systems have strict constraints on power. Given the portability

14
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

requirements of many embedded systems, the need to conserve power is important to


maintain battery life as long as possible. Minimization of heat production is another obvious
concern for embedded systems.

Security; these requirements are often specified as shall not requirements that define
unacceptable system behavior rather than required system functionality.

4.6 HARDWARE IMPLEMENTATION

4.6.1Project development:

This chapter briefly explains about Hardware Implementation of the project. It discusses the
design and working of the design with the help of block diagram and circuit diagram and
explanation of circuit diagram in detail. It explains the features, timer programming, serial
communication, interrupts of LPC2148 microcontroller. It also explains the various modules
used in this project.

4.6.2 Project Design:

The implementation of the project design can be divided in two parts.

Hardware implementation

Firmware implementation

15
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Hardware implementation deals in drawing the schematic on the plane paper according to the
application, testing the schematic design over the breadboard using the various ICs to find if
the design meets the objective, carrying out the PCB layout of the schematic tested on
breadboard, finally preparing the board and testing the designed hardware.

The firmware part deals in programming the microcontroller so that it can control the
operation of the ICs used in the implementation. In the present work, theKeil software
development tool to write and compile the source code, which has been written in the C
language. The progisp programmer has been used to write this compile code into the
microcontroller. The firmware implementation is explained in the next chapter.

The project design and principle are explained in this chapter using the block diagram and
circuit diagram. The block diagram discusses about the required components of the design
and working condition is explained using circuit diagram and system wiring diagram.

Coexistence of zigbee

4.7 LPC2148 MICROCONTROLLER

4.7.1ARM PROCESSOR OVERVIEW:

ARM stands for Advanced RISC Machines. It is a 32 bit processor core, used for high end

Application.

It is widely used in Advanced Robotic Applications.

4.8 History and Development:


ARM was developed at Acorn Computers ltd of Cambridge, England between 1983 and

16
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

1985.

RISC concept was introduced in 1980 at Stanford and Berkley.

ARM ltd was found in 1990.

ARM cores are licensed to partners so as to develop and fabricate new microcontrollers
around same processor cores.

Key features:

1. 16-bit/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.

2. 8kB to 40kB of on-chip static RAM and 32kB to 512kB of on-chip flash memory.
128-bit wide interface/accelerator enables high-speed 60 MHz operation.

3. In-System Programming/In-Application Programming (ISP/IAP) via on-chip boot loader


Software. Single flash sector or full chip erase in 400ms and programming of

256 bytes in 1ms.

4. Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with the
On-chip Real Monitor software and high-speed tracing of instruction execution.

5. USB 2.0 Full-speed compliant device controller with 2kB of endpoint RAM.

In addition, the LPC2146/48 provides 8kB of on-chip RAM accessible to USB by


DMA.

6. One or two (LPC2141/42 vs. LPC2144/46/48) 10-bit ADCs provide a total of 6/14
Analog inputs, with conversion times as low as 2.44s per channel.

7. Single 10-bit DAC provides variable analog output (LPC2142/44/46/48 only)

17
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

8. Two 32-bit timers/external event counters (with four capture and four compare
Channels each), PWM unit (six outputs) and watchdog

9. Low power Real-Time Clock (RTC) with independent power and 32 kHz clock
input.

10. Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400kbit/s),
SPI and SSP with buffering and variable data length capabilities.

11. Vectored Interrupt Controller (VIC) with configurable priorities and vector addresses.

12. Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.

13. Up to 21 external interrupt pins available.

14.60 MHz maximum CPU clock available from programmable on-chip PLL with settling

Time of 100s.

15. On-chip integrated oscillator operates with an external crystal from 1 MHz to 25MHz.

16. Power saving modes include idle and Power-down.

17. Individual enable/disable of peripheral functions as well as peripheral clock scaling for

Additional power optimization.

18. Processor wake-up from Power-down mode via external interrupt or BOD.

19. Single power supply chip with POR and BOD circuits.

20. CPU operating voltage range of 3.0 V to 3.6 V (3.3 V 10 %) with 5 V tolerant I/O Pads.

4.9 LPC 2148 ADC features:

10 bit successive approximation analog to digital converter

18
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

(One in LPC2141/2 and two in LPC2144/6/8).

Input multiplexing among 6 or 8 pins (ADC0 and ADC1).

Power-down mode.

Measurement range 0 V to VREF (typically 3 V; not to exceed VDDA voltage level).

Burst conversion mode for single or multiple inputs.

Optional conversion on transition on input pin or Timer Match signal.

Global Start command for both converters (LPC2144/6/8 only).

4.10 Operation:

4.10.1 Hardware-triggered conversion:

If the BURST bit in the ADCR is 0 and the START field contains 010-111, the ADC will start
a conversion when a transition occurs on a selected pin or Timer Match signal. The choices
include conversion on a specified edge of any of 4 Match signals, or conversion on a
specified edge of either of 2 Capture/Match pins. The pin state from the selected pad or the
selected Match signal, XORed with ADCR bit 27, is used in the edge detection logic.

4.11 Interrupts:

19
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

An interrupt request is asserted to the Vectored Interrupt Controller (VIC) when the DONE
bit is 1. Software can use the Interrupt Enable bit for the A/D Converter in the VIC to control
whether this assertion results in an interrupt. DONE is negated when the ADDR is read.

4.11.1 Accuracy vs. digital receiver:

The AD0.n function must be selected in corresponding Pin Select register in order to get
accurate voltage readings on the monitored pin. For pin hosting an ADC input, it is not
possible to have a have a digital function selected and yet get valid ADC readings. An inside
circuit disconnects ADC hardware from the associated pin whenever a digital function is
selected on that pin.

4.12 LIQUID CRYSTAL DISPLAY:

LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs
(seven segment LEDs or other multi segment LEDs) because of the following reasons:

1. The declining prices of LCDs.

2. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which
are limited to numbers and a few characters.

3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task
of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep displaying
the data.

3. Ease of programming for characters and graphics.

These components are specialized for being used with the microcontrollers, which means
that they cannot be activated by standard IC circuits. They are used for writing different
messages on a miniature LCD

20
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.7: LCD display (whatis.techtarget.com/definition/LCD-liquid-crystal-display)

18
DEPT OF ECE, SBIT KMM
A model is low price and great possibilities most frequently used in practice. It is based on
the HD44780 microcontroller and can display messages in two lines with 16 characters each.
It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In
addition, it is possible to display symbols that user makes up on its own. Automatic shifting
message on display (shift left and right), appearance of the pointer, backlight etc. are
considered as useful characteristics.

19
DEPT OF ECE, SBIT KMM
Wifi for health telemonitoring systems

4.13 Pin Functions

There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background
light is built in). Their function is described in the table 1 below:

21
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Table 4.1: PIN description of LCD (https://www.engineersgarage.com/electronic-components/16x2-


Lcd-module-datasheet)

Pin Logic
D
Number State
Function escriptio
n

Name

Ground 1 Vss - 0V

Power supply 2 Vdd - +5V

Contrast 3 Vee - 0 Vdd

D0 D7 are interpreted
0 as

4 RS commands

1
D0 D7 are interpreted
as data

Write data (from


controller to

LCD)
0
Control of 5 R/W
1 Read data (from LCD to

22
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

operating
controller)

0 Access to LCD disabled

1 Normal operating
6 E
From 1 to Data/commands are
transferred
0 to LCD

7 D0 0/1 Bit 0 LSB

8 D1 0/1 Bit 1

Data /
commands
9 D2 0/1 Bit 2

10 D3 0/1 Bit 3

11 D4 0/1 Bit 4

12 D5 0/1 Bit 5

23
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

13 D6 0/1 Bit 6

DEPT OF ECE, SBIT KMM 20


14 D7 0/1 Bit 7 MSB

4.14 LCD screen:

LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied
on pin marked as Vee. The connections are as shown in figure 6.4. Some versions of displays
have built in backlight (blue or green diodes). When used during operating, a resistor for
current limitation should be used (like with any LE diode).

Fig 4.8: power supply connection to LCD (www.lifewire.com)

4.15 LCD Basic Commands

All data transferred to LCD through outputs D0-D7 will be interpreted as commands or as
data, which depends on logic state on pin RS:

24
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in


processor addresses built in map of characters and displays corresponding symbols.
Displaying position is determined by DDRAM address. This address is either
previously defined or the address of previously transferred character is automatically

incremented.


hich determine display mode. List of
RS = 0 - Bits D0 - D7 are commands w
commands which LCD recognizes.

21
DEPT OF ECE, SBIT KMM
Table 4.2: LCD Command description (binaryupdates.com/interface-lcd-with-lpc2148-arm7/)

Execution
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0
Time

Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS

Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS

Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS

Display on/off control 0 0 0 0 0 0 1 D U B 40uS

25
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Cursor/Display Shift 0 0 0 0 0 1 D/C R/L X x 40uS

Function set 0 0 0 0 1 DL N F X x 40uS

Set CGRAM address 0 0 0 1 CG RAM address 40uS

Set DDRAM address 0 0 1 DD RA M address 40uS

Read BUSY flag (BF) 0 1 BF DD RA M address -

Write to CGRAM or

1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM

Read from CGRAM or

1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM

4.16LCD connections:
Depending on how many lines are used for connection to the microcontroller, there are
8bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the process in
a phase called initialization. In the first case, the data are transferred through outputs D0-D7 as
it has been already explained. In case of 4-bit LED mode, for the sake of saving valuable I/O pins
of the microcontroller, there are only 4 higher bits (D4-D7) used for communication, while other
may be left unconnected. Consequently, each data is sent to LCD in two steps: four higher bits
are sent first (that normally would be sent through lines D4-D7), four lower bits are sent
afterwards. With the help of initialization, LCD will correctly connect and interpret each data

26
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

received. Besides, with regards to the fact that data are rarely read from LCD (data mainly are
transferred from microcontroller to LCD) one more I/O pin may be saved by simple connecting
R/W pin to the Ground. Even though message displaying will

22
DEPT OF ECE, SBIT KMM
Be normally performed, it will not be possible to read from busy flag since it is not possible
to read from display.

4.17 ZIGBEE

Fig 4.9: zigbee (https://en.wikipedia.org/wiki/ZigBee)

27
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

4.17.1 INTRODUCTION

ZigBee is an established set of specifications for wireless personal area networking


(WPAN), i.e. Digital radio connections between computers and related devices. WPAN Low
Rate or ZigBee provides specifications for devices that have low data rates, consume very
low power and are thus characterized by long battery life. ZigBee makes possible completely
networked homes where all devices are able to communicate and be controlled by a single
unit. The current list of application profiles either published or in the works are:

Home Automation

ZigBee Smart Energy

Telecommunication Applications

Personal Home

4.17.2 ZIGBEE KEY FEATURES:

1. Low Power-The benefits of simple, cost-effective, low-power wireless connectivity that


ZigBee technology provides address a variety of markets, including industrial and home
monitoring, control and automation, as well as health care diagnostics.

2. Robust-802.15.4 provides a robust foundation for ZigBee, ensuring a reliable solution in


noisy environments. Features such as energy detection, clear channel assessment and channel
selection help the device pick the best possible channel.

3. Mesh Networking-The ability to cover large areas with routers is one of the key features of
ZigBee that helps differentiate itself from other technologies. Mesh networking can extend
the range of the network through routing.

4. Interoperability-The ZigBee Alliance helps ensure interoperability between vendors by


creating testing and certification programs for ZigBee devices.

28
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

4.17.3 ZIGBEE CHARACTERISTICS

The focus of network applications under the IEEE 802.15.4 / ZigBee standard include
the features of low power consumption.

These features are enabled by the following characteristics,

2.4GHz and 868/915 MHz dual PHY modes. This represents three license-free bands:
2.42.4835 GHz, 868-870 MHz and 902-928 MHz the number of channels allotted to each
frequency band is fixed at sixteen (numbered 11-26), one (numbered 0) and ten (numbered
110) respectively. The higher frequency band is applicable worldwide, and the lower band in
the areas of North America, Europe, Australia and New Zealand.

Low power consumption, with battery life ranging from months to years. Considering the

number of devices with remotes in use at present, it is easy to see that more numbers of
batteries need to be provisioned every so often, entailing regular (as well as timely), recurring
expenditure. In the ZigBee standard, longer battery life is achievable by either of two means:
continuous network connection and slow but sure battery drain, or intermittent connection
and even slower battery drain.

24
DEPT OF ECE, SBIT KMM
-based Wban and

Maximum data rates allowed for each of these frequency bands are fixed as 250 kbps @2.4

29
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

GHz, 40 kbps @ 915 MHz, and 20 kbps @868MHz.

Channel access using Carrier Sense Multiple Access with Collision Avoidance (CSMA -
CA).

50m typical range.

Different topologies as illustrated below: star, peer-to-peer, mesh.

4.18 TRAFFIC TYPES:

IEEE 802.15.4 MAC can accommodate all the types.

1. Data is periodic. The application dictates the rate, and the sensor activates, checks for data
and deactivates.

2. Data is intermittent. The application, or other stimulus, determines the rate, as in the case of
say smoke detectors. The device needs to connect to the network only when communication
is necessitated. This type enables optimum saving on energy.

3. Data is repetitive, and the rate is fixed a priori. Depending on allotted time slots, called GTS
(Guaranteed time slot), devices operate for fixed durations.

TRAFFIC ARCHITECHTURE:

ZigBee stack architecture follows the standard Open Systems Interconnection (OSI)
reference model, ZigBee's protocol stack is structured in layers. The first two layers, physical
(PHY) and media access (MAC), are defined by the IEEE 802.15.4 standard.

The layers above them are defined by the ZigBee Alliance.

30
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

The model has five layers namely

Physical (PHY) layer

Media access control (MAC) layer

Network (NWK) and security layers

Application framework
Wifi for health telemonitoring systems

Application profiles

PHYSICAL LAYER:

ZigBee-compliant products operate in unlicensed bands worldwide, including 2.4GHz


(global), 902 to 928MHz (Americas), and 868MHz (Europe). Raw data throughput rates of
250Kbps can be achieved at 2.4GHz (16 channels), 40Kbps at 915MHz (10 channels), and
20Kbps at 868MHz (1 channel). The transmission distance is expected to range from 10 to
75m, depending on power output and environmental characteristics. Like Wi-Fi, Zigbee uses
direct-sequence spread spectrum in the 2.4GHz band, with offset-quadrature phase-shift
keying modulation. Channel width is 2MHz with 5MHzchannel spacing.

31
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Fig 4.10zigbee stack model


(https://www.safaribooksonline.com/library/view/building.../zigbee_stack_layers.html)

MEDIA ACCESS CONTROL LAYER:

The media access control (MAC) layer was designed to allow multiple topologies
without complexity. The power management operation doesn't require multiple modes of
operation. The MAC allows a reduced functionality device (RFD) that needn't have flash nor
large amounts of ROM or RAM. The MAC was designed to handle large numbers of devices
without requiring them to be "parked".

The MAC provides network association and disassociation, has an optional super
frame structure with beacons for time synchronization, and a guaranteed time-slot mechanism
for high-priority communications.

DEPT OF ECE, SBIT KMM


26
Wifi for health telemonitoring systems

NETWORK LAYER

32
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Zigbee self-forming and self-healing mesh-network architecture lets data and control
messages pass from one node to another by multiple paths. This feature extends the network
range and improves data reliability. It may also be used to build large, geographically
dispersed networks with smaller networks linked to form a 'cluster-tree' network.

SECURITY LAYER:

Security and data integrity are key benefits of the ZigBee technology. ZigBee leverages the
security model of the IEEE 802.15.4 MAC sub-layer which specifies four security services:

access controlthe device maintains a list of trusted devices within the network

Data encryption, which uses symmetric key 128-bit advanced encryption standard

Frame integrity to protect data from being modified by parties without cryptographic keys

Sequential freshness to reject data frames that have been replayedthe network controller
compares the freshness value with the last known value from the device and rejects it if the
freshness value has not been updated to a new value.

COMPARISION BETWEEN WIRELESS STANDARDS

Table 4.3 (https://en.wikipedia.org/wiki/Comparison_of_wireless_data_standards)

33
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

based Wban and

4.19APPLICATIONS

ZigBee is well suited for a wide range of control uses in just about any market. The
Alliance has focused its standards development efforts around the commercial, residential,
energy, consumer and industrial sectors. It has developed global standards for energy
management and efficiency, home and building automation, health care and fitness, telecom
and consumer electronics. Here are just a few examples of what our standards control:

Demand Response

Advanced Metering Infrastructure



Automatic Meter Reading

Lighting controls

HVAC control

34
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Heating control

Wireless smoke and CO detectors

Home security

Blind, drapery and shade controls

Medical sensing and monitoring

Remote control of home entertainment systems

Indoor location sensing

Advertising on mobile devices

Overview:

There are many wireless monitoring and control applications for industrial and home
markets which require longer battery life, lower data rates and less complexity than available
from existing wireless standards like Bluetooth and Wi-Fi. So, there was a need for a standard
based, interoperable wireless technology that addresses the unique needs of low data rate
wireless control and sensor based networks. In this regard, zigbee was poised to become the
global control/sensor network standard.

Zigbee promises to put wireless sensors in everything from factory automation


systems to home security systems to consumer electronics. Zigbee is a new standard that still
needs to pass through the circles or rigorous technology critics and establish its own place in
The industry. The next zigbee challenge will be devising the proposed extension to the

802.15.4 Standard,4a which could be based on ultra-wideband (UWB).

35
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

4.20 ECG

4.20.1 Introduction

The AD8232 is a neat little chip used to measure the electrical activity of the heart. This
electrical activity can be charted as an ECG or Electrocardiogram. Electrocardiography is
used to help diagnose various heart conditions. Now for the disclaimer:

N OTE: This device is not intended to diagnose or treat any conditions.

FIG 4.11.: ECG (https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide )

Coexistence of zigbee-

36
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Covered in this Tutorial:

In this tutorial, we will go over the basics for getting your AD8232 Heart Rate Monitor up
and running. First, an overview of the board and all its features will be presented. Then, well
show you how hook it up to your favorite microcontroller and how to create visual data using
Processing.

Suggested Reading

If you are not familiar with any of the following concepts, you may want to review them
before moving ahead.

What is an Arduino?

Connecting Arduino to Processing

How to Power Your Project

Serial Communication

Serial Terminal Basics

Wire Understanding the ECG:

In general terms, lets look at what an ECG is representing and how were able to sense it.

The ECG is separated into two basic Intervals, the PR Interval and the QT Interval,
described below.

Note: All information comes from the Waves and Intervals section of the ECG Wikipedia
page.

37
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

38
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig4.12: Credit Wikipedia.org (https://learn.sparkfun.com/tutorials/ad8232-heart-rate-


monitor-hookup-guide)

DEPT OF ECE, SBIT KMM


31
Coexistence of zigbee

Fig4.13: Diagram of the heart. Credit Wikipedia.org


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

PR Interval

39
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

The PR interval is the initial wave generated by an electrical impulse traveling from the right
atrium to the left. The right atrium is the first chamber to see an electrical impulse. This
electrical impulse causes the chambers to depolarize. This forces it to contract and drain
deoxygenated blood from both the Superior and Inferior vena cava into the right ventricle. As
the electrical impulse travels across the top of the heart it then triggers the left atrium to
contract. The left atrium is responsible for receiving newly oxygenated blood from the lungs
into the left ventricle via the left and right pulmonary veins. The pulmonary veins are red in
the diagram because they are carrying oxygenated blood. They are still called veins because
veins carry blood towards the heart.

DEPT OF ECE, SBIT KMM


32

QT Interval

The QT Interval is where things get really interesting. The QRS is a complex process that
generates the signature beep in cardiac monitors. During QRS both ventricles begin to
pump. The right ventricle begins to pump deoxygenated blood into the lungs through the left
and right pulmonary arteries. The pulmonary arteries are blue in the diagram because they are
carrying deoxygenated blood. They are still called arteries because arteries carry blood away
the heart. Science, Again! The left ventricle is also begining to pump freshly oxygenated
blood through the aorta and into the rest of the body. After the initial contraction comes the
ST segment. The ST segment is fairly quiet electrically as it is the time where the ventricles
waiting to be re-polarized. Finally the T wave becomes present to actively re-ploarize, or
relax the ventricles. This relaxation phase resets the ventricles to be filled again by the
atriums.

Connecting the Hardware

40
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

In this guide, well connect the AD8232 Breakout to an Arduino microcontroller. We will
build a simple cardiac monitor that will allow you to measure the electrical activity of the
heart in real time!

Materials required for this example

Spark Fun Single Lead Heart Rate Monitor - AD8232SEN-12650The AD8232 Spark Fun
Single Lead Heart Rate Monitor is a cost-effective board used to measure the electrical
activity of the heart. This electrical act

Biomedical Sensor Pad (10 pack) SEN-12969This is a 10 pack of Biomedical Sensor Pads,
disposable electrodes that can be used to measure EEG, ECG and EMG levels.

These little pads are perfect

Sensor Cable - Electrode Pads (3 connector) CAB-12970This is your simple three conductor
sensor cable with electrode pad leads. These cables are 24" long and feature a 3.5mm audio

jack connector.

Arduino Pro Mini 328 - 3.3V/8MHzDEV-11114It's blue! It's thin! It's the Arduino Pro Mini!

Spark Funs minimal design approach to Arduino. This is a 3.3V Arduino running the 8MHz
boot loader. Ar

33
DEPT OF ECE, SBIT KMM
Wifi for health telemonitoring systems

Breadboard - Self-Adhesive (White) PRT-12002This is your tried and true white solderless
breadboard. It has 2 power buses, 10 columns, and 30 rows - a total of 400 tie in points.

41
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Break Away Headers - StraightPRT-00116A row of headers - break to fit. 40 pins that can be
cut to any size. Used with custom PCBs or general custom headers.

Jumper Wire KitPRT-00124This is a time saving kit of jumper wires - cut, stripped, and
prebent for your prototyping pleasure. Included with this kit are 14 various lengths.

SparkFun FTDI Basic Breakout - 3.3VDEV-09873This is the newest revision of our [FTDI
Basic](http://www.sparkfun.com/commerce/product_info.php?products_id=8772).
SparkFun USB Mini-B Cable - 6 FootCAB-11301This is a USB 2.0 type A to Mini-B 5pin
cable. You know, the mini-B connector that usually comes with USB Hubs, Cameras, MP3
players, etc.

4.20.2 Pin Connections

The AD8232 Heart Rate Monitor breaks out nine connections from the IC. We traditionally
call these connections pins because they come from the pins on the IC, but they are actually
holes that you can solder wires or header pins.

Well connect five of the nine pins on the board to your Arduino. The five pins you need are

GND, 3.3v, OUTPUT, LO-, and LO+.

Table 4.4: Headers to board connection


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Board Pin Function Arduino


Label Connection

GND Ground GND

3.3v 3.3v Power 3.3v


Supply

OUTPUT Output Signal A0

42
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

LO- Leads-off Detect 11


-

LO+
Leads-off Detect 10
+

SDN Shutdown Not used

You can use any method youd like to make your connections to the board. For this example,
well solder on a five-pin length of male-male header strip and use a breadboard and jumpers
to make our connections.

DEPT OF ECE, SBIT KMM


34

43
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Fig 4.14. Headers installed


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Follow the diagram below, to make necessary connections. The SDN pin is not used in this
demo. Connecting this pin to ground or LOW on a digital pin will power down the chip.
This is useful for low power applications.

DEPT OF ECE, SBIT KMM


35

44
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.15: Connection Diagram


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Now that the electronics are complete, lets look at sensor pad placement. It is recommended
to snap the sensor pads on the leads before application to the body. The closer to the heart the
pads are, the better the measurement. The cables are color coded to help identify proper
placement.

Table 4.5 (https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Cable Signal
Color

Black RA (Right Arm)

Blue LA (Left Arm)

45
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Red RL (Right Leg)

36
DEPT OF ECE, SBIT KMM

Fig 4.16: Sensors connected to Heart Monitor


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

37
DEPT OF ECE, SBIT KMM

46
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

47
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

48
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.17: Typical Sensor Placements


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Uploading the Sketch and Connecting with Processing

By this point, you should have the hardware connected and ready.

The example sketch can be found on github here. You can cut and paste the code straight
from github or clone the repository and open the file. For more on using the

SparkFunGithub repositories, read this handy tutorial. If youve never worked with the
Arduino IDE before, please see this tutorial.

49
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

50
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.18: Upload sketch to Arduino Pro-Mini


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

Now that you have a sketch running, lets get the processing sketch ready. The processing
sketch will give you a visual output of whats going on. The example processing sketch can
be found here.

51
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Fig 4.19: Run the Processing sketch


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

If the processing sketch does not work, you may need to modify the following line:

COPY CODE

MyPort = new Serial (this, Serial.list () [2], 9600);

You may need to change the parameter inside Serial.list () [N]. A List of available COM ports
will appear in the lower portion of the sketch window. Remember that COM port selection
begins at 0. Typically your Arduino will appear as the highest COM number if it is the only
device connected to your computer.

Fig 4.20: COM ports


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

The Arduino shows up as COM38. This is found in the Serial List at array element 2.

If everything is working correctly, you should see a nice box pop up and start displaying the
output signal.

52
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.21:Normal heart rate of an SFE engineer


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

If your subject decides to remove the sensors, the leads off detection will kick in and display
a flat blue line.

DEPT OF ECE, SBIT KMM

Fig 4.22:Flight, we just lost Lovell!


(https://learn.sparkfun.com/tutorials/ad8232-heart-rate-monitor-hookup-guide)

53
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

Tips and Tricks

ECGs are notoriously noisy. This is because you are measuring muscle activation. The
further sensor pads are from the heart, the more muscle noise you will see. These are
commonly referred to as Motion Artifacts. So here are some simple tips to improve the
signal quality.

Keep sensor pads as close to the heart as you can.



Make sure the RA and LA sensor pads are on correct sides of the heart.

Try not to move too much while taking a measurement.

Try to use fresh pads for each measurement. The pads lose the ability to pass signals with
multiple applications.

Prep and clean the area you plan to stick pads. This will help make a good connection (hair is
not a good conductor).

You may have to adjust sensor placement for different individuals.

DEPT OF ECE, SBIT KMM

42
4.21 .Wi-Fi Module

Fig 4.23: WIFI (https://www.sparkfun.com/products/13678)

54
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

4.21.1 Introduction

When power is applied to the module you should see the red power light turn on and the blue
serial Indicator light flicker briefly. If you have a 3.3V FTDI Serial to USB board you can get
started without fear of destroying your newESP8266 WiFi module. Do note that many FTDI
boards have a solder jumper to convert from 3.3V to5V operation so ensure it is set to enable
3.3V operation.

Here are the connections required to enable communication with the module over serial:

What is this ESP8266

It's a wireless

It has GPIO, I2C, ADC, SPI, PWM and some more



It's running at 80MHz

64KBytes of instruction RAM

96KBytes of data RAM

64KBytes boot ROM

It has a Win bond W25Q40BVNIG SPI flash



DEPT OF ECE, SBIT KMM
It's a RISC architecture

55
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

The core is a 106micro Diamond Standard core (LX3) made by Tensilica

The ESP8266 chip is made by Espressif

Modules bearing this chip are made by various manufacturers

4.21.2 Description:

The ESP8266 WiFi Module is a self-contained SOC with integrated TCP/IP protocol stack
that can give any microcontroller access to your WiFi network. The ESP8266 is capable of
either hosting an application or offloading all Wi-Fi networking functions from another
application processor. The ESP8266 module is an extremely cost effective board with a huge,
and ever growing, community.

This module has a powerful enough on-board processing and storage capability that allows it
to be integrated with the sensors and other application specific devices through its GPIOs
with minimal development up-front and minimal loading during runtime. Its high degree of
on-chip integration allows for minimal external circuitry, including the front-end module, is
designed to occupy minimal PCB area. The ESP8266 supports APSD for VoIP applications
and Bluetooth co-existence interfaces, it contains a self-calibrated RF allowing it to work
under all operating conditions, and requires no external RF parts.

There is an almost limitless fountain of information available for the ESP8266, all of which
has been provided by amazing community support. In the Documents section below you will
find many resources to aid you in using the ESP8266, even instructions on how to
transforming this module into an IoT (Internet of Things) solution!

Note: The ESP8266 Module is not capable of 5-3V logic shifting and will require an external
Logic Level Converter. Please do not power it directly from your 5V dev board.

Note: This new version of the ESP8266 WiFi Module has increased the flash disk size from
512k to 1MB.

56
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Features:

802.11 b/g/n

Wi-Fi Direct (P2P), soft-AP

Integrated TCP/IP protocol stack

DEPT OF ECE, SBIT KMM


+19.5dBm output power in 802.11b mode

Power down leakage current of <10uA

1MB Flash Memory

Integrated low power 32-bit CPU could be used as application processor

Wake up and transmit packets in < 2ms

Standby power consumption of < 1.0mW (DTIM3)


Technical Overview


ESP8266 is a complete and self-contained Wi-Fi network solutions that can carry
software applications, or through another application processor uninstall all Wi-Fi
networking capabilities. ESP8266 when the device is mounted and as the only
application of the application processor, the flash memory can be started directly from
an external Move. Built-in cache memory will help improve system performance and
reduce memory requirements. Another situation is when wireless Internet access
assume the task of Wi-Fi adapter, you can add it to any microcontroller-based design,

57
DEPT OF ECE, SBIT KMM
Coexistence of zigbee-based Wban and

and the connection is simple, just by SPI / SDIO interface or central processor AHB
bridge interface. Processing and storage capacity on ESP8266 powerful piece, it can
be integrated via GPIO ports sensors and other applications specific equipment to
achieve the lowest early in the development and operation of at least occupy system
resources. The ESP8266 highly integrated chip, including antenna switch balun,
power management converter, so with minimal external circuitry, and includes
frontend module, including the entire solution designed to minimize the space
occupied by PCB. The system is equipped with ESP8266 manifested leading features
are: energy saving VoIP quickly switch between the sleep / wake patterns, with low-
power operation adaptive radio bias, front-end signal processing functions,
troubleshooting and radio systems coexist characteristics eliminate cellular /
Bluetooth / DDR / LVDS / LCD interference.

DEPT OF ECE, SBIT KMM

58
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.24: ESP8266 CIRCUIT DIAGRAM


(www.circuitsgallery.com/2016/01/getting-started-with-esp8266-esp-01.html)

ESP8266 application subject


Smart Power Plug

Home Automation

mesh network

industrial wireless control

Baby Monitor

Network Camera

sensor networks

wearable electronics

wireless location-aware devices

Security ID tag

wireless positioning system signals

DEPT OF ECE, SBIT KMM

46

Specifications

Power
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

The following data are based on a 3.3V power supply, ambient temperature 25C and use the
internal regulator measured. [1] All measurements are made in the absence of the SAW filter,
the antenna interface is completed. [2] All transmit data based on 90% duty cycle, continuous
transmission mode in the measured.

CPU and memory

CPU Interface

The chip embedded in an ultra-low-power 32-bit micro-CPU, with 16 compact mode. Can be
connected to the CPU via the following interfaces:

connecting storage controllers can also be used to access external code memory RAM
/ ROM interface (iBus)

Also attached storage controller data RAM interface ( dBus )

Access Register of AHB interface

JTAG debug interface

Storage Controller

Storage controller contains ROM and SRAM. CPU can iBus, dBus and AHB interface to
access the storage controller. Any one of these interfaces can apply for access to ROM or
RAM cells, memory arbiter to determine the running order in the order of arrival.

47
DEPT OF ECE, SBIT KMM

General Purpose I/O pins


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

A total of up to 16 GPIO pins. The firmware can assign them different functions. Each GPIO
can be configured internal pull up / pull down resistors available software registers sampled
input, triggering edge or level CPU interrupt input, trigger level wake-up interrupt input,
open-drain or complementary push-pull output drivers, software register output source or
sigma-delta PWM DAC. These pins are multiplexed with other functions, such as the main
interface, UART, SI, Bluetooth co-existence and so on.

Digital I/O pins

Digital IO pad is two-way, three states. It includes a three-state control input and output
buffers. In addition, for low-power operation, IO can be set to hold state. For example, when
we reduce the chip's power consumption, all the output enable signal can be set to maintain a
low-power state. Hold function can be selectively implanted IO in need. When the IO help
internal and external circuit driving, hold function can be used to hold last state. Hold function
to pin introduce some positive feedback. Therefore, the external drive pin must be stronger
than the positive feedback. However, the required driving force size is still small, in the order
of 5uA

48
DEPT OF ECE, SBIT KMM

Wifi for health telemonitoring systems

Table 4.6 wifi pins


connection

variables Symbol Min Max Units

Input Low Vil -03.3 0.25xV1 V


Voltage 0

Input High Vih 0.75xV10 3.6 V


Voltage
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Input leakage IIL - 50 nA


current

Output Low VOL - 0.1xV10 V


Voltage

Output High VOH 0.8xV10 - V


Voltage

Input pin Cpad - 2 pF


capacitance

VDDIO V10 1.7 3.6 V

Current Imax - 12 mA

Temperature Tamb -20 100 C

All digital I/O pins must add an overvoltage protection circuit (snap back circuit) between the pin
and ground. Usually bounce (snap back) voltage is about 6V, while maintaining the voltage is
5.8V. This prevents excessive voltage and generating ESD. Diodes also avoid reverse voltage
output devices.

Firmware and software tools development kit

The firmware running on the ROM and SRAM chip, when the device is awake, firmware via
SDIO sector Download the instructions from the host side. Firmware is fully compliant with
802.11 b / g / n / e / i WLAN MAC protocol and Wi-Fi Direct specification only supports basic
services unit distributed control function (DCF) under (BSS) operation, but also follow the latest
Wi-Fi P2P protocol to support P2P groups operating (P2P group operation). Low level protocol
functions automatically run by ESP8266, such as
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems


RTS / CTS


Confirm


fragmentation and reassembly


polymerization

frame package (802.11h / RFC 1042)


automatic beacon monitoring / scanning


P2P WiFi direct

With P2P discovery procedures, passive or active scanning once in the host command start, it will
be done automatically. Perform power management, interaction with the host at least, this way,
the task of effectively minimized.

Power Management

Chip can tune into the following states:


Off (OFF): C
HIP_PD pin is in a low power state. RTC failure. All registers are emptied.


Deep sleep (DEEP_SLEEP): RTC open, other parts of the chip are closed. RTC internal
recovery memory to save the basic WiFi connection information.


Sleep (SLEEP): Only RTC running. Crystal oscillator stops. Any part of the wake
( MAC, host, RTC timer, and external interrupt) will make the wake of the chip.


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Wake (WAKEUP): In this state, the system from a sleep state to start (PWR) status.
Crystal oscillator and PLL are converted enabled state.

* On state (ON): High-speed clock can run, and sent to each clock control register is enabled
Modules. Each module, including the CPU, including the implementation of relatively lowlevel
clock gating. When the system works, you can WAITI instructions to turn off the CPU's internal
clock.

50
DEPT OF ECE, SBIT KMM

Clock Management

High Frequency Clock

ESP8266 on high frequency clock is used to drive two Tx and Rx mixer, which is generated by
the internal oscillator and an external oscillator. Crystal frequency between 26MHz to 52MHz
float. Although the internal crystal oscillator of the calibration range of the crystal so that the
clock generator to meet the conditions, but in general, the crystal quality is still obtained a proper
phase noise factors to be considered. When the crystal is used, or because of the frequency offset,
rather than the best choice for quality, the maximum capacity of the data processing system and
will reduce the sensitivity of the wifi. Please refer to the following instructions to measure the
frequency offset.

Table 4.7 Reference requirements:

External

Reference

Requirements

At 26MHz external clock frequency between 52MHz. In order to make a well-functioning


Unit
Variables Symbol Min Max s
Coexistence of zigbee-based Wban and
Frequency Fxo 52 WifiMHz
for health telemonitoring systems

radio receiver, the


Load capacitance Cl pF
32

Dynamic capacitance Cm pF
2 5

Serial resistance Rs
0 65

Frequency tolerance Fxo ppm


-15 15

Frequency vs Temperature ( - Fxo,Tem ppm


25C ~ 75C) p -15

15

Table 4.8 clock will must have the following characteristics:

Variables Symbol Mi Max Units


n

Clock amplitude Vxo 0.2 1 Vpp

External clock accuracy Fxo,EXT -15 15 Ppm

Phase Noise @ 1kHz offset, 40MHz -120 dBc/Hz


clock

Phase Noise @ 10kHz offset, 40MHz -130 dBc/Hz


clock
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Phase Noise @ 100kHz offset, 40MHz -138 dBc/Hz


clock

Radio receivers

ESP8266 radio receiver mainly includes the following modules:


2.4 GHz receiver

2.4 GHz transmitter

High-speed clock generator and crystal oscillator

Real-time clock


bias and regulators

Power Management

52
DEPT OF ECE, SBIT KMM

Channel Frequency

Table 4. 9 According IEEE802.11bgn standard, RF transceiver supports the following channels :

Chann Freq. Chann Fre


el el q.
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

1 2412 8 244
7

2 9 245
2417 2

3 2422 10 245
7

4 2427 11 246
2

5 2432 12 246
7

6 2437 13 247
2

7 2442 14 248
4

4.22GHz receiver

2.4GHz RF signal receiver down into quadrature baseband signal, with two high-resolution, high-
speed ADC and the latter into a digital signal. In order to accommodate different signal channels,
a radio receiver integrated RF filters, automatic gain control (AGC), DC offset compensation
circuit and a baseband filter.

4.23GHz transmitter

2.4 GHz transmitter orthogonal frequency baseband signals up to 2.4GHz, using high-power
CMOS power amplifier to drive the antenna. Further use of the digital calibration improves the
linearity of the power amplifier to achieve the average power of + 19dBm in 802.11b
transmission, the transmission reaches + 16dBm 802.11n average power, features super. To offset
defects in the radio receiver is also calibrated by other measures such as:
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems


carrier leakage


I / Q phase matching, and

bas
eband
nonline
ar

This will reduce the time and equipment required for testing.

Clock generator

The clock generator generates the receiver and transmitter 2.4GHz clock signal all of its
components are integrated on the chip, Include:


inductor

varactor

54
DEPT OF ECE, SBIT KMM

4.24 SOFTWARES USED

The following are the softwares and their procedures used for project are described below:

4.24.1Keil (MDK474):

Keil compiler is a software used where the machine language code is written and compiled. After
compilation, the machine source code is converted into hex code which is to be dumped into the
microcontroller for further processing. Keil compiler also supports C language code.

STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL AND HOW

TO COMPILE IT:

1. Install the Keil Software in the PC in any of the drives.


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

2. After installation, an icon will be created with the name Keil microVision3. Just drag this icon
onto the desktop so that it becomes easy whenever you try to write programs in Keil..

3. Double click on this icon to start the Keil compiler.

4. A page opens with different options in it showing the project workspace at the leftmost corner
side, output window in the bottom and an ash colored space for the program to be written.

5. Now to start using the Keil, click on the option project.

6. A small window opens showing the options like new project, import project, open project etc.
Click on New project.

7. A small window with the title bar Create new project opens. The window asks the user to give
the project name with which it should be created and the destination location. The project can be
created in any of the drives available. You can create a new folder and then a new file or can
create directly a new file.

8. After the file is saved in the given destination location, a window opens where a list of vendors
will be displayed and you have to select the device for the target you have

created.

9. The most widely used vendor is Atmel. So click on Atmel and now the family of microcontrollers
manufactured by Atmel opens. You can select any one of the microcontrollers according to the
requirement.

10. When you click on any one of the microcontrollers, the features of that particular microcontroller
will be displayed on the right side of the page. The most appropriate microcontroller with which
most of the projects can be implemented is the AT89C51.

Click on this microcontroller and have a look at its features. Now click on OK to select
this microcontroller.

11. A small window opens asking whether to copy the startup code into the file you have created just
now. Just click on No to proceed further.

12. Now you can see the TARGET and SOURCE GROUP created in the project
workspace.
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

13. Now click on File and in that New. A new page opens and you can start writing program in
it.

14. After the program is completed, save it with any name but with the asm extension.
Save the program in the file you have created earlier.

15. You can notice that after you save the program, the predefined keywords will be highlighted in
bold letters.

16. Now add this file to the target by giving a right click on the source group. A list of options open
and in that select Add files to the source group. Check for this file where you have saved and
add it.

17. Right click on the target and select the first option Options for target. A window opens with
different options like device, target, output etc. First click on target.

18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the PC, just enter
this frequency value in the Xtal (MHz) text area and put a tick on the Use on-chip ROM. This is
because the program what we write here in the keil will later be dumped into the microcontroller
and will be stored in the inbuilt ROM in the microcontroller.

19. Now click the option Output and give any name to the hex file to be created in the Name of
executable text area and put a tick to the Create HEX file option present in the same window.
The hex file can be created in any of the drives. You can change the folder by clicking on Select
folder for Objects.

20. Now to check whether the program you have written is errorless or not, click on the icon exactly
below the Open file icon which is nothing but Build Target icon. You can even use the shortcut
key F7 to compile the program written.
21. To check for the output, there are several windows like serial window, memory window, project
window etc. Depending on the program you have written, select the appropriate window to see
the output by entering into debug mode.

22. The icon with the letter d indicates the debug mode.

23. Click on this icon and now click on the option View and select the appropriate window to
check for the output.

24. After this is done, click the icon debug again to come out of the debug mode.
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Figure 4.25: new project creation

Wifi for health telemonitoring systems

Fig4.26: after new project creation


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig4.27: selecting the microcontroller

Wifi for health telemonitoring systems

Fig4.28: notice to add startup file


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig4.29: development tool folder settings

Wifi for health telemonitoring systems


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig4.30: target device settings

Fig 4.31: writing the code


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig 4.32: Creating Hex file

Figure 4.33: adding files


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Fig4.34: executing the code

Figure 4.35: rectifying the errors


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

4.25 Flash magic:

Figure 4.36: overview of options

Figure 4.37: step one for dumping


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Figure 4.38: step two of dumping

Figure 4.39: step three of dumping

Figure 4.40: step four of dumping

Figure 4.41: step five start the dump


CHAPTER 5
SOURCE CODE
5.1. CODE:

#include <LPC214x.H> /* LPC214x definitions */

#include "lcd.h"

Typedef unsigned char uc;

#define RDR 0x01 #define THRE 0x20


Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

#define RDA 0x04

#define Fosc 12000000


#define Fcclk (Fosc * 5)
#define Fcco (Fcclk * 4)
#define Fpclk (Fcclk / 4) * 1
#define UART_BPS 115200 //Set Baud Rate here #define
UART0_CH_NUM 6

#define VIC_UART0_CH (0x01 << UART0_CH_NUM) #define


VIC_INT_CH_EN (0x01 << 5)

#define MAX_BUFF_SZ 10

Void uart0_init (void); void


uart0_putc (ucdt);

void uart0_puts (uc*st);

VoidUARTWriteInt (long Val, unsignedintfield_length);


ucbyteCount=0;

Inthb=0, beats, i;

Char x;

Void Delay (unsigned int time)

Unsignedinti,j;

For (i=0; i<time; i++)

For (j=0; j<2500; j++);

Void uart0_init ()
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Unsignedint Baud16;

/* initialize the serial interface */

PINSEL0 |= 0x00000005; /* Enable RxD0 and TxD0 */

U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */

Baud16 = (Fpclk / 16) / UART_BPS;

U0DLM = Baud16 / 256;

U0DLL = Baud16 % 256;

U0LCR = 0x03; /* DLAB = 0 */

/* Enable Uart FIFO


*/ U0FCR |= 0x01;

Void uart1_init ()

PINSEL0 |= 0x00050000; /* Enable RxD1 and TxD1 */

U1IER = 0; /* Disable UART1 Interrupts */

U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */

66
DEPT OF ECE, SBIT KMM
U1DLL = 97; /* 9600 Baud Rate @ 12MHz VPB Clock */
U1LCR = 0x03; /* DLAB = 0 */
U1FCR = 0x07; /*Enables and Resets FIFO, 1 byte */

Void uart1_putc (char c)

{
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

While (! (U1LSR & 0x20)); // Wait until UART1 ready to send character
U1THR = c; // Send character

Void uart1_putc (uc *st)

While (*st)

{
uart1_putc (*st++);

Void UART1WriteInt (long Val, unsignedintfield_length)

char str[10]={0,0,0,0,0,0,0,0,0,0}; inti=9,j=0;

While (Val)

STR[i] =Val%10;

Val=val/10
; i--;

j=10-field_length; if (Val<0)
uart1_putc ('-'); for (i=j; i<10; i+
+)

{ uart1_putc (48+STR[i]); }

}
Void uart0_putc (ucdt)

{
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

While (! (U0LSR & THRE)); // Wait until UART0 ready to send character
U0THR = DT; // Send character

Void uart0_putc (uc *st)

While (*st)

{
uart0_putc (*st++);

VoidUARTWriteInt (long Val, unsignedintfield_length)

char str[10]={0,0,0,0,0,0,0,0,0,0}; inti=9,j=0;

While (Val)

STR[i] =Val%10;

Val=val/10
; i--;

j=10-field_length; if (Val<0) uart0_putc (' ');

for (i=j; i<10; i++)

uart0_putc (48+STR[i]);
}
}
voidSend_Wifi ()
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

{ uart0_putc ("AT\r\n");

Delay (1000);

uart0_putc ("AT+CWMODE=3\r\n");
Delay (5000);

uart0_putc ("AT+CIPMUX=1\r\n");
Delay (5000);

uart0_putc ("AT+CWJAP=\"ElectronicsLab\",\"idea1234\"\r\n"); //ssid and


password

Delay (20000);
uart0_putc ("AT+CIPSTART=4, \"TCP\", \"184.106.153.149\", 80\r\n");

Delay (8000);
uart0_putc ("AT+CIPSEND=4, 46\r\n");

Delay (5000);

uart0_putc ("GET /update? Key=HRJM7JQKG6A7NKG9&field1=");


UARTWriteInt (beats, 4);
Delay (300);
uart0_putc ("\r\n");

Delay (5000);

LCDCmd (0xc0);

Delay (10);

LCDWriteString ("Send successfully ");

Delay (10);

Delay (20000);

LCDCmd (0xc0);

Delay (10);

LCDWriteString (" ");

Delay (10);

U0IER = 0x01;
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

voidadc_init (void)
based Wban and

{
PINSEL1 |= 0x15000000; // P0.28 - AD0.1
AD0CR &= ~0xffffffff;

AD0CR |= 0x00200E00; // with clock = VPBCLK/(13+1) = 60Mhz/14 =


3.28Mhz

}
unsignedintadc_read (unsigned char ch)

Initial, adc_val;

AD0CR = (AD0CR&0xFFFFFF00) | (1<<ch); //AD0CR


= (AD0CR & 0xFFFFFF00) | 0x02;

AD0CR |= (1 << 24); // Start AD conversion NOW on AD0.1 (P0.28) while


((AD0GDR & 0x80000000) == 0); // until bit 31 is high (DONE)

Val=AD0GDR;

adc_val = (Val>>6) & 0x3FF; // Extract AD result returnadc_val;

Int main (void)

IODIR0 = 0x00f0; //output=1 // input=0

IOCLR0 = 0x00f0; //output=1 // input=0

IO1DIR = 0xffffffff;

IO1CLR = 0xffffffff;
uart0_init ();
uart1_init ();
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

Delay (100);

adc_init (); // Initialize ADC

InitLCD ();

LCDCmd (0x80);

Delay (10);
LCDWriteString (" Welcome ");
Delay (10);
LCDCmd (0xc0);
Delay (10);

LCDWriteString ("Health Telemonitoring ");

Delay (10000);

LCDCmd (0x80);

Delay (10);

LCDWriteString (" ");

LCDCmd (0xc0);

Delay (10);

LCDWriteString (" ");

While (1)

Beats=0;

LCDCmd (0x80);

Delay (10);

LCDWriteString ("Calibrating..... ");

Delay (10);

LCDCmd (0xc0);

Delay (10);
Coexistence of zigbee-based Wban and
Wifi for health telemonitoring systems

LCDWriteString (" ");

For (i=0;i<100;i++)

Hb = adc_read (1);

Delay (400);

If (hb>=1000)

Beats++;

}
uart1_putc ("\n\rHeart Rate = ");
UART1WriteInt (beats,4);

LCDCmd(0x80);

Delay (10);
LCDWriteString ("ECG Beats: ");
Delay (10);
LCDWriteInt (beats, 3);
LCDCmd (0xc0);

Delay (10);

LCDWriteString (" ");

Send_Wifi ();

CHAPTER 6

6.1 Results and discussion:


Fig 6.1: KIT
Fig 6.2: OUTPUT 1

Fig 6.3: OUTPUT 2

CHAPTER 7
7.1 ADVANTAGES

Designed simply

Low cost

Can be easily carried

Save the power

7.2 APPLICATION

Used in hospitals for monitoring the condition of patient










7.3 CONCLUSION

Wireless communications, and digital electronics have enabled the development of low-cost,
low-power, multifunctional wireless sensor nodes that are small in size and communicate in
short distances. These tiny wireless sensor nodes, which consist of sensing, data processing,
and communicating components, leverage the idea of sensor networks based on the
collaborative effort of a large number of nodes. In the healthcare field, issues such as
longterm patient care in hospitals, support for elderly people at home and in an ambulatory
environment are being discussed in the realm of wireless sensor networks.

7.4 BIBLIOGRAPHY:

1. WWW. howstuffworks.com
2. EMBEDDED SYSTEM BY RAJ KAMAL

3. Electronics for you

4. Electric India

5. WWW.google.com

6. WWW.Electronic projects.com