Vous êtes sur la page 1sur 103

Project Number JKM-2A00

POWER LINE PROXIMITY ALARM

A Major Qualifying Project Report


Submitted to the Faculty of
WORCESTER POLYTECHNIC INSTITUTE
In Partial Fulfillment of the Requirements for the
Degree of Bachelor of Science
by

________________________
Nicholas Arcolano

________________________
Melissa Diercks

________________________
Jessica Hopkins

________________________
Jeremy Lynch

Approved by:

_____________________________
Professor John K. McNeill, Advisor

_____________________________
Professor Alexander Emanuel, Advisor

26 April 2001
Acknowledgements

W E WOULD LIKE TO THANK THE FOLLOWING PEOPLE FOR ALL OF THEIR

CONTRIBUTIONS AND ASSISTANCE IN HELPING THIS PROJECT EFFORT :

Our advisors, Professor John K. McNeill and Professor Alexander


Emanuel, for their sound advice and guidance;

Julie Barbeau from Analog Devices, for her technical assistance;

Instructor Jonathan Hill, for his continued advice and assistance


throughout the project;

Any other faculty of the WPI Department of Electrical and Computer


Engineering, who may have helped us with our problems and
questions along the way;

And finally, the various sponsors of the New England Center for
Analog/Mixed Signal IC Design.

The authors of this report would like to state that all work contained herein
represents the combined opinions, interpretations, and arguments of the entire
project team. Regardless of who was the original author of each section, each
member of the project team concurs that through the continual processes of
correction and revision, the completed report is wholly representative of the equal
contributions of all to the final product.
ABSTRACT
The purpose of this project was to create a power line proximity alarm to serve as a
safety device for the operation of boomed industrial vehicles and equipment. The two-part
system consisted of a sensor unit and a base unit, connected by a wireless radio-frequency
link. The sensor detects the magnitude of the electric field and transmits this information to
the base station, which then alerts the operator of a potential electrocution hazard with an
audible alarm.
TABLE OF CONTENTS
TABLE OF FIGURES .....................................................................................................6
TABLE OF TABLES .......................................................................................................7
1 INTRODUCTION .................................................................................................8
2 EXECUTIVE SUMMARY.....................................................................................10
3 BACKGROUND INFORMATION......................................................................13
3.1 ELECTROCUTION HAZARDS ............................................................................... 13
3.2 THE PROPOSED SOLUTION................................................................................. 14
3.3 ELECTROMAGNETIC FIELD THEORY ................................................................... 15
3.3.1 Two-phase Systems ....................................................................................... 16
3.3.2 Three-phase Systems ..................................................................................... 17
3.4 DIGITAL DATA COMMUNICATION ALGORITHMS ............................................... 19
3.4.1 Digital Data Line Coding ............................................................................ 19
3.4.2 Error Detection Algorithms ........................................................................... 26
4 SYSTEM DEVELOPMENT..................................................................................29
4.1 PROOF OF CONCEPT .......................................................................................... 29
4.1.1 Experiment #1: Basic Electric Field Sensor ................................................... 29
4.1.2 Experiment #2: Angular Dependence of Sensor ............................................. 37
4.1.3 Conclusions ................................................................................................. 40
4.2 PROPOSED SYSTEM ............................................................................................. 41
4.2.1 System Specification ..................................................................................... 41
4.2.2 Proposed Block Diagram .............................................................................. 43
4.3 COMPONENT INVESTIGATION ............................................................................ 44
4.3.1 Filters.......................................................................................................... 44
4.3.2 Microcontrollers ........................................................................................... 49
4.3.3 RF Transmitters and Receivers ...................................................................... 52
4.3.4 Operational Amplifiers ................................................................................. 55
5 DESIGN PROCESS ..............................................................................................56
5.1 SENSOR UNIT ..................................................................................................... 56
5.1.1 Detection Circuitry ...................................................................................... 56
5.1.2 Microprocessor Control ................................................................................. 59
5.1.3 Microcontroller-Transmitter Interface ........................................................... 70
5.1.4 Radiometrix TX2 FM Data Transmitter Module .......................................... 75
5.1.5 Power Management ..................................................................................... 78
5.2 BASE UNIT.......................................................................................................... 78
5.2.1 Radiometrix RX2 FM Data Receiver Module ................................................ 79
5.2.2 Microcontroller-Receiver Interface ................................................................. 81
5.2.3 Microprocessor Control ................................................................................. 83
6 RESULTS AND ANALYSIS ..................................................................................85

(4)
6.1 FINAL SYSTEM .................................................................................................... 85
6.1.1 Sensor Schematic .......................................................................................... 85
6.1.2 Printed Circuit Board Layout ....................................................................... 87
6.2 COST ANALYSIS .................................................................................................. 87
7 FUTURE CONSIDERATIONS............................................................................89
7.1 POWER MANAGEMENT ....................................................................................... 89
7.1.1 Solar Panels ................................................................................................. 89
7.1.2 Voltage Monitor........................................................................................... 91
7.2 COMPLEX PROGRAMMABLE LOGIC DEVICE ........................................................ 92
7.2.1 Methodology ................................................................................................ 92
7.2.2 Advantages and Disadvantages ..................................................................... 95
8 BIBLIOGRAPHY ..................................................................................................97
APPENDIX A: MATLAB SIMULATION CODE.......................................................99
APPENDIX B: PRINTED CIRCUIT BOARD LAYOUT.........................................100
APPENDIX C: SENSOR UNIT PIC CODE ............................................................101
APPENDIX D: BASE UNIT PIC CODE..................................................................102
APPENDIX E: ASSORTED DATA SHEETS ...........................................................103

(5)
TABLE OF FIGURES
Figure 1: Electric Field of Two-phase Power Line System.................................................. 16
Figure 2: Maximum Electric Field of Three-phase Power Line System (Linear) ................. 18
Figure 3: Maximum Electric Field of Three-phase Power Line System (Triangular) .......... 18
Figure 4: Example of Unipolar Line Coding...................................................................... 21
Figure 5: Example of Unipolar-RZ Line Coding ............................................................... 23
Figure 6: Example of Bi-phase Line Coding ...................................................................... 24
Figure 7: Basic Electric Field Sensor .................................................................................. 30
Figure 8: Simplified Electric Field Sensor Circuit .............................................................. 30
Figure 9: Induced Current versus Distance for Various Sensor Wire Lengths .................... 35
Figure 10: Induced Current versus Distance (Logarithmic Scale)....................................... 36
Figure 11: Induced Voltage versus Angle in Degrees (Semi-Logarithmic Scale) ................. 39
Figure 12: Block Diagram of Sensor Unit.......................................................................... 43
Figure 13: Block Diagram of Base Unit ............................................................................. 43
Figure 14: Schematic of Sensor Circuit.............................................................................. 57
Figure 15: Detection Circuit Voltage versus Distance (Logarithmic Scale) ........................ 59
Figure 16: Flowchart of Sensor Reset Code ....................................................................... 63
Figure 17: Flowchart of Amplitude Calculation Code ....................................................... 66
Figure 18: Flowchart of Amplitude Value Averaging Code................................................ 69
Figure 19: Block Diagram of USART Transmitter Module............................................... 71
Figure 20: Diagram of Digital Data Packing Algorithm..................................................... 75
Figure 21: Block Diagram of TX2-418 Module................................................................. 76
Figure 22: Block Diagram of RX2-418 Module................................................................. 79
Figure 23: Block Diagram of USART Receiver Module .................................................... 81
Figure 24: Schematic of Sensor Unit ................................................................................. 86
Figure 25: High and Low Battery Voltage Indication Circuit ............................................ 91
Figure 26: Flowchart of Sequence Detection Algorithm .................................................... 94

(6)
TABLE OF TABLES
Table 1: Desirable Properties of a Line Code ..................................................................... 20
Table 2: Comparison of Unipolar Line Codes ................................................................... 26
Table 3: Predicted Voltages for 10.15 cm Sensor Wire ...................................................... 32
Table 4: Predicted Voltages for 20.32 cm Sensor Wire ...................................................... 32
Table 5: Predicted Voltages for 30.48 cm Sensor Wire ...................................................... 33
Table 6: Measured and Calculated Results for Experiment #1 ........................................... 34
Table 7: Measured and Calculated Results for Experiment #2 ........................................... 37
Table 8: Relationship Between Sensor Distance and Induced Current............................... 40
Table 9: Extrapolation of Linear Current-to-Distance Relationship................................... 41
Table 10: Projected System Specifications ......................................................................... 42
Table 11: Comparison of Various RF Transmitters ........................................................... 53
Table 12: Comparison of Various RF Receivers................................................................. 54
Table 13: Comparison of Various Operational Amplifiers ................................................. 55
Table 14: Experimental Data for Detection Circuitry........................................................ 58
Table 15: Cost Analysis of Power Line Proximity Alarm.................................................... 88
Table 16: Comparison of Various Solar Panel Types ......................................................... 90

(7)
1 INTRODUCTION
In today’s society, the use of electric power—in both public and private areas, at
home and in the workplace—has become so prevalent that it constitutes a necessary
condition for modern society. Nearly every location in the United States has access to
electric power, and it has become such a common and expected part of life that most people
do not even notice the tangle of power lines that line every street and intersection. However,
this high level of comfort with electricity can be hazardous, unless one remembers how
dangerous it can be.

In the construction industry, electricity especially has the opportunity to injure and
kill, as workers are often performing tasks and using equipment and materials that place
them at a higher risk. A common scenario for electrocution death is illustrated by the
following true report:

SUBJECT: Workman Electrocuted When Crane Load Line Contacts 7,200 -


Volt Power Line

CAUSE: Electrocution

SUMMARY: On January 3, 1985, at about 9:45 A.M., a male construction

worker was electrocuted when a crane load line contacted an

overhead 7,200 VAC power line. The victim was attempting to

hook a load to the crane.

In recent years, the potential for these kinds of accidents has been diminished greatly,
in part by the efforts of governmental and corporate safety regulations, as well as an increase
in safety awareness among the employees. Nevertheless, the National Institute for
Occupational Safety and Health (NIOSH) reports that from 1980 to 1989, there were an
average of 15 electrocutions each year due specifically to contact between cranes (or some
other type of boomed vehicle) and energized overhead power lines [Kisner and Casini,
1998].

The purpose of this project is to develop an application that would help to reduce the
chance of these accidents occurring. The application consists of a two-part system. The first
part is an electric field sensor, which must be able to detect the presence of a nearby power
line. The second part is a base station, which would be located within the cabin of the crane.

(8)
The two parts are connected by a wireless RF link, and when the sensor detects too great of
an electric field, the base sets off an audible alarm, to warn the crane operator of the presence
of danger.

Although other devices for detecting the electric field of power lines are certainly in
existence (such as, for example, a hand-held device for electricians), there is no existing
solution which integrates this technology with a wireless link and an alarm system, such as
would be most successful for addressing the current electrocution dangers in industry. Thus,
this project seeks to fill this gap, possibly saving lives in the construction industry.

(9)
2 EXECUTIVE SUMMARY
The purpose of this project was to create a power line proximity alarm to serve as a
safety device for the operation of boomed vehicles and equipment around power lines. This
safety device is a two-part system consisting of a sensor unit and an alarm unit, connected by
a wireless communication link. The purpose of the sensor unit is to detect the magnitude of
the electric field and transmit the measurement to the alarm unit. The alarm unit interprets
this data and sounds an alarm to alert the operator of a potential electrocution hazard.

In order to begin the design of this two-part system, the team conducted background
research on electrocution hazards, electromagnetic field theory, and digital data
communications. The background search on electrocution hazards reinforced the need for a
power line proximity alarm—between 1980 and 1992, 5,348 workers were electrocuted in
5,180 incidents [Kisner and Casini, 1998]. Fortunately, the Occupational Safety and Health
Administration (OSHA) has since increased safety awareness, and currently limits the
distance between a boomed vehicle and a power line to ten feet. For this reason, the team
was able to set a minimum distance specification of ten feet for determining the magnitude
of the electric field.

Background research on electromagnetic field theory gave a basic understanding of


the fundamental principles behind electromagnetic fields, including three-phase power
transmission lines. Lastly, research on digital data communication algorithms led to the
most appropriate and effective way to create transmission codes and detect errors in
transmission codes. This research was very important because of the wireless communication
link between the sensor and the alarm unit. Based on this research and the capabilities of the
transmitter and receiver modules used in this system, the team decided on a Manchester
encoding algorithm and a simple parity-check as an error detection solution.

The next step in the design was to develop an understanding of how the system will
behave. To do this, the team conducted an experiment to prove the concept of a wire as an
electric field sensor. From this experiment, the team discovered that a capacitance forms
between a power line and the wire in its electric field. Therefore, it is possible to measure the
magnitude of the electric field by measuring the voltage across the wire using an amplifier

(10)
configuration. This concept led to the development of the detection circuitry in the sensor
unit.

Once a basic understanding of the system was achieved, component research was
conducted to find the components best suited for this application. The team rated
components in terms of their performance, taking into consideration cost and power
consumption. Components with low power consumption are especially important for the
sensor unit, because its battery power is limited.

The design for the power line proximity alarm was derived from the background
research, proof of concept experiment, and component research. The sensor unit consists of
an electric field sensor, a microcontroller, a transmitter module, and a battery. The electric
field sensor is simply a sensor wire connected to a current integrator with a MOSFET switch.
The switch allows the system to sample a 60Hz input signal above the Nyquist rate. The
team designed the circuit to over-sample at a rate of 250Hz, which is a sampling interval of
4ms. The microcontroller controls this sampling interval by turning on and off the
MOSFET switch. The microcontroller also performs analog to digital conversions,
calculates the amplitude and average amplitude of the input, and controls the transmission of
data. Data is sent to the transmitter module through the UART of the microcontroller every
100ms. The transmitter module transmits this data wirelessly to the receiver module. Each
component requires 5V of a standard 9V battery, which powers the system. It is our
recommendation for future prototypes that the sensor unit be powered by solar panels in
conjunction with a battery charging circuit in order to extend the life of the battery.

The alarm unit consists of a receiver module, a data slicer, a microcontroller, an


alarm circuit, and a battery. The receiver module is used to receive data from the sensor
unit. Once it receives the data, the analog output of the receiver goes through a data slicer
circuit that the team created to rid the signal of noise and convert it to a 0V to 5V digital
waveform. The microcontroller is able to read this data via the UART and determine
whether or not an alarm should be sounded. Using a series of comparisons, the
microcontroller determines the frequency of the pulse width modulated waveform that it will
output. By using pulse width modulation, the alarm will seem louder when the magnitude
of the electric field is large and quieter when the magnitude is smaller. The alarm circuit is a
series of amplifiers and buffers used to amplify the pulse width modulated waveform to make

(11)
the alarm audible for the operator and a piezo-electric speaker. The battery in alarm unit is
the 12V battery of the boomed vehicle, and most of the devices in the alarm unit require
only +/-10V.

Concluding the design phase of the power line proximity alarm, the team tested the
system to see how well it met the specifications and goals of the project. The sensor unit of
the system meets the all of the specifications, except it does not meet the goal of low power
consumption. As mentioned before, a solar panel and battery charging circuit would help
extend the life of the battery. The sensor also successfully measures the magnitude of the
electric field and transmits the average amplitude over a period of 100ms to the alarm unit.
The alarm unit receives this information, but unfortunately, is not capable of sounding an
audio alarm. The team believes that both software and hardware problems in the alarm unit
are to blame. Future work can be done with the pulse width modulated waveform output
function of the microcontroller, and a more reliable alarm circuit needs to be implemented.

(12)
3 BACKGROUND INFORMATION
This section contains information on a variety of topics that were investigated as a
preliminary step in the design of the sensor and base systems. Such background research
includes information concerning the nature of industrial electrocution hazards and
background on fundamental concepts of electromagnetic theory, as well as common
algorithms for the transmission of digital data.

3.1 Electrocution Hazards


As mentioned in the introduction to this report, electrocution is a very serious hazard
that exists for any persons who must work regularly around energized power transmission
lines. Examples of these kinds of professions include electricians and construction workers.
Although the total number of electrocution accidents is not epidemic, the number of people
who are injured or killed each year does constitute a significant portion of industrial
accidents, particularly when high-voltage power lines are involved.

In total, 5,348 workers were electrocuted in 5,180 incidents from 1980 through
1992 [Kisner and Casini, 1998]. For more than a decade, NIOSH, as a division of the
Center for Disease Control and Awareness (CDC), has been conducting studies on the
dangers of electrocution death. In 1998, Suzanne Kisner and Virgil Casini published a
report summarizing a recent NIOSH study, called the Fatality Assessment and Control
Evaluation (FACE). The FACE study included data from a number of case studies, all
concerning work-related electrocution deaths between 1980 and 1989.

