Sie sind auf Seite 1von 59

A Project Report on

ZIGBEE BASED INDUSTRIAL


AUTOMATION
By
APURVA M. ACHARYA (B3483401)
ANUYA S. BHOSLE (B3483409)
KIRAN B. KULKARNI (B3483430)

Department of Electronics Engineering


TSSM's
PADMABHOOSHAN VASANTDADA PATIL INSTITUTE OF
TECHNOLOGY, BAVDHAN, PUNE.
2010-2011

A Project Report on

ZIGBEE BASED INDUSTRIAL


AUTOMATION
Submitted in partial fulfillment for the award of the Degree of Bachelor of
Engineering in Electronics Engineering
By

APURVA M. ACHARYA (B3483401)


ANUYA S. BHOSLE (B3483409)
KIRAN B. KULKARNI (B3483430)
Under the guidance of

Prof. N.N.THUNE

Department of Electronics Engineering


TSSM's
PADMABHOOSHAN VASANTDADA PATIL INSTITUTE OF
TECHNOLOGY, BAVDHAN, PUNE.
2010-2011

CERTIFICATE
This is to certify that the seminar entitled ZIGBEE BASED
INDUSTRIAL AUTOMATION is a bona fide record of the project to done by
APURVA M. ACHARYA (B3483401), ANUYA S. BHOSLE (B3483409) and
KIRAN B. KULKARNI (B3483430) under my supervision and guidance, in
partial fulfillment of the requirements for the award of Degree of Bachelor of
Engineering in Electronics Engineering from University of Pune, for the year
2010-11.

PROF. S.N.NIPANIKAR
Project Co-ordinator
Dept. of Electronics
Engineering.

PROF. M.S.NAGMODE
Principal
PVPIT, Pune

PROF. N.N.THUNE
Guide
Dept. of Electronics
Engineering.

External Examiner
Engineering

Place:
Date:

PROF. S.D.JOSHI
Head
Dept. of Electronics

Zigbee Based Industrial Automation

ACKNOWLEDGEMENT

Every orientation work has a imprint of many people and it becomes our
duty to express deepest gratitude for some.
We thank our project co-guide Prof. N.N.Thune for giving us opportunity
for presenting our project.
We would like to express our sincere thanks our project co-ordinator to
respected Prof. Nipanikar for increasing our morale and confidence and guiding
and co-operating with us in the project.
We also express our profound gratitude towards our H.O.D Prof. S.D.Joshi
for giving us opportunity for presenting our project. We would also like to thank
our project sponsors VARROC ENGINEERING LIMITED in giving us all
facilities and use their resources.
We especially thank Mr. Mariappan and Mr. Shishir Bhosle personally for
guiding us in our project.
We also thank to all teaching and non-teaching staff for their useful
cooperation.

APURVA M. ACHARYA
ANUYA S. BHOSLE
KIRAN B. KULKARNI

Zigbee Based Industrial Automation

ABSTRACT
In the electronics industries due to manual errors the accuracy of the
system is reduced, this affects the reliability and efficiency of the system.
Electronics has achieved great importance in the field of automation, which deals
with the above problem.
In todays world the field of communication plays a leading role in long
distance data transfer. so one step ahead in the technical world weve decided to
club together both the electronic and the communication world .
In huge industries, it is very difficult to continuously monitor and control
the environmental conditions like temperature, pressure, humidity, etc in each
room. So, we are developing a system using zigbee which will monitor as well as
control the temperature of a room in an industry. According to the status of
temperature ON-OFF of heater/fan is done.
It is also very important to keep a track of current status of light in each
department but due to the large area covered by industry it is not possible to
control lighting system of the entire industry manually. We are developing a
system in which the lighting application is controlled via the zigbee module.
Hence, energy and time consumption is reduced to a great extent. Thus, the
project helps in monitoring and controlling the temperature of a room as well as in
controlling the lighting application.

Zigbee Based Industrial Automation

INDEX
Chapter No.

Description

Page No.

Introduction
Problem Definition

1
1

Literature Survey

Block Diagram
Working
Circuit Diagram
Circuit Description
Selection of components
Zigbee
RS-232
Microcontroller MC9S08AW16
Relay
Temperature sensor

4
5
6
11
12
15
19
29
30

Layout
Artwork

31
34

Software
Algorithms
Flowcharts
Applications

36
36
38
41

8
8.1
8.2
9

Pros
Cons
Future scope

42
42
43

10

Conclusion

44

11

Bill Of Material

45

12

Bibliography

46

1
1.1
1.2
2
2.1
3
3.1
3.2
3.3
3.4
4
4.1
4.2
4.3
4.4
4.5
5
5.1
5.2
6
6.1
6.2
6.3
7

Zigbee Based Industrial Automation

LIST OF FIGURES
Fig. no.

Title

Page No.

3.1.1

Master Circuit

3.1.2

Slave1 Circuit

3.1.3

Slave2 Circuit

3.3.1

Power Supply design

3.3.2

Serial Communication Interface

3.3.3

Microcontroller Circuit

3.3.4

Sensor Circuit

3.3.5

Relay Circuit

10

4.1.1.1

Zigbee logo

12

4.1.1.2

13

4.1.1.3

Graph showing range and data rate of


different wireless module
Zigbee module

4.2.2.1

RS-232 cable

16

4.2.2.2

Pin diagram of RS-232

16

4.3.1.1

19

4.3.2.1

Interfacing of Zigbee module and


microcontroller
IC MC9S08AW16

4.3.2.2

Pin configuration of MC9S08AW16

22

4.4.1.1

Relay

29

4.4.2.1

Relay Symbol

29

4.5.1.1

BAV99

30

5.1.1

Microcontroller Layout

31

5.1.2

Microcontroller layout

32

5.1.3

Relay

33

5.2.1

Microcontroller

34

5.2.2

Relay

35

14

20

Zigbee Based Industrial Automation

LIST OF TABLES
Table No.

