32
Wireless Disturbance Monitoring Network ~ A Senior Design Project ~ Final Report April 22, 2012 Team: Covert Gator Members: Andrew Smith, Bob Minchin

Wireless Disturbance Monitoring Network

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Wireless Disturbance Monitoring Network

Wireless Disturbance Monitoring Network ~ A Senior Design Project ~

Final Report

April 22, 2012

Team: Covert Gator

Members: Andrew Smith, Bob Minchin

Page 2: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 2/32

Table of Contents Project Abstract 3

Introduction 3

Features 3

Hardware Description 4

Software Description 5

Testing and Performance 6

Division of Labor 8

Bill of Materials 10

Potential Future Work 10

Conclusion 10

Appendix A: Detailed Software Description 12

Appendix B: Software Code 15

Appendix C: Design Schematics 29

List of Figures Figure 1: Software flowchart for wireless modules 5

Figure 2: Software flowchart for handheld unit 6

Figure 3: Gantt charts 9

List of Tables Table 1: 1-byte information packaging algorithm 5

Page 3: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 3/32

Project Abstract

Our project allows a user to remotely and covertly monitor disturbances at a number of locations. The network consists of two basic units. The first is the wireless module, each equipped with one or more motion detectors and a microphone attached to a finely tuned filter. When motion or sound of a particular frequency and threshold is detected, a wireless signal is sent out. This wireless signal includes an identifier of the location, direction, and type of the disturbance. Multiple wireless modules can be used in a single network. The other unit is the wireless handheld monitoring unit. It includes a wireless receiver that receives signals from the wireless modules. An OLED screen prints out details of the location of any detected disturbance. Each disturbance-monitoring network includes only one handheld monitoring unit.

Introduction

Quite often it is useful to know when there is movement or disturbance in an area not in one’s immediate line of sight. This is the case in many applications, ranging from spycraft, to hunting, to home security, to “capture the flag”, to determining whether one’s roommate is breaking in to one’s candy drawer.

This project, the Wireless Disturbance Monitoring Network, allows a user to do just that—to remotely and discreetly keep tabs on one or more locations and determine when an area has been compromised. This is accomplished through a series of wireless detection modules working with a handheld monitoring unit.

Features

Key attributes for the design are as follows:

• Portability— Battery powered units can be easily moved and repurposed for various temporary recreational or security functions.

• Covertness—The wireless modules can be camouflaged into their surroundings, and the signals set off silent alerts.

• Multi-directionality—Each wireless module has up to four motion sensors pointed in different directions, allowing for up to 360 degrees of detection.

• Handheld convenience—The monitoring unit is a simple, handheld device. • Intuitiveness—The user is able to operate the device with simple, easy-to-understand

buttons and bright OLED screen.

Page 4: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 4/32

• Programmability—The user is able to enter custom names/labels for identification of the individual wireless modules on the monitoring unit.

Currently available commercial devices can perform many of the functions of our design, but none provide the level of portability, modularity, and covertness that our design has achieved.

Hardware Description

Please see Appendix 3 for detailed schematics of the hardware implementation.

Analog Hardware

Wireless modules

For the sound detector on each wireless module, a microphone is fed into a active analog filter designed to remove ambient noise and focus on sound of a specific range of frequencies. This can be any range; the modules in this project were tuned to a center frequency of 10 kHz. The filtered signal is then fed into an LT1632 precision audio amplifier, which feeds into the ADC pin on the MSP430. This allows real-time detection of sudden bursts of noise above the levels expected in an ambient setting.

Digital Hardware

Wireless modules

The MSP430 is the heart of each wireless module, receiving constant signals from the sensors. On each module, up to four digital motion detector units are placed in a north-south-east-west configuration and feed data to the GPIO pins on the MSP430. The MSP430 also receives the digitized signals from the ADC on the sound sensing circuitry described above in the analog component section. Each module features an Xbee wireless unit that the MSP430 will use to transmit data when a disturbance is detected. The Xbee is connected via the MSP430’s UART communications output.

Handheld monitoring unit

The MSP430 is also used to drive the handheld monitoring unit. An Xbee module connected to the UART input receives the signals from all the wireless modules, which the MSP430 translates to display details of the disturbance on an LCD screen. The MSP430 also connects via a motor driver to a vibrating motor used for alerting the user.

