sensor are network

32
PROJECT REPORT ON SENSOR AREA NETWORK

Upload: vishu-grover

Post on 14-Oct-2014

208 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Sensor are network

PROJECT

REPORT

ON

SENSOR AREA NETWORK

Page 2: Sensor are network

SUBMITTED TO SUBMITTED BY

Abstract

Wireless Sensor Networks are ad-hoc networks that consist of nodes with limited computational power and limited power resources that are fitted with a radio transceiver, and may be deployed easily in a hostile environment due to their nearly zero configurability. These sensor networksare generally used to do environment monitoring; wherein there is a need to design energy and resource efficient algorithms for data acquisition and to come up with schemes to route data efficiently through the network. The aim of this project was to set up an ad hoc wireless sensor network and use it to track moving objects that are bugged with a radio transmitter. This project addressed issues such as multi-hop message routing and (interrupt based) scheduling , data collection & collation and time synchronization in wireless sensor networks as well as trying to achieve a mapping from signal strength parameters (RSSI) to distance.

Introduction

Wireless Sensor Networks today find their main usage in environmental monitoring in a slightly different context, that of tracking objects. This sensing of moving objects was done in this project by measuring radio signal strengths rather than using sensors such as magnetometers, accelerometers etc. In order to achieve this, we had to find out an empirical relation via experimental techniques between a received signal strength metric (RSSI ) and distances.

The motivation for doing this project was to allow to set up a nearly zero configurable network easily in a limited geographical environment where only restricted acces is to be allowed to vehicles, people etc. A typical example would be tracking moving vehicles inside a wildlife sanctuary, where it is pertinent toensure that these vehicles only stay restricted to certain paths.

Page 3: Sensor are network

BLOCK DIAGRAM

List Of Components:

The main components of a sensor node as seen from the figure are microcontroller, transceiver, external memory, power source and one or more sensors.

Page 4: Sensor are network

Microcontroller

Microcontroller performs tasks, processes data and controls the functionality of other components in the sensor node. Microcontrollers are the most suitable choice for a sensor node. A microcontroller is often the best choice for embedded systems because of its flexibility to connect to other devices, ease of programming, and low power consumption. Power can be conserved by programming these devices to go into a sleep state with only part of the controller active.

Transceiver

Sensor nodes make use of ISM band which gives free radio, spectrum allocation and global availability. The various choices of wireless transmission media are Radio frequency, Optical communication (Laser) and Infrared. The functionality of both transmitter and receiver are combined into a single device know as transceivers are used in sensor nodes. Transceivers often lack unique identifiers. The operational states are Transmit, Receive, Idle and Sleep. Current generation transceivers have built-in state machines that perform some operations automatically.

External Memory

From an energy perspective, the most relevant kinds of memory are on-chip memory of a microcontroller and Flash memory - off-chip RAM is rarely if ever used. Flash memories are used due to its cost and storage capacity. Memory requirements are very much application dependent. Two categories of memory based on the purpose of storage a) User memory used for storing application related or personal data. b) Program memory used for programming the device. This memory also contains identification data of the device if any.

Power Source

Power consumption in the sensor node is for the Sensing, Communication and Data Processing. More energy is required for data communication in sensor node. Energy expenditure is less for sensing and data processing. The energy cost of transmitting 1 Kb a distance of 100 m is approximately the same as that for the executing 3 million instructions by 100 million instructions per second/W processor. Power is stored either in batteries or capacitors.

Sensors

Sensors are hardware devices that produce measurable response to a change in a physical condition like temperature and pressure. Sensors sense or measure physical data of the area to be monitored. The continual analog signal sensed by the sensors is digitized by an Analog-to-digital converter and sent to controllers for further processing

Hardware & Software UsedThe network was setup using Berkeley motes from Crossbow. The programming was done on MPR-410 Mica2 motes. These motes have an Atmega128L micro- controller, a CC1000 radio transceiver, and can be integrated with a variety of sensors using a 51-pin connector to an external sensor board. The motes arepowered by two AA batteries.