Title

Page No.

4.1.1.3

13

4.2.2.1

Comparison of different wireless


communication modules
Pin description of RS-232

4.3.1.1

Comparison of different microcontrollers

20

17

Zigbee Based Industrial Automation

CHAPTER 1: INTRODUCTION
1.1

INTRODUCTION
In todays scenario world is moving on very fast. Time constraint is very

severe problem due to which the old traditional methods do not find any place
now. Industries are booming day by day, new industries are emerging daily
where wireless communication plays a vital role. Due to the use of wireless
communication in industries the laborious work done by men is reduced up to
quite extent.There are many wireless communication modules like Bluetooth,
Zigbee , Wi-Fi , etc. As introducing new and new solutions, the basic factor that is
to be considered is safe working and quality assurance. The project deals with the
wireless module ZigBee which is a low cost, long battery life and low
power consuming wireless mesh networking standard (IEEE 802.15.4).

1.2 PROBLEM DEFINITION:


In huge industries, it is very difficult to continuously monitor and control
the environmental conditions like temperature, pressure, humidity, etc in each
room. So, we are developing a system using Zigbee which will monitor as well as
control the temperature of a room in an industry.
It also becomes laborious for monitoring and controlling the lighting
system due to the large area covered by industry. It is not possible to control
lighting system of the entire industry manually. Hence, energy and time
consumption is reduced to a great extent. Hence, we are developing a system in
which the lighting application is controlled via the Zigbee module.
Thus, the project helps in monitoring and controlling the temperature of a
room as well as in controlling the lighting application.

Zigbee Based Industrial Automation

CHAPTER 2:LITERATURE SURVEY


2.1 LITERATURE SURVEY
The First Successful ZigBee Implementation in the Insurance Industry
MeshNetics in Partnership with BOX telematics and Crawford & CompanyRolled
out a New Building Monitoring Solution was announced at Bellevue, WA
September 28, 2006. It has successfully completed the trial of the Zigbee-based
wireless solution deployed to monitor building subsidence for Crawford &
Company, the worlds largest independent provider of claims management
solutions to insurance companies.
Using the Zigbee-based wireless solution, Crawford & Company found
that claim assessment time was cut dramatically. Subsidence, which is a
downward movement of the ground supporting a building, causes hundreds of
millions of dollars of damage to buildings every year. To minimize this damage,
Insurance claim investigators typically conduct manual subsidence inspections
which are time consuming, costly, and labor-intensive efforts requiring two
engineers for an on-site building inspection. Due to high costs, they are performed
on a weekly basis at best meaning that the task is not only expensive and time
consuming, but is also an inefficient monitoring solution.
As a result of this clumsy, inefficient manual inspection practice, claim
assessment would take anywhere from one to two years. The first Zigbee-based
wireless solution trial has already enabled Crawford & Company to reduce claim
investigation time from an average 12-18 months to only 2 months. The wireless
solution also eliminated the costs associated with running cables, an expense that
may exceed $100 per foot. Time-to-market was another important factor.

10

Zigbee Based Industrial Automation

Zigbee-style networks began to be conceived about 1998, when many


installers realized that both Wi-Fi and Bluetooth were going to be unsuitable for
many applications. The IEEE 802.15.4 standard was completed in May

11

Zigbee Based Industrial Automation

2003.Philips remains a promoter member on the Zigbee Alliance Board of


Directors.
The Zigbee specifications were ratified on 14 December 2004. The Zigbee
Alliance is a global ecosystem of companies creating wireless solutions for use in
energy, home, commercial and industrial applications.
It is the only global wireless communications standard enabling the
development of easily deployable low-cost, low-power, monitoring and control
products The goal of the Zigbee Alliance is to provide users with superior
flexibility, interoperability, mobility, and ease of use by building wireless
intelligence and capabilities into everyday devices.
Zigbee technology can be embedded in a wide range of products and
applications across consumer, commercial, industrial and government markets
worldwide. For the first time, organizations using Zigbee technology have a
standards-based wireless platform optimized for the unique needs of remote
monitoring and control applications, including simplicity, reliability, low cost and
low-power usage.
Zigbee along with data transfer it allows us to monitor and control
industrial applications. As monitoring any physical quantity plays an important
key role while deciding the performance of the product .Controlling application
also plays crucial role in industries. The R &D department of the Varroc industries
does the researches and tests on vehicles and its parts.
Zigbee is a low cost, long battery life and low power consuming
wireless mesh networking standard (IEEE 802.15.4) . The frequency band is 2.4
GHz with data rate of 250kbps.The Zigbee is the new module of wireless
communication systems which is upcoming wireless module in industries, as the
Zigbee has a different feature of data transfer, monitor and control.
Currently in many industries, controlling and monitoring applications are
done manually. After knowing the benefits of Zigbee over other communication
devices the system is being implemented in the VARROC ENGG.LTD. which
does the controlling and monitoring applications via Zigbee.

12

Zigbee Based Industrial Automation

13

Zigbee Based Industrial Automation

CHAPTER 3: BLOCK DIAGRAM


3.1 BLOCK DIAGRAM

Fig. 3.1.1 Master Circuit

Fig. 3.1.2 Slave1 Circuit

14

Zigbee Based Industrial Automation

Fig. 3.1.3 Slave2 Circuit

3.2 WORKING
Zigbee is wireless mesh networking standard. It is mainly used

to

control and monitor the application.Hence, we are using Zigbee for controlling
light system and monitoring sensors in automobile industry. The project
consists of 1 Master circuit and 2 Slave circuits.
3.2.1 Master circuit:
The master circuit consists of personal computer, Zigbee, microcontroller
and rs232 for compatibility.
The microcontroller is interfaced to the personal computer via rs232.and
the wireless module Zigbee is interfaced to the microcontroller. So the data sent
from slave circuits Zigbee is catched by antenna of master Zigbee, thus the
master Zigbee sends this data to microcontroller and hence sent to pc for display.
For the controlling application the flow of data will be from the pc to
master Zigbee via microcontroller and then to Zigbee of slave2.
3.2.2 Slave circuit 1:
The slave circuit 1 consists of Zigbee which is interfaced to
microcontroller. Temperature sensor, fan and heater are also interfaced to that
microcontroller. The sensor will sense the temperature and accordingly the
sensed value will be passed to Zigbee master from where it will be
displayed on PC .If the room temperature exceeds the