The FACE report reveals a number of interesting facts. First of all, more than half of
all the deaths recorded (54%) involved 7200-volt to 7620-volt power lines. There are two
reasons why this might be so: (1) these are the most common power lines, used to run
power to a vast number of homes and businesses, and (2) their prevalence can lead to a
reduced sense of danger when working with them. In any case, 80 of the 147 cases in the
FACE study cited this class of power line for the electrocution death [Kisner and Casini,
1998].

(13)
There are many other factors that can affect these situations, as well. From the case
studies, it appears that many of the victims had been working for longer than eight or twelve
hours; in this situation, fatigue and the desire to finish the job quickly can play a part in the
workers’ adherence to safety regulations. Also, in many of the cases, a foreman was not
present at the time of the accident. Concerning the possible prevention of these accidents,
on should note that it is generally not practical for construction workers to require that lines
are de-energized when work is being performed, due to the time involved, as well as the
inconvenience to residential and commercial sectors. Finally, not all of the lines are
insulated; in fact, in the majority of the cases in the FACE study, the lines that caused the
accident were not insulated (and of course, none of them had been de-energized).

Fortunately, an increase in safety awareness, as well as the efforts of the Occupational


Safety and Health Administration (OSHA)—a division of the United States Department of
Labor—have helped to alleviate this problem a great deal. In fact, Kisner and Casini report
that the number of electrocution deaths has decreased by more than 50% from 1980 to 1992
[1998].

Overall, the danger electrocution death in industrial environments is still a realistic


concern, hence the motivation for this project. However, as the FACE study suggests that
most accidents are caused by 7200-volt to 7620-volt power lines, then these are the types of
lines for which this application should be most optimally designed. Also, the necessity of
ease of use required that any user interface be simple and intuitive. Yet another
consideration is that the audible alarm should be loud enough to alert a worker of an
impending hazard, while not too distracting at levels of more moderate danger.

3.2 The Proposed Solution


It has already been stated that the most desirable solution to help alleviate the
dangers of electrocution for operators of boomed industrial vehicles would be a two-part
system. One part, the sensor unit, would be attached to the end of the industrial vehicle
(such as a crane) that was in use, and would monitor the level of electrocution danger. It
would then communicate this information to a base unit, which would be responsible for
alerting the crane operator.

(14)
From this premise, it was determined that two major areas of initial background
investigation would be necessary. This first of these is electromagnetic field theory . Obviously,
since the crane cannot come into contact with the power line, the only way to measure the
level of electrocution danger is from the electrical or magnetic fields that are generated by the
transmission of electrical power. However, power lines have evolved beyond just single lines
of cable strung between posts; most current power lines are part of multi-line, multi-phase
systems, designed to minimize electromagnetic field effects. In other words, there is the
potential for one to detect a low level of electric field, even when close to the power line—
particularly if these considerations of multi-phase systems are ignored. In order to best
detect the electric signal present, one must understand the effects of these multi-phase
configurations.

The second area to investigate is digital data communication . Obviously, the


transmission of digital data bits has become a common task in this age of communication,
and thus it is important to understand the many different line codes and error-checking
algorithms that can be employed. Thus, one may maximize the amount of data that is
transmitted, and the reliability with which it can be received. Since the inaccurate
transmission/reception of data bits could seriously reduce the effectiveness of the sensor—
particularly if the device is so unreliable as to be useless—it is essential that data transmission
be investigated thoroughly.

After developing a solid understanding of these fundamentals, it is then possible to


devise some plausible designs for the sensor-base system. Then, one may begin to investigate
the components needed to actualize this design.

3.3 Electromagnetic Field Theory


Whenever an electric charge exists in space, there is an energy field created, which
radiates out from it. This field of voltage potential—called an electric field—is a function of
the distribution of this charge (for instance, whether it is all at one point, spread out over a
metallic plate, etc.), as well as of how it changes over time. Thus, if one can detect this
electric field, it is possible to gain information about the electric charge creating it.

(15)
It is also true that whenever charge is moving, a magnetic field is created, and
collectively, these two phenomena are the basis for the study of electromagnetic theory.
However, for this application, it cannot be guaranteed that the power line to be detected will
have current flow through it, even though a charge may still be present, constituting an
electrocution hazard. Therefore, magnetic field will not be a reliable indicator of the danger
present, and this section will focus instead on electric field behavior.

3.3.1 Two-phase Systems


In the case of a single power line, the electric field behavior is rather simple. At any
given point, the electric field radiates out from a charge in the wire, such that if one assumes
all of the charge in one cross-section of the wire is at a single point, then the electric field
equipotential lines form concentric circles around the wire.

When considering multiple configurations of power lines, however, this situation


becomes more complicated, because interactions between the electric fields of the two
lines—each caused by voltage waveforms of different phases—warp the equipotential lines.
Figure 1 displays a MATLAB simulation of the equipotential lines for a two-phase system.

Figure 1: Electric Field of Two-phase Power Line System

(16)
In the two-phase system, the voltage waveforms, sinusoids at a frequency of 60 Hz,
are perfectly anti-phase—shifted by 180 degrees with respect to each other. Thus, the
electric potential in the field at any one moment is simply the difference between the two.

3.3.2 Three-phase Systems


Most power lines that are used are more complicated still than the two-phase system.
The typical arrangement of power transmission lines is in a three-phase network, where each
voltage waveform is shifted in phase (either ahead or back) by 120 degrees, with respect to
the other two. Accordingly, the voltage at any one point is not simply the maximum sum or
difference of the magnitudes of the voltage signals, but depends instead on the value of each
line’s voltage at that moment in time.

Since the electric field is a constantly changing quantity in this system, the best way
to visualize the level of hazard is to examine the system over one period, and draw
equipotential lines between the maximum values at each point. This algorithm was also
implemented in MATLAB (for actual code, see Appendix A), and the equipotential lines
graphed. Figure 2 shows the maximum electric field for a linear three-phase network, and
Figure 3 shows the same calculations for a triangular arrangement. Note once again that this
diagram does not correspond to any one moment in time, but rather to the maximum values
for each point, determined over one period of a 60 Hz wave.

As can be seen from the graphs, the interactions between the lines in a three-phase
system cause the maximum values of the electric field to be reduced at some points. This
effect is due to the destructive interference between the voltage waves. While it is generally
desirable to reduce the effect of electric fields—and in fact, this is one of the reasons why
power transmission lines are typically set up in this arrangement—for this application, the
reduced electric field effect must be considered. To be safe, the sensor must be designed
such that it can detect the level of electrocution danger, even if it approaches the power lines
from an angle that passes through a less intense area of the electric field.

(17)
Figure 2: Maximum Electric Field of Three -phase Power Line System (Linear)

Figure 3: Maximum Electric Field of Three -phase Power Line System (Triangular)

(18)
3.4 Digital Data Communication Algorithms
This section includes information relevant to the wireless transmission of digital data.
In addition to background about the creation of appropriate and effective transmission
codes, this section also discusses some simple algorithms for detecting errors in the
transmitted data.

3.4.1 Digital Data Line Coding


By definition, digital data are data, or pieces of information, that consist of a finite
number of levels. Considering that the microcontrollers that will control both the sensor
and base units function primarily through binary number manipulation, the term “digital”,
then, is generally synonymous with “binary” for this application.

When binary data is transmitted over a channel, it must be sent via some analog
format that can encode the individual 0’s and 1’s of which it is comprised. This algorithm is
called a line code. There are many different types of line codes, which differ greatly in terms
of their complexity, efficiency, and reliability.

3.4.1.1 Criteria for Desirable Line Codes


In order to determine the suitability of a given line code, one must evaluate it in
terms of the specific context in which it will be used. However, there are several general
characteristics of suitability, which can be used consistently to define an effective line code,
regardless of the application. Lathi defines six criteria that can be used to evaluate a digital
line code (see Table 1).

(19)
Table 1: Desirable Properties of a L ine Code

C RITERION D
ESIRED QUALITIES

Transmission bandwidth Should be as small as possible.

Efficiency Should have the least detection error probability and inter-
symbol interference (ISI) for a given bandwidth and
transmitting power.

Error detection/correction Should include possibility to detect/correct bit errors.

Favorable power spectral Should have a PSD that matches the frequency response of the
density (PSD) channel (i.e., more power concentrated where there is less
attenuation, and less power concentrated where there is more
attenuation); should also have no DC component (in case of
AC coupling in system blocks).

Adequate timing content Should be possible to extract clock information from the data
signal.

Transparency Should be possible to receive code regardless of the pattern of


bits (e.g., a stream of all 1’s or all 0’s can be received
accurately).

[Lathi, 1989]

(20)
Of course, it is unreasonable to expect that a single line code should excel in all of
these categories. A more typical approach is to determine which of these parameters are most
critical for a given application, and to find a balanced line code that best meets those needs.

Also, while Lathi’s criteria provide a stable foundation to evaluate theoretical line
codes, in practice it is equally important to consider the complexity of implementing a given
method of digital transmission. In other words, algorithms that are more software-intensive,
or are less inherently compatible with the workings of other system components (specifically
the microcontroller) will not be as useful as those which are less complex to implement in
software, or are more compatible with the existing system architecture.

3.4.1.2 Types of Digital Line Codes


There are many ways that binary line codes may differ from one another, such as the
type of symbol used. Two of the most fundamental types of line coding are polar signaling
and on-off keying.

Polar Signaling
Perhaps the simplest way to transmit a bit of information is by using a polar
representation—that is, by setting an analog signal to different voltage levels to represent
different information bits. Polar signaling is typically achieved by using one voltage to
represent a binary “0” (such as 0 volts), and another voltage to represent a binary “1” (such as
5 volts); this implementation is known as a unipolar line code.

Figure 4: Example of Unipolar Line Coding

While it is one of the most straightforward transmission codes to design and


implement in both hardware and software, a unipolar line code has several disadvantages.

(21)
First, its average value is not zero (i.e. it has a DC component), meaning that as a signal, it
cannot be AC coupled. Also, it has a fairly high bandwidth, and no inherent error-
correction capability [Lathi, 1989]. An alternative to unipolar signaling is bipolar signaling.
A bipolar line code can be implemented either by using alternating positive and negative
voltages, such as 5 volts and –5 volts, for “0” and “1” [Roden, 1996], or by using 0 volts for
“0”, and alternating between positive and negative voltages levels for “1” [Lathi, 1989].
However, since the PIC does not have a negative supply voltage, implementing such an
algorithm would be unnecessarily complicated.

Another important consideration is that the PIC microcontroller has a built-in digital
data transmitter and receiver module—the Universal Synchronous Asynchronous Receiver
Transmitter (USART)—that transmits binary data using unipolar signaling. Thus, a
unipolar algorithm would be most compatible with the existing microcontroller
communication interface.

On-Off Keying
As a contrast to polar signaling, another common transmission algorithm is on-off
keying. As the name suggests, on-off keying is implemented by sending a single pulse for a
“1” and no pulse for a “0”. This algorithm is the digital transmission method for several of
the other transmitter-receiver modules investigated as possible components for this system.
While on-off keying can make for simpler, more effective transmitters and receivers, it
requires more power for the same noise immunity. A greater difficulty is that it is not
transparent; a continuous stream of 0’s may not be detected by the receiver [Lathi, 1989].

3.4.1.3 Variations of Unipolar Line Codes


Since on-off keying is compatible with neither the transmitter-receiver modules nor
the PIC microcontroller, this section focuses on variations of unipolar line coding as possible
transmission algorithms. There are many ways to alter a unipolar signal, such as changing
the width of individual pulses, or the number of signal transitions that are necessary to
transmit one bit of information.

Nonreturn-to-Zero (NRZ) Line Coding


In the previously described polar algorithms, it is assumed that the signals have a
duty cycle of 100 percent—that is, a signal level (such as 5 volts for a “1”) is maintained for

(22)
the full duration of the clock cycle, until another bit is sent. This algorithm is known as
nonreturn-to-zero (NRZ) encoding. An example of NRZ line coding can be seen in the
diagram of unipolar coding shown earlier (Figure 4). While simplest to implement, such a
method is not inherently transparent, as long strings of 0’s or 1’s cannot be detected [Roden,
1996]. Also, many transmitters (such as the Radiometrix modules) have a minimum and
maximum duty cycle, making a straightforward NRZ line code unusable.

Return-to-Zero (RZ) Coding


One way to compensate for the lack of transparency in an NRZ line code, is to
ensure that the signal maintains a certain maximum duty cycle. This algorithm is called
return-to-zero (RZ) line coding, and is implemented by allowing a positive voltage pulse
(binary “1”) to return to the zero state at some point during the clock cycle. By doing so,
one may guarantee that a duty cycle of 100 percent is never reached; however, a continuous
stream of 0’s can still be responsible for disrupting the receiving system. Also, since the
signal must often change more quickly than it would for an NRZ algorithm, there is an
increase in the signal bandwidth in exchange for the increase in transparency [Roden, 1996].

Figure 5: Example of Unipolar-RZ Line Coding

Differential Encoding
Both the unipolar NRZ and the unipolar RZ transmission codes, while efficient and
relatively low in bandwidth, also possess other inherent flaws, as related to the criteria listed
in Table 1. For instance, besides making a signal less transparent, the lack of signal changes
when long strings of 0’s or 1’s are sent makes it difficult to extract timing information from
the transmitted signal. Also, it can be problematic when a transmission algorithm depends

(23)
too heavily on absolute signal levels; if the signal should be inverted, the entire data stream is
in error [Roden, 1996].

One way to accommodate these criteria is through differential encoding. In a


differential encoding algorithm, instead of transmitting symbols that represent individual
bits, it is the changes between signals that represent individual bits. For instance, using an
NRZ line code, a change from a 5-volt to a 0-volt signal level (or vice versa) would indicate a
“1”, while no change would indicate a zero. Thus, all that is significant in the extraction of
information from the transmitted signal is that it changes, and not what the actual voltage
levels are.

While this solution certainly helps with the problems associated with signal
inversion, when implemented with an NRZ line code alone, it does not help the problem of
extracting timing information. However, it is possible to integrate a differential algorithm
with other types of line coding, as will be discussed later.

Bi-phase (Manchester) Encoding


Returning to the problem of transparency—although the RZ line coding algorithm
maintained a certain maximum duty cycle, there was no means by which a minimum duty
cycle could be maintained. As yet another alternative, there is a way to create a perfectly
transparent signal, called bi-phase encoding (also known as Manchester encoding). In a bi-
phase algorithm, a signal transition is always responsible for representing a “0” or a “1”.
Thus, a transition from 5 volts to 0 volts might represent a binary “1”, while the opposite
transition would represent a “0”.

Figure 6: Example of Bi-phase Line Coding

(24)
Since every clock cycle contains at least one transition, there is no way for any
combination of bits to lack complete transparency. However, there is a great cost for this
advantage: the transmitting signal must change, on average, twice as fast as the actual bit
rate. This problem equates to a huge cost in signal bandwidth [Lathi, 1989].

Bi-phase encoding is another type of line coding with which one may implement a
differential encoding algorithm. To do so, a change in the type of transition (for example,
changing from “low-to-high” in the previous clock cycle, to “high-to-low” in the next clock
cycle) would represent a binary “1”, while no change in the type of transition would
represent a “0”. While bi-phase differential encoding still exhibits a painfully high
bandwidth, it does allow for protection against signal inversion, and possesses the same
complete transparency as regular bi-phase encoding.

High-Density Encoding
As has been already shown, signal transparency is a primary concern—particularly for
this application, as the transmitter-receiver modules that will be used have a minimum and
maximum duty cycle requirement. A final alternative, which allows for greater transparency
without costing as much bandwidth as is necessary for bi-phase encoding, is called high-
density encoding.

The difficulty of bi-phase encoding is that it basically takes two bits of signal
information to send one bit of data. In other words, half of the information, in the sense of
signal changes, is wasted. As an alternative, it is possible to waste less bits by maintaining a
typical NRZ algorithm, with the single change of adding in an extra bit after every N bits.
The purpose of this extra bit would be to maintain the duty cycle, by being deliberately
different from the previous bit. For instance, if every fifth bit sent were deliberately set by
the transmitting system to maintain the duty cycle (instead of being used for information),
then the duty cycle could never be less than 20 percent, nor greater than 80 percent. (Note
that the choice of N depends, of course, on the restrictions of the transmitter-receiver
system.) The advantage of high-density transmission is that it allows for a significant
reduction in the bandwidth of the signal, as compared to bi-phase encoding [Lathi, 1989].

(25)
3.4.1.4 Summary of Unipolar Line Codes
As mentioned before, it is crucial to evaluate the different line codes within the
context of a specific application and its design requirements/limitations. For this system, a
summary of the different types of unipolar line codes has been compiled in Table 2. Each
line code is evaluated for its performance in each criterion, with three stars representing the
best level of performance, and one star representing the worst.

Table 2: Comparison of Unipolar Line Codes

Differential- Bi-φ High