Page 5: Sensor are network

These motes can be interfaced with a computer using a programming board that connects via a serial port. This interfacing is necessary for programming as well as for transferring data over UART.

Components Price

MICROCONTROLLER 8051 70PCB 120BASE-40 PIN 6ULN 2803 15BASE-18 PIN 3BASE-16 PIN 2BASE-8 PIN 320 K POT 5LM358 101K 110K 1100k 1330k 1Lcd 170LED 1LDR 7Thermister 10BC548 57805 7DIODE 233pf- 322pf 2

Page 6: Sensor are network

Wheels 30Chassis 70Castor Wheels 25DC Geared Motor 300Stepper Motor 350DB9 Connector 15Lm324 10DTMF IC 5Big switch 3Crallic sheet 40Holder 10L293D 130Relay 102pin Switch 2TRANSMITTER 5Solar Panel(small) 200Solar panel(Big) 450Fingerprint sensor 5500Light Circuit 85JACK 5GSM Modem 5500Light Sensor 85RECIVER 5

7 SEGMENT 10BATTERY 15BATTERY CAP 5

IR Sensor

(IR) light radiating from objects in its field of view. PIR sensors are often used in the construction of PIR-based motion detectors (see below). Apparent motion is detected when an infrared source with one temperature, such as a human, passes in front of an infrared source with another temperature, such as a wall.

All objects emit what is known as black body radiation. It is usually infrared radiation that is invisible to the human eye but can be detected by electronic devices designed for such a purpose. The term passive in this instance means that the PIR device does not emit an infrared beam but merely passively accepts incoming infrared radiation. “Infra” meaning below our ability to detect it visually, and “Red” because this color represents the lowest energy level that our eyes can sense before it becomes invisible. Thus, infrared means below the energy level of the color red, and applies to many sources of invisible energy.

Page 7: Sensor are network

The IR range falls between the visible portion of the spectrumand radio waves. IR wavelengths are usually expressed inmicrons, with the lR spectrum extending from 0.7 to 1000microns. Only the 0.7-14 micron band is used for IRtemperature measurement.

Using advanced optic systems and detectors, noncontact IRthermometers can focus on nearly any portion or portionsof the0.7-14 micron band. Because every object (with theexception of a blackbody) emits an optimum amount of IRenergy at a specific point along the IR band, each processmay require unique sensor models with specific optics anddetector types.

For example, a sensor with a narrow spectral range centeredat 3.43 microns is optimized for measuring the surfacetemperature of polyethylene and related materials. A sensorset up for 5 microns is used to measure glass surfaces. A 1micron sensor is used for metals and foils. The broaderspectral ranges are used to measure lower temperaturesurfaces, such as paper, board, poly, and foil composites.

The intensity of an object's emitted IR energy increases ordecreases in proportion to its temperature. It is the emittedenergy, measured as the target's emissivity, that indicatesan object's temperature.

Emissivity is a term used to quantify the energy-emittingcharacteristics of different materials and surfaces. IR sensorshave adjustable emissivity settings, usually from 0.1 to 1.0,

Page 8: Sensor are network

which allow accurate temperature measurements of severalsurface types.

The emitted energy comes from an object and reaches theIR sensor through its optical system, which focuses theenergy onto one or more photosensitive detectors. Thedetector then converts the IR energy into an electricalsignal, which is in turn converted into a temperature valuebased on the sensor's calibration equation and the target'semissivity. This temperature value can be displayed on thesensor, or, in the case of the smart sensor, converted toa digital output and displayed on a computer terminal.

LDR: Light-dependent resistances (LDR) are cheap light sensors. A less known light detector is the electret microphone, whose electret membrane functions as a perfect absorber, but only detects pulsed light. The aim of this study was to analyze the use of a LDR and an electret microphone as a light sensor in an optical spectroscopy system using pulsed light. A photoacoustic spectroscopy setup was used, substituting the photoacoustic chamber by the light sensor proposed. The absorption spectra of two different liquids were analyzed. The results obtained allow the recommendation of the LDR as the first choice in the construction of cheap homemade pulsed light spectroscopy systems.The light dependent resistor (LDR) is a sensor whose resistance decreases when light impinges on it. This kind of sensor is commonly used in light sensor circuits in open areas, to control street lamps for example. Another possible use is in spectroscopic apparatus. In this kind of apparatus, continuous light or pulsed light can be used. Continuous light is used in common spectroscopic apparatus. The use of lock-in amplifiers made the use of pulsed light in spectroscopy easier, as is commonly used in photo acoustic spectroscopy. LDR’s are made of semiconductors as light sensitive materials, on an isolating base. The most common semiconductors used in this system areCadmium sulphide, lead sulphide, germanium, silicon and gallium arsenide [3]. A less known light sensor is the electret microphone. As the electret membrane functions as an absorbing black body, and as the electret microphone case has an air chamber that can be used as photoacoustic chamber, the electret microphone can be used as a detector of pulsed light [4]. This type of microphone can be used to obtain the transmission spectrum of any transparent material. The aim of this communication is to study the response of LDR to pulsed light and the analysis of the spectral curves obtained with a LDR and an electret microphone as light sensors in an optical spectroscopy device.

The results obtained show that LDR could be used as a sensor of pulsed light in opticalspectroscopy devices. It is interesting that the phase of the LDR signal gives information about the energy band gap of the LDR semiconductor. Perhaps it could be used as a way to monitor changes of color in objects, because the phase of the signal does not depend on light intensity but depends on the photon energy related to the light wavelength. In case of Figs. 10 and 12, above 500 nm it can be seen that a drop in the spectrum appears. This is not usual and must be understood as an error in normalization. Perhaps normalization above 500 nm must be in a different way. The functional behavior observed for the LDR voltage with pulsed light has a direct effect in the spectrumstructure: as the light source has a distribution of light powers in function of wavelength, the peak height in the spectrum could be shorter than they must be. So, an optical spectrum obtained with this sensor must be used to determine the absorption peak position. To determine the intensity, care must be taken with the multiplicative factor that depends on the light power. About the beverages used in this study, the spectra obtained for them are different, accounting for the different color. The presence of absorption peaks at 420 and 490 nm for sample 1 are related to its yellowish color . In the case of sample 2, the electret microphone spectrum shows an absorption band at about 490 nm. In the case of LDR spectrum, other peaks can be observed after 400 nm, but the most notorious is that at 490 nm. This absorption peak is more related with its reddish color [8]. The peaks at about 310 nm are more related with the presence of different organic molecules, in this case, different types of alcohol molecules.In conclusion LDR light sensors could be used in optical spectroscopy setups, whenever appropriate normalization procedures be used. The use of pulsed light and lock-in amplifiers increases the signalto-noise ratio, allowing a better definition of

Page 9: Sensor are network

absorption peaks and bands. Electret microphones have worse signal to noise ratio when compared with LDR sensors. So, LDR must be the first choice in the construction of cheap homemade spectroscopy systems.

Metal Sensor

A metal detector is a device which responds to metal that may not be readily apparent.The simplest form of a metal detector consists of an oscillator producing an alternating current that passes through a coil producing an alternating magnetic field. If a piece of electrically conductive metal is close to the coil, eddy currents will be induced in the metal, and this produces an alternating magnetic field of its own. If another coil is used to measure the magnetic field (acting as a magnetometer), the change in the magnetic field due to the metallic object can be detected.

The first industrial metal detectors were developed in the 1960s and were used extensively for mining and other industrial applications. Uses include de-mining (the detection of land mines), the detection of weapons such as knives and guns, especially in airport security, geophysical prospecting, archaeology and treasure hunting. Metal detectors are also used to detect foreign bodies in food, and in the construction industry to detect steel reinforcing bars in concrete and pipes and wires buried in walls and floors.

The metal detector circuit is shown here that the limits represent the sake of simplicity for a metal detector, but the design works remarkably well. It only uses 40,106 Hex Schmitt inverter IC, a capacitor and a search coil – and of course batteries. An advantage of IC1b Pin 4 is to be connected to a medium-wave radio antenna, or it should be wrapped around the radio. It can also be used as a hand-held metal detectors.As you can see what metal a good selection of beat-frequency operation (BFO), up to 90 mm for a bottle-top. In fact, for the ultimate in simplicity, the capacitor C1 is omitted. In this way, the author reaches is astonishing, 150mm range for the bottle top. But with the frequency then to more than 4 MHz, the instability is a major problem.

Rain SensorA rain sensor or rain switch is a switching device actuated by rainfall. There are two main applications for rain sensors. The first is a water conservation device connected to an automatic irrigation system that causes the system to shut down in the event of rainfall. The second is a device used to protect the interior of an automobile from rain and to support the automatic mode of windscreen wipers.

A rain sensor for your water sprinkler irrigation system is a great saver of time, money and embarrassment. Nothing looks more foolish, or is more wasteful, than timer-controlled sprinklers

Page 10: Sensor are network

spraying away in a driving rainstorm. You will not always be at home to manually shut off the sprinklers every time it rains.The Technology that Makes Rain Sensors Work

A sprinkler rain sensor operates via a gauge mounted on an external arm, that is mounted on a fence near your lawn or garden, attached to the sprinkler system. Disks inside the gauge absorb water and expand more as rain continues falling. These send a message to the sprinkler system controller, interrupting the electronic signal that turns on the sprinklers. The signal is blocked until the disks shrink again to their dry size. The sprinkler controller then receives the start signal, and resumes its spraying schedule.Other Options For Sprinkler Control Sensors

Quick shut-off rain sensors activate at the touch of the first raindrops, using external impact-sensing monitors. Wind sensors clock high winds with motion-sensor technology, turning off water flow to the roadway or sidewalk. Programmable thermometers enable freeze sensors to terminate water flow when the air temperature approaches 32 degrees F (0 C).

Schematic Diagram

Page 11: Sensor are network
Page 12: Sensor are network

Fire Sensor Interfacing

Description.

Here is a simple fire alarm circuit based on a LDR and lamp pair for sensing the fire.The alarm works by sensing the smoke produced during fire.The circuit produces an audible alarm when the fire breaks out with smoke.

When there is no smoke the light from the bulb will be directly falling on the LDR.The LDR resistance will be low  and so the voltage across it (below .6V).The transistor will be OFF and nothing happens.When there is sufficient smoke to mask the light from falling on LDR, the LDR resistance increases and so do the voltage across it.Now the transistor will switch to ON.This gives power to the IC1 and it outputs 5V.This powers the tone generator IC UM66 (IC2)  to play a music.This music will be amplified by IC3 (TDA 2002) to drive the speaker.

The diode D1 and D2 in combination drops 1.4 V to give the rated voltage (3.5V ) to UM66 .UM 66 cannot withstand more than 4V.Circuit diagram with Parts list.

IR Sensor Interfacing:

Infrared sensors find numerous applications in electronic systems. Commonly used as obstacle detector, their output is used in digital form (high & low logic) by employing a comparator.  This topic explains a way to use the sensor’s output in its original analog form. Thus, along with detecting an obstacle, its exact distance can also be obtained. This is achieved by processing the output of IR sensor through an ADC0804 (analog to digital converter). The ADC is calibrated to get almost accurate distance measurement.

The measured distance is also displayed on an LCD screen. The ADC0804 and LCD are interfaced with 8051 microcontroller (AT89C51) to perform these operations. The major drawback of IR based sensors is their capability of detecting short distances.

