Académique Documents
Professionnel Documents
Culture Documents
________________________
Nicholas Arcolano
________________________
Melissa Diercks
________________________
Jessica Hopkins
________________________
Jeremy Lynch
Approved by:
_____________________________
Professor John K. McNeill, Advisor
_____________________________
Professor Alexander Emanuel, Advisor
26 April 2001
Acknowledgements
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 todays society, the use of electric powerin both public and private areas, at
home and in the workplacehas 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:
CAUSE: Electrocution
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 alarmbetween 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.
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.
(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.
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).
(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.
(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.
(16)
In the two-phase system, the voltage waveforms, sinusoids at a frequency of 60 Hz,
are perfectly anti-phaseshifted 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.
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 fieldsand in fact, this is one of the reasons why
power transmission lines are typically set up in this arrangementfor 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.
When binary data is transmitted over a channel, it must be sent via some analog
format that can encode the individual 0s and 1s 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.
(19)
Table 1: Desirable Properties of a L ine Code
C RITERION D
ESIRED QUALITIES
Efficiency Should have the least detection error probability and inter-
symbol interference (ISI) for a given bandwidth and
transmitting power.
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.
[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 Lathis 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.
Polar Signaling
Perhaps the simplest way to transmit a bit of information is by using a polar
representationthat 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.
(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 modulethe 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 0s may not be detected by the receiver [Lathi, 1989].
(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 0s or 1s 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.
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 0s or 1s 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].
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.
(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 concernparticularly 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.
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.
(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.
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].
(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 remaindertypically 12 bits or 16 bits in
lengthis 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].
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.
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.
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 dielectricform a capacitor, whose capacitance C
varies as a function of the distance x between the lines. The simplified circuit is shown in
Figure 8.
From the simplified circuit, it is possible to find the output (sensor) voltage V , as a
1
(30)
1
ZC = , [Equation 1]
jωC
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).
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
(8.8542· 10 farads/meter), A is the area of one of the plates (in square meters), and x is the
-12
(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.
(32)
Table 5: Predicted Voltages for 30.48 cm Sensor Wire
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.
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.
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
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.
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
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.
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).
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.
(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.
Size 3x 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
(42)
operator can react to the alarm and reverse the crane direction, before an accident occurs.
Lastly, a third alarm will appear on the operators 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.
(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.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. Noisea term which can refer to
basically any frequency content of a signal that is undesirableis 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.
(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.
(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].
(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 LEDs 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.
(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 Microchips PIC16F87X.
(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 teams current unfamiliarity with this
microcontroller.
(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.
(52)
Table 11: Comparison of Various RF Transmitters
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.
(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
(58)
Voltage vs Distance
Voltage 10
0.1
Distance
(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 PICs
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 PICs 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.
(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
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
NO
Maxl-minl = AmpL
YES
Borrow? Decrement maxh
NO
Maxh-minh = AmpH
Return
(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.
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
Set Index bit 0 Set Index bit 1 Set Index bit 2 Set Index bit 3
Clear countavg
Index bit
5 clear?
No
Yes
return
(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.
(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.
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 clearedsuch as would happen when two or more data
packets are being transmittedafter 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 PICs 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 generators 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 symbolsthat is, the number of
signal changestransferred 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.
(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.
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.
(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)
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 percentwell
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.
(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.)
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 draindepending 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.
(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.
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 PICs 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. Thusas was mentioned earlierother 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.
The remaining three components compose the basic functional unit of the USART.
A block diagram of the USART transmitter is shown in Figure 23.
(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.
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.
(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.
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.
(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
(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.
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.
(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.
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
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 batterys 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.
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.
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
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 UARTs 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.
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.
(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
Lathi, B. P. 1998. Signal Processing and Linear Systems. Berkeley Cambridge Press,
Carmichael, California.
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.
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.
Roden, Martin S. 1996. Analog and Digital Communication Systems. 4 ed. Prenticeth
Texas Instruments. 2000. MSP430 Application Report Book (SLAA024). Application Book
(SLAA024). Chapters 1 and 2.
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.
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