15

Zigbee Based Industrial Automation

predecided value then the fan is turned ON automatically. If suppose the room
temperature goes below the predecided value then accordingly the heater will turn
ON.

3.2.3 Slave circuit 2:


The slave circuit 2 consists of microcontroller which is interface to
Zigbee and 3 relays which controls the ON-OFF conditions of lights.
In main department cell all the current status of light is being displayed on
the pc with help of master Zigbee and slave2 Zigbee communication. Suppose a
light in a particular room is ON and if it is to be switched off then according to
command given to master Zigbee from pc the command is captured by slave2
zigbee via antenna and hence the light is switched OFF automatically as the relay
gets deenergised.
3.3 CIRCUIT DIAGRAM

Fig. 3.3.1 Power Supply design

16

Zigbee Based Industrial Automation

Fig. 3.3.2 Serial Communication Interface

17

Zigbee Based Industrial Automation

Fig. 3.3.3 Microcontroller Circuit

18

Zigbee Based Industrial Automation

Fig. 3.3.4 Sensor Circuit

19

Zigbee Based Industrial Automation

Fig 3.3.5 Relay Circuit

20

Zigbee Based Industrial Automation

3.4CIRCUIT DESCRIPTION:
3.4.1 Master:
Master circuit consist of Personal Computer ,1 microcontroller and 1 zigbee
module.Personal computer is interfaced to microcontroller via RS 232 and also
zigbee module is interface to that microcontroller.Pin 2 of RS232 of PC is connected
to pin 14 of MAX232D.Pin 13i.e.R1IN of MAX232D is connected to pin 3 of RS
232.Pin 12 of MAX232 connected to RX1 of

Serial communication

interface(SCI1).TX1 of SCI1 is connected to T1IN of MAX 232D.


BKGD/MS pin of microcontroller is connected to PIN1 of 6 pin background
header.Pin 5 of 6 pin background header is given as input to the reset circuitry.The
output of this circuit i.e.MC_RST is connected to pin3 of microcontroller. The supply
given to pin 17 of the microcontroller is 3.3V.
3.4.2 Slave1:
Slave1 circuit consist of microcontroller to which zigbee,temperature
sensor,heater and fan are interfaced..Fan is conneced to port F of uc.Temperature
sensed by the sensor is given to AD1P0.Heater is interfaced to port A,B and
D.BKGD/MS pin of microcontroller is connected to PIN1 of 6 pin background
header.Pin 5 of 6 pin background header is given as input to the reset circuitry.The
output of this circuit i.e.MC_RST is connected to pin3 of microcontroller.
The supply given to pin 17 of the microcontroller is 3.3V.
3.4.3 Slave2:
Slave2 consist of microcontroller to which zigbee and 3 relays are
interfaced.Bulbs are connected to respective realys.BKGD/MS pin of microcontroller
is connected to PIN1 of 6 pin background header.
Pin 5 of 6 pin background header is given as input to the reset circuitry.The
output of this circuit i.e.MC_RST is connected to pin3 of microcontroller.
The supply given to pin 17 of the microcontroller is 3.3V.

21

Zigbee Based Industrial Automation

CHAPTER 4: SELECTION OF COMPONENTS


4.1 ZIGBEE
4.1.1 The Name zigbee:

Fig.4.1.1.1ZigBee Logo

The name ZigBee is said to come from the domestic honeybee which uses
a zig-zag type of dance to communicate important information to other hive
members. This communication dance (the "ZigBee Principle") is what engineers
are trying to emulate with this protocol - a bunch of separate and simple
organisms that join together to tackle complex tasks.
ZigBee technology is a low data rate, low power consumption, low cost;
wireless networking protocol targeted towards automation and remote control
applications.
ZigBee compliant wireless devices are expected to transmit 10-75 meters,
depending on the RF environment and the power output consumption required for
a given application, and will operate in the unlicensed RF worldwide (2.4GHz
global, 915MHz Americas or 868 MHz Europe). The data rate is 250kbps at
2.4GHz, 40kbps at 915MHz and 20kbps at 868MHz.

22

Zigbee Based Industrial Automation

PARAMETERS

ZIGBEE

BLUETOOTH

WI-FI

STANDARD

IEEE 802.15.4

IEEE 802.15.1

IEEE 802.15.11

NETWORK

mesh

p2p

p2p

NETWORK

70m

100m

100m

MAIN

-Sensors/control

-Voice applications.

-Office and home

APPLICATION

applications.

-Eliminating short

networks.

-Remote control

distance cabling

-WLAN.

RANGE

-Replace Ethernet
cables
STRONG

-Many devices/nodes.

-In vehicles today.

-Dominating WLAN

POINTS

-Small data packets.

-Easy synchronization tech.

-Low duty cycle.

of mobile devices.

-Low power.
Fig. 4.1.1.2 Graph showing range and data rate of different wireless modules

Table no. 4.1.1.3 Comparison of different wireless communication modules

23

Zigbee Based Industrial Automation


4.1.2 Features of Zigbee:

Support for multiple network topologies such as star, cluster tree and mesh
networks

Low duty cycle provides long battery life.

Low latency, Low power.

Up to 65,000 nodes per network.

128-bit AES encryption for secure data connections.

Data rates of 250 kbps (@2.4 GHz), 40 kbps (@ 915 MHz), and 20 kbps
(@868 MHz).

Reliable (Mesh topology) and secure.

Range: 50m typical (5-500m based on environment) .

Collision avoidance, retries and acknowledgements.

Fig. 4.1.1.3 Zigbee module

4.1.3 Specification of Zigbee RC2400HP:

100mW / 20 dBm option and low-power option in pin compatible

packages.
IEEE 802.15.4 compliant PHY.
256 kB Flash memory, 8 kB SRAM
15 digital and analogue I/O.

24

Zigbee Based Industrial Automation

8 channel 12 bit ADC.


UART, SPI and debug interfaces.
On-board 32.768 kHz real time clock (RTC), 4 timers.
2.0 3.6 V supply voltage, ultra low power modes.
Optional 4 kB internal EEPROM.

4.2 RS-232
4.2.1Specifications:

RS-232 specifications voltage levels :


Transmitted signal:Binary 0: +5 to +15 Vdc (called a space or on).
Binary 1: -5 to -15 Vdc (called a mark or off).
Received signal : Binary 0: +3 to +13 Vdc .
Binary 1: -3 to -13 Vdc.

Data format:Start bit: Binary 0.


Data: 5, 6, 7 or 8 bits.
Parity: Odd, even, mark or space
Stop bit:

Binary 1,one or two bits.

Baud rate : Common baud rates used are 2.4k, 9.6k, 19.2k.

The cable length can be up to 50ft.

4.2.2 RS-232C Cable:


RS-232C stands for Recommend Standard number 232 and C is the latest
revision of the standard.
RS-232 cable is nothing but a communication language used by computers
to talk to devices such as modems, printers, keyboards etc. It is mainly used to
transmit and receive data over short distances (up to 10m) to monitoringand
controlling devices but it is limited to only one device per cable.

25

Zigbee Based Industrial Automation

Fig.4.2.2.1 RS-232 cable

DTE & DCE:


DTE stands for Data Terminal Equipment and DCE stands for Data
communications Equipment.These terms are used to indicate the pin-out for the
connectors on a device and the direction of the signals on the pins. For e.g.
computer is a DTE device, while most other devices are usually DCE devicesWe
can connect a DTE device to a DCE using a straight pin-for-pin connection.

Fig.4.2.2.2 Pin diagram of RS-232

26

Zigbee Based Industrial Automation

Table no. 4.2.2.1 Pin description of RS-232

4.2.3 Pin description:

TD (transmit data) :
The TD (transmit data) wire is the one through which data from a
DTE device is transmitted to a DCE device. This name can be deceiving,
because this wire is used by a DCE device to receive its data.The TD line
is kept in a mark ( logic 1) condition by the DTE device when it is idle.

RD (receive data) :
The RD (receive data) wire is the one on which data is received by
a DTE device, and the DCE device keeps this line in a mark condition
when idle.

RTS (Request To Send) & CTS (Clear To Send ) :


RTSand the CTS line are used when "hardware flow control" is
enabled in both the DTE and DCE devices.The DTE device puts RTS line
in a mark condition to tell the remote device that it is ready and able to
receive data. If the DTE device is not able to receive data (typically
because its receive buffer is almost full), it will put this line in the space
condition as a signal to the DCE to stop sending data so, when the DTE

27

Zigbee Based Industrial Automation


device is ready to receive more data (i.e. after data has been removed from
its receive buffer), it will place this line back in the mark condition. The
complement of the RTS wire is CTS, which stands for Clear To Send.
The DCE device puts CTS line in a mark condition to tell the DTE
device that it is ready to receive the data. Likewise, if the DCE device is
unable to receive data, it will place this line in the space condition.
The Software
asXon/XOff

supports this type of flow control, as well

or "software" flow control. Software flow control uses

special control characters transmitted from one device to another to tell the
other device to stop or start sending data. With software flow control the
RTS and CTS lines are not used.

DTR (Data Terminal Ready) & DSR (Data Send Ready) :


Function of DTR is very similar to the RTS line. DSR (Data Set
Ready) is thecompanion to DTR in the same way that CTS is to RTS.
Some serial devices use DTR and DSR as signals to simply confirm that a
device is connected and is turned on. The Software sets DTR to the mark
state when the serial port is opened and leaves it in that state until the port
is closed. The DTR and DSR lines were originally designed to provide an
alternate method of hardware handshakingIt would be pointless to use both
RTS/CTS and DTR/DSR for flow control signals at the same time.
Because of this, DTR and DSR are rarely used for flow control.

CD (Carrier Detect) :
Carrier Detect is used by a modem to signal that it has a made a
connection with another modem, or has detected a carrier tone.

RI (Ring Indicator) :
The last remaining line is RI or Ring Indicator. A modem

toggles

the state of this line when an incoming call rings your phone
The Carrier Detect (CD) and the Ring Indicator (RI) lines are only
available in connections to a modem. Because most modems transmit
status information to a PC when either a carrier signal is detected (i.e.
when a connection is made to another modem) or when the line is ringing,
these two lines are rarely used.

28

Zigbee Based Industrial Automation

4.3Microcontroller MC9S08AW16
4.3.1 Why HCS08?

Evolutionary step in popular HC08 family.


Extended battery life technology.
High performance without compromising low power.
Extends Flash leadership with third generation 0.25Flash technology.
Innovative on-chip debugger speeds time to market.
High integration reduces system costs.

High-performance HCS08 CPU


50 nsec minimum instruction cycle time down to 2.1V at 20 MHz bus
125 nsec minimum instruction cycle time down to 1.8V at 8 MHz bus

Designed for robust EMC performance


Controlled rise and fall times on ports
Built-in oscillator and protection of clock source

Object code compatible with HC08s plus expanded instructions and


addressing modes to improve code efficiency

Fig. 4.3.1.1 Interfacing of microcontroller and zigbee module

29

Zigbee Based Industrial Automation


MC9S08AW16

PIC

89S52

FLASH
PROGRAM
MEMORY
DATA
MEMORY
PORTS

16K

4K/8K

8K

1K

192

2K