This project mainly consists of three units: a sensor unit, an ADC component and the LCD.The IR receiver detects the IR radiations transmitted by an IR LED. The output voltage level of this IR sensor depends upon the intensity of IR rays received by the receiver. The intensity, in turn, depends on the distance between the sensor module and the obstacle. When the distance between IR pair and obstacle is lesser, more IR radiations fall on the receiver, and vice versa. The receiver along with a resistor forms a voltage divider whose output is supplied as the input for ADC0804.

Page 13: Sensor are network

 

LED Interfacing

    The first thing usually done while learning any microcontroller or embedded system is blinking an LED. The circuit below shows the circuit for Interfacing an LED.

note: Since the circuit diagram dimensions are big, your browser may fit the image to window size, if you are using Internet explorer, then an expander tool will be displayed on the bottom right

corner, if you are using firefox , then when you move the mouse pointer over the image a magnifier tool will be displayed.

    Here an LED is connected to the first pin of port0 (P0.0). The assembly program given below is simple and self explanatory.

;*************************************************;;Program: Blinking LED.;;Description: Blinks an LED connected to P0.0 ;continuously;;*************************************************

Page 14: Sensor are network

led equ P0.0

org 00hup:  setb led        ;Turn ON the LED     acall delay     ;call delay subroutine     clr led         ;Turn OFF the LED     acall delay     ;call delay subroutine     sjmp up         ;Loop 

delay:mov r7,#0ffh   ;delay subroutineloop:mov r6,#0ffh     djnz r6,$          djnz r7,loop     ret

end

Page 15: Sensor are network

HARDWARE

THE 8051 MICROCONTROLLER

2.1 GENERAL

In this chapter, the 8051 family, 8051 assembly language programming, loop and I/O port programming, 8051 addressing modes, arithmetic instructions, 8051 hardware connection and Intel hex file have been discussed.

2.2 THE 8051 FAMILY

In 1981, Intel Corporation introduced an 8-bit microcontroller called the 8051. This microcontroller had 128 bytes of RAM, 4K bytes of on-chip ROM, two timers, one serial port, and four ports (each 8-bits wide) all on a single chip. The 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to broken into 8-bit pieces to be processed by the CPU. The 8051 has a total of four I/O ports, each 8 bits wide. Although the 8051 can have a maximum of 64K bytes of on-chip ROM, many manufacturers have put only 4K bytes on the chip. There are different flavors of the 8051 in terms of speed and amount of on-chip ROM, but they are all compatible with the original 8051 as far as the instructions are concerned. The various members of the 8051 family are 8051 microcontroller, 8052 microcontroller and 8031 microcontroller.

Block Diagram:

Page 16: Sensor are network

Figure 1.2 Block diagram of inside the microcontroller 8051

2.2.1 8051 Microcontroller

The 8051 is the original member of the 8051 family. Figure 2.1 shows the block diagram of the 8051 microcontroller. The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89C51 provides the following standard features: 4Kbytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bittimer/counters, five vector two-level interrupt architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In addition, the AT89C51 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.

2.2.2 Pin Description

VCC

Supply voltage.

Page 17: Sensor are network

GND

Ground.

Port 0

Port 0 is an 8-bit open-drain bi-directional 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 high-impedance inputs. Port 0 may also be configured to be the multiplexed low- order address/data bus during accesses to external program and data memory. In this mode P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during program verification. External pull-ups are required during program verification.

Figure 2.2 Pin diagram for microcontroller 8051

Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled low will source current (IIL) because of the internal pull-ups. Port 1 also receives the low-order address bytes during Flash programming and verification.

Port 2

Page 18: Sensor are network

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. 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 pull-ups 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 pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @DPTR). In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 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 bi-directional I/O port with internal pull-ups. The Port 3 output buffer scan sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51 as listed below:

Table 2.1function of port 3

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.

ALE/PROG

Address Latch Enable 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 is the read strobe to external program memory. When the AT89C51 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.

Page 19: Sensor are network

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, for parts that require 12-volt VPP.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier. Oscillator Characteristics XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown.

Figure 2.3 Crystal Oscillator Connections

There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

2.2.3 Programming of Microcontroller 8051

We are using embedded C programming language to program the central unit i.e. microcontroller 8051, so that it performs the specific task according to the requirement.

Need of C:

Compiler produces hex file that we download into ROM of microcontroller. The size of hex file produced by compiler is one of the main concerns of microcontroller programmers for two reasons:

1. Microcontroller has limited on -chip ROM

2. The code space for 8051 is limited to 64 KB

Page 20: Sensor are network

Programming in assembly language is tedious and time consuming. C is a high level programming language that is portable across many hardware architectures.

So for following reasons we use C:

1. It is easier and less time consuming to write in C than assembly.

2. C is easier to modify and update.

3. You can use code available in function libraries.

4. C code is portable to other microcontrollers with little or no modification.

We use reg51.h as a header file as “#include <reg51.h>”. These files contain all the definitions of the 80C51 registers. This file is included in your project and will be assembled together with the compiled output of your C program.

C data types for 8051:

1. Unsigned char is 8-bit data type ranging 0-255 (0-FFH)

2. Signed char is 8-bit data type that uses most significant bit to represent the – or + value. We

have only 7-bits for the magnitude of the signed numbers giving us values from -128 to

+127.

3. Unsigned int is 16-bit data type ranging 0-65535(0-FFFFH).

4. Signed int is 16-bit data type that uses most significant bit to represent the – or + value. We

have only 15-bits for the magnitude of the signed numbers giving us values from -32768 to

+32767.

Sbit is a keyword designed to access single bit addressable registers. It allows to the single bits of the SFR registers. We can use sbit to access the individual bits of the ports as “Sbit mybit=P1^0”. This controls the D0 of port P1. Bit data type allows access to the single bits of bit - addressable memory spaces 20-2FH. Sfr, the bit data type is used for the bit addressable section of RAM space 20-2FH. Bitwise operators are AND (&), OR (|), EX-OR (^), Inverter (~), Shift Right (>>) and Shift left (<<).

Summary

In this chapter the 8051 Families, Architecture of 8051 Microcontroller, Pin description and Embedded C programming basics have been discussed.

Page 21: Sensor are network

SOFTWARE USED

1. Keil u-Vision 3.0

Keil Software is used provide you with software development tools for 8051 based microcontrollers. With the Keil tools, you can generate embedded applications for virtually every 8051 derivative. The supported microcontrollers are listed in the µ-vision

4.1 Keil (IDE) MicroVision3

Keil Software development tools are used to create products for practically every industry: consumer electronics, industrial control, networking, office automation, automotive, space exploration. Micro Vision Two is a second generation IDE that simplifies project development and application testing. With Micro Vision Two, we can easily create embedded applications in a mixture of C and assembly. Real-time applications benefit from our highly optimized C libraries and real-time kernels.

MicroVision3 provides a centralized front-end interface for the compiler, assembler, linker, debugger, and other development tools. The Project Window in MicroVision3 displays the current target, groups, and source files that comprise our project. Rather than creating a single target for each project, MicroVision2allows multiple targets for each project file. So, with a single project file, we can create a target for simulating, a target for our emulator, and a production target for programming into EPROM {E-PROM}.

Each target is composed of one or more groups which are in turn composed of one or more source files. Groups let us divide the source files into functional blocks or assign source files to different team members. Options may be configured at each level of the project. This gives us a great deal of freedom and flexibility when organizing our application. In addition to the on-line help, MicroVision3 provides on-line versions of the development tool manuals as well as the device manuals.