Page 5: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 5/32

Software Description

Please see Appendix 1 for detailed schematics of the software implementation.

Wireless modules

The wireless modules are programmed with a bare-bones software base that simply sends out a self-identifying signal when a disturbance is detected through the sensors.

All relevant information on location, direction, and disturbance type is packaged into a 1-byte signal that is transmitted by the Xbee units via the UART output. The most significant nibble of the signal identifies the module, and the least significant nibble identifies the disturbance type and direction. Table 1 describes the algorithm used to accomplish this.

Module 1 Module 2 Module 3 Module 4 Motion North 00000000 00010000 00100000 00110000 Notion East 00000001 00010001 00100001 00110001

Motion South 00000010 00010010 00100010 00110010 Motion West 00000011 00010011 00100011 00110011

Noise 00000100 00010100 00100100 00110100 Table 1: 1-byte information packaging algorithm

Handheld monitoring unit

The software in the handheld monitoring unit receives an alert through the UART input via the Xbee, displays details of the alerted unit on the OLED screen, and activates the vibrator. It also features the ability for the user to enter custom names to identify the modules based on location or any other mnemonic. The user can also use the interface to enable or disable the individual wireless modules or put the unit to sleep, which turns

Figure 1: Software flowchart for wireless modules

Page 6: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 6/32

off the OLED and sets the MSP430 in ultra-low-power state. This is accomplished with a menu interface driven by a set of six pushbuttons that correspond to commands displayed on the OLED screen.

Figure 2: Software flowchart for handheld unit

Testing and Performance

To gauge the performance of the project, several tests were conducted on each individual component and for the system as a whole.

Motion Sensors

The motion sensors were tested by enabling them one at a time and placing the unit in a controlled environment with no motion. An object was waved in front of the sensor, and it was determined whether the correct signal was detected by the MSP430.

Page 7: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 7/32

Sound Detector

The sound detector circuit was designed to pass through and amplify noise of a given frequency and send the signal to the ADC of the MSP430. To test this feature, a loudspeaker was used to produce a sound at the center frequency of the circuit. It was then determined whether the signal properly activated the MSP430. Frequency sweeps were used to ensure that only sound of the specified frequency triggered a reaction.

Xbee Transmitter/Receiver

The Xbee transmitter was tested in the wireless modules by first sending data through the UART via a single wire. Once the receive buffer of the destination MSP430 reflected the correct data, the UART wire was replaced by two Xbee units, one set to send and the other to receive. It was then determined whether the same data is transmitted and received successfully.

Menu-Driven Interface with Pushbuttons

The interface of the handheld unit is straightforward. An alert message is displayed when a disturbance detection signal is received, and the user has the option to clear the screen. From the main screen, the user can access a menu where the options are to rename the modules, enable or disable each of the modules, or put the unit to sleep. When the unit is asleep, it still must be able to wake up when a disturbance signal is received. This was tested by sending the unit each of the signals that corresponds to a disturbance and ensuring that the correct alert message was displayed. Each of the modules was named, tested with a signal, and renamed to ensure that the naming algorithm is robust. Each of the modules was disabled individually, tested individually, and reenabled to ensure that the enable/disable functionality works correctly. Finally, the module was put to sleep and reawaked through an incoming disturbance signal. While asleep, it was ensured that the only component drawing any current is the Xbee receiver.

Vibrating Alert Motor

The vibrating alert motor is powered by a motor driver with a digital on/off toggle. This was tested by simply sending the driver an “on” signal followed by an “off” signal.

Page 8: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 8/32

System-Level Testing

Once it was determined that all individual components functioned correctly, the project was assembled and tested at the system level. It was determined that the entire system worked to all desired specifications, and a full demo was conducted for faculty, staff, and TAs on April 17. A few items worth noting are as follows.

• The motion sensors work to a range of approximately 30 feet. • The sound detector was hampered by unforeseen ground plane ripple current caused by

the Xbee modules and fed through the amplifier, causing false positives on sound detection. This required that the threshold be set unreasonably high, which means that the sound must be louder and closer than expected.

• The battery lasted 4 hours in the wireless modules and 2 hours in the handheld unit. • The wireless transmission between module and handheld unit was good to