3-5

TIMERS

ADC

8 channel

8 channel

Not present

KBI

Present

Not present

Not present

MICROCONTROLLER

8 bit

8 bit

8 bit

Table no. 4.3.1.1 Comparison of different microcontrollers

4.3.2 MC9S08AW16Features:

Fig. 4.3.2.1 IC MC9S08AW16

8-Bit HCS08 Central Processor Unit (CPU)


40-MHz HCS08 CPU (central processor unit).
20-MHz internal bus frequency.
Support for up to 32 interrupt/reset sources.

30

Zigbee Based Industrial Automation


Memory Options
Up to 16 KB of on-chip in-circuit programmable.
Up to 1 KB of on-chip RAM.
Timers One 2-channel and one 4-channel
16-bit timer/pulse-width modulator (TPM).
Module: Selectable input capture, output.
Compare and edge-aligned PWM capability on each channel.
System Protection
Optional computer operating properly (COP) reset.
Low-voltage detection with reset or interrupt.
Illegal opcode detection with reset.
Illegal address detection with reset.
Power-Saving Modes
Wait plus two stops.
Peripherals
ADC Up to 8-channel, 10-bit
Analog-to-digital converter with automatic compare function.
SCI two serial communications interface
Two serial communications interface Modules.
SPI Serial peripheral interface module.
Input/output
Up to 34 general-purpose input/output (I/O)Pins.
Software-selectable pullups on ports when used as inputs.
Software-selectable slew rate control and drive strength on ports
when used as outputs.
Master reset pin and power-on reset (POR).
Internal pullup on RESET, IRQ pins to reduce customer system
cost.

31

Zigbee Based Industrial Automation

Fig.4.3.2.2 Pin configuration of MC9S08AW16

4.3.3 Power (VDD, 2 x VSS, VDDAD, VSSAD)

VDD and VSS are the primary power supply pins for the MCU. This voltage
source supplies power to all I/O buffer circuitry and to an internal voltage
regulator. The internal voltage regulator provides regulated lower-voltage source
to the CPU and other internal circuitry of the MCU.
Typically, application systems have two separate capacitors across the
power pins. In this case, there should be a bulk electrolytic capacitor, such as a 10F tantalum capacitor, to provide bulk charge storage for the overall system and a
0.1-F ceramic bypass capacitor located as near to the paired V DD and VSS power
pins as practical to suppress high-frequency noise. The MC9S08AW16 has a

32

Zigbee Based Industrial Automation


second VSS pin. This pin should be connected to the system ground plane or to the
primary VSS pin through a low-impedance connection.
VDDAD and VSSAD are the analog power supply pins for the MCU. This
voltage source supplies power to the ADC module. A 0.1-F ceramic bypass
capacitor should be located as near to the analog power pins as practical to
suppress high-frequency noise.
4.3.4

RESET Pin
RESET is a dedicated pin with a pullup device built in. It has input

hysteresis, a high current output driver and no output slew rate control. Internal
power-on reset and low-voltage reset circuitry typically make external reset
circuitry unnecessary. This pin is normally connected to the standard 6-pin
background debug connector so a development system can directly reset the MCU
system.
If desired, a manual external reset can be added by supplying a simple
switch to ground (pull reset pin low to force a reset). Whenever any reset is
initiated (whether from an external signal or from an internal system) the reset pin
is driven low for approximately 34 bus cycles, released, and sampled again
approximately 38 bus cycles later. If reset was caused by an internal source such
as low-voltage reset or watchdog timeout, the circuitry expects the reset pin
sample to return a logic1.The reset circuitry decodes the cause of reset and records
it by setting a corresponding bit in the system control reset status register (SRS).
4.3.5

Oscillator (XTAL, EXTAL)


Out of reset, the MCU uses an internally generated clock (self-clocked

mode fSelf-reset) equivalent to about 8-MHz crystal rate. This frequency source is
used during reset startup and can be enabled as the clock source for stop recover
to avoid the need for a long crystal startup delay.
This MCU also contains a trimmable internal clock generator (ICG)
module that can be used to run the MCU. The oscillator amplitude on XTAL and
EXTAL is gain limited for low-power oscillation. Typically, these pins have a 1-V
peak-to-peak signal. For noisy environments, the high gain output (HGO) bit can
be set to enable rail-to-rail oscillation. The oscillator in this MCU is a Pierce
oscillator that can accommodate a crystal or ceramic resonator in either of two

33

Zigbee Based Industrial Automation


frequency ranges selected by the RANGE bit in the ICGC1 register. This MCU
also contains a trimmable internal clock generator (ICG) module that can be used
to run the MCU.
4.3.6 Background/Mode Select (BKGD/MS)
While in reset, the BKGD/MS pin functions as a mode select pin.
Immediately after reset rises the pin functions as the background pin and can be
used

for

background

debug

communication.

While

functioning

as

background/mode select pin, the pin includes an internal pullup device, input
hysteresis, a standard output driver and no output slew rate control. If nothing is
connected to this pin, the MCU will enter normal operating mode at the rising
edge of reset.
If a debug system is connected to the 6-pin standard background debug
header, it can hold BKGD/MS low during the rising edge of reset which forces the
MCU to active background mode. The BKGD pin is used primarily for
background debug controller (BDC) communications using a custom protocol that
uses 16 clock cycles of the target MCUs BDC clock per bit time.
The target MCUs BDC clock could be as fast as the bus clock rate, so
there should never be any significant capacitance connected to the BKGD/MS pin
that could interfere with background serial communications.
4.3.7

Serial Communications Interface


The

MC9S08AW16

Series

includes

two

independent

serial

communications interface (SCI) modules which are sometimes called universal


