Академический Документы
Профессиональный Документы
Культура Документы
Presented to:
Dr. Teague, Class Administrator
Dr. Fierro, Group Mentor
Ben Lee
Kazi Islam
Josh Wheeler
Julius Marpaung
EXECUTIVE SUMMARY
The search and rescue robot is probably one of the most talked about technologies in today’s
world. These days, when the world is full of natural calamities, terrorist attacks, and unfortunate
incidents, the search and rescue robot is standing shoulder to shoulder with humanity.
A search and rescue robot can have many features. One of the most important features that our
search and rescue robot has is a camera that is mounted on top of our robot. This camera can be
used to see where our vehicle is going and visually assess the environment. The robot has
sensors to send continuous streams of data in terms of humidity, temperature, and pressure. This
particular search and rescue robot can be driven using the keyboard arrow keys, by entering the
direction and duration of time that the vehicle should move in this direction, or by using voice
commands.
This search and rescue robot costs just under $400.00. There are several features that can be
added to a search and rescue robot according to the intended use of the robot. Up to 15 sensors
could be utilized on our current search and rescue robot without changing which microcontroller
is used. This would allow up to 11 more sensors to be added to the current search and rescue
robot. Adding a sensor that detects explosive vapors in the air would make our robot better
equipped for detecting bombs, and our robot’s size and shape make it perfect to maneuver in
these types of situations.
There are many groups who are interested in search and rescue robots. The Department of
Intelligence for the U.S government is working closely with groups of robotic engineers all over
the country in developing the search and rescue robot. Therefore, they could be a primary target
to market our product. Also, fire departments from all over the country, as well as other rescue
organizations, could be interested in our robot.
The search and rescue robot is no longer a luxury item. Instead, it is a resource that can be used
by many. Overall, the findings in this report show that there are ample reasons to develop search
and rescue robots and much work remains to be done. Due to the rise of war all around the
world, natural disasters such as earthquakes and tornadoes, and various types of terrorist attacks
nationally, as well as internationally, development of search and rescue robots are essential.
Page ii
ABSTRACT
The search and rescue robot has a suite of sensors as well as a video camera to accurately assess
a given environment. The sensors used for this search and rescue robot take data with respect to
temperature, relative humidity, and barometric pressure. The sensor values are sent to a
microcontroller (PIC16F876), which takes the analog voltage values and converts them into 10-
bit digital values. The PIC then sends each digital value to the TXM-916-ES transmitter. This
transmitter sends the value wirelessly to the RXM-916-ES receiver. The receiver then sends the
data to the MAX232 chip, which changes the voltage values from 0 (for low) to -9 and 5 (for
high) to +9 volts. This was necessary to allow the values to be read into the serial port of the
base computer. The base computer then changes the three 10-bit sensor values back to analog
voltages. After the conversion back to analog, the base computer then applies each of the analog
voltages to the appropriate equations (specified in the data sheets) to provide the correct
temperature, humidity, and pressure readings. Once the correct readings have been determined,
the base computer then outputs these values to the screen at a user-defined refresh rate. The
graphical user interface also allows the user to log the given sensor data, either automatically at
the user-defined refresh rate or manually at the user’s request.
The next step in designing the search and rescue robot was to control the robot from the
computer. Originally, the robot was going to be controlled via the remote control that was
provided with the vehicle. The team decided that the vehicle should be controlled from the
computer, which would allow us to have more control of the robot. Using reverse engineering,
the existing circuitry from the vehicle was used to control the robot. The team then added code
to the program that would allow the user to control the robot in three different ways. First, the
arrow keys on the keyboard can be used to maneuver the robot. Second, the user has the option
to select the direction of motion and specify the duration of time that the robot should move in
this direction. Third, the robot can be controlled by speaking a specific set of voice commands
into a microphone.
The initial project proposal stated that the search and rescue robot should be able to wirelessly
transmit data from a sensor array (temperature, humidity and pressure) and wirelessly transmit a
real-time video feed from the vehicle. The search and rescue robot was to be controlled by the
user to allow the user to move the vehicle in and around the area in which the user wishes to
collect information. The final results of the project meet and exceed all specifications that were
laid out in the project proposal.
Page iii
TABLE OF CONTENTS
EXECUTIVE SUMMARY ........................................................................................................................................ ii
ABSTRACT ............................................................................................................................................................... iii
LIST OF TABLES.......................................................................................................................................................v
LIST OF FIGURES................................................................................................................................................... vi
INTRODUCTION .......................................................................................................................................................1
BACKGROUND OF PROBLEM ....................................................................................................................................1
STATEMENT OF PROBLEM .......................................................................................................................................2
TECHNICAL DESCRIPTION ..................................................................................................................................3
SENSOR DATA ACQUISITION, TRANSMISSION, AND RECEPTION..............................................................................3
Sensors (Kazi Islam)........................................................................................................................................3
Interface (Ben Lee)..........................................................................................................................................6
Radio Frequency Transmission (Josh Wheeler)..............................................................................................7
Base Computer Station (Julius Marpaung) .....................................................................................................7
VIDEO TRANSMISSION AND RECEPTION (JOSH WHEELER) ......................................................................................7
CONTROL OF CAR....................................................................................................................................................8
On-Board Vehicle Reception and Control (Ben Lee) ......................................................................................8
Control of Hand-Held Remote Control Board via the Parallel Port (Ben Lee) ..............................................8
Control of Parallel Port on the Base Computer Station (Julius Marpaung)...................................................9
RESULTS................................................................................................................................................................11
PROBLEMS ENCOUNTERED ....................................................................................................................................11
BELIEVABILITY OF RESULTS .................................................................................................................................13
MODIFICATIONS TO THE ORIGINAL PROJECT .........................................................................................................13
SUMMARY AND CONCLUSIONS ........................................................................................................................14
REFERENCES ..........................................................................................................................................................16
APPENDIX A – TABLES AND FIGURES.............................................................................................................17
APPENDIX B – SARR OPERATION MANUAL ..................................................................................................21
SETUP ....................................................................................................................................................................21
SENSOR MEASUREMENTS ......................................................................................................................................21
CONTROL OPERATION ...........................................................................................................................................25
SHUTDOWN ...........................................................................................................................................................26
APPENDIX C – SARR SERVER/CLIENT OPERATION MANUAL.................................................................27
SERVER SETUP AND OPERATION ...........................................................................................................................27
CLIENT SETUP AND OPERATION ............................................................................................................................27
Page iv
LIST OF TABLES
TABLE 1: ARROW KEY CONTROL COMMANDS ..............................................................................................................9
TABLE 2: VOICE CONTROL COMMANDS .......................................................................................................................10
TABLE 3: RANGE SPECIFICATIONS ..............................................................................................................................11
TABLE 4: VIDEO SPECIFICATIONS ...............................................................................................................................11
TABLE 5: POWER CONSUMPTION.................................................................................................................................11
TABLE A-1: PIN DESIGNATIONS FOR THE HTM1505-ND ...........................................................................................18
TABLE B-1: ARROW KEY CONTROL COMMANDS ........................................................................................................25
TABLE B-2: VOICE CONTROL COMMANDS ...................................................................................................................26
Page v
LIST OF FIGURES
FIGURE 1: RH / VOLTAGE RELATIONSHIP OF THE HTM1505-ND.................................................................................4
FIGURE 2: TEMPERATURE / RESISTANCE RELATIONSHIP OF THE HTM1505-ND ..........................................................4
FIGURE 3: INTERNAL BLOCK DIAGRAM OF ASDX030A24R.........................................................................................5
FIGURE 4: PERFORMANCE CHARACTERISTICS OF THE ASDX030A24R .......................................................................6
FIGURE 5: SCHEMATIC OF HANDHELD CONTROLLER IMPLEMENTATION .......................................................................9
FIGURE A-1: HUMIDITY AND TEMPERATURE SENSOR (HTM1505-ND)......................................................................17
FIGURE A-2: PRESSURE SENSOR (ASDX030A24R)....................................................................................................17
FIGURE A-3: PIN-OUT DIAGRAM OF HTM1505-ND....................................................................................................17
FIGURE A-4: PIN OUT DIAGRAM OF ASDX030A24R..................................................................................................18
FIGURE A-5: DETAILED SCHEMATIC OF INTERFACE ....................................................................................................18
FIGURE A-6: DETAILED PIC PROGRAM FLOWCHART ..................................................................................................19
FIGURE A-7: SIMPLIFIED FLOWCHART OF THE SENSOR DISPLAY PORTION OF THE SARR PROGRAM .........................20
FIGURE B-1: SARR WINDOW IMMEDIATELY AFTER OPENING ....................................................................................22
FIGURE B-2: TRANSMITTER RECEIVER SYNCHRONIZATION WINDOW.........................................................................22
FIGURE B-3: SAMPLE LOG FILE ..................................................................................................................................23
FIGURE B-4: SARR TUTORIAL WINDOW ....................................................................................................................24
FIGURE B-5: ABOUT US WINDOW ...............................................................................................................................25
FIGURE C-1: SARR SERVER WINDOW ........................................................................................................................27
FIGURE C-2: CLIENT LOGIN WINDOW .........................................................................................................................28
FIGURE C-3: SARR CLIENT WINDOW.........................................................................................................................29
Page vi
INTRODUCTION
The following report was written to describe the efforts of four students enrolled in ECEN 4023
to accomplish a given design task. The proposed task was listed as a candidate project for the
class on the course website [1]. The description shown there is below.
In this project students are to design a wireless mobile sensor. The design consists of
three main components: (1) a mobile platform, (2) a suite of sensors, and (3) a wireless
communication link. Mobile robots/sensors are currently being used in many
applications ranging from space exploration, to battlefield assessment, to search and
rescue operations. The mobile robot designed under this project will be able to scan its
environment using vision and gather environmental information such as temperature,
humidity, barometric pressure, and possibly other values of interest. The vehicle will be
able to move based on commands sent over a wireless link from a remote user terminal.
Measured values, video, and status will be returned and displayed on the user terminal in
real time over the wireless link.
The original idea of the project began in the concluding weeks of ECEN 4013. Three of the
team members proposed a wireless mobile sensor that would measure the temperature, humidity,
and pressure. As time progressed, the idea evolved into a search and rescue robot. A camera
was needed to provide drivability for the car. When the teams were assigned for the course, the
above description was given as a pattern to follow. Dr. Rafael Fierro, the team’s “Project
Mentor”, held meetings with the team to finalize the project requirements, which were later laid
out in the Project Proposal. In these meetings it was decided that, due to the complexity of the
project, a working remotely-controlled car would be purchased to use for the design. In addition,
the video sending and receiving equipment would be purchased as a complete unit.
After delivering the Project Proposal, the team began designing. The final prototype includes a
radio-controlled car equipped with a camera and temperature, humidity, and pressure sensors.
The car sends video and sensor information to the base computer, while the base computer
controls the car. All this is done wirelessly. The base computer program has many features
including logging capability, fixed-duration control commands, and voice activated control, all
while receiving real-time video and sensor data.
Background of Problem
Although the prototype has a relatively small range of operation and was not made to handle
rough terrain, the idea provides a layout for many applications. Two main applications of the
design that would require some small alterations of the prototype are search and rescue
operations and bomb detection systems.
Page vii
First, the purpose of the search and rescue aspect would be to send the robot into places where
people do not have access, because of rugged terrain or harsh conditions, and bring something
back. The object of retrieval could be information in the form of video and sensor data, or it
could be actual objects, in which case the car would need to be equipped with adequate
mechanical retrieval devices. This would allow rescue workers to work effectively and
efficiently.
Second, the prototype could be altered to detect bombs in parking lots. With an additional
camera on board, perhaps with pan and tilt capabilities, the vehicle could be driven through
parking lots to search for explosive devices under cars. Applications for this technology are
numerous. It would be valuable at crowded sporting events that may be high risk for terrorist
attack, where several replicas could be employed on random parking lot checks. Also, it could
be used at high security checkpoints for military or other governmental departments. While
some personnel are checking drivers’ identifications, other personnel could be operating the
search and rescue robot in order to check the drivers’ cars for explosives.
Statement of Problem
As stated in the project proposal, the search and rescue robot should send temperature, humidity,
and barometric pressure values from the environment in which the robot is introduced back to a
base computer. The search and rescue robot could ideally be used in places that would not be
safe for a human to enter. Due to the nature of the design, a wireless camera is needed to allow
the user to see real-time video of the area in question, which would then allow the user to assess
the potentially dangerous situation accurately. With the real-time video installed, the user would
be able to maneuver the robot using only the video, rather than needing a direct line of sight to
the robot.
The next aspect of the search and rescue robot would be the wireless transmission of the sensor
data to the user. The user should be able to login at a base computer and have reliable real-time
information from the sensors, as well as the camera. This information must be real-time to allow
the user to make quick decisions about a possibly harsh environment, such as a fire or rapidly
decreasing temperatures. The user must be able to maneuver the robot into a harsh environment,
while avoiding obstacles, take data from the environment, and then maneuver out of the
environment. So, complex control commands would also be helpful.
Page viii
TECHNICAL DESCRIPTION
Specifications of HTM1505-ND
The specifications of this sensor are found in [2]. The HTM1505-ND has a solid patented
structure. As the design project is a search and rescue robot, it is necessary for the body structure
of this sensor to be able to be in any place under any hazardous situation. It has high resistance to
chemicals, and it is capable enough to work in acidic, salty, or any other harsh chemical
environment. This particular sensor is not light sensitive, which was an important goal for our
project as light should not be an issue for a search and rescue robot. The temperature range for
this particular sensor reads from -30°C to +85°C, and the humidity range for this sensor is 1% to
99% RH. The maximum supply voltage is 5 Volts DC, and the accuracy of both the humidity
and temperature readings after calibration is ±5% at 10% to 95% RH at 23°C or room
temperature. This device is not protected against reversed polarity, so it is always good to check
the connection of the pins before connecting this sensor to any electronic device. A detailed
schematic and table of the pin-out designations has been included in Appendix A, as Figure A-3
and Table A-1.
The HTM1505 is a humidity and temperature transducer designed to get accurate measurements.
Basically, a direct interface with a micro-controller is made possible with the module’s linear
voltage output for humidity and direct NTC outputs for temperature. Temperature in this sensor
is measured with respect to resistance, and humidity is measured with respect to voltage.
Page ix
Humidity vs. Voltage
100
The above graph shows that the plot of voltage vs. relative humidity is a linear curve, as it was
expected.
90
Temperature (deg C)
70
50
30
10
-10
-30
0 20 40 60 80 100 120
Resistance (k-Ohms)
The plot of resistance vs. temperature shows that the greater the temperature, the lesser the
resistance is for this particular sensor. Both of these graphs are obtained from data or equations
given in the data sheets.
Page x
Pressure Sensor (ASDX030A24R)
The part number of the pressure sensor that was used is ASDX030A24R. The sensor is
manufactured by Invensys Sensor Systems, which has become a part of Honeywell Sensing and
Control, and was purchased from Digikey for $30.00. This sensor was selected based on its
characteristics such as its maximum output voltage, operating mode, lifetime, and the % error
after it is calibrated by the manufacturer, which is listed below.
Specifications of ASDX030A24R
The specifications of this sensor are found in [3]. The ASDX030A24R has a solid patented
structure. As the design project is a search and rescue robot, it is necessary that the body
structure of this sensor is capable enough to be in any place under any hazardous situation. It has
high resistance to chemicals, and it is capable enough to work in acidic, salty, or any other harsh
chemical environment. This particular sensor is not light sensitive, and that was an important
goal for our project as light should not be an issue for a search and rescue robot. The operating
temperature range for this particular sensor is -20°C to +105°C, and it can measure from 0 PSI to
30 PSI. The maximum supply voltage is 5.25 volts DC, and the maximum output current is 2
mA from source. The accuracy to measure pressure after calibration is ±2% at capable
surroundings. The ASDX030A24R is not protected against reversed polarity, so it is always
good to check the connection of the pins before connecting this sensor to any electronic device.
A schematic of the pin-out designations has been included in Appendix A, Figure A-4.
According to the Figure 3, to work properly this particular sensor needs at least 220nF between
the supply voltage and GND. This 220nF capacitor is not internally built and the user needs to
provide it while designing the circuit and using this sensor. We used a 1uF capacitor between
the supply voltage and GND for our application. Faults in accuracy of this pressure sensor are
due to the combined errors of offset and span calibrations, linearity, pressure hysteresis, and
temperature effects.
Page xi
Performance characteristic of this sensor is shown in Figure 4. This figure shows the error band
multiplier from -20°C to +105°C, as the operating temperature range for this sensor is from -
20°C to +105°C.
The PIC16F876 was chosen to perform the interfacing. It designates five pins for 10-bit ADCs.
With the sensor ranges listed in the Sensors section, 10-bit conversions allow for an accuracy of
0.107 °C, 0.029 PSI, and 0.096 %RH. This provides more accuracy than the sensors are capable
of.
Five pins are designated for ADCs, but unless more than one timer is used, only one pin may be
read at a time with accuracy. Because of this, a single pin (pin A0) was used to read in the
analog sensor values, while four other pins switched between temperature, humidity, pressure,
and the supply voltage (used for low battery detection). N-channel MOSFETs were
implemented as switches, and pins B2, B4, B5, and B6 were used to control the gates. When no
switch was on the ADC input was tied low through a 2.2 kΩ pull-down resistor. A detailed
schematic of the interface circuit board has been included in Appendix A as Figure A-5.
Once the PIC has stored the 10-bit sensor values as integers, they are converted to strings, and
appended to an array. The format of the string array is, “X,ABCD,”. The letter, X, can be a P,
T, or H, standing for pressure, temperature, and humidity respectively. The letters, ABCD,
represent a 10-bit decimal integer holding the sensor information of the preceding letter X.
The time that it takes to acquire each sensor value and send the string is less than 4.33 ms.
Therefore, all three sensors will be updated every 13 ms, but each sensor is sent separately. The
time value is calculated from the 19200 baud rate (~ 52 µs per bit). The string contains 7
Page xii
character bytes. Three sensors are sent, and a delay of 1ms is employed for each sensor in order
to get accurate ADC values.
Pin C6 on the PIC will be used to send the sensor data serially to the transmitter. Pins B0 and B1
will be used to light a “Power On” LED and a “Low Battery” LED, respectively.
The PIC has been programmed using the hex file obtained from the PIC-C compiler. The
programming was in the PIC-C language, which is an adaptation of the C language for use with
PICs. The hex file was then loaded onto the PIC through a boot loader. Using the boot loader
required loading a preliminary hex file onto the PIC through a PIC StartPlus Programmer. A
detailed flowchart of the interfacing program is shown in Appendix A in Figure A-6.
After the serial data has been recovered by the receiver, it must be passed through a MAX232
chip before being imported into the base computer’s serial port. The MAX232 chip changes the
values for logic ‘0’ and logic ‘1’, from 0 V and +5 V, to -9 V and +9 V, respectively.
Page xiii
comes with a battery pack, which is mounted on the vehicle along with the camera. The video
receiver we used for our camera is the X10 series receiver (Model VR36A). The receiver
converts the signals back to video signals, which are to be sent to a TV or VCR. However, to
retrieve the signal from the PC we also needed a USB video capture adapter. The adapter allows
the receiver to send the signal directly to the USB port of the PC. We then use the XRay Vision
software, which was provided with the camera, to view the real-time video feed in ‘Preview’
mode.
Control of Car
Although the vehicle was purchased as a working remote control car, the team decided to control
the car from the parallel port of the base computer. This would allow a more integrated system,
and less confusion. Plus, the computer could then be used to achieve complex control
commands. This section explains the implementation of the control mechanisms.
Control of Hand-Held Remote Control Board via the Parallel Port (Ben Lee)
The original handheld remote control contained one internal PCB. This PCB allows only one
forward/backward speed and one left/right turning radius. The board worked by making physical
connections between copper traces on the board when the user slid a connector across these
traces. The handheld box contained mechanical levers used to make the connections on the
board. There was one connection for forward, backward, left, and right. In addition, due to the
placement of the traces, the forward and backward connections could not be made at the same
time, and the right and left connections could not be made at the same time.
In order to model the mechanical control of the device with the parallel port, n-channel
MOSFETs are used to switch the connections on and off. The parallel port controls the gates of
the MOSFETs (Backward, Forward, Left, and Right) as shown below in Figure 5.
Page xiv
Handheld PCB
Backward
Forward
Right Left
To use the arrow keys a user may press any combination of ↑, ↓, ←, and →. However, to protect
the handheld PCB against unrealizable operations (such as forward/backward), some
combinations produce no results. Below, Table 1 shows the possible arrow key combinations
and their results.
Command Function
↑ Move the robot Straight Forward
↓ Move the robot Straight Backward
↑ and ← Move the robot Forward Left
↑ and → Move the robot Forward Right
↓ and ← Move the robot Backward Left
↓ and → Move the robot Backward Right
All Other Combinations Do Nothing
The user can also move the robot by specifying the direction of the robot and the time duration of
the movement. The time must be given as an integer with units of milliseconds. The user can
choose one of six movement options available: straight forward, forward left, forward right,
straight backward, backward left, and backward right. The program will not allow the user to
Page xv
choose more than one option at a time so that the program does not give unusable results. Once
the user specifies the direction of the robot and the duration of the movement, he/she must press
the “Run” button. This button will then carry the desired instruction out, while disabling the
duration movement options and the arrow key controls. After the program finishes doing the
desired task, it will stop the robot and re-enable the duration movement options and arrow key
controls. To stop the robot while the computer is carrying out a time duration command, the user
can press the “Stop” command button. The “Stop” button will cancel the duration command and
enable the duration movement options and arrow key controls again.
The user can also use the voice commands to move the robot. Visual Basic software was used to
realize the voice commands. Voice command programming tips were found from [4]. To
operate in voice command mode, the arrow keys and duration commands must be disabled by the
appropriate voice command. Table 2 lists the commands that can be used to operate the vehicle
and the corresponding results.
Command Function
Enable Voice Command Enables voice command control of car; deactivates other control types
Disable Voice Command Disables voice command control of car; activates other control types
Straight Forward Move the robot Straight Forward indefinitely
Forward Left Move the robot Forward Left indefinitely
Forward Right Move the robot Forward Right indefinitely
Straight Backward Move the robot Straight Backward indefinitely
Backward Left Move the robot Backward Left indefinitely
Backward Right Move the robot Backward Right indefinitely
Stop Stop the robot
Page xvi
RESULTS
The project results include the following: 1) the vehicle prototype, 2) the receiver black box, 3)
the video receiving equipment, and 4) the base computer, server, and client software. The
vehicle is equipped with a wireless video camera, a mobile sensor unit, and a speed control
receiver. The receiver black box communicates to the base computer through the serial and
parallel ports, while the video receiver communicates through the USB port. The search and
rescue robot (SARR) software displays and records sensor values, while allowing the user to
directly control the vehicle. Some important specifications of the final project model are listed in
Tables 3 through 5.
Specification Result
Resolution 310 TV lines
Area Size 510 x 492
Shutter Speed 1/60th to 1/15000th second
Field of View 38.5°
Minimum Illumination 3 Lux
User Consumption
Sensors, Microcontroller, and Transmitter (9V) 240 mW
Receiver Module Positive Battery (9V) 470 mW
Receiver Module Negative Battery (9V) 90 nW
Problems Encountered
During the design process several issues emerged that created difficulties for the team. This
section lists these problems, some attempted solutions, and how well these solutions worked for
the project.
Page xvii
At the beginning of the project, the search for a relatively small wireless video camera that
provided good resolution and a fast transfer rate led to very expensive products. The team soon
learned that some trade-offs would be inevitable, if the team expected to maintain the original
proposed budget of $400. The trade-offs associated with the X10 camera are a slower transfer
rate, a smaller screen size, and a limited field-of-view. Despite these limitations, the X10
worked well for the project prototype.
However, the slower-than-expected video transfer rate sometimes caused the camera to black out
when the car was in motion. The team decided that this was unacceptable. Since a faster camera
was too expensive, the car would have to be slowed down. The speed controller onboard the car
was designed by the manufacturer for simple on/off speed control. Pulse width modulation
(PWM) was implemented from the base computer to allow the user to control the speed of the
car, but due to a deficiency in the speed controller, PWM was abandoned. Whenever a forward
pulse of short duration was sent, the car would move backward. Therefore, all control
commands using PWM resulted in backward motion, because all pulses are of short duration.
This deficiency can be seen, even now. When the user quickly taps the forward arrow key, the
car will jump backward a very short distance. In the final prototype the vehicle was slowed
down by decreasing the voltage to the drive motor.
Next, the microcontroller, or PIC, had limitations on the number of ADCs that it could perform
due to the limited number of timers. To solve this problem a switching circuit was introduced,
so that one pin and one timer could be used to measure all sensor voltages. This solution has
been described further in the Technical Description.
A very significant problem that was encountered was interference between the sensor
transmission and the control reception onboard the vehicle. The transmitter for the sensors
overpowered the control receiver of the car. The team did not anticipate this problem due to the
large difference in operating frequencies. The sensor transmitter operates at 916 MHz, and the
car control receiver operates at 49 MHz. The team was able to partially correct this problem by
reducing the output power of the sensor transmitter. Also, improvements in the control
transmitting antenna on the receiver black box provided some additional distance. Another
attempted solution included using high and low pass filters on the transmitter and receiver
onboard the car, but this offered very little improvement. As a result of this problem, the range
of the car (with the sensors operating) was limited to about one third of its potential.
Because the video software was purchased independently, it runs in its own window. The team
did not find a way to incorporate the video signal into the main program window. Therefore, the
video information cannot be viewed using the server/client program. If the video format could
have been altered to a format recognizable by Windows Media Player, this task could have been
accomplished. However, no solution to this problem was realized.
Finally, the prototype has been designed with three internal power supplies: one for the car
motors and speed controller, one for the camera, and one for the sensor transmission circuit. In
addition, two of these battery supplies are somewhat difficult to replace. This would be a simple
problem to fix, but due to time limitations the team has not implemented any solution to this
problem.
Page xviii
Believability of Results
In order to verify the accuracy of the sensor readings, three instruments were borrowed from
different academic departments at Oklahoma State University. A thermometer was used to
verify temperature measurements, a sling cyclometer was used to verify humidity measurements,
and a barometer was used to verify pressure measurements. In all three cases the measurements
were within the boundaries of error specified on the data sheet of each sensor and listed in the
Technical Description.
Second, the team has included a server/client program that allows a remote user (the client) to
login to the base computer station (the server), view real-time sensor information, and access the
vehicle control commands. Although the team did not find a way to implement the video into
the server/client program, the realization of remote user access for control and sensor
information is a big step toward a very useful accessory. An explanation of how to operate the
server/client program can be found in Appendix C.
Finally, the SARR software includes additional features that are useful when receiving sensor
data. The user can change the refresh rate of the screen and log segments of sensor and video
data. Further discussion of how this was implemented is explained in the Technical Description,
while a more detailed explanation of how to operate these features can be found in Appendix B.
Page xix
SUMMARY AND CONCLUSIONS
The project requirements stated that the search and rescue robot must be able to maneuver into
an environment and send information from that environment back to the user/operator. The
robot was expectd to wirelessly send temperature, humidity and pressure values, as well as
video, back to the base computer. The user/operator should be able to steer the robot through
obstacles while viewing only the video.
The team felt that the search and rescue robot contained four major sections: sensors,
microprocessor, transmitter/receiver, and base computer. The project was split into these four
sections and divided among the group members. The tasks assigned to each group member,
along with other tasks that arose along the way, are as follows:
The sensor array chosen for the project consisted of a temperature sensor, a pressure sensor, and
a humidity sensor. These sensors were to read real time data from the environment and make it
possible to send up-to-date information to the user at a base computer. Along with this sensor
array a wireless video camera was needed to provide a real time stream, which will allow the
user/operator to steer the car through various obstacles, without actually being in the area, while
attempting to gain information about the possibly hazardous environment.
The microprocessor was needed to perform analog to digital conversions on each of the three
sensor values. The microprocessor then packaged the data to be sent in a serial format (RS232)
to the base computer via the transmitter/receiver. Each package consists of an identifier (T, H, or
P) followed by a 10-bit decimal integer in string format. The microprocessor updates all three
sensor packages every 13 ms.
The transmitter takes this information and sends it wirelessly to the receiver which is located at
the base computer. The base computer then converts the 10-bit integer to a floating point
number representing the analog voltage. Then the base computer applies each analog voltage to
the appropriate equation to allow the data to be displayed with proper units. The base computer
also allows the user to maneuver the car via the arrow keys, by specifying direction and duration
of a command, or by the voice command box. In addition, the user has the option to log the data
automatically at a selected refresh rate or to manually log data at a specific instance. This gives
the user the ability to collect data from a given environment.
The final product consists of a sensor array and a video camera which is mounted on the robot.
The sensor information is sent to a black box that is connected to the computer via the serial port
of the base computer. The information is collected, interpreted, and sent to the screen
continuously by the base computer. The parallel port of the base computer is also connected to
the black box and is used to control the robot. The robot may be controlled by identifying the
Page xx
direction and duration of time that the robot should move in the specified direction, by using the
arrow keys, or by using a selection of voice commands.
Several improvements would have been implemented if the team had more time for the project.
The video screen could have been incorporated into the graphical user interface that is used to
control the robot and to output sensor information. This would allow the video screen to be
accessed in the server/client program. Also, a bi-directional transceiver could be used to control
the robot as well as send the sensor information. The bi-directional transceiver would solve the
interference problems between the sensor transmitter and the car’s receiver. Also, using the bi-
directional transceiver would allow commands to be sent to the PIC. Then the PIC could be used
to control the motors, which would allow for the removal of the original vehicle control unit, and
would provide the capacity for more control over the movement of the vehicle. Another possible
future improvement would be to combine both added battery supplies into one external battery
pack, which could be mounted on the outside of the vehicle. This would allow the user to access
the batteries without taking the vehicle apart.
In using the transmitter/receiver pair along with the sensor array that was mounted on the vehicle
we were able to provide a real-time mobile sensor unit. The video camera, which was also
mounted on the vehicle, allows the user to view the actual environment in which the vehicle is
navigating. The user is able to view and log the data that is being collected at the base computer.
Page xxi
REFERENCES
[1] Dr. Keith A. Teague, “Senior Design II,” August 2003, http://ecen4023.okstate.edu
[3] Honeywell Sensing and Control, “Honeywell Sensing and Control - Pressure Sensors,”
September 2003, http://content.honeywell.com/sensing/prodinfo/pressure_all
Page xxii
APPENDIX A – TABLES AND FIGURES
This appendix contains a variety of tables and figures referenced in the report, but not included
directly in the report.
Page xxiii
Table A-1: Pin Designations for the HTM1505-ND
Pin Function
Pin 1 NTC-Temperature
Pin 2 GROUND
Pin 3 Vcc- Voltage supply
Pin 4 Vout- Humidity
+5 V +5 V +5 V
Vpp PIC16F876 B7 1 uF
Connect A0 B6
to PIN B2
A1 B5
Connect A4 B2
to PIN B4
A5 B1
C1 C6
2X Ohms
C2 C5
Connect C3 C4
X Ohms to PIN B5 Serial Output
20 MHz
to Transmitter
15 pF 15 pF
Page xxiv
Turn on Turn off all
Power LED Sensor FETs
Convert Value to
Select Temperature Delay 1 Read Temperature De-select Temperature Send String
Temperature String
Sensor by turning on ms for Voltage and Assign Sensor by turning off out to
and Append to
Temperature FET accuracy to 10-bit Value Temperature FET Transmitter
String Array
Convert Value to
Select Pressure Delay 1 Read Pressure De-select Pressure Send String
Pressure String and
Sensor by turning on ms for Voltage and Assign Sensor by turning off out to
Append to String
Pressure FET accuracy to 10-bit Value Pressure FET Transmitter
Array
Convert Value to
Select Humidity Delay 1 Read Humidity De-select Humidity Send String
Humidity String and
Sensor by turning on ms for Voltage and Assign Sensor by turning off out to
Append to String
Humidity FET accuracy to 10-bit Value Humidity FET Transmitter
Array
No
No
Page xxv
Start Program
No
Quit Program?
Yes
Stop the
Program and
Close the
serial port
Figure A-7: Simplified Flowchart of the Sensor Display Portion of the SARR Program
Page xxvi
APPENDIX B – SARR OPERATION MANUAL
The setup, operation, and shutdown of the Search and Rescue Robot (SARR) is explained in the
following manual.
Setup
1. Users should have a computer equipped with one serial, parallel, and USB port, along with
Visual Basic 6.0 and X10 software installed.
2. Use a DB9 cable with one male and one female end to connect the serial port of the computer
and receiver black box. Use a DB25 cable with two male connectors to connect the parallel
port of the computer and receiver black box.
3. The user is given the option to use batteries or a power supply to power the receiver black
box.
a. To use batteries, flip the switch on the receiver black box to select the “Battery On”
option.
b. To use a power supply, feed +9 V, 0 V, and -9 V into the banana cable inputs, labeled
correspondingly.
The receiver black box is now ready to receive the input signal from the car and transmit
control commands from the computer.
4. To setup the receiver for the camera, connect the video receiver to the USB port of the
computer, and plug its adapter into any 120 VAC outlet. Turn on the switch located on the
side of the receiver.
5. There are 2 switches on the rear of the car. One of them labeled “Car”, and the other labeled
“Sensors and Camera”. To turn on the car, flip the switch to the ON position. The car is now
ready to receive the commands from the computer. To turn on the Sensors and Camera, flip
the switch to the ON position. The camera is transmitting now.
6. Run the X10 software from the desktop.
Sensor Measurements
Once the user finishes setting up the hardware, he/she can run the SARR program.
Page xxvii
Figure B-1: SARR Window immediately after opening
3. The user must choose the desired refresh rate of 13 ms, 100 ms, 500 ms, or 1000 ms to view
the sensor data. Once the user chooses the desired refresh rate, the program will periodically
output the incoming data to the screen.
4. The user can also log the incoming data, both manually and automatically.
a. To start logging data, the user must create a file where the data will be stored by
choosing the “Create File” option from the “Log” menu.
b. After a file has been created, the user can now choose whether to log the data
manually or automatically.
Page xxviii
c. To log the data manually, choose the option “Start Log” from the “Manual Log”
option under the “Log” menu. Toggle to the “Manual Retrieval” option on the
program. The “Get Data” command button will be enabled, allowing the user to log
the data anytime he/she wishes.
d. To log the data automatically, go to the option “Automatic Log” under “Log” menu
and choose one of the recording periods provided. These are the same values as the
refresh rates. The program will automatically start logging data immediately.
e. To stop logging the data, simply choose the option “Stop Log” from the “Log” menu.
A sample log file is shown in Figure B-3.
5. There are two options available on the “Help” menu: “Tutorial” and “About Us”.
a. Clicking the tutorial option will open a new window that briefly discusses how to use
the program. Figure B-4 shows the tutorial window for the SARR program.
Page xxix
Figure B-4: SARR Tutorial Window
b. The “About Us” option will pop up a new window introducing the members of this
team, as shown if Figure B-5.
Page xxx
Figure B-5: About Us Window
Control Operation
The user may control the robot one of three ways: 1) by using the arrow keys from the keyboard,
2) by sending a time-duration command, or 3) by using the voice activation commands.
1. To use the arrow keys a user may press any combination of ↑,↓,←, and →, to produce the
results listed in Table B-1.
Command Function
↑ Move the robot Straight Forward
↓ Move the robot Straight Backward
↑ and ← Move the robot Forward Left
↑ and → Move the robot Forward Right
↓ and ← Move the robot Backward Left
↓ and → Move the robot Backward Right
All Other Combinations Do Nothing
Page xxxi
2. The user can also move the robot by specifying the direction of the robot and the time
duration of the movement.
a. Enter the time as an integer with units of milliseconds in the duration box.
b. Next, choose one of the six movement options available: straight forward, forward
left, forward right, straight backward, backward left, and backward right.
c. Then press the “Run” button.
d. To stop the robot in motion, press the “Stop” button.
3. The user can also use the voice commands to move the robot. To operate in voice command
mode, the arrow keys and duration commands must be disabled by the appropriate voice
command. Table B-2 lists the commands that can be used to operate the vehicle and the
corresponding results.
Command Function
Enable Voice Command Enables voice command control of car; deactivates other control types
Disable Voice Command Disables voice command control of car; activates other control types
Straight Forward Move the robot Straight Forward indefinitely
Forward Left Move the robot Forward Left indefinitely
Forward Right Move the robot Forward Right indefinitely
Straight Backward Move the robot Straight Backward indefinitely
Backward Left Move the robot Backward Left indefinitely
Backward Right Move the robot Backward Right indefinitely
Stop Stop the robot
Shutdown
1. To close the serial port, simply choose the option “Close Serial Port” from the “File” menu.
2. To close the program, a user can choose the option “Quit” from the “File” menu or click the
X on the top right of the window. If the user closes the main window without closing the
serial port, the serial port will be closed automatically. Also, if the user closes the main
window while a log is being recorded, the program will automatically save the data written to
the file.
3. Finally, turn off the power supply for the receiver black box or flip the battery switch to the
off position on the receiver black box.
4. Turn off both switches on the car.
5. Turn off the switch on the video receiver.
Page xxxii
APPENDIX C – SARR SERVER/CLIENT OPERATION MANUAL
The setup, operation, and shutdown of the Search and Rescue Robot (SARR) Server and Client
programs are explained in the following manual.
Page xxxiii
then press the “Login” button. This will allow the SARR client program to connect to the
desired SARR server and verify the user name and password. Figure C-2 displays the Client
Login Window.
If the user name and password is valid, then the client program will open. The client program
differs from the original program in only one area. There are no open and close serial port
commands. These features have been replaced by “Relogin” and “Close Connection”. Choosing
“Relogin” from the “Client” menu will disconnect the server and client, and the user will have to
specify the Server IP address, user name, and password again. Choosing “Close Connection”
will disconnect the server and client, but will not initiate a re-login. To open a connection to the
server, the users must choose the option “Relogin” from the “Client” menu. Figure C-3 displays
the SARR Client Window.
Page xxxiv
Figure C-3: SARR Client Window
Page xxxv
APPENDIX D – BASE COMPUTER CODE (VISUAL BASIC)
Option Explicit
MSComm1.Settings = "19200,N,8,1"
MSComm1.RThreshold = 1
MSComm1.SThreshold = 1
MSComm1.InputLen = 0
bForward = True
bMoveCheck = True
bisup = False
bisdown = False
bisleft = False
bisright = False
intx = 0
intxup = 1
intxdown = 2
intxleft = 4
Page xxxvi
intxright = 8
intCountHeat = 0
intCountHeat1 = 100
intCountHeatLoop = 0
TimerRefresh.Enabled = False
TimerLog.Enabled = False
cmdGetManualData.Enabled = False
strmydata = ""
bLogManual = False
bFileOpen = False
bLogAutomatic = False
bVoiceCommand = False
Me.mnuRefresh.Enabled = False
Me.mnuLog.Enabled = False
Me.Height = Screen.Height
Me.Move 0, 0
Me.OptionCelcius.Value = True
Me.OptionReal.Value = True
Me.KeyPreview = True
End Sub
'This Sub is to close the serial port, stop the car and close the data log
once
'the program Is closed
If bFileOpen Then
Close #iFile
End If
End Sub
If bFileOpen Then
Close #iFile
End If
Page xxxvii
Me.CommonDialog1.FileName = "Log1.log"
Me.CommonDialog1.Filter = "Log File (*.log)|*.log|All Files (*.*)|*.*"
Me.CommonDialog1.FilterIndex = 0
Me.CommonDialog1.CancelError = True
Me.CommonDialog1.ShowSave
If Err.Number = 0 Then
If Len(Me.CommonDialog1.FileName) > 0 Then
iFile = FreeFile
Open Me.CommonDialog1.FileName For Output As #iFile
bFileOpen = True
End If
Else
Err.Clear
End If
On Error GoTo 0
End Sub
End Sub
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 10
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = True
Page xxxviii
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 100
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = True
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 500
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = False
mnuLog500ms.Checked = True
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 1000
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
Page xxxix
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = True
End If
End Sub
dblManualHumi = FormatNumber(dblHumidityRH, 3)
strManualHumiunit = " %RH"
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
Me.mnuOpenPort.Checked = True
Me.mnuClosePort.Checked = False
If MSComm1.PortOpen = False Then
MSComm1.PortOpen = True
Form4.Show
Me.TimerProgress.Enabled = True
Me.mnuFile.Enabled = False
Page xl
End If
End Sub
Unload Form4
Me.TimerRefresh.Enabled = True
Me.TimerProgress.Enabled = False
Me.mnuFile.Enabled = True
Me.mnuRefresh.Enabled = True
Me.mnuLog.Enabled = True
End Sub
Me.mnuOpenPort.Checked = False
Me.mnuClosePort.Checked = True
TimerRefresh.Enabled = False
Me.TimerRefresh.Interval = 0
TimerLog.Enabled = False
Me.mnuRefresh.Enabled = False
Me.mnuLog.Enabled = False
mnuNoRate.Checked = True
mnuRefresh10.Checked = False
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.txtTemp1.Text = ""
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.txtHum1.Text = ""
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.txtPress1.Text = ""
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Page xli
Me.txtTemp2.Text = ""
Me.txtHum2.Enabled = True
Me.txtHum2.Text = ""
Me.txtPress2.Enabled = True
Me.txtPress2.Text = ""
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtTemp3.Text = ""
Me.txtHum3.Enabled = True
Me.txtHum3.Text = ""
Me.txtPress3.Enabled = True
Me.txtPress3.Text = ""
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
End Sub
If bFileOpen Then
Close #iFile
End If
Unload Me
End Sub
TimerRefresh.Interval = 0
mnuNoRate.Checked = True
mnuRefresh10.Checked = False
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
End Sub
Page xlii
If TimerRefresh.Enabled = True Then
TimerRefresh.Interval = 13
mnuNoRate.Checked = False
mnuRefresh10.Checked = True
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
End If
End Sub
Displayme
End Sub
Page xliii
strmydata = MSComm1.Input
End If
If intnumberofdata = 3 Then
strmydata1 = Trim(strmydata1)
strmyarray1 = Split(strmydata1, ",")
intpackagecheck1 = UBound(strmyarray1)
intnumberofdata = 0
Calculatedata
strmydata1 = ""
End If
End If
End Sub
intdatacounter = intdatacounter + 1
Loop
End If
PackSensor
intdatacounter = 0
Page xliv
End Sub
End Sub
cmdGetManualData.Enabled = False
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = False
Me.lblHum2.Enabled = False
Me.lblPress2.Enabled = False
Me.txtTemp2.Enabled = False
Me.txtHum2.Enabled = False
Me.txtPress2.Enabled = False
Me.lblTemperature2.Enabled = False
Me.lblHumidity2.Enabled = False
Me.lblPressure2.Enabled = False
Me.txtTemp2.Text = ""
Me.txtHum2.Text = ""
Me.txtPress2.Text = ""
'Log Output
Me.lblLogTemp.Enabled = False
Me.lblLogHumi.Enabled = False
Me.lblLogPress.Enabled = False
Page xlv
Me.txtTemp3.Enabled = False
Me.txtHum3.Enabled = False
Me.txtPress3.Enabled = False
Me.lblTemperature3.Enabled = False
Me.lblHumidity3.Enabled = False
Me.lblPressure3.Enabled = False
Me.txtHum1.Text = FormatNumber(dblHumidityRH, 1)
cmdGetManualData.Enabled = True
End If
'Real Time
Me.lblTemp1.Enabled = False
Me.txtTemp1.Enabled = False
Me.lblTemperature1.Enabled = False
Me.lblHum1.Enabled = False
Me.txtHum1.Enabled = False
Me.lblHumidity1.Enabled = False
Me.lblPress1.Enabled = False
Me.txtPress1.Enabled = False
Me.lblPressure1.Enabled = False
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Me.txtHum2.Enabled = True
Me.txtPress2.Enabled = True
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Page xlvi
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtHum3.Enabled = True
Me.txtPress3.Enabled = True
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
Me.txtHum2.Text = FormatNumber(dblHumidityRH, 1)
End If
HeatBar
End Sub
Page xlvii
ElseIf dblTempC >= 20 And dblTempC < 30 Then
intCountHeat = 6
End If
Me.lblHeat(intCountHeatLoop).Visible = True
intCountHeatLoop = intCountHeatLoop + 1
Loop
intCountHeat1 = intCountHeat
End If
intCountHeatLoop = 0
End Sub
dblManualHumi = FormatNumber(dblHumidityRH, 1)
Me.txtHum3.Text = FormatNumber(dblHumidityRH, 1)
strManualHumiunit = " %RH"
Page xlviii
dblManualPress = FormatNumber(dblPressurePSI, 1)
Me.txtPress3.Text = FormatNumber(dblPressurePSI, 1)
strManualPressunit = " PSI"
ElseIf Me.OptionAtm.Value = True Then
dblManualPress = FormatNumber(dblPressureAtm, 1)
Me.txtPress3.Text = FormatNumber(dblPressureAtm, 1)
strManualPressunit = " Atm"
End If
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
GearTransition
End If
End Sub
Page xlix
intx = intx - intxup
End If
GearTransition
End If
End Sub
End Sub
'Straight Forward
If intx = 1 Then
Page l
Out Val("&H378"), Val(13)
bForward = True
Exit Sub
End If
'Forward Left
If intx = 5 Then
Out Val("&H378"), Val(9)
bForward = True
Exit Sub
End If
'Forward Right
If intx = 9 Then
Out Val("&H378"), Val(5)
bForward = True
Exit Sub
End If
'Straight Backward
If intx = 2 Then
Out Val("&H378"), Val(14)
bForward = False
Exit Sub
End If
'Backward Left
If intx = 6 Then
Out Val("&H378"), Val(10)
bForward = False
Exit Sub
End If
'Backward Right
If intx = 10 Then
Out Val("&H378"), Val(6)
bForward = False
Exit Sub
End If
End Sub
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Page li
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(9)
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(5)
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(13)
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(14)
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Page lii
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(10)
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Out Val("&H378"), Val(6)
Me.TimerCircleDuration.Enabled = True
End If
End Sub
Me.TimerCircleDuration.Enabled = False
Me.TimerCircleTurns.Enabled = False
Out Val("&H378"), Val(1)
If Me.OptionDuration.Value = True Then
Me.txtCircleDuration.Enabled = True
Me.cmdCircleDuration.Enabled = True
ElseIf Me.OptionTurns.Value = True Then
Me.txtCircleTurns.Enabled = True
Me.cmdCircleTurns.Enabled = True
End If
Me.OptionDuration.Enabled = True
Me.OptionTurns.Enabled = True
bMoveCheck = True
End Sub
Page liii
Private Sub VoiceCommand_PhraseFinish(ByVal flags As String, ByVal beginhi As
String, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long,
ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
'This Sub is to activate the voice command and move the car by the voice
command
Else
If Phrase <> "" Then
strVoiceCommand = strVoiceCommand & " " & Phrase
End If
End If
strVoiceCommand1 = Trim(strVoiceCommand)
Page liv
If strVoiceCommand1 = "Forward Right" Then
Out Val("&H378"), Val(5)
strVoiceCommand = ""
End If
End If
Me.txtVoice.Text = strVoiceCommand1
start:
If Err.Number <> 0 Then
MsgBox ("Error " & Err.Number & " , " & Err.Description)
End If
End Sub
Page lv
APPENDIX E – SARR SERVER CODE (VISUAL BASIC)
Option Explicit
MSComm1.Settings = "19200,N,8,1"
MSComm1.RThreshold = 1
MSComm1.SThreshold = 1
MSComm1.InputLen = 0
TimerRefresh.Enabled = False
TimerLog.Enabled = False
cmdGetManualData.Enabled = False
strmydata = ""
msg = ""
bConnection = False
bLogManual = False
bFileOpen = False
bLogAutomatic = False
Me.Height = Screen.Height
Page lvi
Me.Move 0, 0
Me.OptionCelcius.Value = True
Me.OptionReal.Value = True
Me.KeyPreview = True
Usera = "caesar"
Passa = "caesar"
Checkuserpass = 0
tcpServer.LocalPort = 3456
tcpServer.Listen
End Sub
ClosePort
tcpServer.Close
msg = ""
Unload Form2
Unload Form3
Unload Form5
End Sub
If bFileOpen Then
Close #iFile
End If
If Err.Number = 0 Then
If Len(Me.CommonDialog1.FileName) > 0 Then
iFile = FreeFile
Open Me.CommonDialog1.FileName For Output As #iFile
bFileOpen = True
End If
Else
Err.Clear
End If
On Error GoTo 0
Page lvii
End Sub
End If
End Sub
TimerLog.Enabled = False
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 10
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = True
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 100
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = True
Page lviii
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 500
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = False
mnuLog500ms.Checked = True
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 1000
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = True
End If
End Sub
Page lix
End If
dblManualHumi = FormatNumber(dblHumidityRH, 3)
strManualHumiunit = " %RH"
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
TimerRefresh.Enabled = True
TimerSendClient.Enabled = True
End Sub
TimerSendClient.Enabled = False
If bFileOpen Then
Close #iFile
End If
TimerRefresh.Enabled = False
TimerLog.Enabled = False
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.txtTemp1.Text = ""
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.txtHum1.Text = ""
Page lx
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.txtPress1.Text = ""
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Me.txtTemp2.Text = ""
Me.txtHum2.Enabled = True
Me.txtHum2.Text = ""
Me.txtPress2.Enabled = True
Me.txtPress2.Text = ""
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtTemp3.Text = ""
Me.txtHum3.Enabled = True
Me.txtHum3.Text = ""
Me.txtPress3.Enabled = True
Me.txtPress3.Text = ""
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
End Sub
'ClosePort
Unload Me
End Sub
TimerRefresh.Enabled = False
mnuNoRate.Checked = True
mnuRefresh10.Checked = False
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
End Sub
Page lxi
mnuRefresh10.Checked = True
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
End Sub
Displayme
End Sub
strmydata = MSComm1.Input
End If
Page lxii
If intnumberofdata = 3 Then
strmydata1 = Trim(strmydata1)
strmyarray1 = Split(strmydata1, ",")
intpackagecheck1 = UBound(strmyarray1)
Calculatedata
intnumberofdata = 0
strmydata1 = ""
End If
End If
End Sub
intdatacounter = intdatacounter + 1
Loop
End If
PackSensor
intdatacounter = 0
End Sub
Page lxiii
dblPressurePSI = 7.5 * (dblPressure1 - 0.5)
dblPressureAtm = 0.068 * dblPressurePSI
End Sub
cmdGetManualData.Enabled = False
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = False
Me.lblHum2.Enabled = False
Me.lblPress2.Enabled = False
Me.txtTemp2.Enabled = False
Me.txtHum2.Enabled = False
Me.txtPress2.Enabled = False
Me.lblTemperature2.Enabled = False
Me.lblHumidity2.Enabled = False
Me.lblPressure2.Enabled = False
Me.txtTemp2.Text = ""
Me.txtHum2.Text = ""
Me.txtPress2.Text = ""
'Log Output
Me.lblLogTemp.Enabled = False
Me.lblLogHumi.Enabled = False
Me.lblLogPress.Enabled = False
Me.txtTemp3.Enabled = False
Me.txtHum3.Enabled = False
Me.txtPress3.Enabled = False
Me.lblTemperature3.Enabled = False
Me.lblHumidity3.Enabled = False
Me.lblPressure3.Enabled = False
Me.txtHum1.Text = FormatNumber(dblHumidityRH, 1)
Page lxiv
If Me.OptionPSI.Value = True Then
Me.lblPressure1.Caption = "PSI"
Me.txtPress1.Text = FormatNumber(dblPressurePSI, 1)
ElseIf Me.OptionAtm.Value = True Then
Me.lblPressure1.Caption = "Atm"
Me.txtPress1.Text = FormatNumber(dblPressureAtm, 1)
End If
cmdGetManualData.Enabled = True
End If
'Real Time
Me.lblTemp1.Enabled = False
Me.txtTemp1.Enabled = False
Me.lblTemperature1.Enabled = False
Me.lblHum1.Enabled = False
Me.txtHum1.Enabled = False
Me.lblHumidity1.Enabled = False
Me.lblPress1.Enabled = False
Me.txtPress1.Enabled = False
Me.lblPressure1.Enabled = False
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Me.txtHum2.Enabled = True
Me.txtPress2.Enabled = True
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtHum3.Enabled = True
Me.txtPress3.Enabled = True
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
Page lxv
End If
Me.txtHum2.Text = FormatNumber(dblHumidityRH, 1)
End If
End Sub
dblManualHumi = FormatNumber(dblHumidityRH, 3)
Me.txtHum3.Text = FormatNumber(dblHumidityRH, 3)
strManualHumiunit = " %RH"
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
Page lxvi
Private Sub tcpServer_Close()
bConnection = False
ClosePort
tcpServer.Close
msg = ""
Checkuserpass = 0
tcpServer.Listen
End Sub
End Sub
tcpServer.GetData msg
End If
Movetherobot
End If
End Sub
Page lxvii
If Msgfromclient(0) = "Stop" Then
Out Val("&H378"), Val(1)
End If
If Msgfromclient(0) = "StraightForward" Then
Out Val("&H378"), Val(13)
End If
If Msgfromclient(0) = "ForwardLeft" Then
Out Val("&H378"), Val(9)
End If
If Msgfromclient(0) = "ForwardRight" Then
Out Val("&H378"), Val(5)
End If
If Msgfromclient(0) = "StraightBackward" Then
Out Val("&H378"), Val(14)
End If
If Msgfromclient(0) = "BackwardLeft" Then
Out Val("&H378"), Val(10)
End If
If Msgfromclient(0) = "BackwardRight" Then
Out Val("&H378"), Val(6)
End If
End Sub
End Sub
Page lxviii
Page lxix
APPENDIX F – SARR CLIENT CODE (VISUAL BASIC)
Option Explicit
Me.mnuRelogin.Visible = False
Me.mnuRelogin1.Visible = False
Me.mnuCloseConnection.Visible = False
Me.mnuCloseConnection1.Visible = False
TimerRefresh.Enabled = False
TimerLog.Enabled = False
cmdGetManualData.Enabled = False
intdatacounter = 0
bLogManual = False
bFileOpen = False
bLogAutomatic = False
strMsg1 = ""
bForward = True
bMoveCheck = True
bisup = False
bisdown = False
bisleft = False
bisright = False
intx = 0
intxup = 1
intxdown = 2
intxleft = 4
Page lxx
intxright = 8
intCountHeat = 0
intCountHeat1 = 100
intCountHeatLoop = 0
CheckUserPassword = 0
'Me.Width = 3270
Me.Height = Screen.Height
Me.Move 0, 0
Me.OptionCelcius.Value = True
Me.OptionReal.Value = True
Me.KeyPreview = True
End Sub
If bFileOpen Then
Close #iFile
End If
If Err.Number = 0 Then
If Len(Me.CommonDialog1.FileName) > 0 Then
iFile = FreeFile
Open Me.CommonDialog1.FileName For Output As #iFile
bFileOpen = True
End If
Else
Err.Clear
End If
Page lxxi
On Error GoTo 0
End Sub
End If
End Sub
TimerLog.Enabled = False
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 10
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = True
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 100
cmdGetManualData.Enabled = False
Page lxxii
mnuLog10ms.Checked = False
mnuLog100ms.Checked = True
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 500
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = False
mnuLog500ms.Checked = True
mnuLog1000ms.Checked = False
End If
End Sub
bLogManual = False
bLogAutomatic = True
TimerLog.Enabled = True
TimerLog.Interval = 1000
cmdGetManualData.Enabled = False
mnuLog10ms.Checked = False
mnuLog100ms.Checked = False
mnuLog500ms.Checked = False
mnuLog1000ms.Checked = True
End If
End Sub
Page lxxiii
dblManualHumi = FormatNumber(dblHumidityRH, 3)
strManualHumiunit = " %RH"
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
Me.mnuRelogin.Visible = False
Me.mnuRelogin1.Visible = False
Me.mnuCloseConnection.Visible = False
Me.mnuCloseConnection1.Visible = False
Me.FrameOutput.Visible = False
Me.FrameServerLogin.Visible = True
Me.tcpClient.Close
CheckUserPassword = 0
msg = ""
strMsg1 = ""
End Sub
ClosePort
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.txtTemp1.Text = ""
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.txtHum1.Text = ""
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.txtPress1.Text = ""
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Page lxxiv
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Me.txtTemp2.Text = ""
Me.txtHum2.Enabled = True
Me.txtHum2.Text = ""
Me.txtPress2.Enabled = True
Me.txtPress2.Text = ""
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtTemp3.Text = ""
Me.txtHum3.Enabled = True
Me.txtHum3.Text = ""
Me.txtPress3.Enabled = True
Me.txtPress3.Text = ""
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
End Sub
tcpClient.Close
TimerRefresh.Enabled = False
TimerLog.Enabled = False
If bFileOpen Then
Close #iFile
End If
End Sub
Page lxxv
mnuRefresh100.Checked = False
mnuRefresh500.Checked = False
mnuRefresh1000.Checked = False
End Sub
End Sub
cmdGetManualData.Enabled = False
Page lxxvi
'Real Time
Me.lblTemp1.Enabled = True
Me.txtTemp1.Enabled = True
Me.lblTemperature1.Enabled = True
Me.lblHum1.Enabled = True
Me.txtHum1.Enabled = True
Me.lblHumidity1.Enabled = True
Me.lblPress1.Enabled = True
Me.txtPress1.Enabled = True
Me.lblPressure1.Enabled = True
'Manual Time
Me.lblTemp2.Enabled = False
Me.lblHum2.Enabled = False
Me.lblPress2.Enabled = False
Me.txtTemp2.Enabled = False
Me.txtHum2.Enabled = False
Me.txtPress2.Enabled = False
Me.lblTemperature2.Enabled = False
Me.lblHumidity2.Enabled = False
Me.lblPressure2.Enabled = False
Me.txtTemp2.Text = ""
Me.txtHum2.Text = ""
Me.txtPress2.Text = ""
'Log Output
Me.lblLogTemp.Enabled = False
Me.lblLogHumi.Enabled = False
Me.lblLogPress.Enabled = False
Me.txtTemp3.Enabled = False
Me.txtHum3.Enabled = False
Me.txtPress3.Enabled = False
Me.lblTemperature3.Enabled = False
Me.lblHumidity3.Enabled = False
Me.lblPressure3.Enabled = False
Me.txtHum1.Text = FormatNumber(dblHumidityRH, 1)
Page lxxvii
cmdGetManualData.Enabled = True
End If
'Real Time
Me.lblTemp1.Enabled = False
Me.txtTemp1.Enabled = False
Me.lblTemperature1.Enabled = False
Me.lblHum1.Enabled = False
Me.txtHum1.Enabled = False
Me.lblHumidity1.Enabled = False
Me.lblPress1.Enabled = False
Me.txtPress1.Enabled = False
Me.lblPressure1.Enabled = False
'Manual Time
Me.lblTemp2.Enabled = True
Me.lblHum2.Enabled = True
Me.lblPress2.Enabled = True
Me.txtTemp2.Enabled = True
Me.txtHum2.Enabled = True
Me.txtPress2.Enabled = True
Me.lblTemperature2.Enabled = True
Me.lblHumidity2.Enabled = True
Me.lblPressure2.Enabled = True
'Log Output
Me.lblLogTemp.Enabled = True
Me.lblLogHumi.Enabled = True
Me.lblLogPress.Enabled = True
Me.txtTemp3.Enabled = True
Me.txtHum3.Enabled = True
Me.txtPress3.Enabled = True
Me.lblTemperature3.Enabled = True
Me.lblHumidity3.Enabled = True
Me.lblPressure3.Enabled = True
Me.txtHum2.Text = FormatNumber(dblHumidityRH, 1)
Page lxxviii
Me.txtPress2.Text = FormatNumber(dblPressureAtm, 1)
End If
End If
HeatBar
End Sub
End If
Me.lblHeat(intCountHeatLoop).Visible = True
intCountHeatLoop = intCountHeatLoop + 1
Loop
intCountHeat1 = intCountHeat
Page lxxix
End If
intCountHeatLoop = 0
End Sub
dblManualHumi = FormatNumber(dblHumidityRH, 3)
Me.txtHum3.Text = FormatNumber(dblHumidityRH, 3)
strManualHumiunit = " %RH"
strLog = Now & "," & "Temperature: " & dblManualTemp & strManualTempunit &
"," & "Humidity: " & dblManualHumi & strManualHumiunit & "," & "Pressure: " &
dblManualPress & strManualPressunit
End If
End Sub
Me.mnuRelogin.Visible = True
Me.mnuRelogin1.Visible = True
Me.mnuCloseConnection.Visible = True
Me.mnuCloseConnection1.Visible = True
tcpClient.RemoteHost = Me.txtIPaddress.Text
If tcpClient.RemoteHost = "" Then
tcpClient.RemoteHost = "localhost"
End If
Page lxxx
tcpClient.RemotePort = 3456
tcpClient.Connect
End Sub
tcpClient.GetData msg
strMsg1 = msg & strMsg1
strMsgfromserver = Split(strMsg1, ",")
intMsgarray = UBound(strMsgfromserver)
End If
End If
strMsg2 = Trim(strMsg1)
Page lxxxi
strMsg2array = Split(strMsg2, ",")
intdatacounter = intdatacounter + 1
Loop
PackSensor
strMsg2 = ""
strMsg1 = ""
intdatacounter = 0
End If
End If
End Sub
Page lxxxii
GearTransition
End If
End Sub
GearTransition
End If
End Sub
End Sub
Page lxxxiii
' Arrow up = bit 0 high = 1
' Arrow down = bit 1 high = 2
' Arrow left = bit 2 high = 4
' Arrow right = bit 3 high = 8
'Straight Forward
If intx = 1 Then
Me.tcpClient.SendData "StraightForward"
bForward = True
Exit Sub
End If
'Forward Left
If intx = 5 Then
Me.tcpClient.SendData "ForwardLeft"
bForward = True
Exit Sub
End If
'Forward Right
If intx = 9 Then
Me.tcpClient.SendData "ForwardRight"
bForward = True
Exit Sub
End If
'Straight Backward
If intx = 2 Then
Me.tcpClient.SendData "StraightBackward"
bForward = False
Exit Sub
End If
'Backward Left
If intx = 6 Then
Me.tcpClient.SendData "BackwardLeft"
bForward = False
Exit Sub
End If
'Backward Right
If intx = 10 Then
Me.tcpClient.SendData "BackwardRight"
bForward = False
Exit Sub
End If
End Sub
Page lxxxiv
Me.txtCircleTurns.Enabled = False
Me.lblCircleDuration.Enabled = True
Me.txtCircleDuration.Enabled = True
Me.cmdCircleTurns.Enabled = False
Me.cmdCircleDuration.Enabled = True
End Sub
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Me.tcpClient.SendData "ForwardLeft"
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Me.tcpClient.SendData "ForwardRight"
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Page lxxxv
Me.tcpClient.SendData "StraightForward"
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Me.tcpClient.SendData "StraightBackward"
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Me.tcpClient.SendData "BackwardLeft"
Me.TimerCircleDuration.Enabled = True
bMoveCheck = False
Me.txtCircleTurns.Enabled = False
Me.txtCircleDuration.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleDuration.Interval = Val(Me.txtCircleDuration.Text)
Me.tcpClient.SendData "BackwardRight"
Me.TimerCircleDuration.Enabled = True
End If
End Sub
Page lxxxvi
Me.cmdCircleTurns.Enabled = False
bMoveCheck = True
intx = 0
End Sub
bMoveCheck = False
Me.txtCircleDuration.Enabled = False
Me.txtCircleTurns.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleTurns.Interval = Val(Me.txtCircleTurns.Text) * 500
Me.tcpClient.SendData "ForwardLeft"
Me.TimerCircleTurns.Enabled = True
bMoveCheck = False
Me.txtCircleDuration.Enabled = False
Me.txtCircleTurns.Enabled = False
Me.OptionDuration.Enabled = False
Me.OptionTurns.Enabled = False
Me.cmdCircleDuration.Enabled = False
Me.cmdCircleTurns.Enabled = False
Me.TimerCircleTurns.Interval = Val(Me.txtCircleTurns.Text) * 500
Me.tcpClient.SendData "ForwardRight"
Me.TimerCircleTurns.Enabled = True
End If
End Sub
Me.TimerCircleDuration.Enabled = False
Me.TimerCircleTurns.Enabled = False
Me.tcpClient.SendData "Stop"
If Me.OptionDuration.Value = True Then
Me.txtCircleDuration.Enabled = True
Page lxxxvii
Me.cmdCircleDuration.Enabled = True
ElseIf Me.OptionTurns.Value = True Then
Me.txtCircleTurns.Enabled = True
Me.cmdCircleTurns.Enabled = True
End If
Me.OptionDuration.Enabled = True
Me.OptionTurns.Enabled = True
bMoveCheck = True
End Sub
Page lxxxviii
APPENDIX G – PIC CODE (PIC-C LANGUAGE)
// Design 2 – Sensor / Transmitter Interface
// PIC16F876
//*****************************************************************//
// Pin Designations:
//
// AN0 – Sensors B0 - Power LED C6 - Serial Output to X-mit
// AN1 - B1 - Low Battery LED C7 - Rcv from Boot-Loader
// AN2 - B2 - Temp Switch
// AN3 - !!B3 is bad!!
// AN5 - B4 - Humidity Switch
// B5 - Low Battery Switch
// B6 - Pressure Switch
//*****************************************************************//
#include <16f876.h>
#use delay(clock=20000000)
#use rs232(baud=19200,parity=N,xmit=PIN_C6,rcv=PIN_C7)
#fuses HS,NOWDT
#use fast_io(A)
#use fast_io(B)
#use fast_io(C)
char temp_string[20];
char pres_string[20];
char hum_string[20];
byte stringptr=0;
void main() {
float batt;
Page lxxxix
output_B(0);
output_high(PIN_B0); // "Power Is On" LED
Page xc
else
temp_string[stringptr++]=c;
temp_string[stringptr]=0;
}
Page xci