approximately 40 feet indoors and 100 feet outdoors. • The software for detection, transmission, module naming, disturbance alerts,

enable/disable, and sleep mode works glitch-free.

Division of Labor

Bob Minchin • OLED configuration and setup • User programmable implementation for naming modules • Operating code for wireless modules and handheld unit • UART/Xbee communications and identification algorithm • Design of digital circuitry

Andrew Smith • PCB design • Motion sensor configuration • Microphone incorporation • Housing design • Design of analog circuitry

Together • Research and brainstorming • Overall circuit design • Assembly, testing, and debugging • ADC fine-tuning

Page 9: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 9/32

Both team members worked diligently in cooperation with each other to achieve all overall design goals. If at any point one member needed assistance in any one particular area, the other would help fill in as needed to accomplish the overall project. Both members worked hand in hand in close coordination with each other as to fully understand how each component was integrated into the overall goals of the design.

Figure 3: Gantt chart with proposed vs. actual time

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Introduction

Project Proposal

Research

Ordering Parts

Breadboarding

Spring Break

Circuit Layout

PCB Design

Working …

Demo

Gantt Chart Spring 2012

Planned Extension Actual time

Page 10: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 10/32

Bill of Materials

Potential Future Work

In order for the sound detection to work to a more useful degree of performance, it would be necessary to mitigate the ripple current induced by the activity of the Xbee on the wireless modules. This could be potentially accomplished by splitting the voltage rails and adding a second voltage regulator that would service only the Xbee module.

It may be useful to have the ability to change the detection range of noise frequencies. This could be accomplished by replacing one of the resistors on the amplifier feedback with a potentiometer that the user could adjust to change the center frequency of the filter.

Conclusion

Although a few minor difficulties were encountered over the course of the project, none were able to hinder its successful completion. All design specifications were achieved, and the project culminated in a viable, robust product that readily demonstrates all its features.

Page 11: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 11/32

All deliverables and checkpoints were on time, and the demonstration was completed earlier than expected. Both team members worked extremely well together, and the project was free of the strife or turmoil that so often characterizes team-oriented projects. The early work both members put into the project ensured that the project remained on or ahead of schedule, which prevented any undue stress as the semester drew to a close.

Overall, the project either met or exceeded the expectations of the team members, the faculty, and the staff.

Page 12: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 12/32

APPENDIX A: DETAILED SOFTWARE DESCRIPTIONS

Wireless Module

Main Function

• Disable watchdog timer • Set internal clock at 16 MHz • Initialize ports, pin interrupts, UART, ADC • Enter LPM4, wait for interrupt

o If any motion detector is activated, process alert Place module identification, disturbance, and direction information into

signal variables Transmit signal variables through UART to Xbee

o If ADC detects sound threshold, process alert Place module identification and disturbance information into signal

variables Transmit signal variables through UART to Xbee

Handheld Unit

Main Function

• Initialize module names • Set module enable variables to “on” • Disable watchdog timer • Set internal clock at 16 MHz • Boot up the OLED • Initialize ports, pin interrupts, UART, UART interrupts • Display welcome startup screen • Call module naming function • Display home screen • Enter LPM4, wait for interrupt

o If “Menu” button pressed, display menu screen (“Sleep” option selected by default) If “Enter” button pressed, execute option choice If “Exit” button pressed, return to home screen

Page 13: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 13/32

• Enter LPM4 If “Down” button pressed, move arrow down and select next option If “Up” button pressed, move arrow up and select previous option Options:

• Sleep o Turn off OLED o Enter LPM4 o Wait for interrupt

If either of 2 function buttons pressed, display home screen

If motion signal received, decode and call motion alert function

If sound signal received, decode and call sound alert function

• Rename Modules o Call module naming function o Return to menu (“Sleep” option selected by default)

• En/Disable Modules o Call module enable/disable function o Return to menu (“Sleep” option selected by default)

o If motion signal received through UART, decode and call motion alert function o If sound signal received through UART, decode and call sound alert function

Naming Function

• Display module naming screen • Display current module name

o If “Accept” button pressed, default or current name is preserved o If “Clear” button pressed, name is erased and new name is selected

“Up”/“Down” buttons increment and decrement characters in module name (in ascending order: Space, A-Z, 0-9)

“Left”/“Right” buttons move cursor (max 8 characters) “Accept” button assigns name to given module and advances