Keil C Compilers are based on the ANSI standard and include extensions necessary to support the 8051, 251, and 166 microcontroller families. The optimizer in our compiler is tuned for each specific architecture and provides the highest level of code density and execution speed.

The Keil C compilers give full us control over our embedded platform. We decide which register banks are used, when to access certain memory areas, which variables are stored in bits, when and how to use special function registers, and so on. Without ever writing any assembly code we may even write interrupt service routines in C. Code generated by the Keil C Compiler compares with that of a professional assembly programmer. This is due to the level of optimizations that are performed. One such optimization is global register optimization.

By analyzing which registers are used in each function, the compiler can better optimize register usage program-wide and generate smaller, faster programs. This is accomplished by iterative compilation steps during the make process.

The MicroVision3 debugger is designed to make testing your programs as efficient as possible. While editing and debugging your programs, text and code attributes are displayed in the source window. As you step through your program, the current line is marked with a yellow arrow. Code coverage shows you which lines of your program have been executed. Green means the line has been run. Grey means is has not.

Page 22: Sensor are network

Breakpoints are clearly marked in the source window. Red for enabled, white for disabled. These attributes make following program flow easier than ever. The features of the Micro Vision Two debugger don’t stop there. When simulating your programs, you not only get source-level, symbolic simulation. You also get on-chip peripheral simulation. Dialog boxes display the condition of all peripherals and on-chip components.

Proteus: is a software technology that allows creating clinical executable decision support guidelines with little effort.

A software tool that allows creating and executing clinical decision support guidelines using the Proteus approach is available. The tool called Protean may be downloaded from here. Protean allows creating new guidelines or editing existing ones very easily. Much of the editing is done by dragging and dropping.

The Proteus guidelines are created with modular entities called Knowledge Components (KCs). Each KC represents a clinical activity and is available to the clinician as a module of executable knowledge with its own intelligence.

Experts at remote locations may manage individual KCs, keeping them in sync with the current medical concepts, while the clinicians automatically get the state-of-the-art executable knowledge. This is akin to opening a web page using a hyperlink; the user gets the fresh content by clicking on the same URL when the author of the web page updates it. Unlike a web page however, the Proteus KCs are executable knowledge and not passive information. Each guideline may have many KCs, each being updated by a different expert or a group of experts.

The intelligent decision-making in the KC comes from the Inference Tools in the Proteus approach. Any thing that can make the inferences that a KC needs can be declared its inference tool. Simple software algorithms, sophisticated artificial intelligence tools or even remote human experts can be specified as inference tools for KCs. The inference tool can be as easily swapped as they can be declared. Therefore, if a tool with better inferencing capabilities becomes available, it can be used to replace the previous one in a few simple steps.

Page 23: Sensor are network

Codingorg 0000hmov p1,#00hmov p2,#00h

back: mov a,p1cjne a,#01h,l1acall delaymov p2,#01hacall delay sjmp back

l1: cjne a,#02h,l2acall delaymov p2,#02hacall delaysjmp back

l2: cjne a,#03h,l3acall delaymov p2,#03hacall delaysjmp back

l3: cjne a,#04h,l4acall delaymov p2,#04hacall delaysjmp backl4: cjne a,#05h,l5acall delaymov p2,#05hacall delaysjmp back

l5: cjne a,#06h,l6acall delaymov p2,#06hacall delaysjmp back

l6: cjne a,#07h,l7acall delaymov p2,#07hacall delay

Page 24: Sensor are network

sjmp back

l7: cjne a,#08h,l8acall delaymov p2,#08hacall delaysjmp back

l8: nop

sjmp back

delay: mov r2,#255again: mov r1,#255here: djnz r1,here djnz r2,againretend

Application:

The applications for WSNs are varied, typically involving some kind of monitoring, tracking, or controlling. Specific applications include habitat monitoring, object tracking, nuclear reactor control, fire detection, land slide detection and traffic monitoring. In a typical application, a WSN is scattered in a region where it is meant to collect data through its sensor nodes.