C RITERION NRZ RZ
NRZ Bi-φ Density
Differential
Low bandwidth ZZZ ZZ ZZZ Z Z ZZ
Efficiency ZZ ZZ Z ZZ ZZ ZZ
Error detection Z Z ZZ ZZZ ZZZ ZZZ
Favorable PSD Z Z ZZZ ZZ ZZ ZZ
Timing content Z Z Z ZZZ ZZZ ZZZ
Transparency Z ZZ Z ZZZ ZZZ ZZZ

In the context of this system, it is clear that the high-density algorithm will be the
most effective. It can be easily implemented with an NRZ line code, which is highly
compatible with the PIC microcontroller. Also, the algorithm for stuffing the extra bits can
be readily developed in the transmitting software, and will allow the transmission code to
meet the duty cycle requirements of the transmitter-receiver modules.

3.4.2 Error Detection Algorithms


Although choosing an effective line code can help to ensure the reliability of data
transmission in a transmitter-receiver system, it is usually impossible to guarantee absolutely
error-free communication, especially over a wireless channel. Consequently, another
important part of digital data communication is the methods by which bit errors can be
detected by the receiving system. There are a number of different way this might be
accomplished, from algorithms which can detect only one or two bit errors in a stream of
data, to more complex techniques which can spot—as well as correct—multiple errors.

(26)
To understand error detection/correction, realize that any stream of digital data
containing information is, by its very nature, non-deterministic. (If it were not, it would not
really be information.) Therefore, the only way that a receiver may be able to identify an
error in this information is if more bits are transmitted than are really necessary. This is
called redundancy. Different error checking algorithms are simply different methods to get as
much of this information redundancy for as few extra bits as possible.

3.4.2.1 Parity Checking


One of the simplest forms of error detection would be to transmit a single extra bit
with each section of data. The bit, called a parity bit, would provide redundant information
about the data. For instance, the transmitting system could look at 7 bits of data, count the
number of 1’s in the sequence, and set the 8 bit so that the total number was even. This
th

would be an even parity, and of course, odd parity exists as well. When the data byte arrived
at the receiver, the system could re-calculate the parity bit, and check that it matches the
transmitted parity bit. Thus, by sending one extra bit with each transmission one may
identify errors in the received data. One major drawback of this algorithm, though, is that if
two errors were to occur, the parity check would not be able to identify either of them.

By adding extra bits, however, one may improve the effectiveness of parity checking.
One algorithm, called longitudinal redundancy checkin g (LRC), creates a parity matrix to
detect errors. For instance, a system might send seven data bytes in a row, with each byte
representing seven data bits (plus one parity bit). After this transmission is completed, an
eight byte, called the block check character (BCC), would be sent. Its data bits would be set
for parity based on the previous bytes; bit 7 of the BCC would be the parity bit for the first
bit of the previous seven bytes, bit 6 would be the parity bit for the second bit of the
previous seven bytes, and so on. Not only can this algorithm detect two errors instead of
one, but also if only one error does occur, LRC can pinpoint the exact bit that is in error
[Miller, 1988].

3.4.2.2 Cyclic Redundancy Checking


One of the drawbacks of parity checking is that it demands the frequent transmission
of error detection information, which can be a problem if a continuous stream of several

(27)
thousand bits is desired. One way to accomplish this, and still employ an error detection
scheme, is with cyclic redundancy checking (CRC).

When using a CRC algorithm, a long string of binary bits is divided by a known
binary constant, yielding a remainder. This remainder—typically 12 bits or 16 bits in
length—is then transmitted with the data stream. A re-transmission is only requested if the
receiver does not calculate the same remainder as was transmitted, when it repeats the
division with the digital data [Miller, 1988].

3.4.2.3 Error Correction Codes


Although parity checking and cyclic redundancy checking are quite different, one
thing they have in common is that both can only detect errors in data. However, it is
possible to take error checking a step further, and develop codes that allow the correction of
errors at the receiver. Codes that allow correction at the receiver without further input from
the transmitter are called forward error-correction (FEC) codes.

One example of an FEC code is the Hamming code. This code basically transmits
redundant parity information, by calculating parity of different combinations of bits. When
an error occurs, examination of which parity bits show an error can point the receiver
directly to the erroneous bit. The number of bits needed is determined by how many parity
permutations must be calculated to ensure that any bit error can be identified. In general,
the total number of bits needed is considerably higher than basic error detection codes.
However, this extra cost may be a sufficient tradeoff, especially if the time and processing
required to transmit extra information and have errors corrected at the receiver is
significantly less than the resources lost by querying the transmitter to re-send the data when
errors occur.

(28)
4 SYSTEM DEVELOPMENT
This section contains information on the system development stage of the design
process. Included are the results of experiments performed to verify the feasibility of the
electric field sensor, preliminary block diagrams of the system proposed, and information
gathered about various possible components for the system.

4.1 Proof of Concept


The main function of the sensor unit will be to detect the presence of energized
power transmission lines (primarily those around 7200 volts). Since it cannot always be
guaranteed that there will be current flow in the line, this sensor must also be able to detect
stationary charge.

Given these constraints, the most viable option is to construct a sensor that detects
the electric field of the energized power line. Theoretically, this can be done by introducing
a capacitance (in the form of a sensor wire), and measuring the induced voltage across this
capacitance. However, there are many concerns with the length of sensor wire needed, and
how the effectiveness of the antenna will change with its orientation. To explore these
concerns, two experiments were performed.

4.1.1 Experiment #1: Basic Electric Field Sensor


For the experiment, a standard 3-pronged computer cord was used to model the
power transmission line. The power cord, represented as line A in Figure 7, was
approximately L = 1.067 meters (3.5 feet) long. Its diameter (including insulation) was
A

measured to be d = 6.86 millimeters (0.27 inches). This cord was plugged into the standard
A

wall outlet in the laboratory, which is modeled as a 120-volt AC ideal voltage source (f =
60 Hz). As there was no load on the transmission line (ZL = \), it can be assumed that the
charge in the line was stationary.

(29)
Figure 7: Basic Electric Field Sensor

The sensor portion of the circuit is formed of two parts: (1) a single wire of length
L , which is represented in Figure 7 by line B, and (2) an oscilloscope probe, which is
B

modeled as a 1.0 MΩ resistor to ground. The wire used was standard 22 American Wire
Gauge (AWG), and so its diameter was 0.643 mm (0.0253 in). The basic operation of the
circuit is as follows: the transmission line (line A) and the sensor line (line B)—along with
the air between them, which functions as a dielectric—form a capacitor, whose capacitance C
varies as a function of the distance x between the lines. The simplified circuit is shown in
Figure 8.

Figure 8: Simplified Electric Field Sensor Circuit

From the simplified circuit, it is possible to find the output (sensor) voltage V , as a
1

function of the capacitance C. The impedance of a capacitor is given by:

(30)
1
ZC = , [Equation 1]
jωC

and using voltage division, one finds that

 1.0MΩ   1.0MΩ ⋅ jωC 


V1 = 120V  = 120V  . [Equation 2]
 1.0MΩ + ZC   1.0MΩ ⋅ jωC + 1 

Or, stated in terms of voltage magnitude,

 1.0MΩ ⋅ jωC   Ω ⋅ ϖC 
V = 120V  = 120V 1.0M
, [Equation 3]
1
 1.0MΩ ⋅ jωC + 1   (1.0MΩ ) ⋅ω C + 1 
 
2 2 2

where ω is the frequency of the AC signal in radians per second (in this case, 120π rad/sec).

4.1.1.1 Finding the Capacitance Value


The next step in the theoretical modeling, then, is to find the capacitance between
the two wires. Although it is possible to compute mathematically the theoretical capacitance
for two cylinders of known length, diameter, and composition, it is quite complicated.
Thus, our first approach was to attempt an approximation of the capacitance, by using a
more basic model.

One of the simplest models for capacitance is derived for the case of two parallel
conducting plates of equal size, with some sort of dielectric between them (in the case of our
experiment, air). The relationship for a capacitance C is given as

ε0 A
C =k , [Equation 4]
x

where k is the dielectric constant (k vacuum


= 1; k = 1.006), ε is the permittivity of free space
air 0

(8.8542· 10 farads/meter), A is the area of one of the plates (in square meters), and x is the
-12

distance between them (in meters) [Bueche, 1975].

(31)
4.1.1.2 Theoretical Analysis of Experiment
Using this capacitance model, one can predict the outcomes of the experiment.
Trials were performed using a range of values for x, from 2.45 cm (0.96 in) to 22.89 cm
(9.01 in). Also, three different lengths were used for the sensor wire: 10.15 cm (4.00 in),
20.32 cm (8.00 in), and 30.48 cm (12.00 in). Using the model provided by combining
Equation 3 and Equation 4 a table of predicted values for each length of sensor wire was
generated.

Table 3: Predicted Voltages for 10.15 cm Sensor Wire

x (meters) C (farads) V1 (volts)


0.0245 2.37E-14 2.85E-06
0.0508 1.14E-14 1.37E-06
0.0762 7.63E-15 9.16E-07
0.1016 5.72E-15 6.87E-07
0.1270 4.58E-15 5.49E-07
0.1524 3.82E-15 4.58E-07
0.1778 3.27E-15 3.92E-07
0.2032 2.86E-15 3.43E-07
0.2289 2.54E-15 3.05E-07

Table 4: Predicted Voltages for 20.32 cm Sensor Wire

x (meters) C (farads) V1 (volts)


0.0245 4.75E-14 5.70E-06
0.0508 2.29E-14 2.75E-06
0.0762 1.53E-14 1.83E-06
0.1016 1.15E-14 1.37E-06
0.1270 9.16E-15 1.10E-06
0.1524 7.64E-15 9.16E-07
0.1778 6.55E-15 7.85E-07
0.2032 5.73E-15 6.87E-07
0.2289 5.08E-15 6.10E-07

(32)
Table 5: Predicted Voltages for 30.48 cm Sensor Wire

x (meters) C (farads) V1 (volts)


0.0245 7.13E-14 8.55E-06
0.0508 3.44E-14 4.12E-06
0.0762 2.29E-14 2.75E-06
0.1016 1.72E-14 2.06E-06
0.1270 1.37E-14 1.65E-06
0.1524 1.15E-14 1.37E-06
0.1778 9.82E-15 1.18E-06
0.2032 8.59E-15 1.03E-06
0.2289 7.63E-15 9.15E-07

These graphs clearly show that the induced voltage should be in the microvolt range.
However, this is inconsistent with the experimental data (see Section 4.1.1.4), which clearly
shows voltages in the millivolt range. It is most likely that the inconsistency lies with our
choice of model.

4.1.1.3 Implications of Theoretical Values


The amount of error in these values is possibly related to the gross approximations
involved by employing the parallel plate capacitance model; the wires are not plates (causing
error in the calculated area), and they are also not parallel. Furthermore, they are drastically
different in size. The model transmission line (line A) is much longer and much greater in
diameter than the sensor wire, and this further adds to the inaccuracy of the parallel-plate
model. These limitations of the theoretical model may not play a major part, however. In
our final application, the sensor will be much smaller in size than the power line it is
detecting; in essence the real-world model can be reduced in simplicity to an infinite line (the
transmission line) and a single point (the sensor). In fact, this sort of alternative model may
prove more realistic in its approximations of the final application.

Actually, there are a number of valid conclusions to be drawn from these calculated
results. The tables show two trends that are evident in the behavior of the parallel plate
model, both of which were verified experimentally. The first is that an inverse linear
relationship exists between the distance x and the induced voltage; as x increases, the output
voltage decreases. The second trend is that the induced voltage increases with the size of the

(33)
sensor wire. This has also been confirmed experimentally, and thus it appears as though
there will be a direct tradeoff between the need for a large enough detection sensor, and our
design goal to limit the sensor to a manageable size.

4.1.1.4 Measured Values versus Analysis


The experiment was set up and performed according to the theoretical parameters.
The project team recorded observations and took measurements, in order to compare to the
theoretical values. Table 6 shows the measured and calculated results from the experiment.

Table 6: Measured and Calculated Results for Experiment #1

30.48cm Wire 20.32cm Wire


X [cm]
V [v] I [A] I [µ] V [v] I [A] I [µ]
(meas.)
(meas.) (nominal) (nominal) (meas.) (nominal) (nominal)
2.45 0.72 7.2E-07 0.72 0.68 6.8E-07 0.68
5.08 0.5 5.0E-07 0.5 0.36 3.6E-07 0.36
7.62 0.34 3.4E-07 0.34 0.235 2.35E-07 0.235
10.16 0.245 2.45E-07 0.245 0.18 1.8E-07 0.18
12.7 0.2 2.0E-07 0.2 0.145 1.45E-07 0.145
15.24 0.16 1.6E-07 0.16 0.115 1.15E-07 0.115
17.78 0.13 1.3E-07 0.13 0.096 9.6E-08 0.096
20.32 0.11 1.1E-07 0.11 0.08 8.0E-08 0.08
22.89 0.095 9.5E-08 0.095 0.06 6.0E-08 0.06

10.15 cm Wire
X [cm]
V [v] I [A] I [µ]
(meas.)
(meas.) (nominal) (nominal)
2.45 0.384 3.84E-07 0.384
5.08 0.2 2.0E-07 0.2
7.62 0.144 1.44E-07 0.144
10.16 0.115 1.15E-07 0.115
12.7 0.1 1.0E-07 0.1
15.24 0.08 8.0E-07 0.08
17.78 0.065 6.5E-08 0.065
20.32 0.055 5.5E-08 0.055
22.89 0.05 5.0E-08 0.05

In order to see how current changes with distance, the team members plotted the
results for all three of the wire lengths in the graph in Figure 9. Members also plotted a log-
log scale of the data in order to determine the relationship between the current and the
distance between the wires in Figure 10.

(34)
Current vs. Distance

0.8

0.7

0.6
Current (micro-amperes)

0.5

30.48cm
0.4 20.32cm
10.16cm

0.3

0.2

0.1

0
2.45 5.08 7.62 10.16 12.7 15.24 17.78 20.32 22.89
Distance (cm)

Figure 9: Induced Current versus Distance for Various Sensor Wire Lengths

 


Log-Log Scale of Current vs. Distance

1
1 10 100
Current (microamperes)

30.48cm
20.32
0.1
10.16
Slope of -1

0.01
Distance (cm)


Figure 10: Induced Current versus Distance (Logarithmic Scale)

 
The relationship between current and distance is given by:

k
i= , [Equation 5]
r

where k is the constant 11x10 Ampere-meters, and r is the distance between the wires. The
-9

current versus distance plot supports this finding. As the distance between the “power line”
and the wire increases, the current induced in that wire decreases.

4.1.2 Experiment #2: Angular Dependence of Sensor


This experiment investigated the relationship between voltage and the angle at which
a wire is placed in an electric field. This experiment involved taking measurements at five
different distances and six different angles.

4.1.2.1 Circuit Description


The team used a 1.0668-m extension cord and a 10.16-cm wire in this experiment.
The extension cord was plugged into an outlet, providing a standing voltage wave of 120-
volt amplitude and 60-Hz frequency, to replicate a scaled-down power line. An oscilloscope
probe was then attached to the 10.16-cm wire. The probe serves as the 1-MΩ resistor, across
which the peak-to-peak voltage was measured.

4.1.2.2 Measured Values versus Analysis


The measurements for the second experiment were taken and arranged in tabular
form. Table 7 shows the measured results from the experiment.

Table 7: Measured and Calculated Results for Experiment #2

Angle X V X V X V X V X V
(Degree) (cm) (mV) (cm) (mV) (cm) (mV) (cm) (mV) (cm) (mV)
0 5 376 6 224 7 188 8 180 9 168
20 5 276 6 232 7 188 8 168 9 152
40 5 280 6 228 7 200 8 172 9 152
60 5 284 6 236 7 204 8 180 9 160
80 5 300 6 270 7 216 8 172 9 160
90 5 340 6 280 7 236 8 176 9 160

(37)
Based on experimental values, the angle of the wire has no direct effect on
measurement because the size of the wire in relation to the length of the extension cord is
very small. The wire acts like a point in space, rather than a wire, when the distance between
it and the extension cord is large in relation to the size of the wire. Therefore, the angle of
the wire will only have an effect on the measurement when the distance between the wire
and the extension cord becomes closer and closer to the length of the wire. The semi-
logarithmic graph of voltage versus angle (Figure 11) proves that as the wire becomes further
away from the extension cord, the angle becomes less and less important.

(38)
Semi-Log Scale Voltage vs. Angle

1000

5cm
6cm
7cm
8cm
9cm

100
0 20 40 60 80 90