• If on modules 1-3, next module is displayed • If on module 4, function exits

Page 14: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 14/32

“Clear” button erases name and returns cursor to first character

Enable/Disable Function

• Display enable/disable screen • Display current module name

o If “Enable” button pressed, set current module enable variable to “on” If on modules 1-3, next module is displayed If on module 4, function exits

o If “Disable” button pressed, set current module enable variable to “off” If on modules 1-3, next module is displayed If on module 4, function exits

Motion Alert Function

• Display alert screen • Display name of module that detected disturbance • Display direction relative to module of detected disturbance • Enable vibrating motor to alert user • Enter LPM4, wait for interrupt

o If “Clear” button is pressed, display home screen Enter LPM4

o If “Menu” button is pressed, execute menu routine described in Main function.

Sound Alert Function

• Display alert screen • Display name of module that detected disturbance • Enable vibrating motor to alert user • Enter LPM4, wait for interrupt

o If “Clear” button is pressed, display home screen Enter LPM4

o If “Menu” button is pressed, execute menu routine described in Main function.

Page 15: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 15/32

APPENDIX B: SOFTWARE CODE

Wireless Module

#include <msp430x22x2.h> void main(void) { WDTCTL = WDTPW + WDTHOLD; // disable watchdog timer P2DIR = 0x00; // P2 input ADC10CTL1 |= CONSEQ1; // configure ADC to repeat-single-channel ADC10CTL1 |= 0x4000; // pin A4 input ADC10CTL0 |= ADC10SHT_0 + ADC10ON + MSC; // sets sample time to 4*ADC10CLKs + turns on ADC + Enables Multiple Sample Conversion ADC10AE0 |= 0x10; // analog enable for ADC10AE0 on pin A4 ADC10CTL0 |= ADC10SC + ENC; BCSCTL1 = CALBC1_16MHZ; // set DCO DCOCTL = CALDCO_16MHZ; P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 0x83; // 16MHz 9600 UCA0BR1 = 0x06; UCA0MCTL = UCBRS0; // modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST; // initialize USCI state machine int signal = 0x00 ; // initialize signal variable // different for each module while(1) { if (P2IN & 0x01) { // motion north __delay_cycles(1600) ; if (P2IN & 0x01) { signal |= 0x00 ; UCA0TXBUF = signal ; __delay_cycles(96000000) ; signal &= 0xF0 ; } } if (P2IN & 0x02) { // motion east __delay_cycles(1600) ; if (P2IN & 0x02) { signal |= 0x01 ; UCA0TXBUF = signal ; __delay_cycles(96000000) ; signal &= 0xF0 ; } } if (P2IN & 0x04) { // motion south __delay_cycles(1600) ; if (P2IN & 0x04) { signal |= 0x02 ;

Page 16: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 16/32

