college of engineering and mineral resources

advertisement
WEST VIRGINIA UNIVERSITY
COLLEGE OF ENGINEERING AND MINERAL RESOURCES
Lane Department of Computer Science and Electrical Engineering
EE/CpE 480
SENIOR DESIGN SEMINAR
Spring 2003
Performance Analysis
April 5, 2004
Team 16: Remote Fire Alarm
Nick Rymer
Josh Bertovich
Brian Robinson
Adam Lehotay
Monitor: Wills Cooley
Sponsor: Dr. Winn
Contact Person:
Nick Rymer
304-771-5866
nrymer@mix.wvu.edu
Principle of Operation
The Remote Fire Alarm System is a set of remote fire alarms that communicate
wirelessly to a central controlling unit. The system monitors for fires, communication
losses, and low batteries. The system also has the ability to add and remove remote fire
alarms.
The central unit and remote fire alarms will be wall mounted and will plug into
the 120 VAC power supply. The remote fire alarms can also have a 9 volt battery
supplying its power. The central and remote units must have power connected to them
before any procedures can be performed. The central unit will be placed in the main
building of the location that is to be monitored by the system. The central unit has an
LCD screen to display the status of the system. In normal operation, the LCD screen
displays the number of remote fire alarms that are communicating with the central unit.
The central unit also has a column of eight LEDs. The LEDs represent remote fire alarm
number one to remote fire alarm number eight, going from top to bottom. The LEDs are
only lit when its particular alarm is not in normal operation. To the right of the LED
column is an area that the user can use to describe the physical location of the alarm.
Also, 10 buttons are on the central unit. Eight buttons are located in a column to the left
of the LEDs, and they represent the same remote fire alarm that the LED next to it
represents. The other two buttons are the learn and remove buttons that are located
underneath the LCD screen. The remote fire alarms have only a learn button on them,
and they have no other form of user input or display. The central and remote units are
displayed in Figure 1 and 2.
Figure 1. Central Unit
4 Remote Fire Alarms Communicating Normally
Figure 2. Remote Fire Alarm Unit
To add remote fire alarms to the system, the learn button on the central unit must
be pressed. The central unit will then display on the LCD the alarm number that is being
learned, and it will display a command telling the user to press the learn button on the
remote fire alarm. Also, the LED for that alarm number will flash. The remote fire alarm
is added to the first available alarm number that does not already correspond to a remote
fire alarm. A maximum of eight remote fire alarms can be added to the system, and the
remote fire alarm cans only be 500ft from the central unit. After the remote fire alarm is
added to the system, the central unit will display that the process has finished.
To remove a fire alarm from the system, the remove button on the central unit
must be pressed. The LCD will then display a command telling the user to press the
button that corresponds to the alarm they want to remove. After the user presses the
button for the alarm they want to remove, the LCD will display the alarm number the
user selected and a message asking for conformation. Conformation will be pressing the
remove button if the alarm number is correct or the learn button if it is incorrect. Once
the user confirms the selection, the alarm will be removed, and the LCD will display the
alarm number that has been removed. If the alarm number is not confirmed, the central
unit will return to normal operation.
The central unit can interpret four different states that the remote fire alarm is in:
fire, low battery, communication loss, or normal operation.
The remote fire alarms will
transmit to the central unit their status of normal operation, fire, or low battery. If the
central unit does not receive a transmission from a remote fire alarm, it will determine
that remote fire alarms status as loss of communication.
If a remote fire alarm transmits a fire signal to the central unit, the central unit’s
LCD will display fire and the alarm number of the alarm that transmitted the signal.
Also, that alarm number’s LED will be lit. The central unit will then sound all of the
alarms that are connected to the system. The alarm sound can be turned off by pressing
the button for the alarm number that reported the fire. If the alarms are muted, the LCD
will still display fire and the alarm number. The central unit will display normal operation
only after all alarms are transmitting normal operation.
When the central unit determines a remote fire alarm status to be loss of
communication, the LCD will display loss of communication and that remote fire alarm’s
alarm number. Also, that alarm number’s LED will be lit. The central unit will also beep
once a minute and that sound can be muted by pressing the button for the alarm number
that has a communication loss. If the sound is muted, the LCD will still display loss of
communication and the alarm number. Only once communication has been restored will
the central unit stop displaying the loss of communication.
If a remote fire alarm has a low battery, the central unit’s LCD will display low
battery and the alarm number of the remote fire alarm. Also, that alarm number’s LED
will be lit. The LCD will stop displaying low battery once the battery has been replaced
in the remote fire alarm.
If all remote fire alarms are reporting normal operation, the central unit’s LCD
will display the number of remote fire alarms communicating.
System Description:
Figure 3. Level 0 Context Diagram
Central Unit
110
VAC
5 Volt
Power
Regulator
Rectifier
Regulated 5 Volt
Supply
Regulated
5V
Communication Circuit
Regulated
5V
RF output
Speaker
High output to
sound alarm
Signal to Remote
Unit
Transceiver
PIC
Microprocessor
Decoded Signal
from Remote Unit
RF input
Encoded
Input
G
A
L
2
8 Alarm Buttons
User Input
G
A
L
1
Learn
Button
Remove
Button
LED
Pattern
Information
to be
displayed
Regulated
5V
Regulated
5V
8 LED
Lights
LCD Display
Regulated
5V
Figure 4. Central Unit Block Diagram
Regulated
5V
9 Volt
Battery
Remote Alarm Unit
120
VAC
Rectifier
Regulated 5 Volt
Supply
5 Volt
Power
Regulator
Switch
Sensor and Communication
Circuit
Regulate
d5V
Regulate
d5V
RF output
Speaker
Transceiver
Signal to Central
unit
Decoded Signal
from Central unit
RF input
High output to
sound alarm
PIC
Microprocessor
Status of sensor.
High for Alarm,
Low for OK
Status of learn
button
Smoke and
Heat Sensor
Regulated
5V
Learn
Button
Regulated
5V
User
Input
Figure 5. Remote Fire Alarm Block Diagram
Regulated
5V
Check status of
Learn Button
Has the learn
button been
pressed?
no
yes
Has an alarm
button been
selected?
yes
Check transceiver
Signal exists?
no
yes
no
Check status of
Remove button
Has the remove
button been
pressed?
Process
new device
yes
Request
confirmation
Confirmed?
yes
no
no
Request sensor status
Did sensors
respond?
no
Display comm. loss
yes
Process and display
LCD messages
Remove
Device
Figure 6. Flowchart for central unit PIC
Figure 7. Flowchart for remote sensor PIC
Author Nick Rymer
Rectifier
The rectifier block in figure 4 & 5 performs 1 function: Converting an AC signal
into a steady DC signal to provide the power source for all the chips inside the remote
alarms and central unit. The input to the converter is the standard 60 Hz 120 VAC signal
that the power companies provide to the electric grid. The converter will plug into a
standard 2 prong outlet with the other end plugging into a central unit or remote unit.
The rectifier should supply 6 volts DC at a maximum load current of 1 A. These types of
rectifiers can be purchased as a package that will plug into a 120 VAC source and then
connect to the central unit and remote units.
Central Unit Power Regulator
The central unit’s Power Regulator block in figure 4 is to regulate the rectifier’s
output so that the chips within the central unit will function normally as well as be
protected from over voltage. The PIC microprocessor, transceiver, and GAL chips all
need to be powered by a constant 5 volts DC. The speaker, LEDs, switches, and LCD do
not need a controlled 5 volt supply but they will also use the regulators output as their
supply. The speaker, LEDs, switches, and LCD will not affect the voltage of the
regulators output, but they will affect the output current the regulator will need to supply.
From the calculations below, the power regulator must then provide a 5 volt DC ± .5V
with a load current of 225mA –830mA. Current and Voltage numbers taken from spec
sheets listed in works cited.
Central Unit Power Calculations:
Min Typ Max
8 LED’s needing 20 mA each for operation
0
160mA
10 Switches - negligible current
0
0
0
1 PIC chip Running at 2 MHz IDD
5mA 5mA 250mA
16F877 spec sheet
1 Transceiver
26uA 50mA 150mA
Transmits 25% of time, Transmit current = 150mA
Receives 25% of time, Receiving current = 50mA
idle 25% of time, idle current =26 uA
IAve = 50mA (.25(150 +50) + .5(26uA)
2 GAL chips @ 110mA
220mA 220mA 220mA
1 speaker
0
50mA
1 LCD
1.2
1.2
1.2
Minimum Current needed by Central Unit
225mA
Typical Current needed by Central Unit
275mA
Maximum Current needed by Central Unit
830mA
Typical Power used by Central Unit
Power = ITyp * 5V, 275mA * 5V
Maximum Power used by Central Unit
Power = ITyp* 5V, 830mA * 5V
Maximum Power Supplied by rectifier
Power = IMAX * 6V, 1A * 6V
Maximum Power Supplied by Regulator
Power = IMAX * 5V, 1A * 5V
1.375Watts
4.15 Watts
6 Watts
5 Watts
Excess Capacity
Rectifier Supplies 1.85 Watts of Extra Power
Regulator loses 1 Watt of Power in Heat
Regulator Provides .85 Watts of extra Power to Central Unit
Battery Life Calculations
Standard 9 Volt Battery Life = 500 Milliamp Hours
Central Unit Battery Life @ Typical Current
I = 500 / 275 = 1.8 Hours
Using a Battery in Central Unit is not feasible.
Remote Unit Power Regulator
The remote unit’s Power Regulator in figure 5 block will do the same as the
central unit’s regulator except that it will power fewer devices. Voltage will need to be
regulated for the PIC microprocessor and transceiver at a constant 5 volts DC ± .5V. The
speaker, switch, and heat and smoke sensor do not need a rigorously controlled 5 volt
supply but they will also use the regulators output as their supply. Again they will only
affect the output current of the regulator. From the calculations below, the power
regulator must then provide a 5 volt DC ± .5V with a load current of 5 – 230 mA.
Current and Voltage numbers taken from spec sheets listed in works cited.
Remote Unit Power Calculations:
1 PIC chip Running at 2 MHz Typ IDD =
16F877 spec sheet
1 Transceiver
Transmits 5% of time, Transmit current = 150mA
Receives 5% of time, Receiving current = 50mA
idle 90% of time, idle current =26 uA
IAve = 10mA, (.05(150 +50) + .90(26uA)
1 speaker @
1 Smoke and Heat Sensor
1 switch, negligible Current
Minimum Current needed by Remote Unit
Typical Current needed by Remote Unit
Maximum Current needed by Remote Unit
Typical Power used by Remote Unit
Power = ITyp * 5V, 15mA * 5V
Maximum Power used by Remote Unit
Power = ITyp* 5V, 470mA * 5V
Maximum Power Supplied by rectifier
Power = IMAX * 6V, 1A * 6V
Maximum Power Supplied by Regulator
Power = IMAX * 5V, 1A * 5V
Min
5mA
Typ
5mA
26uA 10mA 150mA
0
0
0
5mA
0
50mA
20mA
0
15mA
470mA
.075 Watts
2.35 Watts
6 Watts
5 Watts
Excess Capacity
Rectifier Supplies 3.65 Watts of Extra Power
Regulator loses 1 Watt of Power in Heat
Regulator Provides 2.65 Watts of extra Power to Remote Unit
Battery Life Calculations
Standard 9 Volt Battery Life = 500 Milliamp Hours
Central Unit Battery Life @ Typical current
I = 500 / 15 = 33.3 Hours
Max
250mA
Using a Battery for primary power in Remote Unit is not feasible.
GAL 1
Gal 1 Block’s in figure 4 purpose is to interpret what switch has been pressed and
to communicate it to the PIC in the form of 4 bits. The Gal will have the ten switches as
inputs and it will give a 4 bit output to the PIC. The Gal will use the 5 Volt Supply from
the Regulator Block.
Excess Capacity:
To convert the switch selection to 4 bits for the PIC, the gal will have to
perform 15 bitwise operations. Since the gal20V8A can perform a maximum of
50 bitwise operations, the gal block has an excess capacity of 35 unused bitwise
operations.
Author: Brian M. Robinson
Transceiver
The transceiver is a device that sends and receives information wirelessly. The
transceiver in question transmits using FM modulation between a 900 and 950 MHz
frequency. The type of wireless communication technology being used is frequency
hopping spread spectrum. This technology allows the transmit frequency to hop around a
frequency band at a rapid pace to prevent interference. The information being
transmitted and received is packets of binary bits that make up codes to represent a
certain function to be executed. The packets being transmitted consist of 8 data bits, least
significant bit first. When the data bits are received, a start bit and a stop bit are added to
the bit pattern by the receiver module. This is done to comply with a RS-232 protocol
standard to determine the start and stop points of the packets since it is asynchronously
and serially transferred between the microprocessor and the transceiver. Figure 6 shows
a packet of 6 high bits and 3 low bits with the start bit and stop bits added at the receiving
end.
1
5V
1
1
1
1
1
0
0
0
Stop bit
Start bit
Figure 8
When the receiver module receives the packets, the bits are stored in the date-out
buffer. The bits are buffered until the microprocessor agrees to receive the data using the
request-to-send bit. If the request-to-send bit is not reset by the processor, the buffer can
fill up and data will be lost. This is not much of a concern for this project, since little
information is being transmitted in reference to how much the buffers can store.
The transmitter module gets the information it is transmitting from the
microprocessor which is stored in the data-in buffer. It continues to receive information
from the microprocessor as long as the clear-to-send bit is high. Once the buffer is
almost full the clear-to-send to reset to low and no more information can be transferred to
the transceiver.
Modes of Operation
There are four possible modes that the transceiver can operate in. The four modes
are sleep mode, transmit mode, receive mode, and transition mode. During sleep mode,
the transceiver is in a lower power consumption state. It is not receiving information nor
transmitting information. This mode is important for saving power when the battery is
being used in the remote alarms, and overall more efficient. A sleep timer controls the
time the transceiver is in sleep mode. When the transceiver leaves sleep mode, it must
transition to either the receive mode or the transmit mode. The transition time is called
the transition mode. The transceiver is also in transition mode when going from the
either the transmit mode or receive mode to sleep mode. When in transition mode, the
transceiver uses as much power as if it were transmitting or receiving, but it is just
responding to information being received by the antenna or the data-in buffer. During
transmit mode, the transceiver take the data from the data-in buffer and sends its out.
When in receive mode, the transceiver receive data from the antenna and stores it in the
data out buffer.
Figure 9
Utilizing Modes of Operation
The modes of operation should be used efficiently, so that the maximum amount
of power can be saved while all information is transfer without error. For a worse case
scenario, approximately 400 bits will be transferred in a second was estimated. Since the
transceivers transmit and receive at a much faster rate, most of the time the transceivers
can be in sleep mode. The central unit will be in sleep mode fifty percent of the time and
will be switching between the other modes during the other fifty percent of the time. The
remote alarms will be in the sleep mode ninety percent of the time and will be in the other
modes the other ten percent of the time.
Performance and Excess Capacity
The performance of the wireless transmission of the transceiver is one of the most
important attributes to the project. With a transmit power output of 140 mW and a
receiver sensitivity of -114 dBm, the transmission range should reach up to 1500 feet
with obstructing objects in the wireless channel. The project only requires for the
transmission to reach at least 500 feet. The serial data throughput is approximately 1200
bps, which is more than sufficient to meet the project’s needs. The maximum number of
bits that will be sent is approximately 400 bits in a second. This data shows the excess
capacity of the transceiver hardware.
Gal 2:
Originally, the purpose of the second GAL was to control the display LEDs on the
central unit, but it is much simpler to the logically run the LEDs straight from the PIC. In
the final proposal the GAL 2 will be remove from our design, hence be removed from the
diagrams.
Author Josh Bertovich
Remote Sensor PIC:
The microcontroller installed in each remote sensor will be responsible for processing all
incoming and outgoing signals of the sensor. Incoming signals to the microcontroller
will consist of the status of the “learn” button, which is used to add the sensor to the list
of installed sensors on the central unit, the status of the heat and smoke sensor, and
decoded signals from the transceiver. Since the microcontroller must produce a certain
action for a given input, it will output signals to control the speaker/alarm and the
transceiver.
Figure 10: Level 1 Data Flow Diagram of PIC in remote sensor
FUNCTIONS:
Main Function:
This function will consist of an infinite loop which will check the status of the I/O pins in
use on the PIC. The devices that need to interact with the PIC are the transceiver, the
battery sensor, the learn button, and the fire sensor. All of these devices will be
connected to I/O pins that will be monitored by this function. When an event occurs on a
device and it needs the PIC to process the event, this function will call sub-functions that
will deal with the event.
Learn Function:
This function will be executed when the user requests that the remote sensor be installed
in the installed device list of the central unit. When the learn button, located on the front
of the remote sensor, is pressed, the PIC will communicate with the transceiver, which in
turn will send an encoded signal to the central unit. The central unit will interpret this
signal as a request that a new device is to be installed. Once the central unit stores the
device into its list of known devices, a signal will be sent to the sensor to instruct it to go
into normal operating mode.
Inputs:
o Learn button
o Normal operation request
Outputs:
o Request to transceiver
Figure 11: Level 2 Data Flow Diagram of Learn function
Fire Alert Function:
The Fire Alert function is used to notify the central unit that there is a fire at the present
location of the requesting sensor. When the fire sensor is tripped, a signal is sent to the
PIC, which then requests that the transceiver sends a signal to the central unit. This
signal is specific to the sensor transmitting it so the central unit will know where a fire is
taking place. The central unit will then send a signal for the rest of the installed alarms to
sound after it receives the fire signal.
Inputs:
o Fire status from fire sensor
Outputs:
o Request to transceiver
o Trigger speaker
Figure 12: Level 2 Data Flow Diagram of Fire Alert function
Low Battery Alert function:
This function is invoked when the level of battery power drops below operational levels.
The microcontroller will determine this by monitoring battery level status. If the battery
level drops below the needed voltage, a signal will be sent to the alarm for it to beep
every two hours. A signal will also be sent to the transceiver to notify the central unit of
the battery warning.
Inputs:
o Battery status
Outputs:
o Request to transceiver
o Activate speaker
Figure 13: Level 2 Data Flow Diagram of Low Battery Alert function
Remote Fire Alert function:
The central unit will be capable of transmitting a signal that is universally known by all
remote sensors that instructs them to sound their alarm. This function is executed when
monitoring of the transceiver interprets a signal meaning there is a fire at another
location.
Figure 14: Level 2 Data Flow Diagram of Fire Alert function
Performance analysis:
The PIC microcontroller installed in the remote sensor will be responsible for processing
the requests of all attached devices. It must be able to interface with the transceiver, the
fire/smoke detector, and the learn button. The estimated number of lines of code to be
written to enable the PIC to process all requests from the devices is ~150 LOC. This
number is derived from the estimation of 30 LOC per sub-function and 30 LOC for the
main function. The PIC has 256k of program memory, which results in excess capacity
when pertaining to memory use. In order to save on power consumption from the
battery, the PIC will be set to run at 2MHz. This seems like a low speed compared to
many processors, but the amount of data being processed by the PIC is small enough to
permit this operation.
Author: Adam Lehotay
PIC in Central Unit:
The microcontroller installed in the central unit will be responsible for processing
all incoming and outgoing signals of the unit and controlling the system. Through these
incoming and outgoing sensors the microcontroller will control the network by requesting
information from the different sensor devices, processing information sent by the sensor
devices, and processing user input. The microcontroller will also be responsible for
running an LCD display. The incoming signals to the microcontroller will consist of the
status of each sensor present in the network as well as a learn signal from a remote sensor
that needs to be installed into the system. Status signals from each networked sensor will
include low battery, fire, and normal. Other incoming signals are user signals from
buttons present on the central unit.
Outgoing signals will be information sent to the different sensor devices. These
signals will include a status prompt, confirmation requests, a trigger signal used to set all
alarms off in the network, and LCD control signals. Refer to the diagram on the next
page.
Figure 15: Level 1 Data Flow Diagram of PIC in Central
Unit
FUNCTIONS:
Received_Fire_Alert
This function will be executed when a signal representing a detected fire has been
received by the microcontroller. When executed, the alarm will be triggered on the
central unit, a signal will be sent for all other alarms on the network to be triggered, and
the LCD will display a fire alert with the location.
Inputs:
o Alarm of concern
Outputs:
o “All alarms trigger” message through transceiver
o LCD display request
Figure 16: Level 2 Data Flow Diagram of Fire
.
Alert
Received_Low_Battery
This function will be executed when a signal representing a low battery has been
received by the microcontroller. When executed, a request for LCD display indicating
low battery for the specific alarm will be sent. The light representing the sensor of
concern will blink indicating a need for attention from the user.
Inputs:
o Alarm of concern
Outputs:
o LCD display request
Figure 17: Level 2 Data Flow Diagram of Low Battery Alert.
Learn_New_Device
This function will be executed when the user presses the learn button on the central
unit. When a new device is being initialized into the system no device signals will be
processed except a fire alert. This function will assign the device a position in the
network and then send this information to the device and wait for confirmation. If the
learn button is pressed but no confirmation is received this function will terminate after
an allotted amount of time and the assigned position for the new device will be freed.
Inputs:
o User button
o New Device Signal
o New device confirmation
Outputs:
o LCD display requests
o Confirmation request
Figure 18: Level 2 Data Flow Diagram of New Device Request
Remove_Device
This function will be executed when the user presses the remove button on the central
unit and the button representing the sensor to be removed. A confirmation request
message will be displayed and the user will need to press the yes or no button. If one of
these buttons is not pressed within a certain amount of time the function will terminate. If
a yes is received from the user then the device will be removed from the network. If a no
is received then the function will terminate without altering the device information.
Inputs:
o User buttons including remove, device identity, and yes/no
Outputs:
o LCD display requests
Figure 19: Level 2 Data Flow Diagram of Remove Device Request.
Communication_Loss
This function will be executed when a request from the microcontroller has been sent
to a specific sensor and it does not respond to this request within a certain amount of
time. Upon execution display message will appear indicating the loss of communication
and the LED for the specific alarm will flash.
Inputs:
o Sensor status messages
Outputs:
o Status request
o LCD display requests
Figure 20: Level 2 Data Flow Diagram of Communication Loss Alert.
Performance Analysis:
The PIC microcontroller for the central unit will be responsible for processing and
temporarily storing all input and output signals to the central unit. It will also need to
maintain a stored list of the networked devices. The microcontroller must be able to
interface with the transceiver, the user buttons, the LCD display, and the LEDs. The code
needed to run the microcontroller is estimated to contain approximately 350 lines of code.
This number was reached by assigned an average value of 40 lines of code to each major
function, 50 lines of code for a task manager to run the processes appropriately, and 100
lines of code for the LCD driver. The 256k of program memory the microcontroller
provides will be excessive to maintain the maximum of 8 separate sensor locations and
the temporary memory needed. The PIC will run at a frequency on the order of 2MHz
which will not require a large amount of power.
Works Cited
Maxstream, Inc. “Xstream Wireless OEM Modules Datasheet.” 2003. April 5, 2004
<http://www.maxstream.net/products/xstream/module/datasheet-XStream-OEM-RFModule_v4.29.pdf>.
Maxstream, Inc. “Xstream Advanced Programming and Configuration.” 2003. April 5,
2004< http://www.maxstream.net/products/xstream/manual-XStreamAdvProgram&Config-v4.29.pdf>.
Marktech Optoelectronics. “Marktech Standard 10mm LEDs” April 4, 2004
http://www.marktechopto.com/catalog.cfm?Drill_Level=Series&DeptID=1000&SeriesID
=1151>
Lattice Corporation Semiconductors. April 4, 2004 <http://www.latticesemi.com/lit/docs/
datasheets/pal_gal/16v8.pdf>
Microchip. “PIC16F87X Data Sheet” April 2, 2004 <http://www.microchip.com/
download/lit/pline/picmicro/families/16f87x/30292c.pdf>
Fairchild Semiconductor. “MC78XX/LM78XX/MC78XXA 3-Terminal 1A Positive
Voltage Regulator” April 2, 2004 <http://www.fairchildsemi.com/ds/LM/LM7805.pdf>
Download