Figure 11: Induced Voltage versus Angle in Degrees (Semi-Logarithmic Scale)

 
4.1.3 Conclusions
This lab experiment was designed to simulate a real world environment.
Unfortunately, this can be very dangerous, therefore, in the experiment, the power line
carried 120V 60Hz signal. In a real world environment a power line carries approximately
8KV 60Hz. This will impact the current, as current is proportional to voltage. As the
voltage increases, the current will increase. Therefore, the current at 1ft distance will be
increased as will the current at 50 ft. distance by the same factor. The three-phase
configuration, however, will scale down the current. This configuration was designed to
decrease or eliminate the magnetic field created by power lines. The result is a decrease in
the magnitude of the electric field and therefore a decrease the current range that will be
sensed. Our design will account for this configuration and amplify our signal to a
measurable value.

Based on experimental results, it appears that the current is inversely proportional to


the distance (see Table 8). This can also be understood by observing the theory of
capacitance. Capacitance is dependant upon the area of the plates divided by the distance of
separation. The consequence is the current also being dependant upon the distance by this
factor.

Table 8: Relationship Between Sensor Distance and Induced Current

Distance (cm) – r 1/r I (µA) k = I * r (ηAm)


2.54 39.370 0.384 9.75
4.90 20.408 0.200 9.80
7.35 13.605 0.144 10.6
9.80 10.204 0.115 11.3
12.25 8.163 0.100 12.3
14.70 6.803 0.080 11.8
17.15 5.831 0.065 11.1
19.60 5.102 0.055 10.8
22.05 4.535 0.050 11.0

The current is related to the distance by a constant k of approximately 11 * 10 -9

Ampere Meters. Using this equation to describe the relationship, the calculations show how

(40)
one might extrapolate the expected current at 10 feet distance and 50 feet distance (provided
that the linear relationship holds true).

Table 9: Extrapolation of Linear Current-to-Distance Relationship

Distance (cm) – r 1/r I (ηA) = k * (1/r)


30.48 (1 ft) 3.28 36.09
304.8 (10 ft) .328 3.609
762.0 (25 ft) .131 1.440
1524 (50 ft) .066 0.721

Our system must continue detecting current after the warning alarm has been
activated. OSHA regulations list the closest distance construction equipment can come to an
active power line is 10 ft. Our earliest detection of a field will be approximately 50 feet
distance away from an active power line. The range is predicted to be approximately 0.721
nA at 50 feet distance and about 36.09 nA at a distance of 1 ft. The quotient found when
dividing the maximum current by the minimum current is 50.06, meaning there are 25.06
steps. This will require 6 bits for detection of this range. Conversely, using a 10-bit ADC, a
maximum of 1024 steps can exist. This allows the range of detection to vary over
approximately 312 meters.

4.2 Proposed System


Based on the information gathered from the two experiments, and with the
knowledge of the problem statement, it was possible to define the sensor and base units from
a system level. This resulted in a set of preliminary system specifications, and a block
diagram of both the sensor and base units.

4.2.1 System Specification


System specifications are the first and most general specifications assigned. This
system will include a remote sensor that will detect an electric field, as well as an audio and
visual alarm that are activated upon detection. In addition to activating the audio alarm, the

(41)
alarm intensity will increase as the electric field intensity increases. Finally, the second visual
alarm will indicate when the threshold limit is reached.

More limiting specifications also exist. For instance, the sensor must be a compact
system, approximately 3” x 4” x 2”, that will not interfere with normal operation of the
crane. Also an inexpensive system is most desired and a physically compact system will be
cost effective when purchasing materials. Being inexpensive could allow for multiple sensors
to be placed at one location, a goal for this project would be less than $100.

Although cost efficiency is important, this system must be both reliable and durable.
This device will be responsible for detecting very small current due to the large distance,
approximately 1 ft. to 50 ft. This sensor will be completely exposed and, therefore, must be
weatherproof, operational at extreme temperature, approximately –40 C to +85 C, and
bonded securely at its location. Finally, as no supply power exists at the remote location, this
section will be battery operated. For convenience the battery must be solar rechargeable.
This will allow for less battery maintenance and a user-friendlier environment. Energy
conservation is very important and sampling may prove to be more beneficial than
continuously powering the system.

Table 10: Projected System Specifications

Size 3”x 4” x 2”
Cost $100.00
Detection range 1 Ft. to 50 Ft.
Ambient operating temperature range –40°C to 85°C
Battery Solar rechargeable
Estimated battery life 5 to 10 year interval
Boot-up time 2 seconds

One of the most important specifications is supplying an extremely user-friendly


environment. This includes fast startup (boot) and shutdown times, instantaneously would
be ideal, however, under 2 seconds will be our limit. This allows the device to be used on all
jobs independent of time. An easily identified alarm is crucial, a loud and unique audio
alarm as well as a bright red visual alarm. The audio alarm will indicate the presence of an
electric field whereas the visual alarm will indicate the presence of a dangerous area and the
operator needs to move out of this region. The visual alarm will be activated so that the

(42)
operator can react to the alarm and reverse the crane direction, before an accident occurs.
Lastly, a third alarm will appear on the operator’s display to indicate low battery power.
This will be indicated approximately 24 hours prior to system shutdown to allow for any
delay in battery replacement.

4.2.2 Proposed Block Diagram


An important part of the design process—especially at very early stages—is to create
a top-level block diagram. Figure 12 shows the block diagram of the sensor unit, complete
with battery, electric field sensor, an analog filter, a microcontroller, the transmitter, and an
antenna. Figure 13 shows the block diagram of the base unit, which will contain another
battery, antenna, and microcontroller, as well as a receiver, and a user interface (with an
audio alarm warning signal).

Figure 12: Block Diagram of Sensor Unit

Figure 13: Block Diagram of Base Unit

As a wire approaches a transmission line, the capacitance formed between the


detection circuitry and the transmission line causes a current through the current amplifier

(43)
proportional to the distance. This current is then filtered out so that only the desired
frequencies are detected and amplified to an order of magnitude, which the Analog to
Digital Converter (ADC) can interpret. Since the ADC will have finite voltage ranges it can
accept, a component has to be added to convert the current input to a voltage whose input
will not exceed this range.

The ADC transforms the analog input to a digital value so that the microcontroller
can perform the operations of calculating the voltage at a distance. This digital number will
then be modulated and transmitted down to the base unit.

The base unit would then filter out all frequencies that do not contain the intended
information and demodulate the signal. The demodulated signal is passed to the
microcontroller in the base unit, which compares the transmitted value with the threshold
“alarm” voltages. Once the value exceeds the “alarm” voltage a visual and audio display is
triggered to alert the operator.

4.3 Component Investigation


This section contains information concerning various possible system components.
It includes relevant information about certain system blocks that can be readily constructed,
such as analog filters, as well as various commercially manufactured components, such as
microcontrollers, batteries, and solar panels.

4.3.1 Filters
Filters are a necessary part of any system, for a number of reasons. First, they are
useful in managing the frequency content of any inputs. Noise—a term which can refer to
basically any frequency content of a signal that is undesirable—is one of the most common
sources of error in a system. Consequently, noise typically must be filtered out from any
critical information in a system. Also, as there are often many different, (relatively)
independently functioning stages in a system, it is sometimes desirable to place filters
between design blocks to remove any noise that has been introduced by that block during its
operation.

(44)
However, filters are, in themselves, another “block” of a system, and thus they
possess a number of associated disadvantages. If nothing else, they make a system more
complicated, and accordingly, more expensive, greater in physical size, and more prone to
failure. As real world filters do not have the kind of “ideal” transfer functions that would
perfectly preserve information in the system (i.e. a flat pass band, nearly vertical rolloff, and a
perfectly linear phase response), they have the potential to unintentionally skew the
frequency content of the very signals that they are filtering.

4.3.1.1 Analog vs. Digital Filtering


One way to classify filters is in terms of either analog or digital implementation.
Analog filter circuits traditionally are constructed from discrete analog components such as
capacitors and resistors. Digital filter circuits are implemented with the help of a specialized
integrated circuit (IC) known as a digital signal processing (DSP) chip, which can perform
calculations on discrete-time signals. Of these two major divisions of filter implementations,
there are a number of advantages and disadvantages concerning each.

Benefits of Analog Filtering


Analog filters are constructed out of common components such as resistors and
capacitors (although active filters include the use of operational amplifiers, as well).
Especially for lower orders, they are fairly simple to build and debug, and are extremely
inexpensive.

Disadvantages of Analog Filtering


Unfortunately, there are many drawbacks to analog filtering. First of all, filter order
corresponds roughly to the number of components needed, which means that as the needed
filter order increases, the implementation of that filter quickly becomes too complex to be
valuable. Furthermore, every component introduces a certain amount of noise and phase
delay that contribute to the degradation of the message signal.

Benefits of Digital Filtering


Digital filtering offers a number of opportunities that are not available to its analog
counterpart. As the impulse response of a digital filter is simply the culmination of a set of
digital values, impulses responses that would be very difficult to implement with real-world

(45)
components are quite easy to implement digitally. A digital filter that is not operating on a
signal in real-time even can be noncausal.

Disadvantages of Digital Filtering


Depending on the type of filter needed, a digital filter can be far more expensive than
a comparable analog one, due to the fact that a DSP chip is required. Furthermore, discrete-
time signal operations carry with them a number of restrictions. For instance, the input
signal must be sampled at a high enough rate (i.e. over the Nyquist rate), in order to avoid
aliasing, so that all of its critical information is preserved. Also, some pre-filtering must be
done to remove undesirable frequency elements from the message signal; otherwise, high
frequency noise content could be aliased down into to the spectrum of the sampled signal.

4.3.1.2 Types of Filters


There are many different kinds of filter transfer functions that have been developed
throughout the evolution of electrical engineering. Each one can be framed in terms of
typical engineering tradeoff criteria. These parameters include: ripple in the pass band,
rolloff in the transition band, attenuation in the stop band, complexity, cost, etc. All of these
characteristics must be investigated, in order for one to reach a reasonable conclusion about
what filter type is suitable for a given application.

First-order Low-pass Filter


The most basic filter type to consider would be a simple low-pass filter of the first
order. This analog circuit can be implemented using only a resistor and either an inductor
or a capacitor. Although it provides the lowest level of rolloff, it does possess a flat pass band
characteristic, and the phase response is reasonably linear in the region around the 3-dB
frequency. Thus, if a first-order analog filter is adequate to provide the needed noise
rejection, then it is the simplest solution [Lathi, 1998].

Another option is to implement the single-capacitor rolloff as part of the feedback


loop of an operational amplifier. This yields the same transfer function as a typical first
order low-pass filer, except the DC gain is no longer unity; it is instead the DC gain of the
op-amp. This configuration is known as an active filter. (Note that all op-amps possess
inherent frequency-dependent characteristics—that is, they are all low-pass filters of a sort.
For simplicity, it is assumed that the pole introduced by the feedback capacitor is dominant,

(46)
resulting in a transfer function that is approximately first-order.) Since the sensor unit for
this application requires an operational amplifier anyway, perhaps implementing an active
low-pass filter will be the simplest possible solution.

Butterworth Filter
One way to implement a higher-order filter is to use a Butterworth filer. These types
of filters exhibit a fair rolloff in the transition band, but are designed primarily for maximum
flatness in the pass band. This characteristic is useful for preserving the ratio of size between
the different frequency components of a signal. The phase response of these filters is
reasonably linear around the region of the transition band, which helps to minimize the
distortion in the output signal that is created by inconsistent phase delays. One major
drawback is that to increase the rolloff of the filter, about one extra component is required
per filter order [Lathi, 1998].

Chebyshev Filter
The Chebyshev filter offers greater rolloff for a level of complexity similar to that of a
Butterworth filter of equivalent order. The cost of this advantage, however, is that a
Chebyshev filter exhibits ripple in the pass band. Consequently, unlike the relatively flat
pass-band gain offered by the Butterworth filter, the Chebyshev will distort the frequency
components of an output relative to one another. However, this may not be a concern,
especially if there are only a few discrete frequencies that need to be filtered. Another
drawback is that the attenuation in the stop band is directly related to the pass band ripple;
therefore, the designer must choose to sacrifice a certain level of noise suppression in order to
create a more flat pass band. Finally, the phase response of the Chebyshev is slightly less
linear than that of the Butterworth [Lathi, 1998].

Inverse Chebyshev Filter


As an alternative to the Chebyshev, it is possible to design and build an inverse
Chebyshev filter, so named because the ripple is shifted from the pass band to the stop band.
This adjustment can be quite an advantage, in addition to the fact that the inverse
Chebyshev also offers slightly better transition-band rolloff. Unfortunately, this effect is
achieved through the addition of a number of extra components per filter order, making an
inverse Chebyshev a difficult economical solution [Lathi, 1998].

(47)
Elliptic Filter
An elliptic filter offers one of the best rates of rolloff of any of the filters mentioned
here. As an extension of the Chebyshev, an elliptic filter is able to accomplish this feat by
allowing ripple in both the pass band and the stop band. Once again, though, the amount of
stop band attenuation is a function of the amount of ripple allowed. Furthermore, the phase
response is quite poor [Lathi, 1998].

Band-pass Filter
As an alternative to simply using a low pass filter, one might consider employing a
band pass filter, if there is noise located on the frequency spectrum both above and below the
key frequencies of the message signal. A band pass filter is generally constructed by
combining a high pass filter stage with a low pass filter stage. As one would expect, to do so
requires approximately twice the components. However, this may be a necessity, depending
on the frequency characteristics of the noise in the system and the surrounding environment
[Lathi, 1998].

Matched Filter
A final option is to employ the use of a matched filter, so named because it has an
impulse response perfectly matched to a given input signal. In other words, a matched filter
can only be used if one knows the shape of the message signal beforehand. By matching the
impulse response of the filter to the pulse shape, one can determine that when there is a peak
in the output signal (that is, when the input and the impulse response are highly correlated),
then the pulse shape has been received.

While this is the most reliable way to detect a known pulse shape, there are some
associated drawbacks. Since the impulse response of the filter must be engineered for the
specific pulse shape, matched filter implementation often requires the design of some
unusual filter responses. In many cases, it is necessary to implement these filters digitally,
and thus the needs of the system must be weighed heavily against the cost of performing
DSP on the information signals in the system. For the detection of predetermined pulse
shapes in a high-noise environment, though, a matched filter is an excellent alternative
[Haykin, 1994].

(48)
4.3.2 Microcontrollers
According to the Motorola Semiconductor Application note, “Selecting the Right
Microcontroller Unit,” the main goal is to select the least expensive microcontroller unit
(MCU) that minimizes the overall cost of the system while still fulfilling the system
specification” [Motorola, 2000].

The first step in the selection of a microcontroller unit is to determine what it needs
to do in the system [Motorola 2000]. The Power Line Proximity Alarm needs two
microcontrollers: one to control the sensor system and one to control the warning system.
Since the sensor system will be battery operated, a controlling factor in MCU selection will
be operating voltage. (Note that the base unit will be powered from a power supply in the
cabin of the industrial vehicle in which it is being used, so an appropriate power supply can
be regulated from this voltage.) The MCU in the sensor system will also need at least a 10-
bit analog to digital converter. It is possible to implement a separate A/D converter into the
system, but a single chip solution is preferred for reliability, cost, and size considerations.
The MCU in the sensor will need to be able to determine a change in the magnitude of an
electric field from a given voltage. It will then convert this information into a transmittable
digital signal, which it then must output (via a serial link) to a transmitting module. This
means that the output of the MCU and the input of the transmitting module have to be
compatible.

The MCU in the base unit will need to take the information from the receiver and
determine the type of warning to give the user. The MCU in the base will have to control a
user interface as well. It needs the ability to light LED’s that will act as indicators for power,
standby, and warning, and sound an alarm as an audible warning. Both microcontrollers
will need to have timers and clocks for controlling certain functions, such as transmitting or
taking measurements with the ADC. They also need to be as small as possible and
inexpensive. This will ensure that the final product meets the size and cost specifications.
Lastly, the system needs microcontrollers that can operate in an outdoor environment where
they will be exposed to both high and low temperatures as well as humidity.

Research of possible microcontrollers is the next step in the selection process


[Motorola 2000]. Since using the same MCU for both parts of the Power Line Proximity

(49)
Alarm will save development time, a team member conducted a search on microcontrollers
with all of the above features and capabilities. This search consisted of reading numerous
data sheets and application notes from several different companies on several different
MCU's. Some of the products researched include those of Texas Instruments, Microchip,
and XEMICS. The team considered the following microcontroller families for the project:
Texas Instruments’ MSP430, XEMICS’ XE8000, and Microchip’s PIC16F87X.

4.3.2.1 Texas Instruments’ MSP430 Family


The MSP430 microcontroller family by Texas Instruments is a family of low power
mixed-signal microcontrollers. The MSP430 includes LCD control, an analog to digital
converter, ROM, RAM, and I/O ports. It also includes a basic timer, a watchdog timer, and
five power-saving modes. Its typical applications include sensor systems that display or
transmit data to a host. These features, as well as the starting price of $0.99 each, made this
particular family a good candidate for the system’s microcontroller [Texas Instruments,
2000].