UCA0TXBUF = signal ; __delay_cycles(96000000) ; signal &= 0xF0 ; } } if (P2IN & 0x08) { // motion west __delay_cycles(1600) ; if (P2IN & 0x08) { signal |= 0x03 ; UCA0TXBUF = signal ; __delay_cycles(96000000) ; signal &= 0xF0 ; } } if (ADC10MEM > 505) { // noise signal |= 0x04 ; UCA0TXBUF = signal ; __delay_cycles(96000000) ; signal &= 0xF0 ; } } }

Handheld Unit

#include <msp430x22x2.h> #include <UF_LCD.h> #include "naming.c" char Mod1Name[8] = {'M', 'O', 'D', 'U', 'L', 'E', ' ', '1'} ; char Mod2Name[8] = {'M', 'O', 'D', 'U', 'L', 'E', ' ', '2'} ; char Mod3Name[8] = {'M', 'O', 'D', 'U', 'L', 'E', ' ', '3'} ; char Mod4Name[8] = {'M', 'O', 'D', 'U', 'L', 'E', ' ', '4'} ; int Mod1En = 1 ; int Mod2En = 1 ; int Mod3En = 1 ; int Mod4En = 1 ; void main(void) { WDTCTL = WDTPW + WDTHOLD ; // disable watchdog timer DCOCTL = CALDCO_16MHZ ; // set internal oscillator at 16MHz BCSCTL1 = CALBC1_16MHZ ; // set internal oscillator at 16MHz lcd_init() ; // boot up the LCD P1DIR = 0x00 ; // P1 input P2DIR = 0X02 ; // P2.1 output P2OUT = 0x00 ; // P2.1 initialized to "off" P1IE |= 0x03 ; // P1 interrupt enabled P1IES |= 0x00 ; // P1 rising edge

Page 17: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 17/32

P1IFG &= ~0x03 ; // P1 IFG cleared P3SEL = 0x30 ; // P3.4,5 = USCI_A0 TXD/RXD UCA0CTL1 |= UCSSEL_2 ; // SMCLK UCA0BR0 = 0x83 ; // 16MHz 9600 UCA0BR1 = 0x06 ; UCA0MCTL = UCBRS0 ; // modulation UCBRSx = 1 UCA0CTL1 &= ~UCSWRST ; // initialize USCI state machine IE2 |= UCA0RXIE ; // enable USCI_A0 RX interrupt __delay_cycles(22000) ; Welcome() ; // display the startup screen Naming(Mod1Name, '1') ; // name the modules Naming(Mod2Name, '2') ; Naming(Mod3Name, '3') ; Naming(Mod4Name, '4') ; HomeScreen() ; __bis_SR_register(LPM4_bits + GIE); // enter LPM0, interrupts enabled } #pragma vector=USCIAB0RX_VECTOR __interrupt void USCI0RX_ISR(void) { int Signal = UCA0RXBUF ; int Enable, i ; char ModuleName[8] ; if ((Signal & 0xF0) == 0x00) { for (i = 0; i < 8; i++) { ModuleName[i] = Mod1Name[i] ; } Enable = Mod1En ; } else if ((Signal & 0xF0) == 0x10) { for (i = 0; i < 8; i++) { ModuleName[i] = Mod2Name[i] ; } Enable = Mod2En ; } else if ((Signal & 0xF0) == 0x20) { for (i = 0; i < 8; i++) { ModuleName[i] = Mod3Name[i] ; } Enable = Mod3En ; } else if ((Signal & 0xF0) == 0x30) { for (i = 0; i < 8; i++) { ModuleName[i] = Mod4Name[i] ; } Enable = Mod4En ; }

Page 18: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 18/32

if ((Signal & 0x0F) == 0x00) Motion(ModuleName, 'N', Enable) ; else if ((Signal & 0x0F) == 0x01) Motion(ModuleName, 'E', Enable) ; else if ((Signal & 0x0F) == 0x02) Motion(ModuleName, 'S', Enable) ; else if ((Signal & 0x0F) == 0x03) Motion(ModuleName, 'W', Enable) ; else if ((Signal & 0x0F) == 0x04) Sound(ModuleName, Enable) ; } #pragma vector=PORT1_VECTOR __interrupt void Port_1(void) { int exit = 0 ; if (P1IN & 0x01) { HomeScreen() ; __delay_cycles(4000000) ; } else if (P1IN & 0x02) { __delay_cycles(4000000) ; Menu() ; int option = 1 ; while (exit == 0) { if (0x01 & P1IN) { HomeScreen() ; exit = 1 ; } else if (0x80 & P4IN) { if (option == 1) { lcd_command(0x80) ; lcd_char(' ') ; lcd_command(0x94) ; lcd_char(0x7E) ; option = 3 ; } else if (option == 2) { lcd_command(0xC0) ; lcd_char(' ') ; lcd_command(0x80) ; lcd_char(0x7E) ; option = 1 ; } else if (option == 3) { lcd_command(0x94) ; lcd_char(' ') ; lcd_command(0xC0) ; lcd_char(0x7E) ; option = 2 ; } __delay_cycles(4000000) ; } else if (0x40 & P4IN) { if (option == 1) { lcd_command(0x80) ;

Page 19: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 19/32