asynchronous receiver/transmitters (UARTs). Typically, these systems are used to
connect to the RS232 serial input/output (I/O) port of a personal computer or
workstation, but they can also be used to communicate with other embedded
controllers.
A flexible, 13-bit, modulo-based baud rate generator supports a broad
range of standard baud rates beyond115.2 kbaud. Transmit and receive within the
same SCI use a common baud rate, and each SCI module has a separate baud rate
generator. This SCI system offers many advanced features not commonly found
on other asynchronous serial I/O peripherals on other embedded controllers.

34

Zigbee Based Industrial Automation


The receiver employs an advanced data sampling technique that ensures
reliable communication and noise detection. Hardware parity, receiver wakeup,
and double buffering on transmit and receive are also included.

Features
Full-duplex
Double-buffered transmitter and receiver with separate enables
Programmable baud rates (13-bit modulo divider)
Interrupt-driven or polled operation:
- Transmit data register empty and transmission complete
- Receive data register full
- Receive overrun, parity error, framing error, and noise error
- Idle receiver detect
Hardware parity generation and checking
Programmable 8-bit or 9-bit character length
Receiver wakeup by idle-line or address-mark

Register Definition
The SCI has eight 8-bit registers to control baud rate, select SCI
options, report SCI status, and for transmit/receive data.

Modes of Operation
1. 8- and 9-bit data modes
2. Stop modes SCI is halted during all stop modes
3. Loop mode
4. Single-wire mode
1. 8- and 9-Bit Data Modes
The SCI system (transmitter and receiver) can be configured to
operate in 9-bit data mode by setting the M control bit in SCIxC1. In 9-bit
mode, there is a ninth data bit to the left of the MSB of the SCI data
register.
For the transmit data buffer, this bit is stored in T8 in SCIxC3. For
the receiver, the ninth bit is held in R8 in SCIxC3. When transmitting 9bit data, write to the T8 bit before writing to SCIxD for coherent writes to
the transmit data buffer. If the bit value to be transmitted as the ninth bit

35

Zigbee Based Industrial Automation


of a new character is the same as for the previous character, it is not
necessary to write to T8 again. When data is transferred from the transmit
data buffer to the transmit shifter, the value in T8 is copied at the same
time data is transferred from SCIxD to the shifter. When receiving 9-bit
data, clear the RDRF bit by reading both R8 and SCIxD. R8 and SCIxD
can be read in either order. 9-bit data mode typically is used in
conjunction with parity to allow eight bits of data plus the parity in the
ninth bit
2. Stop Mode Operation
During all stop modes, clocks to the SCI module are halted. In
stop1 and stop2 modes, all SCI register data is lost and must be reinitialized upon recovery from these two stop modes. No SCI module
registers are affected in stop3 mode.
Because the clocks are halted, the SCI module will resume
operation upon exit from stop (only in stop3 mode). Software should
ensure stop mode is not entered while there is a character being
transmitted out of or received into the SCI module.
3. Loop Mode
When LOOPS = 1, the RSRC bit in the same register chooses
between loop mode (RSRC = 0) or single-wire mode (RSRC = 1). Loop
mode is sometimes used to check software, independent of connections in
the external system, to help isolate system problems. In this mode, the
transmitter output is internally connected to the receiver input and the
RxD pin is not used by the SCI, so it reverts to a general-purpose port I/O
pin.
4. Single-Wire Mode
When LOOPS = 1, the RSRC bit in the same register chooses
between loop mode (RSRC = 0) or single-wire mode (RSRC = 1). Singlewire mode is used to implement a half-duplex serial connection. The
receiver is internally connected to the transmitter output and to the TxD
pin. The RxD pin is not used and reverts to a general-purpose port I/O
pin.In single-wire mode, the TXDIR bit in SCIxC3 controls the direction
of serial data on the TxD pin. When TXDIR = 0, the TxD pin is an input
to the SCI receiver and the transmitter is temporarily disconnected from

36

Zigbee Based Industrial Automation


the TxD pin so an external device can send serial data to the receiver.
When TXDIR = 1, the TxD pin is an output driven by the transmitter.
4.3.8 Analog to digital converter :
The

10-bit

analog-to-digital

converter

(ADC)

is

successive

approximation ADC designed for operation within an integrated microcontroller


system-on-chip. The ADC module design supports up to 28 separate analog inputs
(AD0-AD27). Only 18 (AD0-AD15, AD26, and AD27) of the possible inputs are
implemented on the MC9S08AW16 Series of MCUs. These inputs are selected by
the ADCH bits.
The ADC module is disabled during reset or when the ADCH bits are all
high. The module is idle when a conversion has completed and another conversion
has not been initiated. When idle, the module is in its lowest power state. The
ADC can perform an analog-to-digital conversion on any of the software
selectable channels. The selected channel voltage is converted by a successive
approximation algorithm into an 11-bit digital result.
In 8-bit mode, the selected channel voltage is converted by a successive
approximation algorithm into a9-bit digital result. When the conversion is
completed the result is placed in the data registers (ADC1RH and ADC1RL).In10bit mode, the result is rounded to 10 bits and placed in ADC1RH and ADC1RL. In
8-bit mode, the result is rounded to 8 bits and placed in ADC1RL. The conversion
complete flag (COCO) is then set and an interrupt is generated if the conversion
complete interrupt has been enabled
(AIEN = 1).

Features
Linear successive approximation algorithm with 10 bits resolution.
Up to 28 analog inputs.

Single or continuous conversion (automatic return to idle after single


conversion).
Configurable sample time and conversion speed/power.
Conversion complete flag and interrupt.
Operation in wait or stop3 modes for lower noise operation.
Asynchronous clock source for lower noise operation.
37

Zigbee Based Industrial Automation


Selectable asynchronous hardware conversion trigger.
Automatic compare with interrupt for less-than, or greater-than or equalto, programmable value.
4.3.9 Timer/PWM
The MC9S08AW16 Series includes two independent timer/PWM (TPM)
modules which support traditional input capture, output compare, or buffered
edge-aligned pulse-width modulation (PWM) on each channel. A control bit in
each TPM configures all channels in that timer to operate as center-aligned PWM
functions.
In each of these two TPMs, timing functions are based on a separate 16-bit
counter with prescaler and modulo features to control frequency and range (period
between overflows) of the time reference. This timing system is ideally suited for
a wide range of control applications and the center-aligned PWM capability on
the 3-channel TPM extends the field of applications to motor control in small
appliances.