The MSP430 family has three subfamilies: MSP430C31X, MSP430C32X, and


MSP430C33X. The team researched the MSP430C32X subfamily, since it is the only
subfamily with a 14-bit analog to digital converter. This not only meets the system
requirements, but it also exceeds them. This can add unneeded cost to the system. The
MSP430C32X also is high speed with real time capabilities. It can wakeup from standby
mode in 6µs and operates at 300ns per instruction at 3.3 MHz {Texas Instruments, 2000].
One drawback to this microcontroller is its unfamiliarity to the design team. The team will
need to spend a considerable amount of time learning the device and its instruction set
before programming.

4.3.2.2 XEMICS’ XE8000 Family


The XE8000 microcontroller family is a family of ultra low power microcontrollers.
There are numerous chips in this family, but the team narrowed its search down to the
XE88LC01 because of its programmable analog input channel. The programmable analog
input channel allows for a five to 16-bit ADC. The XE88LC01 can operate as low as 2.4
volts, and typical applications include portable battery operated instruments, RF system
supervisor, and remote control [XEMICS, 2000]. Because this low power microcontroller

(50)
has been used for similar applications to this project, it made a good candidate for the MCU
in Power Line Proximity Alarm. However, the XE88LC01 is slightly more expensive than
the Texas Instrument choice. Its price ranges from $2.93 to $7.33 per part, for quantities of
10,000 or more. Another drawback, again, is the team’s current unfamiliarity with this
microcontroller.

4.3.2.3 Microchip’s PIC16F87X Family


The team researched the PIC16F87X family by Microchip because of its wide
operating voltage of 2.0 volts to 5.5 volts and low power consumption. Each chip in this
family also has an internal 10-bit ADC, an operating frequency of 20MHz, and three to five
I/O ports. The PIC 16F87X family also has an instruction set of only 35 instructions with
which the design team is already familiar. The team focused primarily on the PIC16F874,
because it is most familiar to them and it has five I/O ports. The price of this device is
reasonable; it ranges from $10.08 to $15.64 ($5.04-$7.82 per 100) depending on the type
[Microchip, 1999].

4.3.2.4 Microcontroller Choice


The chosen MCU for this project is the PIC16F874. This microcontroller has all of
the needed I/O, plus a 10-bit A/D converter. The PIC16F874 has both commercial and
industrial temperature ranges available, as well. This makes it more suitable for the type of
environment to which the Proximity Alarm will be exposed. Although this microcontroller
is not the cheapest on the market, it offers the best deal for this project. The main reason for
this choice is the available resources. The team will have access to PIC Educational Boards
for program development and testing. These boards will be beneficial in the development
stage of the Proximity Alarm project, since they already have an LCD, buttons, and LED’s.
Other than the PIC Educational Boards, the manufacturer, Microchip, has free
downloadable software and offers technical support on the world-wide-web. Another reason
for choosing this MCU is time. The educational boards will help by saving time in the
development and testing stage. The boards can be used to simulate the system before all of
the parts are implemented. Also, since this MCU is already familiar to the team, more time
can be spent on design rather than becoming familiar with a new device.

(51)
4.3.3 RF Transmitters and Receivers
There are a number of concerns when trying to choose the most appropriate
transmitter-receiver system. First of all, the units must fit within the limits of the total
system cost (with some flexibility). Also, the units must be able to communicate in an
industrial environment, over the specified distance from the cabin to the end of the crane.
The necessity of industrial, typically outdoor use requires that the units be able to function
in the most extreme of temperature conditions.

Radio-frequency units from GloLab, Radiometrix, and RFM were considered. A


summary of the transmitters is provided in Table 11. A summary of the receivers is provided
in Table 12.

(52)
Table 11: Comparison of Various RF Transmitters

GloLab Radiometrix Radiometrix RFM


TRANSMITTERS
TM1 TXM-418-A TX2 DR4100
Parameters Min Typ Max Min Typ Max Min Typ Max Min Typ Max Units
Power Supply Voltage Range 2.7 5.2 6.0 9.0 2.2 4.0 2.7 3.5 V
Frequency of Operation 417.96 418.02 418.08 418.00 433.92 433.92 MHz
Type of Modulation On-Off Keying Frequency Frequency On-Off Keying
Data Rate 0.3 5.0 5.0 19.2 19.2 Kbps
Supply Current 2.0 3.0 6.0 3.0 17.0 4.0 6.0 10.0 12.0 mA
Turn-on time 80 100 200 µs
Standby Current 1.5 5.0 µA
Ambient Temperature of Operation 0 70 -10 55 -10 55 -20 65 deg C
Link Distance 100 300 300 m
Cost $16.40
Table 12: Comparison of Various RF Receivers

GloLab Radiometrix Radiometrix RFM


RECEIVERS
RM1 RXM-418-A RX2 DR5100
Parameters Min Typ Max Min Typ Max Min Typ Max Min Typ Max Units
Power Supply Voltage Range 2.7 4.2 4.5 5.0 5.5 2.2 3.0 4.0 3.0 V
Receive Frequency 417.96 418.02 418.08 418.00 418.00 433.92 MHz
Data Rate 0.3 4.8 2.4 19.2 Kbps
Supply Current 6.0 7.0 8.0 17.0 21.0 27.0 4.0 6.0 10.0 1.8 mA
Enable time 1.0 3.0 2.0 5.0 0.1 0.2 ms
Ambient Temperature of Operation 0 70 0 40 -10 55 -20 65 deg C
Cost $23.75
4.3.4 Operational Amplifiers
A high-performance operational amplifier will be necessary in order to construct the
current amplifier for the sensor circuit. Table 13 lists a variety of operational amplifiers and
their characteristics.

Table 13: Comparison of Various Operational Amplifiers

Part ALD1701 ALD1702 CA3420 OP90 OP97 LMC6482 LT1782

Supply 2-12 V 4 - 12V 2-20 V .8 -18V 2.25- 20V -16V – 0-18V


Voltage 16V
Input Offset 1.7 mV 1.7 mV 10 mV .4 mV .02 mV .11 mV .5 mV
Voltage

Input Offset 240 pA 240 pA 4 pA 5 nA 15 pA .01 pA .7 nA


Current

Input Bias 300 pA 300 pA 5 pA 20 nA 30 pA .02 pA 8 nA


Current
Input 100 TΩ 100 TΩ 150 TΩ 30 MΩ 500 GΩ 10 TetraΩ 5 GΩ
Resistance
(Common
Mode)
Supply 120 µA 2.0 mA 650 µA 20 µA 525 µA 1.0 µA 55 µA
Current
Voltage 100 V/mV 85 V/mV 1500 700 2000 666 V/mV 1500
Gain V/mV V/mV V/mV V/mV
Cost Not Not 1.92 1.90 3.90 2.64 1.61
Available Available

The low bias current of the LMC6482 minimizes the effects to the input and output
ranges of the detection circuitry. The LMC6482 also provides a common-mode range that
extends to both supply rails along with low voltage characteristics and power dissipation
meeting all the design requirements for the intended application.

(55)
5 DESIGN PROCESS
Once suitable components were chosen, the next step was to integrate these
components in such a way that, along with programming the microcontroller, the sensor and
base systems would meet the functionality and performance goals set forth by the
specifications. This section contains a summary of the construction of the entire sensor and
base units.

5.1 Sensor Unit


The sensor unit consists of four main blocks: the detection circuit, the
microcontroller, the transmitter module, and the power supply circuitry. In addition to
detailing these four main areas, this section also includes information about the interface
between the microcontroller and the transmitter module, and its associated software.

5.1.1 Detection Circuitry


The sensor circuit (Figure 14) consists of a LMC6482 rail-to-rail operational
amplifier and a MC14007UB multi-purpose MOSFET chip. The op amp was configured
to operate as a comparator circuit with a center voltage of 2.5 volts. The 5-volt source was
connected to the non-inverting input through a voltage divider network, thus producing the
2.5-volt center point desired. A capacitor was connected in a feedback configuration
creating a continuous-time integrator. The integrator was selected as the means of detection,
for simplicity of component design as well as the mathematical convenience of the sine and
cosine relationship.

(56)
Figure 14: Schematic of Sensor Circuit

The feedback capacitor creates an inherent low-pass active filter, removing much of
the high frequency noise present on the sensor antenna. Experimental results have shown
that the peak-to-peak voltage of the attenuated signal produces a change in amplitude of the
60 Hz signal by about 28 mV. The 10-bit resolution of the analog to digital converter
(ADC) provides a quantization of 3 mV/bit, resulting in an error of 1 LSB in the amplitude
of the detected signal.

A clocked reset is needed to discharge the integrating capacitor, to keep the detected
voltage from gradually charging to the positive rail of the op amp. A voltage applied from
the PIC microcontroller can force the open circuit produced by the MOSFET switch to
close, discharging the capacitor. The PIC was set to clock the MOSFET switch at an
interval of 4 ms, which is the sampling frequency chosen for the 60 Hz signal. The switch
remains closed for 12 µS, allowing time for the capacitor to discharge to within 1 LSB of the
ADC value.

The resulting detection circuitry creates a voltage divider between the capacitor and
the capacitance of air. The distances calculated for the 120V line would then be
proportional to other power line voltages.

(57)
Table 14: Experimental Data for Detection Circuitry

DISTANCE VOLTAGE CAPACITANCE


2.00E-03 3.24 1.35E-13
4.00E-03 2.64 1.1E-13
6.00E-03 2.6 1.08333E-13
8.00E-03 2.2 9.16667E-14
1.00E-02 1.96 8.16667E-14
1.20E-02 1.84 7.66667E-14
1.40E-02 1.44 6E-14
1.60E-02 1.24 5.16667E-14
1.80E-02 1.12 4.66667E-14
2.00E-02 1 4.16667E-14
2.20E-02 0.92 3.83333E-14
2.40E-02 0.88 3.66667E-14
2.60E-02 0.8 3.33333E-14
2.80E-02 0.76 3.16667E-14
3.00E-02 0.68 2.83333E-14
3.20E-02 0.64 2.66667E-14
3.40E-02 0.58 2.41667E-14
3.60E-02 0.56 2.33333E-14
5.00E-02 0.44 1.83333E-14
6.00E-02 0.36 1.5E-14
8.00E-02 0.32 1.33333E-14
1.00E-01 0.26 1.08333E-14
MEAN
5.01515E-14

(58)
Voltage vs Distance

Voltage 10

0.1
Distance

Figure 15: Detection Circuit Voltage versus Distance (Logarithmic Scale)

5.1.2 Microprocessor Control


The microprocessor of the sensor unit controls many of the functions that the sensor
unit must perform. The microprocessor controls analog to digital conversions, resets the
sensor circuit, and calculates both the amplitude and average amplitude of the input to the
sensor. The microprocessor is also an integral part of the transmitter circuitry, serving as a
switch for the power to the transmitter module.

5.1.2.1 Analog to Digital Converter


The PIC16F877 microprocessor has a 10-bit Analog to Digital Converter (A/D)
module with eight inputs. This project design uses only one of these A/D inputs. The
output of the detection circuitry will be the input to the A/D. The analog input will charge
a capacitor inside of the A/D module in the microprocessor. The output of this capacitor is
the input to the A/D converter. Using successive approximation, the converter generates a
digital result of the analog level. The result is a 10-bit binary number stored in two of the
A/D module’s four registers. The purpose of the A/D is to translate the detected voltage
from the detection circuitry into a 10-bit binary number that can be easily manipulated,
interpreted, and then transmitted to the receiver unit. Refer to the Analog to Digital
Converter section of the PIC16F877 data sheet in Appendix E.

(59)
ADC Configuration
In order to implement the Analog to Digital Converter on the PIC microprocessor,
the program code must first configure the port pins. Bits 3-0 of the ADCON1 register
configure the pins as analog inputs or digital I/O. This project needs only one of the PIC’s
eight analog inputs to the ADC, so the project team selected AN0/RA0 as an analog input
and set all other pins as digital I/O. Next, the program selects the A/D result format by
setting or clearing bit 7 of ADCON1. The format of the result is not important, as long as it
is consistent and compatible with the other subroutines in the program code. The team
chose the format of the A/D result as right justified by setting bit 7 of ADCON1. A right
justified result means that the six most significant bits of ADRESH (the high byte of the
ADC result) are read as ‘0’. The next step in the A/D configuration is to select the A/D
Conversion Clock and the Analog Channel. By setting bits 7-6 of the ADCON0 register to
‘01’, Fosc/8 is selected as the A/D Conversion Clock. The team chose Fosc/8 as the A/D
Conversion Clock to ensure a minimum A/D conversion time per bit (TAD) of 1.6µs. Since
RA0/AN0 is chosen as our analog input, we use bits 5-3 of ADCON0 to select channel 0 as
our Analog Channel.

ADC Acquisition

Because the A/D uses successive approximation, it is necessary to allow ample time
for the capacitor to charge to the input channel voltage level. This time is called the A/D
acquisition time. Acquisition time begins when the A/D holding capacitor begins to charge.
For a clock rate of 4MHz, acquisition time is approximately 8µs. In order to ensure an 8µs
acquisition time, we included eight “nop” commands in the program code before the start of
an A/D conversion.

ADC Conversion
A/D conversion begins when bit 2 of the ADCON0 register is set. A/D conversion
time is 12TAD per 10-bit conversion, or approximately 19.2µs. In order to wait for the
conversion to be completed, the program code sits in a tight loop waiting for bit 2 to clear,
indicating that the conversion is done. The converter stores this result in ADRESH and
ADRESL. ADRESH stores the high byte of the A/D result, and ADRESL stores the low
byte of the A/D result.

(60)
5.1.2.2 Sensor Reset
The detection circuitry needs to be reset for 12µs every 4ms in order to operate
correctly. We decided to use the PIC microprocessor and software to control the reset signal.
The PIC microprocessor is the logical choice for controlling the reset due to its individually
configurable I/O and programmable timers.

Initialization
In order to configure a pin to be a PIC output, it must be initialized. The team
decided to use the I/O on PORTD of the PIC. The purpose of using PORTD was so that
we could use an LED on the PIC Educational Board as an indicator that the program code
was functioning properly when testing. Since we needed only one output on PORTD for
the reset, we set bit 0 of PORTD and cleared all other bits using the TRISD register. This
initializes bit 0 as an output and the other pins as inputs. Later, we change this initialization
to allow for another output from this port to be used to turn on and off the transmitter
module. Also when initializing PORTD, we clear bit 0 to put the reset signal in a low state.

Another part of the initialization process is the configuration of the timer used to
control the timing of the reset. The PIC has three timers: TIMER1, TIMER2, AND
TIMER3. According to Peatman, “TIMER1 is the most versatile and can be used to
monitor the time between transitions occurring on an input pin or control the precise time
of transitions on an output pin” . The team decided to use TIMER1 of the PIC’s three
timers because it will be controlling a low to high transition on an output pin. To initialize
TIMER1, we set the prescaler to divide by 8, turned the oscillator off to save power, and set
it to use the internal clock (Fosc/8). Next we set the timer start time to BFEh, which will
allow 4ms until the timer overflows. Lastly, we unmask the TIMER1 interrupt. By using an
interrupt, the program will be able to complete other tasks between resets. TIMER1 is
turned on during the main part of the code.

Interrupt Service Routine


Once we initialized PORTD and the timer, we developed the code for the interrupt
routine. The purpose of this routine is to send a high signal to the detection circuitry for
12µs and then go low again before returning to the main program. The first two commands
of the interrupt routine are to turn off the timer and clear the overflow flag. Also at this

(61)
time, the program clears the Watchdog timer to ensure that the system will not be reset
during the interrupt routine. Next, the timer is reset to start at BFEh, and the program
turns on the timer again. Then by setting PORTD bit 0, we send a high signal to the
detection circuitry. Using 12 “nop” commands ensures a wait time of 12µs before the
program clears bit 0 of PORTD and sends a low signal again to the detection circuitry.

Besides controlling the reset of the detection circuitry, the interrupt service routine
performs a few other important functions. Each time the interrupt is called, the program
increments two variables, count and countavg. Count tracks how many times the interrupt
occurs. When count equals 25, the program causes a transmission. The variable countavg
tracks the number of interrupts as well. When countavg equals four, the program performs a
subroutine that saves the value of the amplitude for use in the calculation of the average
amplitude. Also during this interrupt, ADRESH and ADRESL, the results of the ADC, are
stored as ADvalH and ADvalL, respectively. Figure 16 shows the flowchart of the sensor
reset code.

(62)
Figure 16: Flowchart of Sensor Reset Code

(63)
5.1.2.3 Calculations
Several different complex comparisons must be performed during the analysis of the
ADC information. First the peak-to-peak amplitude must be determined, so that the
amplitude information will be independent of the offset of the voltage waveform. Next, an
average of these values is taken, to be sent to the transmitter for communication to the base
unit.