Area monitoringArea monitoring is a common application of WSNs. In area monitoring, the WSN is deployed over a region where some phenomenon is to be monitored. For example, a large quantity of sensor nodes could be deployed over a battlefield to detect enemy intrusion instead of using landmines When the sensors detect the event being monitored (heat, pressure, sound, light, electro-magnetic field, vibration, etc.), the event needs to be reported to one of the base stations, which can take appropriate action (e.g., send a message on the internet or to a satellite). Depending on the exact application, different objective functions will require different data-propagation strategies, depending on things such as need for real-time response, redundancy of the data (which can be tackled via data aggregation and information fusion techniques), need for security, etc.

Environmental monitoring

A number of WSNs have been deployed for environmental monitoring. Many of these have been short lived, often due to the prototype nature of the projects. Examples of longer-lived deployments are monitoring the state of permafrost in the Swiss Alps

Machine Health Monitoring or Condition based maintenance

Wireless sensor networks have been developed for machinery condition-based maintenance as they offer significant cost savings and enable new functionalities. In wired systems, the installation of enough sensors is often limited by the cost of wiring, which runs between $10–$1000 per foot.Previously inaccessible locations, rotating machinery, hazardous or restricted areas, and mobile assets can now be reached with wireless sensors. Often, companies use manual techniques to calibrate, measure, and maintain equipment. This labor-intensive method not only increases the cost of maintenance but also makes the system prone to human errors. Especially in US Navy

Page 25: Sensor are network

shipboard systems, reduced manning levels make it imperative to install automated maintenance monitoring systems. Wireless sensor networks play an important role in providing this capability

Industrial Monitoring

Water/Wastewater Monitoring

There are many opportunities for using wireless sensor networks within the water/wastewater industries. Facilities not wired for power or data transmission can be monitored using industrial wireless I/O devices and sensors powered using solar panels or battery packs.

Summary:

Presently we use a simplistic scheme to determine the location of the object. This is well described by the figure above. We only consider the top three strongest signal values and use them to estimate the location. This sorting of readings and figuring out of top three strongest signal measurements is done at the base station itself and is transparent to the server. This simplistic approach is however not a good idea since it gives no result in a lot of cases due to the nature of solution that is being seeked and the unreliable relation between RSSI and distance. The idea is to have a Wireless Sensor Network up and running, this network being in constant communication with a computer on the network.

Page 26: Sensor are network

References

[1] Mazidi M.A., McKinlay R.D. and Causey D., “PIC Microcontroller and Embedded, Using

Assembly and C for PIC18”, 1st ed., Prentice-Hall, 2006

[2] Sedra A.S. and Smith K.C., “Microelectronic Circuits”, 5th ed., 2008

[3] M.H. Rashid, “Power Electronics: Circuits, Devices and Applications,” 3rd Edition,

2004.

Pearson Education, Inc

[4] Dorin O. Neacsu, “Power Switching Converters”, 2006 by Taylor & Francis Group,

LLC

[5] Simone Buso and Paolo Mattavelli,”Digital Control in Power Electronics”, 2006 by

Morgan & Claypool

[6]Bimal .K. Bose, “Modern Power Electronics and AC Drives,” 2002, Pearson Education

[7] N. Mohan T. M. Undeland and W. P. Robbins, “Power Electronics: Converters,

[8] Muhammad H. Rashid, “Power Electronics Handbook: Devices, Circuits and

Applications”, 2nd Edition, Academic Press, New York, 2006.

[9] http://en.wikipedia.org/wiki/Buck_converter

[10] http://en.wikipedia.org/wiki/battery(electrical)

[11] Proteus VSM official website,

http://www.labcenter.co.uk

[12] CCS Compiler official website,

http://www.ccsinfo.com/

[13] Microchip official website,

http://www.microchip.com/