Features
The timer system in the MC9S08AW16 Series includes a 4-channel TPM1
and a separate 2-channel TPM2.
A total of eight channels:
-Each channel may be input capture, output compare, or buffered edgealigned PWM
-Rising-edge, falling-edge, or any-edge input capture trigger
16-bit free-running or up/down (CPWM) count operation
16-bit modulus register to control counter range
Timer system enable
Clock sources independently selectable per TPM (multiple TPMs device)
Selectable clock sources :bus clock, fixed system clock, external pin.\

38

Zigbee Based Industrial Automation

4.4 RELAY:
4.4.1 Relay

Fig.4.4.1.1 Relay

A relay is an electrically operated switch. Since relays are switches, the


terminology applied to switches is also applied to relays. A relay will switch one
or more poles, each of whose contacts can be thrown by energizing the coil in one
of three ways:

Normally-open (NO) contacts connect the circuit when the relay is


activated; the circuit is disconnected when the relay is inactive. It is also
called a Form A contact or "make" contact.
Normally-closed (NC) contacts disconnect the circuit when the relay is
activated; the circuit is connected when the relay is inactive. It is also
called a Form B contact or "break" contact.
Change-over (CO), or double-throw (DT), contacts control two circuits:
one normally-open contact and one normally-closed contact with a
common terminal. It is also called a Form C contact or "transfer" contact
("break before make"). If this type of contact utilizes a make before
break" functionality, then it is called a FormD contact.

4.4.2 Relay symbol:

Fig.4.4.2.1 Relay Symbol

SPST Single Pole Single Throw. These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four
terminals in total. It is ambiguous whether the pole is normally open or

39

Zigbee Based Industrial Automation


normally closed. The terminology "SPNO" and "SPNC" is sometimes used
to resolve the ambiguity.

4.4.3 Specifications:

Relay part number:-32.21.7.012.2300


Bounce time: 2ms
Series: 32
Type: PCB mount
Number of poles:1 pole,6A
Coil version: sensitive D.C
Contact circuit: SPST(NO)
Rated coil consumption(I); 16mA.

4.5 Temperature Sensor (BAV99)

Fig.4.5.1 BAV99

FEATURES:

High-speed double diode.

It is diode connected in series, encapsulated in small SOT23 plastic


SMD package.

High switching speed: max. 4 ns.

Continuous reverse voltage: max. 75 V.

Repetitive peak forward current: max. 450 mA.

Total power dissipation : 250mW.

40

Zigbee Based Industrial Automation

Diode capacitance : f = 1 Mhz,


VR = 0V,
C = 1.5pF.

41

Zigbee Based Industrial Automation

CHAPTER 5 : ARTWORK AND LAYOUTS


5.1 LAYOUT

Fig. 5.1.1 Microcontroller Layout(top solder mask)

42

Zigbee Based Industrial Automation

Fig.5.1.2 Microcontroller layout(bottom solder mask)

43

Zigbee Based Industrial Automation

Fig. 5.1.3 Relay (bottom solder mask)

44

Zigbee Based Industrial Automation


5.2 ARTWORK

Fig. 5.2.1 Microcontroller

45

Zigbee Based Industrial Automation

Fig. 5.2.2 Relay

46

Zigbee Based Industrial Automation

47

Zigbee Based Industrial Automation

CHAPTER 6 : SOFTWARE
6.1 SOFTWARE
Language used: Embedded c.
Software used: Code warrior.
Microsoft visual studio
Express pcb
6.1.1 CodeWarrior
CodeWarrior is a desktop PC integrated development environment (IDE)
which includes a C compiler for the HCS08 MCU and the other tools to generate a
downloadable image as well as a debugger that can download code into the
HCS08 MCUs flash memory.
CodeWarrior takes the output of BeeKit and compiles and links the C
source code and libraries into a binary image that may be downloaded into the
Flash memory of an HCS08 MCU using the background debug memory (BDM)
port.
6.2 ALGORITHMS
6.2.1 Master :
1) Start
2) Initialize micro-controller.
3) Initialize Zigbee module.
4) Wait for signal.
5) Check whether data frame is from computer or not.
6) If YES transfer data frame to slave2 via zigbee module and go to step
no.4.

48

Zigbee Based Industrial Automation


7) i) If NO then transfer data from slave1 to master via zigbee.
ii) Transfer data to micro-controller and display temperature on PC.
iii) Check if temperature is greater than rated value.
iv) If YES then send command to turn ON fan and go to step no.4,elsesend
command to turn ON heater and go to step no.4.
6.2.2 Slave1 :
1)Start
2)Initialize micro-controller
3) Initialize zigbee.
4)Wait for signal
5)If ISR is detected then check for UART frame, if no then repeat step 5.
6)If UART frame detected check for type of frame
7)If it is frame of fan then turn ON fan,else turn ON heater and go to step5.
8)If UART frame not detected then check for timer frame.
9)If YES then wait for 5 seconds then sample ADC, display temperature
on LCD send temperature to master via zigbee, then go to step 5.
10)If timer frame not detected then go to step 5.
6.2.3 Slave2:
1) Start.
2) Initialize micro-controller.
3) Initialize zigbee.
4) Wait for signal from master.
5) Check if ID equal to 1.
6) If YES turn ON bulb1 and go to step no.4
7) Check if ID is equal to 2 if YES turn ON bulb 2 and go to step 4,else
turn ON bulb 3 and go to step 4.

49

Zigbee Based Industrial Automation

6.3 FLOWCHARTS
6.3.1 Master:

50

Zigbee Based Industrial Automation

6.3.2 Slave 1:

51

