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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
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.
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
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
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
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.
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.
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.
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.
General Block Diagram
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
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
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
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
• Flexible ISP Programming (Byte and Page Mode)• Green (Pb/Halide-free) Packaging Option
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.
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
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.
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.
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.
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.
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
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.....
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.
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
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,
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?
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.
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
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
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
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
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
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
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:
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.
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)
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.
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
Pin Functions
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
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
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.
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
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
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.
Your finished application is a true .exe file that uses a Visual Basic