lcd_char(' ') ; lcd_command(0xC0) ; lcd_char(0x7E) ; option = 2 ; } else if (option == 2) { lcd_command(0xC0) ; lcd_char(' ') ; lcd_command(0x94) ; lcd_char(0x7E) ; option = 3 ; } else if (option == 3) { lcd_command(0x94) ; lcd_char(' ') ; lcd_command(0x80) ; lcd_char(0x7E) ; option = 1 ; } __delay_cycles(4000000) ; } else if (0x02 & P1IN) { if (option == 1) { lcd_command(0x08) ; exit = 1 ; } else if (option == 2) { Naming(Mod1Name, '1') ; // name the modules Naming(Mod2Name, '2') ; Naming(Mod3Name, '3') ; Naming(Mod4Name, '4') ; option = 1 ; Menu() ; } else if (option == 3) { __delay_cycles(4000000) ; Mod1En = EnableDisable(Mod1Name, Mod1En) ; __delay_cycles(4000000) ; Mod2En = EnableDisable(Mod2Name, Mod2En) ; __delay_cycles(4000000) ; Mod3En = EnableDisable(Mod3Name, Mod3En) ; __delay_cycles(4000000) ; Mod4En = EnableDisable(Mod4Name, Mod4En) ; option = 1 ; Menu() ; } __delay_cycles(4000000) ; } } P1IFG &= ~0x03; // P1 IFG cleared

Page 20: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 20/32

} } void Welcome(void) { lcd_char('W') ; lcd_char('i') ; lcd_char('r') ; lcd_char('e') ; lcd_char('l') ; lcd_char('e') ; lcd_char('s') ; lcd_char('s') ; lcd_char(' ') ; lcd_char('D') ; lcd_char('i') ; lcd_char('s') ; lcd_char('t') ; lcd_char('u') ; lcd_char('r') ; lcd_char('b') ; lcd_char('a') ; lcd_char('n') ; lcd_char('c') ; lcd_char('e') ; lcd_command(0xC0) ; lcd_char('M') ; lcd_char('o') ; lcd_char('n') ; lcd_char('i') ; lcd_char('t') ; lcd_char('o') ; lcd_char('r') ; lcd_char('i') ; lcd_char('n') ; lcd_char('g') ; lcd_char(' ') ; lcd_char('N') ; lcd_char('e') ; lcd_char('t') ; lcd_char('w') ; lcd_char('o') ; lcd_char('r') ; lcd_char('k') ; lcd_command(0x94) ; lcd_char('C') ; lcd_char('o') ; lcd_char('p') ; lcd_char('y') ; lcd_char('r') ; lcd_char('i') ;

Page 21: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 21/32

lcd_char('g') ; lcd_char('h') ; lcd_char('t') ; lcd_char(' ') ; lcd_char('(') ; lcd_char('c') ; lcd_char(')') ; lcd_char(' ') ; lcd_char('2') ; lcd_char('0') ; lcd_char('1') ; lcd_char('2') ; lcd_command(0xD4) ; lcd_char('C') ; lcd_char('o') ; lcd_char('v') ; lcd_char('e') ; lcd_char('r') ; lcd_char('t') ; lcd_char(' ') ; lcd_char('G') ; lcd_char('a') ; lcd_char('t') ; lcd_char('o') ; lcd_char('r') ; lcd_char('s') ; __delay_cycles(48000000) ; lcd_command(0x01) ; lcd_command(0x02) ; } char Increment(char input) { char output ; if (input == ' ') output = 'A' ; else if (input == 'Z') output = '0' ; else if (input == '9') output = ' ' ; else output++ ; return output ; } char Decrement(char input) { char output ; if (input == ' ') output = '9' ; else if (input == 'A') output = ' ' ; else if (input == '0') output = 'Z' ; else output-- ; return output ; } void Naming(char ModuleName[8], char ModuleNumber) {

Page 22: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 22/32

lcd_command(0x0E) ; // enable cursor int clear = 1 ; int init = 1 ; while (clear == 1) { int i = 0 ; int done = 0 ; lcd_command(0x01) ; lcd_command(0x02) ; lcd_char('N') ; lcd_char('a') ; lcd_char('m') ; lcd_char('e') ; lcd_char(' ') ; lcd_char('o') ; lcd_char('f') ; lcd_char(' ') ; lcd_char('M') ; lcd_char('o') ; lcd_char('d') ; lcd_char('u') ; lcd_char('l') ; lcd_char('e') ; lcd_char(' ') ; lcd_char(ModuleNumber) ; lcd_char(':') ; lcd_command(0xD6) ; lcd_char('A') ; lcd_char('c') ; lcd_char('c') ; lcd_char('e') ; lcd_char('p') ; lcd_char('t') ; lcd_command(0xE0) ; lcd_char('C') ; lcd_char('l') ; lcd_char('e') ; lcd_char('a') ; lcd_char('r') ; lcd_command(0xC0) ; if (init == 1) { int j ; for (j = 0; j < 8; j++) { lcd_char(ModuleName[j]) ; } __delay_cycles(4000000) ; while (init == 1) { if (0x02 & P1IN) { //Accept done = 1 ; clear = 0 ; init = 0 ;

Page 23: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 23/32

} if (0x01 & P1IN) { //Clear for (j = 0; j < 8; j++) { ModuleName[j] = ' ' ; } done = 1 ; clear = 1 ; init = 0 ; } } __delay_cycles(4000000) ; } while(done == 0){ if (0x80 & P4IN) { //Up ModuleName[i] = Increment(ModuleName[i]) ; lcd_char(ModuleName[i]) ; lcd_command(0x10) ; __delay_cycles(4000000) ; } if (0x40 & P4IN) { //Down ModuleName[i] = Decrement(ModuleName[i]) ; lcd_char(ModuleName[i]) ; lcd_command(0x10) ; __delay_cycles(4000000) ; } if ((0x08 & P1IN) && (i < 7)) { //Right lcd_command(0x14) ; i++ ; __delay_cycles(4000000) ; } if (0x04 & P1IN) { //Left lcd_command(0x10) ; i-- ; __delay_cycles(4000000) ; } if (0x02 & P1IN) { //Enter done = 1 ; clear = 0 ; __delay_cycles(4000000) ; } if (0x01 & P1IN) { //Clear int j ; for (j = 0; j < 8; j++) { ModuleName[j] = ' ' ; } done = 1 ; clear = 1 ; __delay_cycles(4000000) ; } }

Page 24: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 24/32

} lcd_command(0x0C) ; // disable cursor } void HomeScreen() { lcd_command(0x0C) ; lcd_command(0x01) ; lcd_command(0x02) ; lcd_command(0x84) ; lcd_char('*') ; lcd_char('A') ; lcd_char('l') ; lcd_char('l') ; lcd_char(' ') ; lcd_char('C') ; lcd_char('l') ; lcd_char('e') ; lcd_char('a') ; lcd_char('r') ; lcd_char('!') ; lcd_char('*') ; lcd_command(0xD7) ; lcd_char('M') ; lcd_char('e') ; lcd_char('n') ; lcd_char('u') ; } void Menu() { lcd_command(0x0C) ; lcd_command(0x01) ; lcd_command(0x02) ; lcd_char(0x7E) ; lcd_char('S') ; lcd_char('l') ; lcd_char('e') ; lcd_char('e') ; lcd_char('p') ; lcd_command(0xC1) ; lcd_char('R') ; lcd_char('e') ; lcd_char('n') ; lcd_char('a') ; lcd_char('m') ; lcd_char('e') ; lcd_char(' ') ; lcd_char('M') ; lcd_char('o') ; lcd_char('d') ; lcd_char('u') ;

