1.INTRODUCTION
EMBEDDED SYSTEM:
An embedded system is a special-purpose system in which the computer is completely encapsulated by or dedicated to the device or system it controls. Unlike a general-purpose computer, such as a personal computer, an embedded system performs one or a few predefined tasks, usually with very specific requirements. Since the system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product. Embedded systems are often mass-produced, benefiting from economies of scale. Personal digital assistants (PDAs) or handheld computers are generally considered embedded devices because of the nature of their hardware design, even though they are more expandable in software terms. This line of definition continues to blur as devices expand. With the introduction of the OQO Model 2 with the Windows XP operating system and ports such as a USB port both features usually belong to "general purpose computers", the line of nomenclature blurs even more. Physically, embedded systems ranges from portable devices such as digital watches and MP3 players, to large stationary installations like traffic lights, factory controllers, or the systems controlling nuclear power plants. In terms of complexity embedded systems can range from very simple with a single microcontroller chip, to very complex with multiple units, peripherals and networks mounted inside a large chassis or enclosure.
Figure1.1
POWER SUPPLY
KEYPAD
MICRO CONTROLLER
ZIGBEE TRANCEIVER
FIGURE1.1
AMBULANCE 2 SECTION:
POWER SUPPLY
KEYPAD
MICRO CONTROLLER
ZIGBEE TRANCEIVER
Figure1.2
POWER SUPPLY
Figure1.3
POWER SUPPLY:
Bridge Rectifier
Filter Circuit
Regulator section
DESCRIPTION:
According to this project, it employs 3 sections, one is placed at traffic signal junction and the other two sections placed in two different Ambulances. The sections placed in the ambulance contains 5 switches for the operations Emergency, Normal, out, direction 1 and direction 2. So according to this project, whenever the ambulance is yet to reach a traffic signal junction, the concerned person need to press the switches like Emergency / Normal priority and direction 1 / 2 informing the direction and priority of ambulance reaching the signal junction. The other section placed at traffic signal receives the information and takes the control action according to the priority. The control action is in the form of timing for Green lights. If both are of high priority i.e. Emergency then the one who pressed first will be given priority. The communication between the sections is done using Zigbee technology. Each and every section is designed around a microcontroller as a control unit. The Zigbee module is interfaced to microcontroller.
TECHNOLOGY:
Now a day's every system is automated in order to face new challenges. In the present days Automated systems have less manual operations, flexibility, reliability and accurate. Due to this demand every field prefers automated control systems. Especially in the field of electronics automated systems are giving good performance. And this is realized by making use of Zigbee technology for communication. Zigbee is new wireless technology guided by IEEE 802.15.4 Personal Area Network standard. It is primarily designed for the wide ranging controlling applications and to replace the existing non-standard technologies. It currently operates in 868MHz band at a data rate of 20Kbps in Europe, 914MHz band at 40kbps in USA, and the 2.4GHz ISM bands Worldwide at a maximum data-rate of 250kbps.
SOFTWARES:
1. Embedded C 2. Keil IDE 3. Uc-Flash
2. Introduction To Microcontroller
2.1 A BRIEF HISTORY OF 8051:
In 1981, Intel Corporation introduced an 8 bit microcontroller called 8051. This microcontroller had 128 bytes of RAM, 4K bytes of chip ROM, two timers, one serial port, and four ports all on a single chip. At the time it was also referred as A SYSTEM ON A CHIP
2.2 AT89S52:
The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory pro-grammer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller, which provides a highly flexible and cost-effective solution to many, embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Powerdown mode saves the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt
Figure2.1
Figure2.2 8031 has 128 bytes of RAM, two timers and 6 interrupts. 8051 has 4K ROM, 128 bytes of RAM, two timers and 6 interrupts. 8052 has 8K ROM, 256 bytes of RAM, three timers and 8 interrupts. Of the three microcontrollers, 8051 is the most preferable. Microcontroller supports both serial and parallel communication. In the concerned project 8052 microcontroller is used. Here microcontroller used is AT89S52, which is manufactured by ATMEL laboratories. The 8051 is the name of a big family of microcontrollers. The device which we are going to use along this tutorial is the 'AT89S52' which is a typical 8051 microcontroller manufactured by Atmel. Note that this part doesn't aim to explain the functioning of the different components of a 89S52 microcontroller, but rather to give you a general idea of the organization of the chip and the available features, which shall be explained in detail along this tutorial. The block diagram provided by Atmel in their datasheet showing the architecture the 89S52 device can seem very complicated, and since we are going to use the C high level language to program it, a simpler architecture can be represented as the figure 1.2.A.
This figures shows the main features and components that the designer can interact with. You can notice that the 89S52 has 4 different ports, each one having 8 Input/output lines providing a total of 32 I/O lines. Those ports can be used to output DATA and orders do other devices, or to read the state of a sensor, or a switch. Most of the ports of the 89S52 have 'dual function' meaning that they can be used for two different functions: the fist one is to perform input/output operations and the second one is used to implement special features of the microcontroller like counting external pulses, interrupting the execution of the program according to external events, performing serial data transfer or connecting the chip to a computer to update the software.
Bulky:
On comparing a board full of chips (Microprocessors) with one chip with all components in it (Microcontroller).
Debugging:
Lots of Microprocessor circuitry and program to debug. In Micro controller there is no Microprocessor circuitry to debug. Slower Development time: As we have observed Microprocessors need a lot of debugging at board level and at program level, where as, Micro controller do not have the excessive circuitry and the built-in peripheral chips are easier to program for operation. So peripheral devices like Timer/Counter, Parallel programmable port, Serial Communication Port, Interrupt controller and so on, which were most often used were integrated with the Microprocessor to present the Micro controller .RAM and ROM also were integrated in the same chip. The ROM size was anything from 256 bytes to 32Kb or more. RAM was optimized to minimum of 64 bytes to 256 bytes or more. Microprocessor has following instructions to perform: 1. Reading instructions or data from program memory ROM. 2. Interpreting the instruction and executing it. 3. Microprocessor Program is a collection of instructions stored in a Nonvolatile memory. 4. Read Data from I/O device 5. Process the input read, as per the instructions read in program memory. 6. Read or write data to Data memory. 7. Write data to I/O device and output the result of processing to O/P device.
Introduction to AT89S52:
The system requirements and control specifications clearly rule out the use of 16, 32 or 64 bit micro controllers or microprocessors. Systems using these may be earlier to implement due to large number of internal features. They are also faster and more reliable but, the above application is satisfactorily served by 8-bit micro controller. Using an inexpensive 8-bit Microcontroller will doom the 32-bit product failure in any competitive market place. Coming to the question of why to use 89S52 of all the 8-bit Microcontroller available in the market the main answer would be because it has 8kB Flash and 256 bytes of data RAM32 I/O lines, three 16-bit timer/counters, a Eight-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power Down Mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next hardware reset. The Flash program memory supports both parallel programming and in Serial InSystem Programming (ISP). The 89S52 is also In-Application Programmable (IAP), allowing the Flash program memory to be reconfigured even while the application is running. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcomputer which provides a highly flexible and cost effective solution to many embedded control applications.
FEATURES:
Compatible with MCS-51 Products 8K Bytes of In-System Reprogrammable Flash Memory Fully Static Operation: 0 Hz to 33 MHz Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters
Eight Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes 4.0V to 5.5V Operating Range Full Duplex UART Serial Channel Interrupt Recovery from Power-down Mode Watchdog Timer Dual Data Pointer Power-off Flag Fast Programming Time Flexible ISP Programming (Byte and Page Mode)
PIN DIAGRAM:
GND:
Ground.
Port 0:
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs.Port 0 can also be configured to be the multiplexed loworder address/data bus during accesses to external program and data memory. In this mode, P0 has internal pullups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pullups are required during program verification.
Port 1:
Port 1 is an 8-bit bidirectional I/O port with internal pullups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.
Port 2:
Port 2 is an 8-bit bidirectional I/O port with internal pullups.The Port 2 output buffers can sink/source four TTL inputs.When 1s are written to Port 2 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (IIL) because of the internal pullups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.
Port 3:
Port 3 is an 8-bit bidirectional I/O port with internal pullups.The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pullups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. Port 3 also receives some control signals for Flash programming and verification.
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 96 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch Enable (ALE) is an
output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
PSEN:
Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.
EA/VPP:
External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming.
XTAL1:
Input to the inverting oscillator amplifier and input to the nternal clock operating circuit.
XTAL2:
Output from the inverting oscillator amplifier.
FIG-2.4 Functional block diagram of micro controller The 8052 Oscillator and Clock: The heart of the 8051 circuitry that generates the clock pulses by which all the internal all internal operations are synchronized. Pins XTAL1 And XTAL2 is provided for connecting a resonant network to form an oscillator. Typically a quartz crystal and capacitors are employed. The crystal frequency is the basic internal clock frequency of the microcontroller. The manufacturers make 8051 designs that run at specific minimum and maximum frequencies typically 1 to 16 MHz.
a) Code memory :
Code memory is the memory that holds the actual 8052 programs that is to be run. This memory is limited to 64K. Code memory may be found on-chip or off-chip. It is possible to have 8K of code memory on-chip and 60K off chip memory simultaneously. If only off-chip memory is available then there can be 64K of off chip ROM. This is controlled by pin provided as EA
b) Internal RAM:
The 8052 have a bank of 256 bytes of internal RAM. The internal RAM is found on-chip. So it is the fastest Ram available. And also it is most flexible in terms of reading and writing. Internal Ram is volatile, so when 8051 is reset, this memory is cleared. 256 bytes of internal memory are subdivided. The first 32 bytes are divided into 4 register banks. Each bank contains 8 registers. Internal RAM also contains 256 bits, which are addressed from 20h to 2Fh. These bits are bit addressed i.e. each individual bit of a byte can be addressed by the user. They are numbered 00h to FFh. The user may make use of these variables with commands such as SETB and CLR. Special Function registered memory: Special function registers are the areas of memory that control specific functionality of the 8052 micro controller.
a) Accumulator (0E0h)
As its name suggests, it is used to accumulate the results of large no of instructions. It can hold 8 bit values.
b) B registers (0F0h)
The B register is very similar to accumulator. It may hold 8-bit value. The b register is only used by MUL AB and DIV AB instructions. In MUL AB the higher byte of the product gets stored in B register. In div AB the quotient gets stored in B with the remainder in A.
d) Data pointer
The SFRs DPL and DPH work together work together to represent a 16-bit value called the data pointer. The data pointer is used in operations regarding external RAM and some instructions code memory. It is a 16-bit SFR and also an addressable SFR.
e) Program counter
The program counter is a 16 bit register, which contains the 2 byte address, which tells the 8052 where the next instruction to execute to be found in memory. When the 8052 is initialized PC starts at 0000h. And is incremented each time an instruction is executes. It is not addressable SFR.
Figure2.6
Figure2.7
Figure2.8
These two SFRs taken together represent timer 0. Their exact behavior depends on how the timer is configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when they increment in value.
This is a port latch3. Each bit of this SFR corresponds to one of the pins on a micro controller. Any data to be outputted to port 0 is first written on P0 register. For e.g., bit 0 of port 0 is pin P3.0, bit 7 is pin P3.7. Writing a value of 1 to a bit of this SFR will send a high level on the corresponding I/O pin whereas a value of 0 will bring it to low level.
Figure2.9
Figure2.10
register bank select flags, which are used to select, which of the R register banks currently in use.
Figure2.11
igure2.12 Figure 1 shows the basic block diagram of a fixed regulated power supply. Let us go through each block.
2.6.1 TRANSFORMER:
Figure2.13 A transformer consists of two coils also called as WINDINGS namely PRIMARY & SECONDARY. They are linked together through inductively coupled electrical conductors also called as CORE. A changing current in the primary causes a change in the Magnetic Field in the core & this in turn induces an alternating voltage in the secondary coil. If load is applied to the secondary then an alternating current will flow through the load. If we consider an ideal condition then all the energy from the primary circuit will be transferred to the secondary circuit through the magnetic field.
So
The secondary voltage of the transformer depends on the number of turns in the Primary as well as in the secondary.
2.6.2 Rectifier:
A rectifier is a device that converts an AC signal into DC signal. For rectification purpose we use a diode, a diode is a device that allows current to pass only in one direction i.e. when the anode of the diode is positive with respect to the cathode also called as forward biased condition & blocks current in the reversed biased condition.
Figure2.14 This is the simplest type of rectifier as you can see in the diagram a half wave rectifier consists of only one diode. When an AC signal is applied to it during the positive half cycle the diode is forward biased & current flows through it. But during the negative half cycle diode is reverse biased & no current flows through it. Since only one half of the input reaches the output, it is very inefficient to be used in power supplies.
Figure2.15 Half wave rectifier is quite simple but it is very inefficient, for greater efficiency we would like to use both the half cycles of the AC signal. This can be achieved by using a center tapped transformer i.e. we would have to double the size of secondary winding & provide connection to the center. So during the positive half cycle diode D1
conducts & D2 is in reverse biased condition. During the negative half cycle diode D2 conducts & D1 is reverse biased. Thus we get both the half cycles across the load. One of the disadvantages of Full Wave Rectifier design is the necessity of using a center tapped transformer, thus increasing the size & cost of the circuit. This can be avoided by using the Full Wave Bridge Rectifier.
3)BridgeRectifier:
Figure2.16 As the name suggests it converts the full wave i.e. both the positive & the negative half cycle into DC thus it is much more efficient than Half Wave Rectifier & that too without using a center tapped transformer thus much more cost effective than Full Wave Rectifier. Full Bridge Wave Rectifier consists of four diodes namely D1, D2, D3 and D4. During the positive half cycle diodes D1 & D4 conduct whereas in the negative half cycle diodes D2 & D3 conduct thus the diodes keep switching the transformer connections so we get positive half cycles in the output.
Figure2.17
If we use a center tapped transformer for a bridge rectifier we can get both positive & negative half cycles which can thus be used for generating fixed positive & fixed negative voltages.
Figure2.18 If we go on increasing the value of the filter capacitor then the Ripple will decrease. But then the costing will increase. The value of the Filter capacitor depends on the current consumed by the circuit, the frequency of the waveform & the accepted ripple.
Where, Vr= accepted ripple voltage.( should not be more than 10% of the voltage) I= current consumed by the circuit in Amperes. F= frequency of the waveform. A half wave rectifier has only one peak in one cycle so F=25hz Whereas a full wave rectifier has Two peaks in one cycle so F=100hz.
Figure2.19
After filtering the rectifier output the signal is given to a voltage regulator. The maximum input voltage that can be applied at the input is 35V.Normally there is a 2-3 Volts drop across the regulator so the input voltage should be at least 2-3 Volts higher than the output voltage. If the input voltage gets below the Vmin of the regulator due to the ripple voltage or due to any other reason the voltage regulator will not be able to produce the correct regulated voltage.
(i)Circuit diagram:
(ii) IC 7805:
7805 is an integrated three-terminal positive fixed linear voltage regulator. It supports an input voltage of 10 volts to 35 volts and output voltage of 5 volts. It has a current rating of 1 amp although lower current models are available. Its output voltage is fixed at 5.0V. The 7805 also has a built-in current limiter as a safety feature. 7805 is manufactured by many companies, including National Semiconductors and Fairchild Semiconductors. The 7805 will automatically reduce output current if it gets too hot.The last two digits represent the voltage; for instance, the 7812 is a 12-volt regulator. The 78xx series of regulators is designed to work in complement with the 79xx series of negative voltage regulators in systems that provide both positive and negative regulated voltages, since the 78xx series can't regulate negative voltages in such a system.
The 7805 & 78 is one of the most common and well-known of the 78xx series regulators, as it's small component count and medium-power regulated 5V make it useful for powering TTL devices.
3.KEYPAD
columns. So in all twelve switches have been interfaced using just seven lines. The adjoining figure shows the diagram of a matrix keypad and how it is interfaced with the controller.
Figure3.2 As you can see no pin is connected to ground, over here the controller pin itself provides the ground. We pull one of the Column Pins low & check the row pins if any of the Pin is low then we come to know which switch is pressed. Suppose we make column 1 pin low and while checking the rows we get Row 3 is low then we come to know switch 7 has been pressed.
3.2 ALGORITHM:
1. 2. 3. 4. 5. 6. 7. 8. 9. Start. Make All Pins High. Make Column 1 pin low. Check if Row 1 is low, if yes then Switch 1 has been pressed. Check if Row 2 is low, if yes then Switch 4 has been pressed. Check if row 3 is low if yes then Switch 7 has been pressed. Check if row 4 is low if yes then Switch 10 has been pressed. Make Column 1 Pin high & Column 2 Pin Low. Check if Row 1 is low, if yes then Switch 2 has been pressed.
10. Check if Row 2 is low, if yes then Switch 5 has been pressed.
11. Check if row 3 is low if yes then Switch 8 has been pressed. 12. Check if row 4 is low if yes then Switch 11 has been pressed. 13. Make Column 2 Pin high & Column 3 Pin Low. 14. Check if Row 1 is low, if yes then Switch 3 has been pressed. 15. Check if Row 2 is low, if yes then Switch 6 has been pressed. 16. Check if row 3 is low if yes then Switch 9 has been pressed. 17. Check if row 4 is low if yes then Switch 12 has been pressed. 18. Make column 3 pin high 19. Stop
4.ZIGBEE TECHNOLOGY
4.1 Zig-bee
Figure4.1
Zig-bee is a specification for a suite of high level communication protocols using small, low-power digital radios based on the IEEE 802.15.4,2006 standard for wireless personal area networks (WPANs), such as wireless headphones connecting with cell phones via short-range radio. The technology defined by the Zig-bee specification is intended to be simpler and less expensive than other WPANs, such as Bluetooth. Zig-bee is targeted at radio-frequency (RF) applications that require a low data rate, long battery life, and secure networking. Zig-bee is a low data rate, two-way standard for home automation and data networks. The standard specification for up to 254 nodes including one master, managed from a single remote control. Real usage examples of Zig-bee includes home automation tasks such as turning lights on, setting the home security system, or starting the VCR. With Zig-bee all these tasks can be done from anywhere in the home at the touch of a button. Zig-bee also allows for dial-in access via the Internet for automation control. Zig-bee protocol is optimized for very long battery life measured in months to years from inexpensive, off-the-shelf non-rechargeable batteries, and can control lighting, air conditioning and heating, smoke and fire alarms, and other security devices. The standard supports 2.4 GHz (worldwide), 868 MHz (Europe) and 915 MHz (Americas) unlicensed radio bands with range up to 100 meters.
IEEE 802.15.4:
IEEE 802.15.4 is a standard which specifies the physical layer and medium access control for low-rate wireless personal area networks (LR-WPAN's).This standard was chartered to investigate a low data rate solution with multi-month to
multi-year battery life and very low complexity. It is operating in an unlicensed, international frequency band. Potential applications are sensors, interactive toys, smart badges, remote controls, and home automation. 802.15.4 Is part of the 802.15 wireless personal-area network efforts at the IEEE? It is a simple packet-based radio protocol aimed at very low-cost, battery-operated widgets and sensors (whose batteries last years, not hours) that can intercommunicate and send low-bandwidth data to a centralized device. As of 2007, the current version of the standard is the 2006 revision. It is maintained by the IEEE 802.15 working group. It is the basis for the Zig-bee specification, which further attempts to offer a complete networking solution by developing the upper layers which are not covered by the standard.
802.15.4 Protocol:
Data rates of 250 kbps with 10-100 meter range. Two addressing modes; 16-bit short and 64-bit IEEE addressing. CSMA-CA channel access. Power management to ensure low power consumption. 16 channels in the 2.4GHz ISM band Low duty cycle - Provides long battery life Low latency Support for multiple network topologies: Static, dynamic, star and mesh Up to 65,000 nodes on a network
Article I.
Article II.
Zigbee Technology: Wireless Control that Simply Works Why is Zigbee needed?
There are a multitude of standards that address mid to high data rates for voice, PC LANs, video, etc. However, up till now there hasnt been a wireless network standard that meets the unique needs of sensors and control devices. Sensors and controls dont need high bandwidth but they do need low latency and very low energy consumption for long battery lives and for large device arrays. There are a multitude of proprietary wireless systems manufactured today to solve a multitude of problems that also dont require high data rates but do require low cost and very low current drain. These proprietary systems were designed because there were no standards that met their requirements. These legacy systems are creating significant interoperability problems with each other and with newer technologies. Article III. Zigbee/IEEE 802.15.4 - General Characteristics Dual PHY (2.4GHz and 868/915 MHz)
Data rates of 250 kbps (@2.4 GHz), 40 kbps (@ 915 MHz), and 20 kbps (@868
MHz)
and controls
Low power (battery life multi-month to years) Multiple topologies: star, peer-to-peer, mesh Addressing space of up to:
18,450,000,000,000,000,000 devices (64 bit IEEE address) 65,535 network nodes.
Optional guaranteed time slot for applications requiring low latency Fully hand-shaked protocol for transfer reliability Range: 50m typical (5-500m based on environment)
Figure4.2
PAN Coordinator
Full Function Device Communications Flow Reduced Function Device Star Topology
Figure4.3
Three devices in network 1. zigbee PAN coordinator (MASTER) 2. zigbee router (full function device) 3. zigbee end device(reduced function device)
PHYSICAL LAYER:
The physical layer was designed to accommodate the need for a low cost yet allowing for high levels of integration. The use of direct sequence allows the analog circuitry to be very simple and The PHY provides two services: the PHY data service and PHY management service interfacing to the physical layer management entity (PLME). The PHY data service enables the transmission and reception of PHY protocol data units (PPDU) across the physical radio channel. The features of the PHY are activation and deactivation of the radio transceiver, energy detection(ED), link quality indication
(LQI), channel selection, clear channel assessment (CCA) and transmitting as well as receiving packets across the physical medium. The standard offers two PHY options based on the frequency band. Both are based on direct sequence spread spectrum (DSSS). The data rate is 250kbps at 2.4GHz, 40kbps at 915MHz and 20kbps at 868MHz. The higher data rate at 2.4GHz is attributed to a higher-order modulation scheme. Lower frequency provide longer range due to lower propagation losses. Low rate can be translated into better sensitivity and larger coverage area. Higher rate means higher throughput, Lower latency or lower duty cycle. There is a single channel between 868 and 868.6MHz, 10 channels between 902.0 and 928.0MHz, and 16 channels between 2.4 and 2.4835GHz.
MAC LAYER :
The media access control (MAC) layer was designed to allow multiple topologies without complexity. The power management operation doesnt require multiple modes of operation. The MAC allows a reduced functionality device (RFD) that neednt 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. Article IV. Article V. Article VI. Article VII. MAC Primitives: MAC Data Service
MCPS-DATA exchange data packets between MAC and PHY MCPS-PURGE purge an MSDU from the transaction queue MAC Management Service MLME-ASSOCIATE/DISASSOCIATE network association MLME-SYNC / SYNC-LOSS - device synchronization MLME-SCAN - scan radio channels MLME- COMM-STATUS communication status MLME-GET / -SET retrieve/set MAC PIB parameters MLME-START / BEACON-NOTIFY beacon management MLME-POLL - beaconless synchronization MLME-GTS - GTS management
Article VIII.
MLME-RESET request for MLME to perform reset MLME-ORPHAN - orphan device management MLME-RX-ENABLE - enabling/disabling of radio system
Network Layer:
Section VIII.1 The responsibilities of the Zigbee NWK layer include:
Starting a network: The ability to successfully establish a new network. Joining and leaving a network: The ability to gain membership (join) or relinquish
membership (leave) a network.
Configuring a new device: The ability to sufficiently configure the stack for
operation as required.
algorithm is as a hierarchical routing strategy with table-driven optimizations applied where possible. NWK uses an algorithm that allows stack implementers and application developers to balance unit cost, battery drain, and complexity in producing Zigbee solutions to meet the specific cost-performance profile of their application. Started with the well-studied public-domain algorithm AODV and Motorolas Cluster-Tree algorithm and folding in ideas from Ember Corporations GRAd. Article X. Article XI. Network Summary The network layer builds upon the IEEE 802.15.4 MACs features to
allow extensibility of coverage. Additional clusters can be added; networks can be consolidated or split up.
Application layer:
The Zigbee application layer consists of the APS sub-layer, the ZDO and the manufacturer-defined application objects. The responsibilities of the APS sub-layer include maintaining tables for binding, which is the ability to match two devices together based on their services and their needs, and forwarding messages between bound devices. Another responsibility of the APS sub-layer is discovery, which is the ability to determine which other devices are operating in the personal operating space of a device. The responsibilities of the ZDO include defining the role of the device within the network (e.g., Zigbee coordinator or end device), initiating and/or responding to binding requests and establishing a secure relationship between network devices. The manufacturer-defined application objects implement the actual applications according to the Zigbee-defined application descriptions Zigbee Device Object:
Defines the role of the device within the network (e.g., Zigbee coordinator or end device) Initiates and/or responds to binding requests Establishes a secure relationship between network devices selecting one of
ZigBees security methods such as public key, symmetric key, etc. Article XII. Application Support Layer: Section XII.1 This layer provides the following services:
Discovery: The ability to determine which other devices are operating in the personal operating space of a device. Binding: The ability to match two or more devices together based on their services and their needs and forwarding messages between bound devices
Home Entertainment and Control Smart lighting, advanced temperature control, safety and security, movies and music Home Awareness Water sensors, power sensors, energy monitoring, smoke and fire detectors, smart appliances and access sensors Mobile Services m-payment, m-monitoring and control, m-security and access control, m-healthcare and tele-assist Commercial Building Energy monitoring, HVAC, lighting, access control Industrial Plant Process control, asset management, environmental management, energy management, industrial device control, machine-to-machine (M2M) communication
ZigBee uses a basic master-slave configuration suited to static star networks of many infrequently used devices that talk via small data packets. It allows up to 254 nodes. Bluetooths protocol is more complex since it is geared towards handling voice, images and file transfers in ad hoc networks. Bluetooth devices can support scatter nets of multiple smaller non-synchronized networks (piconets). It only allows up to 8 slave nodes in a basic master-slave piconet set-up. When ZigBee node is powered down, it can wake up and get a packet in around 15 msec whereas Bluetooth device would take around 3sec to wake up and respond.
Standard Transmission Range (meters) Battery Life (days) Network Size (# of nodes) Application Stack Size (KB) Throughput kb/s)
ZigBee 802.15.4 1 100* 100 1,000 > 64,000 Monitoring & Control 4 32 20 250
Wi-Fi 802.11b 1 100 0.5 5.0 32 Web, Email, Video 1,000 11,000
250 720
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 100m, 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 5MHz channel spacing. The 868 and 900MHz bands also use direct-sequence spread spectrum but with binary-phase-shift keying modulation.
Power output:: 1mW (+0 dBm) North American & International version Indoor/Urban range: Up to 100 ft (30 m) Outdoor/RF line-of-sight range: Up to 300 ft (90 m) RF data rate: 250 Kbps Interface data rate: Up to 115.2 Kbps Operating frequency: 2.4 GHz Receiver sensitivity: -92 dBm
Performance: XBee-PRO:
Power output:
Indoor/Urban range: Up to 300 ft (90 m) Outdoor/RF line-of-sight range: Up to 1 mile (1.6 km) RF LOS RF data rate: 250 Kbps Interface data rate: Up to 115.2 Kbps Operating frequency: 2.4 GHz Receiver sensitivity: -100 dBm (all variants)
Networking:
Spread Spectrum type: DSSS (Direct Sequence Spread Spectrum) Networking topology: Point-to-point, point-to-multipoint, & peer-to-peer Error handling: Retries & acknowledgements Filtration options: PAN ID, Channel, and 64-bit addresses Channel capacity:
XBee: 16 Channels
XBee-PRO: 12 Channels
Power:
Supply voltage:
XBee: 2.8 - 3.4 VDC XBee-PRO: 2.8 - 3.4 VDC XBee Footprint Recommendation: 3.0 - 3.4 VDC
Transmit current:
XBee: 45 mA (@ 3.3 V) boost mode 35 mA (@ 3.3 V) normal mode XBee-PRO: 215 mA (@ 3.3 V)
Receive current:
General:
Physical Properties:
Size:
XBee: 0.960 in x 1.087 in (2.438 cm x 2.761 cm) XBee-PRO: 0.960 in x 1.297 in (2.438 cm x 3.294 cm)
2 3
Weight: 0.10 oz (3g) Antenna options: U.FL, Reverse Polarity SMA (RPSMA), chip antenna or Operating temperature: -40 C to 85 C (industrial)
To display interactive messages we are using LCD Module. We examine an intelligent LCD display of two lines,16 characters per line that is interfaced to the controllers. The protocol (handshaking) for the display is as shown. Whereas D0 to D7th bit is the Data lines, RS, RW and EN pins are the control pins and remaining pins are +5V, -5V and GND to provide supply. Where RS is the Register Select, RW is the Read Write and EN is the Enable pin. The display contains two internal byte-wide registers, one for commands (RS=0) and the second for characters to be displayed (RS=1). It also contains a userprogrammed RAM area (the character RAM) that can be programmed to generate any desired character that can be formed using a dot matrix. To distinguish between these two data areas, the hex command byte 80 will be used to signify that the display RAM address 00h will be chosen.Port1 is used to furnish the command or data type, and ports 3.2 to3.4 furnish register select and read/write levels. The display takes varying amounts of time to accomplish the functions as listed. LCD bit 7 is monitored for logic high (busy) to ensure the display is overwritten. Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. The most common type of LCD controller is HITACHI 44780 which provides a simple interface between the controller & an LCD. These LCD's are very simple to interface with the controller as well as are cost effective.
2x16 Line Alphanumeric LCD Display The most commonly used ALPHANUMERIC displays are 1x16 (Single Line & 16 characters), 2x16 (Double Line & 16 character per line) & 4x20 (four lines & Twenty characters per line). The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the mode of operation. If operated in 8-bit mode then 8 data
lines + 3 control lines i.e. total 11 lines are required. And if operated in 4-bit mode then 4 data lines + 3 control lines i.e. 7 lines are required. How do we decide which mode to use? Its simple if you have sufficient data lines you can go for 8 bit mode & if there is a time constrain i.e. display should be faster then we have to use 8-bit mode because basically 4-bit mode takes twice as more time as compared to 8-bit mode. Pin Symbol Function 1 Vss Ground 2 Vdd Supply Voltage 3 Vo Contrast Setting 4 RS Register Select 5 R/W Read/Write Select 6 En Chip Enable Signal 7-14 DB0-DB7 Data Lines 15 A/Vee Gnd for the backlight 16 K Vcc for backlight When RS is low (0), the data is to be treated as a command. When RS is high (1), the data being sent is considered as text data which should be displayed on the screen. When R/W is low (0), the information on the data bus is being written to the LCD. When RW is high (1), the program is effectively reading from the LCD. Most of the times there is no need to read from the LCD so this line can directly be connected to Gnd thus saving one controller line. The ENABLE pin is used to latch the data present on the data pins. A HIGH - LOW signal is required to latch the data. The LCD interprets and executes our command at the instant the EN line is brought low. If you never bring EN low, your instruction will never be executed.
5. SOFTWARE DESCRIPTION
ABOUT SOFTWARE:
Software used: *Keil software for c programming 5.1 ABOUT KEIL SOFTWARE: It is possible to create the source files in a text editor such as Notepad, run the Compiler on each C source file, specifying a list of controls, run the Assembler on each Assembler source file, specifying another list of controls, run either the Library Manager or Linker (again specifying a list of controls) and finally running the ObjectHEX Converter to convert the Linker output file to an Intel Hex File. Once that has been completed the Hex File can be downloaded to the target hardware and debugged. Alternatively KEIL can be used to create source files; automatically compile, link and covert using options set with an easy to use user interface and finally simulate or perform debugging on the hardware with access to C variables and memory. Unless you have to use the tolls on the command line, the choice is clear. KEIL Greatly simplifies the process of creating and testing an embedded application.
Projects:
The user of KEIL centers on projects. A project is a list of all the source files required to build a single application, all the tool options which specify exactly how to build the application, and if required how the application should be simulated. A project contains enough information to take a set of source files and generate exactly the binary code required for the application. Because of the high degree of flexibility required from the tools, there are many options that can be set to configure the tools to operate in a specific manner. It would be tedious to have to set these options up every time the application is being built; therefore they are stored in a project file. Loading the project file into KEIL informs KEIL which source files are required, where they are, and how to configure the tools in the correct way. KEIL can then execute each tool with the correct options. It is also possible to create new projects in KEIL. Source files are added to the project and the tool options are set as required. The project can then be saved to preserve the settings. The project is reloaded and the simulator or debugger started, all the desired windows are opened. KEIL project files have the extension
Simulator/Debugger:
The simulator/ debugger in KEIL can perform a very detailed simulation of a micro controller along with external signals. It is possible to view the precise execution time of a single assembly instruction, or a single line of C code, all the way up to the entire application, simply by entering the crystal frequency. A window can be opened for each peripheral on the device, showing the state of the peripheral. This enables quick trouble shooting of mis-configured peripherals. Breakpoints may be set on either assembly instructions or lines of C code, and execution may be stepped through one instruction or C line at a time. The contents of all the memory areas may be viewed along with ability to find specific variables. In addition the registers may be viewed allowing a detailed view of what the microcontroller is doing at any point in time. The Keil Software 8051 development tools listed below are the programs you use to compile your C code, assemble your assembler source files, link your program together, create HEX files, and debug your target program. Vision2 for Windows Integrated Development Environment: combines Project Management, Source Code Editing, and Program Debugging in one powerful environment. C51 ANSI Optimizing C Cross Compiler: creates relocatable object modules from your C source code, A51 Macro Assembler: creates relocatable object modules from your 8051 assembler source code, BL51 Linker/Locator: combines relocatable object modules created by the compiler and assembler into the final absolute object module, LIB51 Library Manager: combines object modules into a library, which may be used by the linker, OH51 Object-HEX Converter: creates Intel HEX files from absolute object modules.
What is Vision3?
Vision3 is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: A project manager. A make facility. Tool configuration. Editor. A powerful debugger.
To help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided.
HELLO is a simple program that prints the string "Hello World" using MEASURE is a data acquisition system for analog and digital systems. TRAFFIC is a traffic light controller with the RTX Tiny operating SIEVE is the SIEVE Benchmark. DHRY is the Dhrystone Benchmark. WHETS is the Single-Precision Whetstone Benchmark.
system.
Additional example programs not listed here are provided for each device architecture.
2. Select Project - Rebuild all target files or Build target. Vision2 compiles, assembles, and links the files in your project
Creating Your Own Application in Vision2 To create a new project in Vision2, you must:
1. Select Project - New Project. 2. Select a directory and enter the name of the project file.
3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. Select Project - Options and set the tool options. Note when you select the target device from the Device Database all special options are set automatically. You typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target.
Debug your program using standard options like Step, Go, Break, and so on.
Window Files:
Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the micro controller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration
CPU Simulation:
Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses.
In addition to memory mapping, the simulator also provides support for the Integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device.
Database selection:
you have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes.
Start Debugging:
You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are Available. The additional debug windows are discussed in the following. _ The project structure or tool parameters cannot be modified. All build Commands are disabled.
Disassembly Window:
The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording. If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging.
About Keil: 1. 2.
Click on the Keil u Vision Icon on Desktop The following fig will appear
3. 4.
Click on the Project menu from the title bar Then Click on New Project
5.
Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\
6. 7. 8.
Then Click on Save button above. Select the component for u r project. i.e. Atmel Click on the + Symbol beside of Atmel
9.
10. 11.
Then Click either YES or NOmostly NO Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.
15.
Click on the file option from menu bar and select new
16.
The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.
17. 18.
Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C
19. Now right click on Source group 1 and click on Add files to Group
Source
20.
Now you will get another window, on which by default C files will appear.
21. 23.
Now select as per your file extension given while saving the file
24. 25.
If the file contains no error, then press Control+F5 simultaneously. The new window is as follows
26. 27.
Then Click OK Now Click on the Peripherals from menu bar, and check your required port as shown in fig below
28.
29. 30.
Now keep Pressing function key F11 slowly and observe. You are running your program successfully
Good, well-proven compilers are available for every embedded processor (8-bit to 32-bit or more).
APPLICATIONS:
1. Used for ambulance service systems. 2. Used for 108 services.
RESULT:
By this project we can implement an automatic traffic clearing system for ambulances and can provide medical support to the people with in time who are in critical conditions and can save their lives.
Article XIII.
1. 2. 3. 4.
BIBLIOGRAPHY: