75
Zigbee Based Automatic Meter Reading Plus Power Theft Detection Abstract – An on going project to develop a 3 phase TOU (Time of use) meter and a wireless handheld meter reader is described. The internal hardware of each device is described. The TOU meter is capable of measure and record various data such as active energy, reactive energy, apparent energy for each tariff and 15 minute energy demand for the past 30 days. This large amount of data makes manual reading impossible. Therefore

wireless energy management Zigbee

Embed Size (px)

Citation preview

Page 1: wireless energy management Zigbee

Zigbee Based Automatic Meter Reading Plus Power Theft Detection

Abstract –

An on going project to develop a 3 phase TOU (Time of use) meter and a

wireless handheld meter reader is described. The internal hardware of each

device is described. The TOU meter is capable of measure and record various

data such as active energy, reactive energy, apparent energy for each tariff and

15 minute energy demand for the past 30 days. This large amount of data makes

manual reading impossible. Therefore both devices install a ZigBee 2.4GHz RF

module for handling the wireless communication protocol and transmitting data.

A single reader can automatically search for all meters within its100m range and

read data from each meter based on the ANSI Cxx format.

Page 2: wireless energy management Zigbee

Automatic meter reading, or AMR, is the technology of automatically collecting

consumption, diagnostic, and status data from water meter or energy metering

devices (water, gas, electric) and transferring that data to a central database for

billing, troubleshooting, and analyzing. This advance mainly saves utility

Page 3: wireless energy management Zigbee

providers the expense of periodic trips to each physical location to read a meter.

Another advantage is billing can be based on near real time consumption rather

than on estimates based on previous or predicted consumption. This timely

information coupled with analysis, can help both utility providers and customers

better control the use and production of electric energy, gas usage, or water

consumption.

AMR technologies include handheld, mobile and network technologies based on

telephony platforms (wired and wireless), radio frequency (RF), or power line

transmission.

Advanced AMR and AMI

Originally AMR devices just collected meter readings electronically and matched

them with accounts. As technology has advanced, additional data could then be

captured, stored, and transmitted to the main computer, and often the metering

devices could be controlled remotely. This can include events alarms such as

tamper, leak detection, low battery, or reverse flow. Many AMR devices can also

capture interval data, and log meter events. The logged data can be used to

collect or control time of use or rate of use data that can be used for water or

energy usage profiling, time of use billing, demand forecasting, Demand

response, rate of flow recording, Leak detection, flow monitoring, water and

energy conservation enforcement, remote shutoff, etc. Advanced Metering

Infrastructure, or AMI is the new term coined to represent the networking

technology of fixed network meter systems that go beyond AMR into remote

utility management. The meters in an AMI system are often referred to as smart

meters, since they often can use collected data based on programmed logic.

The Automatic Meter Reading Association (AMRA) endorses the National

Association of Regulatory Utility Commissioners (NARUC) resolution to eliminate

regulatory barriers to the broad implementation of advanced metering

infrastructure (AMI). The resolution, passed in February 2007 [6], acknowledged

the role of AMI in supporting the implementation of dynamic pricing and the

Page 4: wireless energy management Zigbee

resulting benefits to consumers. The resolution further identified the value of AMI

in achieving significant utility operational cost savings in the areas of outage

management, revenue protection and asset management. The resolution also

called for AMI business case analysis to identify cost-effective deployment

strategies, endorsed timely cost recovery for prudently incurred AMI expenditures

and made additional recommendations on rate making and tax treatment of such

investments.

Benefits of Advanced Metering

Advanced Metering systems can provide benefits for utilities, retail providers and

customers. Benefits will be recognized by the utilities with increased efficiencies,

outage detection, tamper notification and reduced labor cost as a result of

automating reads, connections and disconnects. Retail Providers will be able to

offer new innovative products in addition to customizing packages for their

customers. In addition, with the meter data being readily available, more flexible

billing cycles would be available to their customers instead of following the

standard utility read cycles. With timely usage information available to the

customer, benefits will be seen through opportunities to manage their energy

consumption and change from one REP to another with actual meter data.

The benefits of smart metering are clear and proven.

Accurate meter reading, no more estimates

Improved billing

Accurate Profile Classes and Measurement Classes, true costs applied

Improved Security for premises

Energy Management through profile data graphs

Less financial burden correcting mistakes

Less accrued expenditure

Less time chasing call centers to provide meter readings

Transparency of “cost to read” metering

Page 5: wireless energy management Zigbee

Improved procurement power though more accurate data - “de-risking”

price

Many companies are moving towards complete AMR solutions.

Radio frequency network

Radio frequency based AMR can take many forms. The more common

ones are handheld, mobile, and fixed network. There are both two-way RF

systems and one-way RF systems in use that use both licensed and

unlicensed RF bands.

In a two-way or "wake up" system, a radio transceiver normally sends a

signal to a particular transmitter serial number, telling it to wake up from a

resting state and transmit its data. The meter attached transceiver and the

reading transceiver both send and receive radio signals and data. In a

one-way “bubble-up” or continuous broadcast type system, the transmitter

broadcasts readings continuously every few seconds. This means the

reading device can be a receiver only, and the meter AMR device a

transmitter only. Data goes one way, from the meter AMR transmitter to

the meter reading receiver. There are also hybrid systems that combine

one-way and two-way technologies, using one-way communication for

reading and two way communication for programming functions.

RF based meter reading usually eliminates the need for the meter reader

to enter the property or home, or to locate and open an underground

meter pit. The utility saves money by increased speed of reading, has

lower liability from entering private property, and has less chance of

missing reads because of being locked out from meter access.

The technology based on RF is not readily accepted everywhere. In several Asian

countries the technology faces a barrier of regulations in place pertaining to use of

the radio frequency of any radiated power. For example in India the radio

frequency which is generally in ISM band is not free to use even for low power

radio of 10 mW. The majority of manufacturers of electricity meters have radio

Page 6: wireless energy management Zigbee

frequency devices in the frequency band of 433/868 MHz for large scale

deployment in European countries. The frequency band of 2.4 GHz can be now

used in India for outdoor as well as indoor applications but few manufacturers

have shown products within this frequency band. Initiatives in radio frequency

AMR in such countries are being taken up with regulators wherever the cost of

licensing outweighs the benefits of AMR.

RF technologies commonly used for AMR Narrow Band (single fixed radio frequency) Spread Spectrum

Direct-sequence spread spectrum (DSSS) Frequency-hopping spread spectrum (FHSS)

There are also meters using AMR with RF technologies such as cellular phone data systems, zigbee, bluetooth, Wavenis and others. Some systems operate with FCC licensed frequencies and others under FCC Part 15 which allows use of unlicensed radio frequencies.

Zigbee through AMR system

Since 1993, the Metropolitan Electricity Authority (MEA) has implemented the

time-of-use (TOU) tariff system [1] which charges day uses (on-peak) 7/3 times

that of night uses (off-peak). Its goal is to provide incentives for Thai

householders to leverage their electricity uses that could result decreasing the

country’s peak electricity consumption. This implementation calls for replacing

the conventional mechanical electricity meter, shown in Fig.1a, with a new

electronic TOU meter, shown in Fig. 1b.

Page 7: wireless energy management Zigbee

The TOU (time of use ) meter has to be implemented electronically because the

new tariff system is hourly, daily and yearly dependent. There is a different rate

for an on-peak period, i.e. weekdays from 9am-22pm, and an off-peak period, i.e.

weekdays from 22pm-9am and weekend plus holidays (whole day). Thus the

meter must have a built-in electronic clock calendar unit and two energy registers

to take care of these requirements. With the advance in semiconductor

technologies, an electronic TOU meter is also more accurate, i.e. class 0.5

versus class 2.0, and consumes less operating energy than its mechanical

counterpart. Its only drawback is in its higher price but this will eventually be

compensated by its ability to implement an automatic meter reading (AMR)

system that prevents error due to human reading. At the time of this paper, the

only existing standards for meter reading are ANSI C12.18 [2] and IEC 62056 [3].

These two standards govern the use of an infrared optical port within the meter

as a gateway for reading meter data with a handheld optical reader. This AMR

system still requires an operator to come in close contact with the meter for

reading. The Integrated Circuit Design and Application Research (IDAR)

Laboratory has been prototyping the design of various TOU meters in Thailand

Page 8: wireless energy management Zigbee

since 2000, both 1 phase [4] and 3 phases [5]. It has also implemented an AMR

system based on a 2.4GHz RF signal using its own proprietary protocol and

frequency hopping scheme [6] for anti-collision and data security. A reader can

gather meter data by using a handheld RF reader within some 30m range as

shown in Fig. 3. Although this RF system operates successfully, there is a need

to use a standard RF protocol that is open to multiple vendors while data security

can be ensured through the use of encryption.

This paper thus presents an on going development of a new AMR system using

a standard 2.4GHz RF protocol name “ZigBee” for reading a 3 phase TOU meter.

The hardware of the TOU meter will be described in section II. The handheld

ZigBee reader will be described in section III and sample readouts will be shown

in Section IV.

II. A 3 PHASE TOU METER

The latest prototype version of a 3 phase TOU meter developed at IDAR is

shown in Fig. 3. The meter can be used in a 3 or 4 wires system and is capable

of performing the

Page 9: wireless energy management Zigbee

following measurements

. active energy (kWHr)

. reactive energy (kVarHr)

. apparent energy (kVA)

. power factor (0-1.0)

. phase voltages (Vrms)

. phase currents (Arms)

Furthermore, active energies used during each 15 minutes interval (called

demand) for the past 40 days are stored in the meter memory. This allows the

load consumption profile of the meter to be retrieved.

The internal hardware architecture of the meter is shown in Fig. 4. The function

of each unit in the figure is briefly described as follows. The line voltages and line

currents are sensed and properly scaled by voltage dividers and current

transformers to within the operating ranges (2V approximately) of the

measurement unit. These scaled voltages and currents are then sampled by

Page 10: wireless energy management Zigbee

the energy IC (ADE7758 [7]) which performs 16 bit Delta- Sigma analog to digital

conversion and calculates all energy values as well as the RMS values. For

example, the active energy is obtained by calculating and accumulating

Active energy in each interval = T t i t v n p

p

n p · · ‡”=

) ( ) (

3

1

where n t is the sampling instance,

p is the phase number

and T is the interval between each sampling.

Such a fine 16 bit digitization of voltages and currents in the energy IC gives the

meter an accuracy of class 0.5 that guarantees less than 0.5% error through a

wide range of voltage, current and power factor. These data are then read from

the energy IC by the microcontroller (MCU: MSP430F448 [9]) which also

performs appropriate energy collection, updates time (sec, min, hour, day and

year), displays the energy data on an LCD panel and controls two

communication devices, i.e. an infrared optical port and a ZigBee 2.4GHz RF

Module.

Page 11: wireless energy management Zigbee

This meter also has a DC back-up system using a super capacitor and a 1.5V

button battery cell. When there is a power failure, the brown-out detector unit in

the MCU will automatically inform the MCU to shut down all units except the time

keeper and store all important energy data in the EEPROM. During this time, the

MCU is put into sleep mode and the total current consumed from the back-up

system is kept minimum at 1 A ì or less. Hence, this TOU meter can retain data

for as long as one year without external power. The whole system will be turned

back to normal when the main power is back.

Page 12: wireless energy management Zigbee

ZigBee [10] is a standard wireless protocol designed for low data rate control

networks. It is layered on top of the IEEE 802.15.4 specifications [11] and

provides a standard set of functions, including network formation, messaging and

device discovery. Compared to other wireless protocols, the ZigBee protocol

offers low complexity and reduced resource requirements. There are a number of

applications that can benefit from the ZigBee protocol, e.g. Building automation

Home security system

Industrial control

and Remote meter reading

Page 13: wireless energy management Zigbee

The ZigBee protocol uses the IEEE 802.15.4 specifications as its Medium

Access Layer (MAC) and Physical Layer (PHY). This wireless network can be

implemented using either one of the three frequency bands with different data

rates: 2.4 GHz (250 kbps), 915 MHz (40kbps) and 868 MHz (20kbps). Here we

select a 2.4GHz system due to its high data rate and smaller antenna. The

ZigBee module [12] used in this TOU meter and the reader has the following

features:

The ZigBee module [12] used in this TOU meter and the

reader has the following features:

- Transmit power : 1mW or 0dBm

- Receiver Sensitivity : -92 dBm

- Range : 30m (indoor), 100m (outdoor)

- Data Rate : 250 kbps (max)

- Internal packet memory : 127 Bytes

- Module data interface : serial

- Serial data rate :1200-115200 bps

- Operating frequency : ISM 2.4GHz

- Antenna : chip type

- Supported topologies : Point-to-point, Point-tomultipoint

and Peer-to-peer

- Channels : 16 Direct Sequence

- Addressing Options : PAN ID, Channel and

Addresses

- Dimension : 2.438 cm x 2.761 cm

It is natural to set the data packet format in the communication channel according

to ANSI C12.18 regulation since this is already used for the optical reading.

Hence the same application layer used in the infrared system is also

implemented for the RF system. Each data packet consists of the following fields

Page 14: wireless energy management Zigbee

IV. RESULT

The reader records data in its MMC memory card which can easily store data of

more than 10,000 TOU meters. At the end of the day when the operator returns

to utility office, the MMC card is taken off the reader and plugged into a personal

computer (PC). An AMR software has been developed on a PC to read these

data from the MMC for further processing. The figures below are screen shots

obtained from an AMR software developed at IDAR which has also been used for

the earlier version [6] of TOU meter.

Page 15: wireless energy management Zigbee

For tariff calculation, only the active energy consumption is needed. This is

shown in Fig. 7 where both On-peak and Off-peak reading are tabulated. Notice

that the recorded data also indicates the last time this meter was read. Therefore

the TOU meter must memorize its reading time to present them to the reader.

This is to prevent multiple readings and charges.

For demand calculation or energy consumption profile study, the MMC card also

has the detailed energy used during each 15 minutes for the past 40 days. These

data can be tabulated as shown in Fig. 8 or plotted in Fig. 9.

Page 16: wireless energy management Zigbee

What is Power Theft?

INTRODUCTION:

Revenue protection is a major concern of electricity utilities all over the world,

especially when energy theft is growing at an ever-increasing pace. Various

pilfering techniques have been devised by consumers with criminal tendencies,

with the result that a large portion of the utility’s revenues remain unaccounted

for. This in turn makes utilities’ operations more difficult.

However, these losses are controllable if they are effectively dealt with. The key

components of commercial losses are caused by defective or dead meters,

defective connections, illegal connections to the distribution network, meter

tampering and billing losses due to closed services and human errors. The

recorded losses are as high as 43% in some Indian utilities, where approximately

30% of these losses are non-technical.

WHY IS ENERGY STOLEN?

Competition and dwindling margins force industrial and commercial customers to

resort to energy theft in a country like India, where energy is a scarce and costly

commodity. Amongst residential domestic consumers, the nouveau riche who

wish to enjoy many luxuries and get away without paying for electricity, and the

poor who are simply unable to afford the cost have been found to be the major

defaulters.

ABC OF THEFT PREVENTION

Automation – manage the utility by managing information by automation.

Beat hackers – the root cause of theft of energy.

Continuous monitoring – you are watched, consumer!

Deterrent action – penalize defaulters.

Page 17: wireless energy management Zigbee

Empower vigilance teams – authority and freedom make difficult tasks easier.

Force – use it when needed

FUTURE STRATEGIES

The people involved in energy theft are using ingenious methods, posing new

challenges to the utility and to energy measurement system manufacturers.

Some of the forms of tamper prevalent today include burning of the meter by

applying excessive voltages and direct tapping of supply before the metering

point. Utilities should gear themselves to counter these forms of tamper and

adopt suitable revenue protection programmes and secure metering systems to

control the losses.

We plan to introduce remote metering for selected bulk customers, to monitor

consumers in a more effective manner. Prepayment metering is also being

considered for controlling defaulters and for temporary connections. The use of

such advanced techniques is sure to give a new dimension to controlling

commercial losses, resulting in better utility operations and enhanced consumer

satisfaction.

Effective use of computer-based information and statistical data analysis tools

aid in protecting revenues. Utilities will have to prepare themselves for a

complete IT system and carry out energy audits periodically. With deregulation in

the electricity supply industry becoming a common phenomenon, more and more

utilities will have to introduce changes to make revenue protection a core

operating strategy.

Page 18: wireless energy management Zigbee

General Block Diagram

Page 19: wireless energy management Zigbee

System Block Diagram

Photo Diode sensor

Power Theft Signal

0000005679

PulseIndicationLED

Energy Meter

Microcontroller 89s51 40 pin 5v supply voltage

LCD Display

Screw Pannel

Micro switchIN

Out

Power Supply 5v Clock Reset

Meter Number DIP Switch

Zig-BeeModule

Relay Driver IC ULN 2803

Cut outRelay Board

Alarm Power Supply+ 9 v

Page 20: wireless energy management Zigbee

Receiver Section For Control Room

Serial Port DB 9pin

VB 6 SoftwareZig-BeeModule

RS 232 Serial CommunicationIC MAX 232

Computer

Power Supply+5 v

Power Supply+ 9 v

Page 21: wireless energy management Zigbee

Block Diagram Description

1. Photo Diode Sensor

IR Sensor

This sensor sense red led pulses. and also The photo depicts the schematics for an infrared sensor which allows you to detect an object's distance from the robot. The big picture problem is attach this infrared sensor on both wings of the aerial robot. Attaching these sensors on the wing tips will help the robot navigate through the halls of any building .

2. Micro switch This is a small switch inside the controller connected to the full on power and full off brake. Gives positive contact, and eliminates the resistor from the circuit. A very efficient way of handling power, even in the newer electronic controllers.

Micro switch Diagram

Page 22: wireless energy management Zigbee

A micro switch is a generic term used to refer to an electric switch that is designed to be actuated by the physical motion of mechanical devices and is generally packaged in a small form factor to allow placement in small spaces. They are very common due to their low cost and extreme durability, typically greater than 1 million cycles and up to 10 million cycles for heavy duty models. This durability is a natural consequence of the design.

3. AT89S51

1. Description

The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of In

System Programmable Flash memory. The device is manufactured using Atmel’s high-density

nonvolatile memory technology and is compatible with the industry- standard 80C51 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 In-

System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful

microcontroller which provides a highly-flexible and cost-effective solution to many embedded

control applications. The AT89S51 provides the following standard features: 4K bytes of Flash,

128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a

five-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock

circuitry. In addition, the AT89S51 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 external interrupt or hardware reset.

Features• Compatible with MCS®-51 Products• 4K Bytes of In-System Programmable (ISP) Flash Memory– Endurance: 10,000 Write/Erase Cycles• 4.0V to 5.5V Operating Range• Fully Static Operation: 0 Hz to 33 MHz• Three-level Program Memory Lock• 128 x 8-bit Internal RAM• 32 Programmable I/O Lines• Two 16-bit Timer/Counters• Six Interrupt Sources• Full Duplex UART Serial Channel• Low-power Idle and Power-down Modes• Interrupt Recovery from Power-down Mode• Watchdog Timer• Dual Data Pointer• Power-off Flag• Fast Programming Time

Page 23: wireless energy management Zigbee

• Flexible ISP Programming (Byte and Page Mode)• Green (Pb/Halide-free) Packaging Option

Page 24: wireless energy management Zigbee

LCD DISPLAY : Various display device such as seven segment display. LCD display, etc can be interfaced with microcontroller to read the output directly. In our project we use a two line LCD display with 16 characters each.

Liquid crystal Display (LCD) displays temperature of the measured element, which is calculated by the microcontroller. CMOS technology makes the device ideal for application in hand held, portable and other battery instruction with low power consumption.

GENERAL SPECIFICATION: Drive method: 1/16 duty cycle Display size: 16 character * 2 lines Character structure: 5*8 dots. Display data RAM: 80 characters (80*8 bits) Character generate ROM: 192 characters Character generate RAM: 8 characters (64*8 bits) Both display data and character generator RAMs can be read from MPU. Internal automatic reset circuit at power ON. Built in oscillator circuit.

Net Media 2x16 Serial LCD Display Module

Page 25: wireless energy management Zigbee

PIN Configuration

JP1/JP14 Pins 1 – 8

Description JP1/JP14 Pins 9 -16

Description

Pin1 Ground Pin9 D2 (Not Used)Pin2 VCC (+5) Pin10 D3 (Not Used)Pin3 Contrast Pin11 D4Pin4 Data/Command

(R/S)Pin12 D5

Pin5 Read/Write (W) Pin13 D6Pin6 Enable (E1) Pin14 D7Pin7 D0 (Not Used) Pin15 VCC (LEDSV+)Pin8 D1 (Not Used) Pin16 Ground

LCD Control Codes

Description Keyboard Code ASCII or Decimalvalue

Display custom character0-7

Ctrl-@ -Through- Ctrl-G

0 - 7

BackSpace Ctrl-H 8Horizontal Tab Ctrl-I 9New Line Ctrl-J 10Vertical Tab Ctrl-K 11Form Feed (Clear Screen) Ctrl-L 12Carriage Return Ctrl-M 13Reset Controller Ctrl-N 14Set Geometry Ctrl-O 15Set Tab Size Ctrl-P 16Set Cursor Position Ctrl-Q 17*Not Used ***** **Set Contrast Ctrl-S 19Set Backlight Ctrl-T 20Command Escape Ctrl-U 21Data Escape Ctrl-V 22Raw Data Escape Ctrl-W 23*Not Used ***** **Display an ASCIICharacter

None 22 – 255

Page 26: wireless energy management Zigbee

Power Supply

There are many types of power supply. Most are designed to convert high

voltage AC mains electricity to a suitable low voltage supply for electronic circuits

and other devices. A power supply can by broken down into a series of blocks,

each of which performs a particular function.

For example a 5V regulated supply:

Each of the blocks is described in more detail below:

Transformer - steps down high voltage AC mains to low voltage AC.

Rectifier - converts AC to DC, but the DC output is varying.

Smoothing - smoothes the DC from varying greatly to a small ripple.

Regulator - eliminates ripple by setting DC output to a fixed voltage.

Power supplies made from these blocks are described below with a circuit

diagram and a graph of their output:

Transformer only

Transformer + Rectifier

Transformer + Rectifier + Smoothing

Transformer + Rectifier + Smoothing + Regulator

Transformer only

Page 27: wireless energy management Zigbee

The low voltage AC output is suitable for lamps, heaters and special AC

motors. It is not suitable for electronic circuits unless they include a rectifier

and a smoothing capacitor.

Transformer + Rectifier

The varying DC output is suitable for lamps, heaters and standard motors. It

is not suitable for electronic circuits unless they include a smoothing

capacitor.

Transformer + Rectifier + Smoothing

Page 28: wireless energy management Zigbee

The smooth DC output has a small ripple. It is suitable for most electronic

circuits.

Transformer + Rectifier + Smoothing + Regulator

The regulated DC output is very smooth with no ripple. It is suitable for all

electronic circuits.

The fig. above shows the circuit diagram of the power supply unit. This block

mainly consists of a two regulating IC 7805 and a bridge rectified and it

provides a regulated supply approximately 5V.

The transformer used in this circuit has secondary rating of 7.5V. The main

function of the transformer is to step down the AC voltage available from the

main. The main connections are given to its primary winding through a switch

connected to a phase line. The transformer provides a 7.5V AC output at its

secondary terminals and the maximum current that can be drawn form the

transformer is 1 Amp which is well above the required level for the circuit.

The bridge rectified the AC voltage available from the secondary of the

transformer, i.e. the bridge rectifier convert the AC power available into DC

power but this DC voltage available is not constant. It is a unidirectional

voltage with varying amplitude.

Page 29: wireless energy management Zigbee

To regulate the voltage from the bridge rectifier, capacitors are connected.

Capacitors C1 filter the output voltage of the rectifier but their output is not

regulated and hence 7805 is connected which is specially designed for this

purpose.

Although voltage regulators can be designed using op-amps, it is quicker and

easier to use IC voltage regulator. Further more, IC voltage regulators are

available with features such as programmable output current/ voltage

boosting, internal short circuit current limiting, thermal shut down and floating

operation for high voltage applications.

The 78 XX series consists of three terminals viz, input, output & ground. This

is a group of fixed positive voltage regulator to give and output voltage

ranging form 5V to 24V. These IC’s are designed as fixed voltage regulators

and with adequate heat sinking, can delivery output current in excess of 1

Amp although these devices do not require external components and such

components can be used to obtain adjustable voltage and current limiting. In

addition, the difference between the input and output voltages (V in Vo) called

the dropout voltage must be typically 2V even from a power supply filter.

Capacitors C2, C3, C4, and C5 are small filters which are used for extra

filtering.LED1& LED2 are used for Power ON indicator for IC1 and IC2,

current-limiting resistors R2&R4, which prevents the LED’s from getting

heated and thus damaged.

Page 30: wireless energy management Zigbee

Relay Driver

ULN2803

The eight NPN Darlington connected transistors in this family of arrays are ideally

suited for interfacing between low logic level digital circuitry (such as TTL, CMOS

or PMOS/NMOS) and the higher current/voltage requirements of lamps, relays,

printer hammers or other similar loads for a broad range of computer, industrial,

and consumer applications. All devices feature open–collector outputs and free

wheeling clamp diodes for transient suppression.

The ULN2803 is designed to be compatible with standard TTL families while the

ULN2804 is optimized for 6 to 15 volt high level CMOS or PMOS.

Features

1. Eight darlingtons with common emitters;

2. Output current to 500 Ma;

3. Output voltage to 50 V;

4. Integral suppression diodes;

5. Versions for all popular logic families;

6. Output can be paralleled;

7. Inputs pinned opposite outputs to simplify board layout.

Page 31: wireless energy management Zigbee

Description

The ULN2801A-ULN2805A each contains eight Darlington transistors with

common emitters and integral suppression diodes for inductive loads. Each

Darlington features a peak load current rating of 600mA (500mA continuous) and

can withstand at least 50V in the off state. Outputs maybe paralleled for higher

current capability. ive versions are available to simplify interfacing to standard

logic families: the ULN2801A is designed for general purpose applications with a

current limit resistor; the ULN2802A has a 10.5k input resistor and zener for 14-

25V PMOS; the ULN2803A has a 2.7k input resistor for 5V TTL and CMOS; the

ULN2804A has a 10.5k input resistor for 6-15V CMOS and the ULN2805A is

designed to sink a minimum of 350mA for standard and Schottky TTL where

higher output current is required. All types are supplied in an 18-lead plastic DIP

with a copper lead from and feature the convenient input opposite-output pinout

to simplify board layout.

Page 32: wireless energy management Zigbee

RELAYS 1

The basis for relays, is the simple electromagnet

A nail, some wire, and a battery is all that is needed to make one,

to demonstrate and amaze your small children..add a switch, and presto! You're the talk of the town.

With no power applied to the coil, the nail is NOT magnetized

Connect this to a power source, and it will now grab and hold small pieces of metal.

 

So, herein lies the concept. If we take an electromagnet, it will interact with

metals in its vicinity. now lets take this one step further... If we were to place a

piece of metal, near the electromagnet, and connect some contacts, so that

Page 33: wireless energy management Zigbee

when the electromagnet is energized, the contacts close, we have a working

relay.

The simplest relay, is the Single Pole, Single Throw (spst) relay. It is nothing

more than an electrically controlled on-off switch. It's biggest property, is the

ability to use a very small current, to control a much larger current. this is

desireable because we can now use smaller diameter wires, to control the

current flow through a much larger wire, and also to limit the wear and tear on the

control switch.

 

Above is a simple relay control. Now, here is what is happening.....

Page 34: wireless energy management Zigbee

The control circuit (GREEN) powers the coil inside the relay, using a small

amount of current. It flows from the battery, thru the fuse ( for protection) to a

switch, (say, a light switch) then to the coil in the relay, energizing it.

 

The coil, now energized becomes an electromagnet, and attracts the metal strip with the contacts, which closes, providing a secondary heavy current path (

RED ) to the device ( say, the fog lights)

Turning off the switch, opens the circuit to the coil, removes current flow, and the electromagnet is no longer a magnet, the secondary path is opened, and the

lights extinguish.

Page 35: wireless energy management Zigbee

Meter Number selector switch

Zigbee Transmitter Receiver Module

What is ZigBee technology?

This article paper provides a complete description of the concepts and features that

Page 36: wireless energy management Zigbee

make ZigBee technology what it is. All aspects of ZigBee are described including the

IEEE802.15.4 layers, the ZigBee stack, the motivation behind the system, typical

applications and design methodologies.

What ZigBee chips are available and what are the differences?

Many silicon manufacturers are currently taking advantage of the features and popularity

of ZigBee.This article surveys the devices currently on the market, the advantages and

disadvantages of each, and provides a simple, unbiased, side by side comparison of the

available silicon. This comparison is aimed at helping a newcomer to ZigBee select a

device that will be suitable for their application.

How do I get started with ZigBee?

The most difficult part of getting started in any new electronics field is quantifying exactly

what represents a usable development platform. This article looks at what is available in

terms of development kits, software, test equipment and diagnostic tools and provides

structured advice on selecting what is really needed for your particular application.

I want to make my product wireless. Is ZigBee right for me?

Obviously, ZigBee is not the right system for every application. Each situation must be

analysed to determine the exact requirements, and to determine how many of these are

in line with what ZigBee can provide. This paper details the types of applications that

may benefit from a ZigBee approach, those that will not, and provides worked examples

for several typical applications.

How do I make my system ZigBee compliant and what does it cost?

There is some confusion over ZigBee compliance – what it means, how to achieve it,

what costs are involved and whether it is actually necessary at all. This paper looks at

several typical applications and provides a step by step procedure for ascertaining

whether compliance is required or desirable, and details in plain English where to go,

Page 37: wireless energy management Zigbee

what to do and what the associated costs are likely to be. A walkthrough is provided that

illustrates a compliant and non-compliant approach to the same application and the

benefits and disadvantages of each approach.

How do I make my system interoperable with other ZigBee devices?

Interoperability between devices from different manufacturers is a desirable feature for

some applications. This paper looks at the basic procedures involved with making a

product interoperable with other devices on the market and teaches you what steps you

need to take once you have a device that is working as intended.

Which is better – ZigBee, WiFi or Bluetooth?

This paper provides an unbiased, side by side comparison of several technologies and

looks in depth at how each is suited to a particular class of application. Worked

examples are provided detailing how to select the appropriate technology for your

project. These examples look at the overall requirements from required data rate to final

BOM and even go into such detail as PCB implications for a given technology.

How does ZigBee location tracking work?

A relatively recent development in ZigBee systems is location tracking. This paper looks

at the suitability of ZigBee for this type of application, demonstrates how it works and

makes compares the ZigBee approach to other leading systems in terms of

effectiveness, location techniques, cost and complexity.

What is a ZigBee profile?

ZigBee device profiles are a (sometimes unnecessary) confusion for those new to

ZigBee concepts. This paper looks at what profiles are, what they represent to you as a

developer, and whether you need concern yourself with them at all.

If ZigBee’s so great, why are there no products on the market?

Page 38: wireless energy management Zigbee

In this part of the series, an objective market survey is carried out. Commercial devices

currently based on IEEE802.15.4 are identified, and the reasoning and philosophy

behind their design strategies are revealed. In addition, a clear explanation is given as to

why there appears to be little ZigBee market penetration, and what this really represents

in terms of your product.

How does ZigBee mesh networking work?

Mesh networking is a very useful tool for wireless network coverage, but can be

confusing for those new to ZigBee. In this paper we show you exactly what mesh

networking is, how it works in theory, how well it works in practice and show you how

test and analyse your prospective vendors’ hardware and software for meshing

capability. Not all vendors are equal in this regard, and a system that looks good on the

surface may fail to meet your expectations in the real world. Several systems

are surveyed and compared in terms of their meshing capability and reliability.

How does ZigBee compare to other wireless standards?

This paper looks in-depth at the differences, similarities and overall philosophy behind

several major (and some less popular) wireless personal area networking systems.

Comparisons are made in terms of network stability, data rate, reliability and automated

network management. Cost-of implementation comparisons are made between several

popular systems and an analysis of cost versus real and perceived benefits is

performed.

What is the battery life?

This paper not only looks at the battery life of several ZigBee implementations, but also

walks through several worked examples showing you exactly how to calculate the

battery life in your particular application. ZigBee can achieve formidable battery life, but

only if you analyse your system and requirements correctly at the outset.

Page 39: wireless energy management Zigbee

Can ZigBee really coexist with other products at 2.4GHz?

Presented in this paper is an unbiased analysis of the real effectiveness of ZigBee

devices in unfavourable radio frequency environments. Adopters of systems other than

ZigBee often cite poor 2.4GHz coexistence as a reason not to use ZigBee. Adopters of

ZigBee generally claim that their systems can coexist with higher power 2.4GHz devices

without issue. Both sides are generally able to provide evidence to support their

argument. This paper presents an investigation of why, when and

how ZigBee devices can peacefully co-exist with other 2.4GHz devices and the

performance implications of poor device selection and placement. Test results are

presented along with code examples illustrating several strategies that may be useful in

harsh environments.

What does ZigBee cost?

ZigBee is not free. When you a ZigBee implementation in your project, a licence fee

must be paid to the ZigBee Alliance. This fee is normally part of the purchase price of

you particular ZigBee IC, but what other fees are payable? Do you need to join the

Alliance? Do you need to pay for certifications? All of these questions and more are

answered in this paper – it provides a concise and accurate reference detailing all fees

that you are (or may be) required to pay.

Example ZigBee design and schematics.

This package presents a real, usable ZigBee design example.

Schematics, circuit board layouts and code are all presented in a form

that will enable you to build, program and commission a simple,

working ZigBee device. All design strategies are documented and

explained, and practical advice is given on implementing the design in

hardware. Unlike most reference designs, this package does not

attempt to create an overly complex system. Rather, a very simple

implementation is presented that demonstrates how to exchange a

Page 40: wireless energy management Zigbee

single data item between modules, along with clear explanations

and suggestions for expansion.

ZigBee is a wireless technology developed as an open global standard

to address the unique needs of low-cost, low-power, wireless sensor

networks. The standard takes full advantage of the IEEE 802.15.4

physical radio specification and operates in unlicensed bands

worldwide at the following frequencies: 2.400–2.484 GHz, 902-928 MHz

and 868.0–868.6 MHz.

The 802.15.4 specification was developed at the Institute of Electrical

and Electronics Engineers (IEEE). The specification is a packet-based

radio protocol that meets the needs of low-cost, battery-operated

devices. The protocol allows devices to intercommunicate and be

powered by batteries that last years instead of hours.

The ZigBee protocol carries all the benefits of the 802.15.4 protocol

with added networking functionality.

The ZigBee Protocol

The ZigBee protocol was engineered by the ZigBee Alliance, a non-

profit consortium of leading semiconductor manufacturers, technology

providers, OEMs and end-users worldwide. The protocol was designed

to provide OEMs and integrators with an easy-to-use wireless data

solution characterized by low-power consumption, support for multiple

network structures and secure connections.

The ZigBee Advantage

The ZigBee protocol was designed to carry data through the hostile RF

environments that routinely exist in commercial and industrial

applications.

Page 41: wireless energy management Zigbee

ZigBee protocol features:

Low duty cycle - Provides long battery life Low latency Support for multiple network topologies: Static, dynamic, star

and mesh Direct Sequence Spread Spectrum (DSSS) Up to 65,000 nodes on a network 128-bit AES encryption – Provides secure connections between

devices Collision avoidance Link quality indication Clear channel assessment Retries and acknowledgements Support for guaranteed time slots and packet freshness

Secure Connections

The ZigBee specification provides a security toolbox approach to

ensuring reliable and secure networks. Access control lists, packet

freshness timers and 128-bit encryption based on the NIST Certified

Advanced Encryption Standard (AES) help protect transmitted data.

ZigBee Applications

ZigBee enables broad-based deployment of wireless networks with low-cost, low-power

solutions. It provides the ability to run for years on inexpensive batteries for a host of

monitoring applications: Lighting controls, AMR (Automatic Meter Reading), smoke and

CO detectors, wireless telemetry, HVAC control, heating control, home security,

Environmental controls, drapery and shade controls, etc.

StandardZigBee® 802.15.4

Wi-Fi™802.11b

Bluetooth™802.15.1

Transmission Range (meters)

1 – 100* 1 - 100 1 – 10

Battery Life (days)100 – 1,000 0.5 – 5.0 1 - 7

Page 42: wireless energy management Zigbee

Network Size (# of nodes)

> 64,000 32 7

ApplicationMonitoring &

ControlWeb, Email,

VideoCable

Replacement

Stack Size (KB)4 – 32 1,000 250

Throughput kb/s)20 – 250 11,000 720

* Digi’s XBee-PRO Module yields 2 – 3x the range of standard ZigBee Modules (up to 1200 meters).

Use Case Scenario

It is 4:00 a.m. on a farm in Iowa. Sensors distributed throughout the

fields report the moisture content in the soil and humidity of the air.

The staff on the farm uses this data to decide where and when to water

for optimum effect. The information also serves as an early warning

system for environmental issues such as frost. Precious resources are

used more efficiently and productivity increases.

The sensors distributed in the field are interconnected in a “mesh”

network. If a sensor node goes down, the network is self-healing; the

nodes are able to connect with one another dynamically, finding

another route to stay connected within the network.

Mesh Networks

A key component of the ZigBee protocol is the ability to support mesh

networks. In a mesh network, nodes are interconnected with other

nodes so that at least two pathways connect each node. Connections

between nodes are dynamically updated and optimized in difficult

Page 43: wireless energy management Zigbee

conditions. In some cases, a partial mesh network is established with

some of the nodes only connected to one other node.

Mesh networks are decentralized in nature; each node is self-routing

and able to connect to other nodes as needed. The characteristics of

mesh topology and ad-hoc routing provide greater stability in changing

conditions or failure at single nodes.

Digi XBee & XBee-PRO Modules

Digi is a member of the ZigBee Alliance and has developed OEM

solutions based on the ZigBee architecture. The XBee and XBee-PRO

modules provide an easy-to-implement solution and a powerful boost

to range and reliability to companies looking to offer ZigBee

XBee and XBee-PRO features:

Small form factor

True plug-and-communicate wireless capability

Optimized for low cost, low data rate applications

Long battery life

Robust security

High data reliability

Product interoperability – Modules are interchangeable and pin-

for-pin compatible with each other

XBee-PRO Modules yield 2-3x the range of standard ZigBee

Modules (300’ – 1000’)

 

RS 232 Serial communication

MAX 232: The MAX232 is a dual driver/receiver that includes a

capacitive voltage generator to supply TIA/EIA-232-F voltage levels

Page 44: wireless energy management Zigbee

from a single 5-V supply. Each receiver converts TIA/EIA-232-F inputs

to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3

V, a typical hysteresis of 0.5 V, and can accept ±30-V inputs. Each

driver converts TTL/CMOS input levels into TIA/EIA-232-F levels.

MAX 232

FEATURES:

Meets or Exceeds TIA/EIA-232-F and ITU

Recommendation V.28

Operates From a Single 5-V Power Supply

With 1.0-_F Charge-Pump Capacitors

Operates Up To 120 kbit/s

Two Drivers and Two Receivers

30-V Input Levels

Low Supply Current . . . 8 mA Typical

ESD Protection Exceeds JESD 22

- 2000-V Human-Body Model (A114-A)

Upgrade With Improved ESD (15-kV HBM)

and 0.1-_F Charge-Pump Capacitors is

Available With the MAX202

Applications

- TIA/EIA-232-F, Battery-Powered Systems,

Terminals, Modems, and Computers

DESCRIPTION:

The MAX232 was the first IC which in one package contains the

necessary drivers (two) and receivers (also two), to adapt the RS-232

signal voltage levels to TTL logic. It became popular, because it just

needs one voltage (+5V) and generates the necessary RS-232 voltage

levels (approx. -10V and +10V) internally. This greatly simplified the

Page 45: wireless energy management Zigbee

design of circuitry. The MAX232 has a successor, the MAX232A. It

should be noted that the MAX232 (A) is just a driver/receiver. It does

not generate the necessary RS-232 sequence of marks and spaces

with the right timing, it does not decode the RS-232 signal, it does not

provide a serial/parallel conversion. All it does is to convert signal

voltage levels. Generating serial data with the right timing and

decoding serial data has to be done by additional circuitry.

The original manufacturer offers a large series of similar ICs, with

different numbers of receivers and drivers, voltages, built-in or

external capacitors, etc. E.g. The MAX232 and MAX232A need external

capacitors for the internal voltage pump, while the MAX233 has these

capacitors built-in.

Figure 1 - Design of MAX-232 circuit

Serial Communication

Serial communication is a very common protocol for device

communication that is standard on almost every PC. Most computers

Page 46: wireless energy management Zigbee

include two RS232 based serial ports .the serial port sends and receive

bytes of information one bit at a time .although this is a slower than

parallel communication which allows the transmission of entire byte at

once it is simpler and can be used over longer distances. Typically,

serial communication is used to transmit ASII data. Communication is

completed using three transmission lines.

1. Ground

2. Transmit

3. Receive

Since serial communication is asynchronous the port is available to

transmit data on one line while receiving data on another line. The

important serial characteristics are baud rate, data bits, stop bits and

parity. For two ports to communicate these parameters should match.

Transmission in 89C51

89C51 has a serial data communication circuit that uses register SBUF

to hold data. Register SCON controls data communication. Register

PCON controls data rates. Pins RxD (p3.0) and TxD(3.1) connect to

serial data network. SBUF is physically two registers, one is writing

only i.e. to hold data to be transmitted out of microcontroller via TxD.

The other is read only and holds received data from an external

transmitting source via RxD.

Whenever a data byte is transmitted T1 flag is set and so program is

interrupted to transmit another byte of data. The main program is

interrupted only serial port interrupt is 1E SFR is enable.

The data transmission steps are:

Page 47: wireless energy management Zigbee

1. Initially the t1 flag is reset.

2. Data to be transmitted must be written into SBUF.

3. As soon as data is transmitted the T1 flag is set and main program

is interrupted to execute ISR.

4. In the ISR T1 flag is reset .another data is written in SBUF register.

Page 48: wireless energy management Zigbee

Serial Port

The Serial Port is harder to interface than the Parallel Port. In most

cases, any device you connect to the serial port will need the serial

transmission converted back to parallel so that it can be used. This can

be done using a USART.

So what are the advantages of using serial data transfer rather than

parallel?

1. Serial Cables can be longer than Parallel cables. The serial port

transmits a '1' as -3 to -25 volts and a '0' as +3 to +25 volts where

as a parallel port transmits a '0' as 0v and a '1' as 5v. Therefore,

the serial port can have a maximum swing of 50V compared to the

parallel port which has a maximum swing of 5 Volts. Therefore

cable loss is not going to be as much of a problem for serial cables

as they are for parallel.

2. You don't need as many wires as parallel transmission. If your

device needs to be mounted a far distance away from the computer

then 3 core cable (Null Modem Configuration) is going to be a lot

cheaper that running 19 or 25 core cable. However you must take

into account the cost of the interfacing at each end.

3. Microcontroller's have also proven to be quite popular recently.

Many of these have in built SCI (Serial Communications Interfaces)

which can be used to talk to the outside world. Serial

Communication reduces the pin count of these MPU's. Only two pins

are commonly used, Transmit Data (TXD) and Receive Data (RXD)

Page 49: wireless energy management Zigbee

compared with at least 8 pins if you use an 8 bit Parallel method

(You may also require a Strobe).

4. Hardware Properties

Devices which use serial cables for their communication are split into

two categories. These are DCE (Data Communications Equipment) and

DTE (Data Terminal Equipment.) Data Communications Equipments are

devices such as your modem, TA adapter, plotter etc while Data

Terminal Equipment is your Computer or Terminal.

The electrical specifications of the serial port are contained in the EIA

(Electronics Industry Association) RS232C standard. It states many

parameters such as -

1. A "Space" (logic 0) will be between +3 and +25 Volts.

2. A "Mark" (Logic 1) will be between -3 and -25 Volts.

3. The region between +3 and -3 volts is undefined.

4. An open circuit voltage should never exceed 25 volts. (In Reference

to GND)

5. A short circuit current should not exceed 500mA. The driver should

be able to handle this without damage. (Take note of this one!)

Above is no where near a complete list of the EIA standard. Line

Capacitance, Maximum Baud Rates etc are also included. For more

information please consult the EIA RS232-E standard. It is interesting

to note however, that the RS232C standard specifies a maximum baud

rate of 20,000 BPS, which is rather slow by today's standards. Revised

standards, EIA-232D & EIA-232E were released, in 1987 & 1991

respectively.

Page 50: wireless energy management Zigbee

Serial Ports come in two "sizes". There are the D-Type 25 pin connector

and the D-Type 9 pin connector both of which are male on the back of

the PC, thus you will require a female connector on your device. Below

is a table of pin connections for the 9 pin and 25 pin D-Type

connectors.

Serial Pinouts (D25 and D9 Connectors)

Table 1: D Type 9 Pin and D Type 25 Pin Connectors

Page 51: wireless energy management Zigbee

Pin Functions

Page 52: wireless energy management Zigbee

Interfacing Devices to RS-232 Ports

RS-232 Waveforms

So far we have introduced RS-232 Communications in relation to the

PC. RS-232 communication is asynchronous. That is a clock signal is

not sent with the data. Each word is synchronized using its start bit,

and an internal clock on each side, keeps tabs on the timing.

Figure 4: TTL/CMOS Serial Logic Waveform

The diagram above shows the expected waveform from the UART

when using the common 8N1 format. 8N1 signifies 8 Data bits, No

Parity and 1 Stop Bit. The RS-232 line, when idle is in the Mark State

(Logic 1). A transmission starts with a start bit which is (Logic 0). Then

each bit is sent down the line, one at a time. The LSB (Least Significant

Bit) is sent first. A Stop Bit (Logic 1) is then appended to the signal to

make up the transmission.

The diagram shows the next bit after the Stop Bit to be Logic 0. This

must mean another word is following, and this is it's Start Bit. If there

is no more data coming then the receive line will stay in it's idle state

(logic 1). We have encountered something called a "Break" Signal.

This is when the data line is held in a Logic 0 state for a time long

enough to send an entire word. Therefore, if you don't put the line back

into an idle state, then the receiving end will interpret this as a break

Page 53: wireless energy management Zigbee

signal. The data sent using this method, is said to be framed. That is

the data is framed between a Start and Stop Bit. Should the Stop Bit be

received as Logic 0, then a framing error will occur. This is common,

when both sides are communicating at different speeds.

The above diagram is only relevant for the signal immediately at the

UART. RS-232 logic levels uses +3 to +25 volts to signify a "Space"

(Logic 0) and -3 to -25 volts for a "Mark" (logic 1). Any voltage in

between these regions (i.e. between +3 and -3 Volts) is undefined.

Therefore this signal is put through a "RS-232 Level Converter". This is

the signal present on the RS-232 Port of your computer, shown below.

Figure 5: RS-232 Logic Waveform

The above waveform applies to the Transmit and Receive lines on the

RS-232 port. These lines carry serial data, hence the name Serial Port.

There are other lines on the RS-232 port which, in essence are Parallel

lines. These lines (RTS, CTS, DCD, DSR, DTR, RTS and RI) are also at

RS-232 Logic Levels.

RS-232 Level Converters

Almost all digital devices which we use require either TTL or CMOS

logic levels. Therefore the first step to connecting a device to the RS-

232 port is to transform the RS-232 levels back into 0 and 5 Volts. As

we have already covered, this is done by RS-232 Level Converters. Two

common RS-232 Level Converters are the 1488 RS-232 Driver and the

Page 54: wireless energy management Zigbee

1489 RS-232 Receiver. Each package contains 4 inverters of the one

type, either Drivers or Receivers. The driver requires two supply rails,

+7.5 to +15v and -7.5 to -15v. As you could imagine this may pose a

problem in many instances where only a single supply of +5V is

present. However the advantages of these I.C's are they are cheap.

(Figure 6) Pinouts for the MAX-232, RS-232 Driver/Receiver.

(Figure 7) Typical MAX-232 Circuit.

Another device is the MAX-232. It includes a Charge Pump, which

generates +10V and -10V from a single 5v supply. This I.C. also

includes two receivers and two transmitters in the same package.

Page 55: wireless energy management Zigbee

This is handy in many cases when you only want to use the Transmit

and Receive data Lines. You don't need to use two chips, one for the

receive line and one for the transmit line. However all this convenience

comes at a price, but compared with the price of designing a new

power supply it is very cheap.

There are also many variations of these devices. The large values of

capacitors are not only bulky, but also expensive. Therefore other

devices are available which use smaller capacitors and even some with

inbuilt capacitors.

Computer Software

Visual Basic (VB) is an event driven programming language and associated development environment from Microsoft for its COM programming model. VB has been replaced by Visual Basic .NET. The older version of VB was derived heavily from BASIC and enables the rapid application development (RAD) of graphical user interface (GUI) applications, access to databases using DAO, RDO, or ADO, and creation of ActiveX controls and objects.

A programmer can put together an application using the components provided with Visual Basic itself. Programs written in Visual Basic can also use the Windows API, but doing so requires external function declarations.

In business programming, Visual Basic has one of the largest user bases. With 62% of developers using some form of Visual Basic, it currently competes with C++ and JavaScript as the third most popular programming language behind C# and Java.

Visual Basic was designed to be easy to learn and use. The language not only allows programmers to easily create simple GUI applications, but also has the flexibility to develop fairly complex applications as well. Programming in VB is a combination of visually arranging components or controls on a form, specifying attributes and actions of those components, and writing additional lines of code for more

Page 56: wireless energy management Zigbee

functionality. Since default attributes and actions are defined for the components, a simple program can be created without the programmer having to write many lines of code. Performance problems were experienced by earlier versions, but with faster computers and native code compilation this has become less of an issue.

Although programs can be compiled into native code executables from version 5 onwards, they still require the presence of runtime libraries of approximately 2 MB in size. This runtime is included by default in Windows 2000 and later, but for earlier versions of Windows it must be distributed together with the executable.

Introduction to Visual Basic

Welcome to Microsoft Visual Basic, the fastest and easiest way to

create applications for Microsoft Windows®. Whether you are an

experienced professional or brand new to Windows programming,

Visual Basic provides you with a complete set of tools to simplify rapid

application development.

So what is Visual Basic? The "Visual" part refers to the method used to

create the graphical user interface (GUI). Rather than writing

numerous lines of code to describe the appearance and location of

interface elements, you simply add prebuilt objects into place on

screen. If you've ever used a drawing program such as Paint, you

already have most of the skills necessary to create an effective user

interface.

The "Basic" part refers to the BASIC (Beginners All-Purpose Symbolic

Instruction Code) language, a language used by more programmers

than any other language in the history of computing. Visual Basic has

evolved from the original BASIC language and now contains several

Page 57: wireless energy management Zigbee

hundred statements, functions, and keywords, many of which relate

directly to the Windows GUI. Beginners can create useful applications

by learning just a few of the keywords, yet the power of the language

allows professionals to accomplish anything that can be accomplished

using any other Windows programming language.

The Visual Basic programming language is not unique to Visual Basic.

The Visual Basic programming system, Applications Edition included in

Microsoft Excel, Microsoft Access, and many other Windows

applications uses the same language.

The Visual Basic Scripting Edition (VBScript) is a widely used scripting

language and a subset of the Visual Basic language. The investment

you make in learning Visual Basic will carry over to these other areas.

Whether your goal is to create a small utility for yourself or your work

group, a large enterprise-wide system, or even distributed applications

spanning the globe via the Internet, Visual Basic has the tools you

need.

Data access features allow you to create databases, front-end

applications, and scalable server-side components for most popular

database formats, including Microsoft SQL Server and other

enterprise-level databases.

ActiveX™ technologies allow you to use the functionality provided

by other applications, such as Microsoft Word processor, Microsoft

Excel spreadsheet, and other Windows applications. You can even

automate applications and objects created using the Professional or

Enterprise editions of Visual Basic.

Internet capabilities make it easy to provide access to documents

and applications across the Internet or intranet from within your

application, or to create Internet server applications.

Page 58: wireless energy management Zigbee

Your finished application is a true .exe file that uses a Visual Basic

Virtual Machine that you can freely distribute.