Calculation of Amplitude
In order to find the peak-to-peak amplitude of the output of the sensor, the
microprocessor needs to calculate this value from the available analog to digital conversion
results. By keeping track of the maximum and minimum values measured by the A/D, the
amplitude is found by subtracting the minimum value from the maximum value. A
subroutine in the microprocessor code calculates this amplitude after the reset interrupt
occurs to ensure that the transmitted amplitude value is the most recent and accurate
measurement. See the following flow chart of the amplitude calculation.

Since the program is suppose to perform calculations after the reset interrupt, it uses
a variable called calcflag to determine when calculations are necessary. Calcflag is initially
clear, but when an interrupt occurs the program will set this flag high. After an A/D
conversion, the program tests this flag to see if it is set. If the flag is set, calculations are
preformed on the A/D results. Otherwise, the program continues without calling the
calculation subroutine.

The first step in the calculation subroutine is initialization. The program clears the
calculation flag in order to ensure that another calculation will be possible. Since the A/D
result is a 10-bit binary number, it is necessary to keep track of both the high and low bytes.
For this reason, we use four variables to represent the maximum and minimum values
measured from the sine wave outputted by the sensor. These variables are: maxh (high byte
of the maximum value), maxl (low byte of the maximum value), minh (high byte of the
minimum value), and minl (low byte of the minimum value). The maximum values are
initialized to all zeros, and the minimum values are initialized to all ones. Lastly, it is
necessary to have two variables to store the high and low bytes of the amplitude, AmpH (high
byte) and AmpL (low byte). Another subroutine will use these values to calculate the average
amplitude.

(64)
After initialization, the subroutine performs calculations in order to compare the
A/D result with the maximum values. Since the assembly language for the PIC
microprocessor has a very limited instruction set, this task is not easy. First, the high byte of
the A/D result (ADvalH) is subtracted from the high byte of the maximum value. If the
result is negative, then the A/D result is larger than the current maximum value. A negative
result is determined by testing the carry/borrow (C) bit of the STATUS register. The
borrow flag is cleared each time an operation results in a borrow. A borrow will only occur
in a situation where a larger number is subtracted from a smaller number. At this point in
the program, ADvalH and ADvalL replace both maxh and maxl, respectively, and the
subroutine continues by comparing the minimum values with the ADC result. If the result
of maxh minus ADvalH is zero, then the two values are equal. A zero result is determined by
testing the zero (Z) bit in the STATUS register. The zero flag is set high whenever the result
of an arithmetic operation is zero. If the high bytes of the two values are equal then it is
necessary to examine the low bytes. At this point, the low byte of the A/D result (ADvalL) is
subtracted from maxl. The purpose of this operation is to see if ADvalL is larger than maxl
by checking the borrow flag. If ADvalL is larger than maxl, then it replaces it, otherwise, the
current maximum values remain unchanged.

After comparing the A/D result with the maximum values, the subroutine then
compares it to the minimum high and low bytes. This comparison is done similarly to the
one above, but this time the minimum bytes are subtracted from the A/D result. First, minh
is subtracted from ADvalH. If the result is negative, then ADvalH is smaller than minh.
ADvalH and ADvalL replace both minh and minl, respectively, and the program continues
by calculating the amplitude. If the result is zero, however, then the two high bytes are equal
and it is necessary to compare the low bytes. To compare the low bytes, minl is subtracted
from ADvalL. If the result is negative, then ADvalL is smaller than minl and ADvalL
replaces minl. Otherwise, the current value for minimum remains unchanged.

(65)
Start
Equal

Clear Calc. Flag


Maxl-ADvalL

AdvalH-maxh
NO
Borrow?

Result YES
Negative =0?
YES Replace maxl with ADvalL

NO
Replace maxh with ADvalH
AdvalH-maxh

Equal2
Replace maxl with ADvalL
YES
Borrow?
ADvalL-minl

NO

Minh-AdvalH NO
Borrow?

YES
Result
Neg2 =0? Replace minl with ADvalL
YES

NO
Replace minh with ADvalH
Minh-AdvalH

Replace minl with ADvalL


YES
Borrow?

NO

Maxl-minl = AmpL

YES
Borrow? Decrement maxh

NO

Maxh-minh = AmpH

Return

Figure 17: Flowchart of Amplitude Calculation Code

(66)
The last calculation in this subroutine is the calculation of the peak-to-peak
amplitude. The peak-to-peak amplitude value is found by subtracting the minimum values
from the maximum values. However, this calculation is not completely straightforward.
Because the values are 10 bits long, minl must first be subtracted from maxl and the result
saved in AmpL. It is possible that a borrow may occur during this operation, and therefore,
it is necessary to check the borrow flag. If a borrow occurred, the program will decrement
maxh to account for it. Lastly, minh is subtracted from maxh, and the result is stored in
AmpH.

The result of the subroutine for the calculation of the amplitude is a 10-bit binary
number that represents the peak-to-peak value of the sine wave from the detection circuitry.
The variables AmpH and AmpL store this result as high and low bytes, respectively.

Calculation of Average Amplitude


Due to the quickly changing fields around the sensor, it is necessary to calculate the
average measured amplitude before transmitting to the base. By finding the average
measurement of the amplitude over the period of 100ms, we eliminate error in our
measurements. The software flow chart of the calculation of the average amplitude follows
the discussion.

As mentioned earlier, one of the functions of the interrupt for the sensor reset is to
increment a variable called countavg. Countavg tracks the number of times the interrupt
occurs. When countavg equals four, the program performs a subroutine that will save the
value of the amplitude for use in the calculation of the average amplitude. Every four
interrupts, or 16ms, the program saves a value. The program will save a total of four values
for the average. The total time to obtain these four numbers for the average calculation is
96ms.

After the program determines that countavg equals four, a subroutine checks to see
what bits of Index are set or cleared. The program uses the variable called Index to track how
many numbers it saves for the calculation of the average amplitude. If bit 0 of Index is
cleared, then AmpH and AmpL move into One_H and One_L, the high and low bytes of the
first number in the series to be averaged. The subroutine also sets bit 0 of Index, indicating
that the next number should be saved as the second number in the series to be averaged, and

(67)
clears countavg. If bit 0 is set and bit 1 is cleared, then AmpH and AmpL move into Two_H
and Two_L, the high and low bytes of the second number in the series of numbers to be
averaged. This time the subroutine sets bit 1 of Index before clearing countavg. If bit 1 is set
and bit 2 of Index is cleared, then the subroutine saves AmpH and AmpL as Three_H and
Three_L, sets bit 2, and clears countavg. If bit 2 is set and bit 3 is cleared, then the
subroutine saves AmpH and AmpL as Four_H and Four_L, sets bit 3, and clears countavg.
Once bit 3 is set and bit 4 is cleared, the subroutine begins saving over the variables One_H
and One_L. When the subroutine sees bits one through four set and bit 5 cleared, the
program will perform the calculation of the average.

To find the average of the amplitude, the program must add the high and low bytes
of the four saved values and then divide by four. To do this, the average subroutine first
clears two variables, Avg_H and Avg_L, which will save the high and low bytes of the
average. Next, the subroutine adds the low byte of the first number to Avg_L and stores the
result in Avg_L. The subroutine checks for a carry and increments Avg_H if one occurred.
The subroutine then adds the high byte of the first number and Avg_H and stores the result
in Avg_H. The subroutine continues to add the other values in this manner until Avg_H
and Avg_L represent the high and low bytes of the sum of the four values. Since there is not
a command in the PIC language set for division, the subroutine must rotate the registers
containing Avg_H and Avg_L to the right four times in order to divide by four.

(68)
Counta
4?
Yes

Start

Index bit Index bit Index bit Index bit


0 clear? 1 clear? 2 clear? 3 clear?
No No No No

Yes Yes Yes Yes

One_H = AmpH Two_H = AmpH Three_H = AmpH Four_H = AmpH


One_L = AmpL Two_L = AmpL Three_L = AmpL Four_L = AmpL

Set Index bit 0 Set Index bit 1 Set Index bit 2 Set Index bit 3

Clear countavg

Index bit
5 clear?
No

Yes

Clear Avg_H and Avg_L

One _ L + Two _ L + Three _ L + Four _ L + C


Avg _ L =

One _ H + Two _ H + Three _ H + Four _ H + C


Avg _ H =

return

Figure 18: Flowchart of Amplitude Value Averaging Code

(69)
5.1.2.4 Watchdog Timer
The watchdog timer resets the CPU of the PIC microcontroller upon timing-out;
this provides a system reset for the sensor unit. The timer overflow indicates a malfunction
in the execution of the mainline code and resets the CPU in an effort to recover. The
watchdog timer times-out between 7 and 33 milliseconds, with a nominal value of 18
milliseconds. This period is dependent upon manufacturing process and environment
variations. The execution of the clrwdt instruction resets the timer and prevents the system
reset for another 7 to 33 milliseconds. The clrwdt instruction is executed within the code
just prior to the resetting of the detection circuitry, every 4 milliseconds.

5.1.3 Microcontroller-Transmitter Interface


Once the electric field amplitude information has been converted by the PIC into
digital data, the next step is to transmit this 10-bit word to the base unit by way of the
wireless data link. The PIC microcontroller has a built in module designed to accommodate
the asynchronous transmission of digital data, called the Universal Synchronous Asynchronous
Receiver Transmitter (USART).

5.1.3.1 PIC 16F87X USART Module (Transmitter)


The USART is one of two serial input/output modules built into the PIC16F87X
microcontroller. Although it can be configured for full-duplex communication (either
synchronous or asynchronous), the power limitations of the sensor unit restrict the
application to a one-way data link, to avoid the need for a receiver as part of the sensor
system. Thus, the USART of the sensor-unit microcontroller is configured for only the
transmitting of serial data, while the USART of the base-unit microcontroller is configured
only for the receiving of serial data.

Design of USART and Associated Registers


There are four main components to the USART transmitter: the TXSTA control
register, the TXREG data register, the baud rate generator, and the transmitter shift register
(TSR). The control register is the primary means for controlling the operation of the
USART, and the procedure for initializing the transmitter via the TXSTA register will be
covered in greater detail later.

(70)
The remaining three components compose the basic functional unit of the USART.
A block diagram of the USART transmitter is shown in Figure 19.

Figure 19: Block Diagram of USART Transmitter Module

The TXREG file is an 8-bit special-function register located in Bank 0 of the data
memory. It is directly linked to the TSR, which is a 9-bit shift register (to accommodate up
to 9-bit transmission word lengths). In addition to the 8 or 9 data bits, a transmitted packet
also includes a start bit (logic low) and a stop bit (logic high). Whenever data is loaded into
the TXREG, it waits for TSR to be cleared—such as would happen when two or more data
packets are being transmitted—after which the contents of TXREG are immediately
transferred into TSR. When data has been written to the TSR, it automatically begins to
shift out the data, LSB first. When dealing with these two registers, one may utilize the two
status flags that report on the current state of the USART transmission. The TXIF flag
(PIR1, bit 0) is set whenever the data in TXREG has been transferred to TSR, while the
TRMT flag (TXSTA, bit 1) is set once TSR has finished shifting out the data (i.e. the
transmission is complete).

The final component of the USART is the baud rate generator. This dedicated 8-bit
timer can be used to generate standard baud rates from the PIC’s main oscillator. The
period of the baud rate generator is controlled by the SPBRG register.

(71)
Initialization of the USART Transmitter Module
The first step in utilizing the USART for data transmission is to initialize the module
for the proper operating parameters. The module options are set primarily via the control
bits located in the TXSTA register. In addition to an enable bit (TXEN) that turns the
USART on or off, the TXSTA register allows the user to specify either synchronous or
asynchronous transmission, and select either a low or high baud rate setting. For this
application, the asynchronous transmission and high baud rate settings were used.

To initialize the PIC for a specific baud rate, a binary value must be loaded into the
SPBRG register, which controls the period of baud rate generator’s 8-bit timer. The
asynchronous baud rate is determined according to the formula

f OSC
baud rate = [Equation 6]
16 ⋅ (X + 1)

where X is the decimal value of the binary word in the SPBRG register. As the maximum
specified bit rate of the transmitter-receiver pair was 14 kbps, the project team selected the
highest standard transmission rate below this limit, 9600 baud.

(Note that baud rate is a measure of the number of symbols—that is, the number of
signal changes—transferred per unit time. Bit rate, on the other hand, is a measure of the
number of bits transferred per unit time. Since the PIC uses a unipolar NRZ line code,
where each bit consists of either one mark or one space, each signal change represents a data
bit. Thus, baud rate and bit rate are essentially interchangeable terms for this application.)

When initializing the USART, the user must also select a transmission word length.
The USART is designed to accommodate either 8-bit or 9-bit transmissions; if a 9-bit
transmission is preferred, the extra bit can be loaded in as bit 0 of the TXSTA register (bit
TX9D). For this application, the default transmission word length of 8 bits was chosen.

Operation of the USART Transmitter Module


Once the USART has been properly initialized, operation is as simple as loading a
data word into the TXREG register. Upon writing to TXREG, the data is moved
immediately to the transmitter shift register, and TXREG is cleared. Since only two data
packets are transmitted for this application, it is possible to load both in immediate
succession; the USART hardware will leave the second packet in TXREG until the first has

(72)
been successfully transmitted, at which point it will be automatically transferred to TSR.
When this transfer occurs, the TXIF flag will be set, which will cause an interrupt if it has
been previously enabled in software. For this application, the interrupt was left disabled, as
there is currently no need for the processor to know when the data transfer has occurred.

When a data word is transferred to TSR, it immediately begins to shift out the bits,
LSB first, at the pre-specified baud rate. Note that it is not possible to access TSR via
software; the only software access to the transmitted data is through TXREG. Once TSR
has finished shifting out the last bit, and the stop bit has been sent for the current packet, the
TRMT bit of the transmitter control register (TXSTA, bit 1) will be set. The monitoring of
this flag was also deemed unnecessary for this application.

5.1.3.2 Digital Data Error Checking Algorithm


Whenever the wireless communication of digital data is attempted—especially in a
noisy environment—there exists a high possibility for error in the received bits. However,
the transmitter/receiver modules chosen for this application exhibit more than adequate
performance for the desired transmission distance, and as the electric field waveform is
already over-sampled, the risks posed by a single erroneous transmission is moderate.

Given this line of reasoning, the team chose to implement a simple parity-checking
algorithm in the transmitter and receiver software, as a reasonable error detection solution.
A single parity check can be implemented easily in software, and utilizes only one extra data
bit per transmitted packet. (For more background on error detection algorithms, see Section
3.4.2).

Since the PIC can only transmit up to 9 bits at a time (although the default setting of
8-bit transmissions were chosen), the 10-bit amplitude word is transmitted in two packets.
With the 10 bits divided evenly between the two, such that 5 data bits are sent per packet,
there is enough room left over to transmit a parity bit for each packet. (This algorithm
leaves another 2 bits for duty cycle management, which is discussed further in Section
5.1.3.3.) The software algorithm implemented computes even parity for each 5-bit part of
the data, and adds this parity bit to the final transmitted packet.

Since the parity bit only describes whether the number of marks in the transmitted
data is odd or even, it is only capable of detecting a single bit error. If a second bit error were

(73)
to occur in one of the data bits within a transmitted packet, the parity would remain
unchanged, and the receiver would be unable to detect the error (that is, based on the parity
indication alone). However, since the receiver has other means by which to detect
transmission errors, such as overflow or framing error indication, and since it would be rare
for a multiple-bit error to occur without triggering one of these other indicators, the single-
parity solution is more than suitable.

5.1.3.3 Digital Data Packing Algorithm


As mentioned before, the serial data output of the PIC is 5-volt unipolar nonreturn-
to-zero line code. This output is compatible with the expected input of the FM transmitter
module, which accepts binary pulses of approximately 0 and 5 volts. However, there are
limitations imposed by the required minimum and maximum duty cycles for the FM
module’s input waveform (see Section 5.1.4.3). In other words, there exists a possibility a
packet consisting of too many marks or spaces in a row will leave the receiver unable to
reliably detect the transmitted data.

One solution would be to implement a Manchester encoding algorithm (discussed


earlier in Section 3.4.1.2). This alternative, though, would double the number of symbols
transmitted per information bit, so that the minimum number of packets to transmit a 10-
bit amplitude measurement would be 3 (since a minimum of 20 bits would be required).
Due to the fact that a 10-bit word would require no less than 2 packets, a compromise was
developed, which utilizes the extra bits in each packet to maintain the minimum/maximum
duty cycle requirement. The composition of the two data packets, complete with the 10-bit
measurement and parity bits, is shown in Figure 20.

(74)
Data Packet 0
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
AmpH(1) AmpH(0) X AmpL(7) AmpL(6) X AmpL(5) Pbit0(0)

Data Packet 1
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
AmpL(4) AmpL(3) X AmpL(2) AmpL(1) X AmpL(0) Pbit1(0)