Page 25: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 25/32

lcd_char('l') ; lcd_char('e') ; lcd_char('s') ; lcd_command(0x95) ; lcd_char('E') ; lcd_char('n') ; lcd_char('/') ; lcd_char('D') ; lcd_char('i') ; lcd_char('s') ; lcd_char('a') ; lcd_char('b') ; lcd_char('l') ; lcd_char('e') ; lcd_char(' ') ; lcd_char('M') ; lcd_char('o') ; lcd_char('d') ; lcd_char('u') ; lcd_char('l') ; lcd_char('e') ; lcd_char('s') ; lcd_command(0xD6) ; lcd_char('E') ; lcd_char('n') ; lcd_char('t') ; lcd_char('e') ; lcd_char('r') ; lcd_command(0xE1) ; lcd_char('E') ; lcd_char('x') ; lcd_char('i') ; lcd_char('t') ; } int EnableDisable(char ModuleName[8], int ModEnable) { int done = 0 ; lcd_command(0x01) ; lcd_command(0x02) ; lcd_char(ModuleName[0]) ; lcd_char(ModuleName[1]) ; lcd_char(ModuleName[2]) ; lcd_char(ModuleName[3]) ; lcd_char(ModuleName[4]) ; lcd_char(ModuleName[5]) ; lcd_char(ModuleName[6]) ; lcd_char(ModuleName[7]) ; lcd_command(0xC0) ; lcd_char('E') ; lcd_char('n') ;

Page 26: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 26/32

lcd_char('a') ; lcd_char('b') ; lcd_char('l') ; lcd_char('e') ; lcd_char(' ') ; lcd_char('o') ; lcd_char('r') ; lcd_char(' ') ; lcd_char('d') ; lcd_char('i') ; lcd_char('s') ; lcd_char('a') ; lcd_char('b') ; lcd_char('l') ; lcd_char('e') ; lcd_char('?') ; lcd_command(0xD5) ; lcd_char('E') ; lcd_char('n') ; lcd_char('a') ; lcd_char('b') ; lcd_char('l') ; lcd_char('e') ; lcd_command(0xE0) ; lcd_char('D') ; lcd_char('i') ; lcd_char('s') ; lcd_char('a') ; lcd_char('b') ; lcd_char('l') ; lcd_char('e') ; while(done == 0) { if (0x02 & P1IN) { ModEnable = 1 ; done = 1 ; } if (0x01 & P1IN) { ModEnable = 0 ; done = 1 ; } } return ModEnable ; } void Alert() { lcd_command(0x01) ; lcd_command(0x02) ; lcd_command(0x0C) ; lcd_char('*') ; lcd_char('*') ;

Page 27: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 27/32

lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('A') ; lcd_char('L') ; lcd_char('E') ; lcd_char('R') ; lcd_char('T') ; lcd_char('!') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; lcd_char('*') ; } void Motion(char ModuleName[8], char Direction, int Enable) { if (Enable == 1) { P2OUT = 0x02 ; Alert() ; lcd_command(0xC0) ; lcd_char('M') ; lcd_char('o') ; lcd_char('t') ; lcd_char('i') ; lcd_char('o') ; lcd_char('n') ; lcd_char(' ') ; lcd_char(Direction) ; lcd_char(' ') ; lcd_char('o') ; lcd_char('f') ; lcd_char(' ') ; lcd_char(ModuleName[0]) ; lcd_char(ModuleName[1]) ; lcd_char(ModuleName[2]) ; lcd_char(ModuleName[3]) ; lcd_char(ModuleName[4]) ; lcd_char(ModuleName[5]) ; lcd_char(ModuleName[6]) ; lcd_char(ModuleName[7]) ; lcd_command(0xD7) ; lcd_char('M') ; lcd_char('e') ; lcd_char('n') ; lcd_char('u') ;

Page 28: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 28/32

lcd_command(0xE1) ; lcd_char('C') ; lcd_char('l') ; lcd_char('e') ; lcd_char('a') ; lcd_char('r') ; __delay_cycles(8000000) ; P2OUT = 0x00 ; } } void Sound(char ModuleName[8], int Enable) { if (Enable == 1) { P2OUT = 0x02 ; Alert() ; lcd_command(0xC0) ; lcd_char('N') ; lcd_char('o') ; lcd_char('i') ; lcd_char('s') ; lcd_char('e') ; lcd_char(' ') ; lcd_char('a') ; lcd_char('t') ; lcd_char(' ') ; lcd_char(ModuleName[0]) ; lcd_char(ModuleName[1]) ; lcd_char(ModuleName[2]) ; lcd_char(ModuleName[3]) ; lcd_char(ModuleName[4]) ; lcd_char(ModuleName[5]) ; lcd_char(ModuleName[6]) ; lcd_char(ModuleName[7]) ; lcd_command(0xD7) ; lcd_char('M') ; lcd_char('e') ; lcd_char('n') ; lcd_char('u') ; lcd_command(0xE1) ; lcd_char('C') ; lcd_char('l') ; lcd_char('e') ; lcd_char('a') ; lcd_char('r') ; __delay_cycles(8000000) ; P2OUT = 0x00 ; } } APPENDIX C: DESIGN SCHEMATICS

Page 29: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 29/32

Wireless Module

Page 30: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 30/32

Page 31: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 31/32

Handheld Unit

Page 32: Wireless Disturbance Monitoring Network

University of Florida EEL4924 Spring 2012 22 April 2012 Electrical and Computer Engineering Team: Covert Gator Page 32/32