Zigbee Based Industrial Automation


6.3.3

Slave 2:

52

Zigbee Based Industrial Automation

53

Zigbee Based Industrial Automation

CHAPTER 7: APPLICATIONS
1)

In automobile industries this system can be used in research and


testing department to test the endurance of motor in extreme heat and cold
conditions.Due to this test we can judge the maximum critical
temperatures the motor can withstand.

2) Home Automation
Light switches and lights
Computers, TVs, and other electronic devices
Smoke detectors and other safety equipment
Electricity, water, and gas meters.
3) Building Automation
Wireless sensing and control mesh networks can make building
automation easier and more efficient by combining lighting,security, safety
systems, and other monitoring networks into a single platform.
4) Automated meter reading (AMR)
Flexible and scalable mesh networks provide wireless AMR, which
helps to reduce effort and increase accuracy across many industries
including utility companies, manufacturers, and storage facilities.
5) Healthcare
-Within hospitals, adding patient monitors to a mesh network enables
faster detection of irregularities in a patients medical condition.
-Outside hospitals, patients can be treated at home, with doctors able to
monitor their vital statistics over the Internet.
6) Defense and national security
-Mesh networks can be used to monitor and protect installations that are
identified as potential targets, including military installations and sites
where hazards such as heat, gases, and toxins are manufactured or stored.
-Mesh networks can also be used for battlefield and shipboard monitoring.

54

Zigbee Based Industrial Automation

CHAPTER 8: PROS AND CONS


8.1 Pros
1) Using the system the manual efforts will be reduced and hence the time and
energy consumption is reduced to great extent.
2) Along with data transfer monitoring and controlling can be done using this
system
3) Low power consumption, simply implemented
4) Users expect batteries to last many months to years. Consider single family
house has about 6 smoke/CO detectors. If the batteries for each one only
lasted six months, the home owner would be replacing batteries every
month!
5) Low cost to the users means low device cost, low installation cost and low
maintenance.
6) Zigbee devices allow batteries to last up to years using primary cells (low cost)
without any chargers (low cost and easy installation).
7) ZigBees simplicity allows for inherent configuration and redundancy of
network devices provides low maintenance.
8) High density of nodes per network
9) Cheaper than Bluetooth
10) Faster than Bluetooth
11) With the addition of certain RF modules to ZigBee the range for ZigBee can
be extended up to 45 Km thereby controlling and monitoring the electronic
devices Effectively.
8.2

Cons

1) Not suitable for Larger area.


2)Not suitable for transfer of Audio or Video.

CHAPTER 9: FUTURE SCOPE


55

Zigbee Based Industrial Automation

1. This system can be used in big hospitals by interfacing an RFID to the


controller.If the doctor is in opd section and if he is urgently neede in the icu
sectio then the location of the doctor can be tracked using rfid ,and hence the
time required to search the doctor is mnimised.Even expensive instruments
can be tracked by this system.
2. Motor can be interfaced to the microcontroller of this system,and the speed of
the motor can be controlled.
3. The sensors

such as humidity sensor,dust sensors,pressure sensor,motion

sensor,gas sensor and soil moisture sensor also can be

interfaced to the

microcontroller.So the monitoring of humidity,gas, pressure also can be done.

CHAPTER 10: CONCLUSION


56

Zigbee Based Industrial Automation

This is a small attempt of ours in the fast processing and fast


moving world of today to efficiently utilize the time and efforts of a human being
so that controlling of light can be done from one place. With this,we hope that the
product of ours will be helpful in someway or the other to save the manpower and
utilize it efficiently.
Zigbee has wide range of application. It is a low-cost, lowpower, wireless mesh networking proprietary standard. Due to this it is best suited
for applications in Automation and Control field.

CHAPTER 11: BILL OF MATERIAL


57

Zigbee Based Industrial Automation

SR.NO COMPONENT

PART

1
2
3
4
5
6
7
8
9
10
11

C1
C2
C3,C4,C5,C6,C8,C9,C18
C7,C10
C11,C12
D1
D2,D3
D4
D5,D6,D7
F1
J1, J2,J3,J4,J5,
J6,J7,J8,J9,J11,J12,J13,J14

470uF/35V
1uF/63V
0.1uF/50V
10uF/50V
1nF
1N4007
BAV99L
3.3VZener
1N4148
Fuse(clip)
Connectors

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

P1
Q1,Q2,Q3
R1
R2
R4,R5,R6,R7
R8
R9
R10,R11,R12
SW1
U1
U2
U3
6 PIN FRC/M1
FAN
BULB
RL1,RL2,RL3
ZIGBEE MODULE
PCB
Others
TOTAL

CON DB9 ra female


BC547BP
4K7
10K/0.125W
1K
2K2
50R
330E
RESET SWITCH
UA7833
Microcontroller/44pin/LQFP
MAX232/DIP
J1
12V
40W,60W,100W
12V
RC2400HP

CHAPTER 12: BIBLIOGRAPHY


58

QUANTITY COST
(Rs.)
3
18
3
7.50
17
8.50
3
7.5
2
1
3
1.50
6
12
1
1
5
2.5
3
12
13
2
1
5
1
1
4
1
1
3
3
1
3
1
1
1
4
5
3
5

5
2.5
0.5
0.5
1
0.5
0.5
1.5
5
12
1500
35
5
125
46
120
20,000
4050
100
26,083.5

Zigbee Based Industrial Automation

1) Datasheet of Microcontroller MC9S08AW16,www.freescale


semiconductor.com
2) Datasheet of relay 12V,6Awww.findernet.com
3) Datasheet of Zigbee RC2400HPwww.radiocraft.com
4) M.A.Mazidi ,max232
5) Wikipidea,rs232,www.wikipedia.com
6) Google,zigbee communication modulewww.google.com
7) Google,temperature sensorwww.google.com
8) Wikipediarelay,www.wikipedia.com

59

Das könnte Ihnen auch gefallen