Figure 20: Diagram of Digital Data Packing Algorithm

As shown, each data packet is composed of five data bits, one parity bit, and two
“stuff bits”. The stuff bits (labeled in Figure 20 as “X”) are set by the PIC software by
examination of the previous data bit, to maintain the minimum/maximum duty cycle.
Thus, if bit 6 is set, then the data packing routine will clear bit 5 (and vice-versa). Using this
algorithm, the minimum duty cycle is 25 percent, while the maximum is 75 percent—well
within the limits specified by the FM modules.

Once the parity has been calculated, the data has been packed into two 8-bit words,
and the parity bits have been added, the packets are ready to be transmitted. To initiate a
USART transmission, the packets are loaded into the TXREG register. Since the transmitter
shift register is large enough to store two 8-bit words, the second packet can be immediately
loaded into TXREG, without regard for how much progress has been made in transmitting
the first packet. A board trace directly connects the transmitter output pin of the PIC (pin
25) with the input pin of the FM module.

5.1.4 Radiometrix TX2 FM Data Transmitter Module


Of the several off-the-shelf transmitter modules investigated for this system, the
Radiometrix TX2 FM transmitter was chosen as most suitable, for reasons of performance,
cost, and availability. The TX2 is a complete FM data transmitter, which accepts a binary
digital input (where 0 volts corresponds to logic low and 5 volts corresponds to logic high),
and generates from it a frequency-modulated bandpass output, around its carrier frequency
of 418 MHz. It is designed for use with a matching Radiometrix receiver module, the RX2.
Depending on the receiver model, the pair is capable of reaching data rates of up to 14 kbps
or 40 kbps.

(75)
5.1.4.1 Module Characteristics
The TX2 module is a two-stage FM transmitter system. The input waveform is
passed through a 20-kHz low-pass filter, after which the frequency modulation of the carrier
is accomplished via a SAW-stabilized oscillator (see Figure 21). The FM signal is then sent
through a 418-MHz band-pass filter, and sent to the antenna. (Note that for all
Radiometrix block diagrams and data sheets, the United States standard license-free carrier
frequency of 418 MHz is used, as opposed to the United Kingdom standard of
433.92 MHz.)

Figure 21: Block Diagram of TX2-418 Module

The performance characteristics of the TX2 are quite suitable for this application. It
operates at a nominal supply voltage of 5.0 V (although it will perform at supply voltages
ranging from 4.0 V to 6.0 V), and draws an average of 6 mA supply current when
transmitting. The maximum specified transmission distance is approximately 300 meters,
which is far enough to support communication from the sensor to the base unit, with a low
occurrence of bit error.

Finally, the module has a maximum turn-on time of approximately 100 µs, which
can accommodate the turning on and off of the module, for power management purposes.
In the final application, this feature was not utilized, although a number of possible power
management solutions have been included in this document as future considerations.

(76)
5.1.4.2 Advantages
Because of the many constraints imposed by a system of this complexity, the project
team selected the Radiometrix modules as an alternative to designing a transmitter-receiver
pair specifically for this application. This choice brought with it several advantages, such as a
reduction of the size and complexity of the sensor unit, as well as guaranteed compatibility
between the data transmitter and receiver. The modules were also selected to accept binary
input/output data in a format compatible with the PIC microcontrollers at each end of the
two-part system (5-volt unipolar NRZ line coding).

Also, the transmitter-receiver pair chosen offers a reasonably high data rate for a
relatively low current drain—depending on the receiver version, the transmitter can operate
up to either 14 kbps or 40 kbps, at a supply current of 4 mA (typical). Moreover, the TX2
module can maintain a data link for a distance of up to 300 meters, which offers more than
enough transmitting capability for the project application.

5.1.4.3 Disadvantages
One disadvantage of the Radiometrix modules is the limited duty cycle range of 20
percent minimum to 80 percent maximum. This requirement is primarily a function of the
adaptive data-slicing block of the receiver, which maintains an average voltage level for the
received data, as part of the comparator circuit that re-creates the digital output waveform.
Consequently, exceeding these limits can upset this average value, resulting in the detection
of spurious transitions due to noise in the received signal. As was mentioned in Section
5.1.3.2, this problem is one of the primary reasons for the data-packing algorithm chosen.
Also, this problem is particularly manifested when the transmitter is left on for an extended
period of time without transmitting a data packet (e.g. the time period just before the next
two packets are to be transmitted). To alleviate this condition, some modifications had to be
made to the receiver unit.

Another major disadvantage is the problem of turning on and off a wireless data link
that uses frequency modulation as its transmission algorithm. When the transmitter is on,
the FM signal dominates the spectrum in the band around the 418 MHz carrier, and the
receiver unit is designed such that any noise present in this range of frequencies poses little
threat to the transmitted data. Even when no digital data packet is sent from the USART, a

(77)
logic high is present, and this value is transmitted to the receiver. However, when the
transmitter is turned off, the only result at the receiver module is that there is no longer an
information signal present; regardless, there still exists frequency information (due to
ambient noise) at and around the carrier. As the receiver is unable to distinguish this noise
from an information signal, the result is the creation of spurious data bits by the receiver
module.

Thus, given the FM transmission format, there are two solutions for this problem:
(1) leave the transmitter at all times, or (2) increase the complexity of the base unit design to
accommodate for the lack of a constant data link. The former is certainly the less desirable
of the two; however, due to the constraints of the project, it was chosen as a temporary
design solution. There are several ways by which the latter choice may be developed, and
explanations of a number of these solutions are included in Section 7.

5.1.5 Power Management


A 9-volt battery powers the sensor unit. The addition of a voltage regulator
maintains a constant 5-volt supply voltage for the component circuitry. The digital
components, especially the PIC microcontroller, are extremely sensitive to spikes or drops in
supply voltage, generally resulting in substantial malfunction. Should the sensor unit be
modified such that the transmitter is powered only for the duration of the data transmission
and shut off immediately afterward, the regulator would be absolutely essential. The
regulator will compensate for the voltage drop occurring every 100 ms and lasting for the
duration of the data transmission, approximately 2 milliseconds. The power circuit
schematic can be seen in the complete sensor circuit schematic (see Section 6.1.1).

5.2 Base Unit


The base unit consists of three main blocks: the receiver module (with adaptive
digital data slicing modifications), the microcontroller, and the alarm circuitry. In addition
to detailing these three main areas, this section also includes information about the interface
between the microcontroller and the receiver module, and its associated software.

(78)
5.2.1 Radiometrix RX2 FM Data Receiver Module
As part of a matching off-the shelf module set, the Radiometrix RX2 Data Receiver
Module is designed for exclusive use with the TX2. It provides FM digital data reception at
two different bit rates, depending on the receiver model. The RX2-418-A (used for this
project) provides a wireless link at up to 14 kbps. The RX2-418-F, however, offers
comparable performance in terms of supply voltage, supply current, and noise rejection,
while offering a data link at up to 40 kbps.

5.2.1.1 Module Characteristics


The RX2 module is, for the most part, a typical FM superheterodyne receiver. It
demodulates in two stages, first bringing the frequency information to an intermediate
frequency (IF) before completing the demodulation. After filtering, the final stage is to re-
square the analog output waveform, making it a digital 5-volt signal. The block diagram of
the receiver can be seen in Figure 22.

Figure 22: Block Diagram of RX2-418 Module

The performance characteristics of the RX2 are quite suitable for this application.
Like the TX2, it operates at a nominal supply voltage of 5.0 V (although it will perform at
supply voltages ranging from 4.0 V to 6.0 V). The supply current ranges from 11 mA to
17 mA, but this quantity is of less concern than the transmitter supply current, since power
consumption at the base unit is not as critical as it is for the sensor.

(79)
5.2.1.2 Advantages
The RX2 offers many of the same advantages as the TX2, including convenience,
affordability, and compact performance. Furthermore, it is easily integrated with the PIC
microcontroller at the base, since it provides a digital output of 0 volts to 5 volts, which can
be fed directly into the PIC’s receiving USART.

Another advantage of the RX2 is that it offers an extremely high bit rate. Although
the slower model was used for this project prototype, the faster version conforms to the
requirements of the base system circuitry. Therefore, a faster data link could be easily
implemented, if so desired. This alteration would allow the transmission time to decrease,
further reducing the power needed at the sensor unit.

5.2.1.3 Disadvantages
The first disadvantages of the RX2 module are the obvious limitations of FM
reception. Since the receiver is on at all times, it is always attempting to decode information
at an around the carrier (418 MHz), regardless of whether there is a valid signal from the
transmitter. Since there is always a sufficient amount of ambient noise in the spectrum at
and around the carrier, the receiver is prone to generate spurious data when the TX2 module
has been turned off. Thus—as was mentioned earlier—other methods will be necessary if
the transmitter module is to be turned on and off to save power.

Another problem occurs, however, when the transmitter and receiver are left on.
Although the data packing algorithm has been designed to implement high-density
encoding, to maintain the duty cycle requirement, this has no effect on the transmitter
between transmissions. At this time, the transmitter is simply forced high by the sensor unit
PIC, and this high voltage is transmitted to the receiver. Eventually, the capacitor in the
internal data slicer at the receiver becomes sufficiently charged, and spurious data begins to
appear as the data slicer misinterprets noise on the AF channel (pin 6) as signal transitions.

To compensate for this problem, an external data slicer with hysteresis was added as
part of the base circuitry. This provides sufficient noise suppression to prevent spurious
transitions, while detecting the actual data transitions on the AF channel.

(80)
5.2.2 Microcontroller-Receiver Interface
Once the transmitted data has been demodulated, the digital output is fed directly to
the RX pin of the PIC microcontroller. This data is then read into memory via the USART
module of the PIC.

5.2.2.1 PIC 16F87X USART Module (Receiver)


The receiver interface of the PIC uses the same input/output module as is employed
in the sensor unit—the Universal Synchronous Asynchronous Receiver Transmitter. This is
because the USART of the PIC microcontroller can be configured to act as either a
transmitter or a receiver, depending on how it is initialized.

Design of USART and Associated Registers


In its operation as a receiver, the USART has a similar structure to its transmitting
counterpart. There are four main components: the RCSTA control register, the RCREG
data register, the baud rate generator, and the receiver shift register (RSR). The control
register is the primary means for controlling the operation of the USART, and the procedure
for initializing the transmitter via the RCSTA register will be covered in greater detail later.

The remaining three components compose the basic functional unit of the USART.
A block diagram of the USART transmitter is shown in Figure 23.

Figure 23: Block Diagram of USART Receiver Module

(81)
The RSR works in a similar manner to the TSR, shifting in bits as they are read.
Once the RSR receives a full data word, this value is automatically shifted into the RCREG
file, to be read as data into the PIC memory for program use. If any errors are generated,
they are automatically reported as error flags to the RCSTA register.

Initialization of the USART Receiver Module


Any initialization of the USART as a receiver must match the transmitter with which
it will be communicating. Using the RCSTA register and the SPBRG register, the modules
must be set to agree on baud rates and the number of bits per packet (either 8 or 9). Once
this initialization has been completed, the receiver can be enabled by setting the Continuous
Receive Enable bit (CREN).

Operation of the USART Receiver Module


If it has been enabled, the receiving USART module simply waits until it sees a start
bit transition on the RX pin. At this point, it begins clocking in the received data bits, and
when a word has been completed and the stop bit has been detected, this data is transferred
to the RCREG file. The USART transmitter has the capability of detecting simple reception
errors, such as framing or overflow errors. Should one of these occur, the appropriate bit is
set in the RCSTA file, and the reception is aborted. Note that if an error does occur, it is
necessary to manually reset the USART receiver via software—in other words, the CREN bit
must be set low, and then reset to high.

For multiple transmissions, the RSR register will retain any data bits until the
previous one has been read from the RCREG register. This allows for a simple reception
algorithm in the case of only two packets, since the processor can simply wait in a loop until
each packet has been completely read and transferred to RCREG.

5.2.2.2 Data Unpacking and Error Checking


The final steps of data reception are fairly straightforward. The next procedure is to
unpack the transmitted data (essentially decoding the high-density line code). This is
accomplished by a software routine that basically performs the packing algorithm in reverse.
After the 16 bits of data have been recovered and converted to a 10-bit word (plus two parity
bits), a final parity check can be performed. For each 5-bit group of data, parity is re-
calculated using an algorithm identical to the transmitting PIC. The two parity bits are then

(82)
compared to the transmitted parity information, to detect whether a single bit inversion has
occurred. If an error is identified, the reception is aborted and the received data is ignored.

5.2.3 Microprocessor Control


The microprocessor control of the base unit consists primarily of the management of
the audible alarm. It must decode the transmitted data, and based on this information, alter
the output of the base unit buzzer, to serve as an indication of the electric field strength.

5.2.3.1 Pulse Width Modulation


Pulse width modulation (PWM) uses a changing duty-cycle that when used along
with a low pass filter will generate a DC voltage between 0 and 5 Volts. The DC voltage is
determined by the average power produced at the output of the low pass filter.

The duty cycle is programmed by separating the 10-bit resolution value into two
registers, the CCP1CON and CCPR1L. The 8 MSB are loaded into the CCPR1L register
and the remaining bits are loaded into CCP1CON bits 5 and 4. The duty cycle can then be
calculated by the equation:

[
duty _ cycle = CCPR1L : CP1CON < 5 : 4 >]⋅ 4 ⋅ OSC ⋅ (TMR2 prescaler) [Equation 7]

The intended application was to informally separate frequency ranges to indicate the
changing of the 10-bit amplitude transmission. The problem presented with this approach is
that the changing field intensity increased drastically as the detection circuitry approached
the power line. The rapid changing voltage produced indistinguishable frequency changes as
the PWM circuitry stepped between frequency ranges resulting in undesirable alarm
conditions.

In order to compensate for the changing field intensity, one distance was selected
as an indication of a point of danger. The other frequency range that the detection circuitry
would produce audible by the PWM would offer little information about its relative position
to the power line. The alarm would increase in volume as the detection circuitry approaches
but the distance covered would exceed a uniform step towards the power line.

(83)
5.2.3.2 Watchdog Timer
The watchdog timer at the receiver unit provides the same functionality as the
watchdog timer at the sensor unit. Upon overflow, indicating a malfunction in the
execution of the mainline code, the CPU of the PIC microcontroller is reset. The time-out
period occurs between 7 and 33 milliseconds, with a nominal value of 18 milliseconds. The
execution of the clrwdt instruction resets the timer and prevents the resetting of the CPU.

(84)
6 RESULTS AND ANALYSIS
This section reports the results of the final system design. These topics include basic
functionality, as well as the final printed circuit board layout, and a final analysis of the cost
of the proposed system.

6.1 Final System


The final sensor unit prototype is a battery-operated device that measures the
magnitude of an electric field and converts this to digital, binary information. The PIC
microcontroller processes this information, calculating and averaging amplitudes, preparing
data packets, and determining parity, finally, outputting this information serially through the
USART to the transmitter module.

The information is transmitted and received through the Radiometrix modules as


expected. Information is outputted from the base Radiometrix receiver to the USART on
the base PIC microcontroller. The PIC microcontroller correctly unpacks the data and
checks the parity information, discarding data with incorrect parity information. The PIC
microcontroller then manipulates the received information to determine the amplitude and
frequency of the alarming signal. For this project, the base microcontroller’s pulse width
modulation feature was unable to be programmed to adequately control the alarm signal.

6.1.1 Sensor Schematic


A schematic of the final sensor unit circuit is shown in Figure 24. A 9-volt battery is
input to the voltage regulator, which powers the sensor circuit with 5 volts. The sensor
antenna carries the signal to the operational amplifier, amplifying it before sending the signal
to the PIC microcontroller’s analog to digital converter. The processed, digital information
is then serially sent to the Radiometrix transmitter module through the microcontroller’s
USART port. The data is output serially from the module through the transmitting
antenna.

(85)
+5V
+5V
LM78LXX
+
GND 9V

.01 µF .33 µF -

20k Ω
SENSOR
ANTENNA .1µF
1000pF

+5V .1pF
TX ANTENNA

(1)Vpp
100k Ω (2)ADC
3.9k Ω

.1µF
PIC (1)Gnd

100k Ω (2)RF_Out

+5V
+5V

.1µF
VDD(32)
VSS(31) XMTR
(11)VDD
(12)VSS

.1µF (13)ClkIN
(14)ClkOUT

TX(25)
4MHz

(19)Reset
(20)Xmtr

12 9
100k Ω

1
2

VDD 4

14 5

11
13
10

6 8

Figure 24: Schematic of Sensor Unit

(86)
6.1.2 Printed Circuit Board Layout
In an effort to keep the device from interfering with the normal operation of the
boomed vehicle a compact size was desired. A printed circuit board was designed for the
sensor unit; this design significantly decreased the overall system size, making it less
susceptible to damage as well. The final sensor unit is approximately 7 cm x 7 cm (2 ¾ in x
2 ¾ in) on printed circuit board. Particular attention was paid to those traces carrying
analog signals; due to their increased sensitivity, an effort was made to keep these
connections as short as possible. Printouts of the printed circuit board layout can be seen in
Appendix B.

6.2 Cost Analysis


The specification for the cost of the Power Line Proximity Alarm was fifty dollars. In
comparison to the cost of industrial boomed vehicles and equipment and the value of saving
lives, fifty dollars ($50.00) seems like a reasonable goal. In order to stay within this budget,
it was necessary to use inexpensive components, as well as limit the number of components
needed.

Once the design for the Power Line Proximity Alarm was completed, the price of
each component was found. Table 15 shows the price of each part and the number used.
Also, since this product will most likely be manufactured in large quantities, the cost of each
component per 50,000 was also found. The total cost of the system is fifty-four dollars and
three cents ($54.03). This is four dollars and three cents ($4.03) over the specified cost of
the system, not including labor costs.

Although the prototype for the Power Line Proximity Alarm did not meet the cost
specification, it is still at a reasonable cost. The actual cost of the system did not exceed the
cost specification enough to suggest an alternate design.

(87)
Table 15: Cost Analysis of Power Line Proximity Alarm

Part Description Price Cost Per 50,000 Quantity Per System Total Cost per 50,000
Microcontroller $6.18 $3.15 2 $6.30
Rail-to-Rail Input and Output Op-Amp $2.98 $1.13 1 $1.13
4MHz Crystal $0.94 $0.37 2 $0.74
P-Channel Mosfet $0.69 $0.14 1 $0.14
Voltage Comparator $0.49 $0.17 1 $0.17
Op-Amp $0.56 $0.19 1 $0.19
Battery Holder 9V with lead wires $0.88 $0.63 1 $0.63
Battery 9V Alkaline $2.22 $0.88 1 $0.88
Dual Comparator Pair plus Inverter $0.58 $0.16 1 $0.16
Transmitter Module $14.00 1 $14.00
Receiver Module $28.50 1 $28.50
Voltage regulator $0.00 1 $0.00
$0.00 1 $0.00
Quad Op-Amp $0.88 $0.30 1 $0.30
Diode $0.90 $0.50 $0.00
Zener Diode $0.25 $0.10 $0.00
Piezo-electric speaker $3.17 $0.26 1 $0.26
5% $0.27 $0.01 21 $0.21
$0.75 $0.02 21 $0.42
Total $54.03
7 FUTURE CONSIDERATIONS
This section contains information concerning various concepts for potential
improvement of this project. Included in this section are suggestions for improving power
management (such as with solar cell recharging), as well as methods for implementing a
transmitter switching function for the system to reduce sensor power.

7.1 Power Management


It is recommended that the sensor unit be modified such that it includes a solar
rechargeable battery system as well as a voltage monitor. The solar rechargeable battery
system will require the least amount of maintenance when compared with other power
management solutions, while the voltage monitor will prove to be quite an advantage when
troubleshooting should any malfunction occur.

7.1.1 Solar Panels


By combining solar power with rechargeable batteries the longest possible lifespan
can be obtained, requiring less attention and maintenance. Photon Technologies provides
solar cells of different size, output voltage, and price, therefore, choosing the type of solar
panel will be dependant on the requirements of the system.

Thin-Film Micro-Solar Panels appear to be the optimum choice in this application.


Thin-Film panels will be cost effective when compared with Crystalline Solar Panels; Thin-
Film Solar Panels also have a better reaction in low-light conditions. The full spectrum is
most beneficial in both applications for optimum functionality; however, the Crystalline
panels are more dependant on the Infrared side of the spectrum, the mostly red light,
whereas, the Thin-Film uses more of the blue/gray light to operate, closer to the ultra-violet
side of the spectrum. Many events can limit the amount of sunlight exposure the panel will
have access to. For instance, shading provided by buildings, trees, or other high reaching
objects, or even natural weather conditions can prove to be quite problematic when
encountered in the work place environment. In this situation, the Thin-Film Panels possess

(89)
a significant advantage over the Crystalline Panels, making the Thin-film appear to be the
optimum choice. The solar panels include a blocking diode that prevents battery drainage
while the panel has limited or no exposure to light.

Problems may also arise when working in conditions where additional light is being
supplied to the work area. The presence of fluorescent lighting will significantly impact the
solar panels. The Thin-Film panel will experience a significant decrease in output power;
however, the Crystalline Solar panels will be completely inoperable under these conditions.
This information is summarized below in Table 16.

The Crystalline panels do have some advantages over the Thin-Film panels. For
instance, they are more compact. Thin-Film panels will need about twice the area that
crystalline panels would need to create the same output. However, this is not catastrophic
and can be accounted for. The size for a 3V Thin-Film Panel is approximately 2” x 3” x
0.05”, still meeting our size specifications.

The Thin-Film Panels will charge many varieties of batteries, however, Lithium Ion
Batteries will most likely be used in this application. These batteries have the longest shelf
life and lifespan when compared with other batteries on the market today. The solar panels
have a lifespan of approximately 5 years and using batteries that require the least amount of
charging will be beneficial for both the life of the battery and the life of the panel.

Table 16: Comparison of Various Solar Panel Types

Glass Thin Plastic Thin


Crystalline
Film Film
Power per unit area High Average Average
Cost High Low Low
Light spectrum Infrared Ultra-violet Ultra-violet
Durable Yes No Yes
Handling in construction Delicate Delicate Most durable
Blocking diode Yes Yes Yes
Output under fluorescents None Low Low

The addition of a battery charge controller will be a necessary interface between the
solar cells and the rechargeable battery for complete implementation and functionality.

(90)
7.1.2 Voltage Monitor
It is recommended that the sensor unit include a voltage monitor; this will be a great
advantage when troubleshooting should any malfunction occur. One practical solution is
utilizing the TL431 produced by Texas Instruments as an indication of low battery power.
When constructed, the simple circuit outputs a voltage indicating the battery voltage has
dropped below the programmed, threshold voltage limit.

R
V 3

I(BATT)

R R R
TL431
1A 1B 4

R 2A
R 2B

Figure 25: High and Low Battery Voltage Indication Circuit

This signal can be input into any port on the PIC microcontroller. The battery
power status information can be included in the two data packets transmitted. The base unit
microcontroller will check the binary digit and determine if the battery power is full or low
and, if necessary, output an indication to the operator. The threshold voltage is determined
by a relationship between R , R , and a reference voltage:
1B 2B

 R1B 
LowLimit = 1 +  * VREF [Equation 8]
 R2B 

For correct functionality, the relationship between R , R , and the reference voltage must be
1A 2A

greater than the battery’s output supply voltage. The threshold voltage produced by this
relationship is the high limit and the relationship is given below:
 R1A 
HighLimit = 1 +  * VREF [Equation 9]
 R2A 

The LED intensity and cathode current is dependant upon the selection of resistors
R and R ; a cathode current ≥ 1mA must be supplied to the TL431 for expected operation.
3 4

(91)
7.2 Complex Programmable Logic Device
Turning off the transmitter introduced the problem of invalid information being
received by the UART of the base. The receiver would be unable to detect the digital
information as sent from the transmitter. A possible approach to solving the problem is to
develop a logical device that would recognize a transmitted preamble and instruct the
receiver that valid information was to follow.

A CPLD would be connected to the digital output of the receiver to read in the
transmitted input. The CPLD could be configured to act as a logical device that acts like a
combination of a UART and sequence detector. The digital output of the receiver module
could then be multiplexed between the UART and the CPLD with the use of TTL AND
gates.

7.2.1 Methodology
An eight-bit byte, transmitted from the PIC, is framed by start and stop bits to
complete a transmitted package. The TX output to the RX input idles at a high voltage level
producing a voltage link between the two microcontrollers, when connected with a wire.
The high voltage link is no longer present when the transmitter is turned off. The problem
with the transmission becomes distinguishing these framing bits from the random digital
information produced by the receiver digital output.

The receiver module expects the high-to-low transition produced as an indication of


the start of transmitted data. The digital information, without the aide of a CPLD, would
cause the receiver UART to recognize the first high-to-low transition as the start of
information. The digital information would then either produce erroneous results, cause
framing errors as well as increasing the probability of synchronization errors between the
transmitter and receiver.

7.2.1.1 Synchronization

The PIC receiver UART samples the RC7/RX/DT pin three times by a majority
detect circuit to determine if a high or a low level is present at the RX pin. Once a low

(92)
transition is sampled the data recover block is enabled. The data recovery block is a high
speed shifter, operating at 16 times the baud rate allowing the data to be sampled 16 times to
ensure validity.

Synchronization is needed to ensure the information transmitted from the PIC is


recognized as the preamble. There is no way to determine the start and stop bits from the
digital information so a similar method of framing should be implemented. The start bit of
the transmitter would have to be a combination of bits that would cause the sequence
detector to exit its current location and start from the beginning.

7.2.1.2 Sequence Detection

The bit sequence was determined to consist of 011b to indicate the start of the
upcoming preamble. The RX_IN value is the input data from the digital output of the
receiver. The following five bits would be the preamble for a three-packet transmission. The
five-bit preamble is a fair identifier for the sequence where the baud rate is limited to 9600.
The largest problem associated with this sequence is location at which the sequence detector
is in prior to the transmitted preamble. The probability that the four bit sequence 1010b at
the specified baud rate precedes the transmitted preamble is higher than if a fourth packet is
transmitted. The initial zero bit is already sent as the transmitter sends the start bit resulting
in the completion of the sequence just prior to its initiation.

The preamble could then be extended to a forth packet without changing the
detection pattern 10b. The stop bit concluding the first preamble packet would produce a
low-to-high transition and the start bit producing the high-to-low transition completing one
full cycle through the sequence detector. The second preamble packet would be a
continuation of the 10b sequence resulting in a transmission of a bit sequence with a
frequency equal to the baud rate clock.

(93)
Figure 26: Flowchart of Sequence Detection Algorithm

7.2.1.3 16-Bit Shift Register

The remaining concern is to ensure that the preamble is sampled at the right points
as the bits advance through the sequence. The center point of the bit would not be sufficient
for identification. A larger number of samples increase the probability that the bit is the
desired value. The UART’s data recovery block samples the bit 16 times for identification
with a clock 16 times the received baud rate.

The sequence detector, once the start bit has been detected, would pass the Rx_IN
value to another process shifting the input into a 16-bit register. The process would have to
be clocked at a rate 16 times the baud rate, on positive transitions, in order to remain
consistent with the design of the PIC UART. The process would be a conditional
comparing the Rx_in value with a concurrently running 4-bit counter.

(94)
The process would require parameters to be passed between the sequence process and
the shift process. The conditions for these parameters would determine the position of the
main count variable. When the 4-bit counter reaches 16 the shift register would be compared
to the expected bit and the sequence detector would advance or clear according to the results.
The main counter would advance until the sequence had completed and the Rx_go and
Rx_wait outputs would be changed from there current locations and the CPLD would be
multiplexed with the UART of the receiver.

7.2.1.4 Multiplexing devices


The two devices could then be multiplexed by the CPLD and two TTL AND gates.
This would require that the PIC send a reset back to the device once the data had been
received. The reset would set the CPLD back to the currentstates defined by there respective
timing processes and could continue processing the noise. The reset idea is not a good
design due to the fact that the reset of the CPLD would effectively be clocked at 20 times
1/baud and initialization of a device would then occur after every receiver interrupt.

It is possible to use only one AND gate along with another clock. The problems
with this methodology would be that it would require another process clocked at 20 times
the 1/baud to turn off the rx_go signal. The current state machine could not be used because
in order to avoid latency problems it is being clocked at the highest possible frequency range
requiring a large count for the delay. It may be possible it counter act this problem by
creating a combination of the divided clock and counter such that both latency and the
required number of states would be such that the CPLD could create the flip-flop and logic
configurations.

7.2.2 Advantages and Disadvantages


The 5V transmitter module allowed a maximum baud rate of 9600. The
transmission of 9600 would allow a three-packet transmission resulting in a total
transmission time of 3.125 ms. The remaining .875 ms would leave significant time for all
instructions needed to complete the interrupt sequence while only missing one sample. The
minimal on time of the transmitter would result in a 3.03% duty cycle and minimize the
power consumption due to the transmitter. The disadvantage of the three-packet

(95)
transmission is the short preamble and therefore a higher possibility of turning the receiver
UART on prematurely.

The four-packet transmission requires that the transmitter and receiver modules
operate at a much higher baud rate. The PIC microcontrollers allow a baud rate of 19200
with no change in the bit error rate from 9600 baud. A 19200 baud-rate transmission would
result in a total time of 2.083 ms with an on time duty cycle percentage of 2.04%. The four-
packet sequence has benefits in both required time of transmission allowing more
instructions between transmissions as well as power benefits. The disadvantage is the
availability of 5V transmission modules with the ability to transmit higher than 9600.

(96)
8 BIBLIOGRAPHY
Biegel, Michael. Objective Measurements for RF-ID System Performance: System Design and
Evaluation Criteria. http://www.rapidttp.com/transponder/beigel.html.

Bierl, L. 1999. Economic Voltage Measurement with the MSP430 Family. Texas Instruments
Incorporated.

Bueche, Frederick J. 1975. Introduction to Physics for Scientists and Engineers. McGraw-
Hill, New York.

Haykin, Simon. 1994. Communication Systems. 3 ed. John Wiley & Sons, Inc., New
rd

York.

Inan, Umran S. and Inan, Aziz S. 1999. Engineering Electromagnetics. Addison Wesley
Longman, Inc., Menlo Park.

Kisner, Suzanne, and Virgil Casini. 1998. Worker Deaths by Electrocution: A Summary of
Surveillance Findings and Investigative Case Reports. NIOSH Pub. No. 98-131.

Lathi, B. P. 1989. Modern Digital and Analog Communication Systems. 2 ed. Holt,
nd

Reinhart, and Winston: Philadelphia.

Lathi, B. P. 1998. Signal Processing and Linear Systems. Berkeley Cambridge Press,
Carmichael, California.

Marsh, Michael. Designing RF-ID Systems. http://rapidttp.co.za/transponder/taglayer.html.

Microchip Technology, Inc. 1999. PIC16F87x 28/40-pin 8-bit CMOS FLASH


Microcontrollers. Data Sheet.

Microchip Technology, Inc. 1997. PIC16C9xx 8-bit CMOS Microcontroller with LCD
Driver. Data Sheet.

Miller, Gary M. 1988. Modern Electronic Communication. 3 ed. Prentice Hall: New
rd

Jersey.

Motorola. 2000. Selecting the Right Microcontroller Unit. Motorola Semiconductor


Application Note. Document Number: AN1057.

Peatman, John B. 1997. Design with PIC Microcontrollers. Prentice Hall: New Jersey.

PIC Data Sheet. 2001. PIC 16F87X Data Sheet: 28/40-Pin 8-Bit CMOS FLASH
Microcontrollers. Microchip Technology, Inc. http://www.microchip.com.

(97)
Radiometrix Data Sheet. 1998. Radiometrix TX2 and RX2 UHF FM Data Transmitter and
Receiver Modules. Radiometrix Ltd. http://www.radiometrix.co.uk.

Ramo, Simon, et al. 1965. Field and Waves in Communication Electronics. John Wiley &
Sons, Inc., New York.

RF-ID: What is it, and how is it used? http://rapidttp/rfid/rfsystems.html.

Roden, Martin S. 1996. Analog and Digital Communication Systems. 4 ed. Prenticeth

Hall: Upper Saddle River, New Jersey.

Texas Instruments. 2000. MSP430 Application Report Book (SLAA024). Application Book
(SLAA024). Chapters 1 and 2.

Texas Instruments. 2000. MSP430C32x, MSP430P325A Mixed Signal Microcontroller.


Data Sheet.

Texas Instruments. 2000. MSP430x11x Mixed Signal Microcontrollers. Data Sheet.

Texas Instruments. 1999. Architecture and Function of the MSP430 14-bit ADC.
Application Report: SLAA045.

Texas Instruments. 1999. Application Basics for the MSP430 14-bit ADC. Application
Report: SLAA026.

Voland, G. 1999. Engineering by Design. United States: Addison Wesley.

Wilcox, A. 1990. Engineering Design for Electrical Engineers. Englewood Cliffs, New Jersey:
Prentice-Hall, Inc.

XEMICS. 2000. Ultra low-power Mixed Signal Microcontroller. Data Book XX-
XE88LC01/03/05.

(98)
APPENDIX A:
MATLAB SIMULATION CODE
APPENDIX B:
PRINTED CIRCUIT BOARD LAYOUT
APPENDIX C:
SENSOR UNIT PIC CODE
APPENDIX D:
BASE UNIT PIC CODE
APPENDIX E:
ASSORTED DATA SHEETS

Vous aimerez peut-être aussi