ece 477 final report spring 2005 - college of …...ece 477 final report spring 2005 -iii- table of...
TRANSCRIPT
ECE 477 Final Report Spring 2005
Team Code Name: __GROVER__________________________________ Team ID: __7___ Team Members (#1 is Team Leader): #1: Joel Stubbs Signature: ____________________ Date: _________ #2: Andrew Parcel Signature: ____________________ Date: _________ #3: Stan Miller Signature: ____________________ Date: _________ #4: Edwin Tjandranegara Signature: ____________________ Date: _________
ECE 477 Final Report Spring 2005
-ii-
REPORT EVALUATION
Component/Criterion Score Multiplier Points
Abstract 0 1 2 3 4 5 6 7 8 9 10 X 1
Project Overview and Block Diagram 0 1 2 3 4 5 6 7 8 9 10 X 2
Team Success Criteria/Fulfillment 0 1 2 3 4 5 6 7 8 9 10 X 2
Constraint Analysis/Component Selection 0 1 2 3 4 5 6 7 8 9 10 X 2
Patent Liability Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2
Reliability and Safety Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2
Ethical/Environmental Impact Analysis 0 1 2 3 4 5 6 7 8 9 10 X 2
Packaging Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2
Schematic Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2
PCB Layout Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2
Software Design Considerations 0 1 2 3 4 5 6 7 8 9 10 X 2
Version 2 Changes 0 1 2 3 4 5 6 7 8 9 10 X 1
Summary and Conclusions 0 1 2 3 4 5 6 7 8 9 10 X 1
References 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix A: Individual Contributions 0 1 2 3 4 5 6 7 8 9 10 X 4
Appendix B: Packaging 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix C: Schematic 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix D: Top & Bottom Copper 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix E: Parts List Spreadsheet 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix F: Software Listing 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix G: User Manual 0 1 2 3 4 5 6 7 8 9 10 X 2
Appendix H: FMECA Worksheet 0 1 2 3 4 5 6 7 8 9 10 X 2
Technical Writing Style 0 1 2 3 4 5 6 7 8 9 10 X 5
CD of Website Image and Reports/Poster 0 1 2 3 4 5 6 7 8 9 10 X 2
TOTAL
Comments:
ECE 477 Final Report Spring 2005
-iii-
TABLE OF CONTENTS
Abstract 1 1.0 Project Overview and Block Diagram 2 2.0 Team Success Criteria and Fulfillment 4 3.0 Constraint Analysis and Component Selection 5 4.0 Patent Liability Analysis 12 5.0 Reliability and Safety Analysis 17 6.0 Ethical and Environmental Impact Analysis 25 7.0 Packaging Design Considerations 29 8.0 Schematic Design Considerations 34 9.0 PCB Layout Design Considerations 40 10.0 Software Design Considerations 42 11.0 Version 2 Changes 50 12.0 Summary and Conclusions 51 13.0 References 53 Appendix A: Individual Contributions A-1 Appendix B: Packaging B-1 Appendix C: Schematic C-1 Appendix D: PCB Layout Top and Bottom Copper D-1 Appendix E: Parts List Spreadsheet E-1 Appendix F: Software Listing F-1 Appendix G: User Manual G-1 Appendix H: FMECA Worksheet H-1
ECE 477 Final Report Spring 2005
-1-
Abstract
Our project, GROVER (Ground-Roaming Offensive Vehicular Engagement Robot), is an
autonomous vehicle that is designed to look for moving heat-emitting targets and engage them
while patrolling a limited area and avoiding ground obstacles. Ultrasonic and passive IR sensors
are integrated with an off-shelf vehicle and AirSoft weaponry. The vehicle is controlled by a
Freescale (Motorola) 9S12C32 microcontroller and will “patrol” an area looking for human
targets to engage. Power is provided internally using batteries. Ultrasonic sensors are used for
obstacle avoidance and range-finding while passive IR sensors aid in the detection of human
targets. Once a human is detected, a high-torque servo is used to align the weapon with the
target.
ECE 477 Final Report Spring 2005
-2-
1.0 Project Overview and Block Diagram
GROVER is an autonomous vehicle designed to look for moving heat-emitting targets and
engage them while patrolling a limited area and avoiding ground obstacles. The block diagram
in Figure 1-1 shows that the Freescale MCU communicates with 9 separate external devices to
carry out GROVER’s duties. Two 7.2V rechargeable batteries are used in series, along with four
9V alkaline batteries to power the robot’s entire system.
Figure 1-1: GROVER Block Diagram
ECE 477 Final Report Spring 2005
-3-
Figure 1-2: Image of Final Project
ECE 477 Final Report Spring 2005
-4-
2.0 Team Success Criteria and Fulfillment
• An ability to detect a heat-emitting target – successfully demonstrated
• An ability to determine and display the number of engagements – successfully demonstrated
• An ability to fire the weapon – successfully demonstrated
• An ability to turn weapon to face target – successfully demonstrated
• An ability to avoid collisions with inanimate objects – successfully demonstrated
ECE 477 Final Report Spring 2005
-5-
3.0 Constraint Analysis and Component Selection
3.1 Constraint Analysis
3.1.1 Computation Requirements
The computational requirements of GROVER include the computation of a “time of
flight” for the ultrasonic sensor for measuring distance. This is done by activating an ultrasonic
ping and waiting for an echo to be received. Upon echo reception, the ultrasonic sensor informs
the microcontroller via a logic level indicator. By utilizing the microcontroller’s timer capture
feature, one can determine the distance of an object given that the frequency of the ping is
known.
The only other computation requirements of GROVER include the timing of software
delay loops. Several delays are used to create a meaningful sequence of events in the polling
software.
3.1.2 Interface Requirements
The bulk of this robot design will be located outside of the microcontroller with a large
number of interfaces. These interfaces include four PIR (Passive Infrared) sensors, one
ultrasonic sensor, an LCD with a shift register chip utilizing an SPI channel, a miniature
paintball gun, a servo, and two tank motors. Other than the SPI channel used for the LCD
interface, general purpose I/O channels will be used as control signals for each of the other
peripheral devices.
3.1.3 Power Supply
All components will receive power from batteries in order to keep GROVER mobile. A
combination of two 7.2 volt rechargeable RC batteries and four 9 volt alkaline batteries will be
used to provide the requisite voltage levels to each component. The electronic gun motor
requires 5 volts DC drawing about 1 amp of current. The two tank motors each require 3 volts
DC also drawing at least 1 amp per motor. The RF switch requires 12 volts DC, and the PIR
sensors each require 9 volts DC with small amounts of current draw. The servo, microcontroller,
and other PCB components require a 5 volt source. The motors will not all be operating at the
same time since the robot will stop traveling before engaging any targets. This will help reduce
the overall current requirements. The two 7.2 volt rechargeable batteries will be used in series to
ECE 477 Final Report Spring 2005
-6-
create a 14.4 volt source. This will be fed straight into the RF switch which has its own voltage
regulator. Two other switching voltage regulators will be used to step down the voltage to 5
volts. One regulator will be used for the lower current drawing components like the
microcontroller and the other PCB components. The other regulator will be used for the servo,
gun, and tank motors. The four 9 volt batteries will be used for the PIR sensors. Due to their
current draw, they each require their own 9 volt battery to operate correctly.
3.1.4 Packaging Constraints
The robot tank base is approximately 4.5” by 8” so our design is limited to a fairly small
area. The main packaging constraints include mounting the four PIR sensors to the sides of the
tank, the paintball gun to the servo, and finally distributing the weight of the batteries throughout
the tank. The PCB must also be designed very compactly to fit in the small spaces of the tank.
The size and efficiency of our design will be a major design constraint. The selected
components must be small enough and light enough for the tank motors to work properly without
losing balance.
3.1.5 Cost Constraints
A maximum estimate of $500 was set to be the spending limit of our design. None of the
components chosen were very expensive on their own, so this limit did not affect too many
design choices. The tank base turned out to be the most expensive component, but having a
strong working project platform is very important. Each component has been carefully selected
to keep costs low without sacrificing functionality.
3.2 Component Selection
3.2.1 Microcontroller
The interfacing capabilities of a candidate microcontroller far outweigh its computational
prowess for our project. Our microcontroller must be capable of controlling three motors (two
drive, one turret) using pulse width modulation. Furthermore, the chosen microcontroller must
also feature timers to record a “time of flight” for our ultrasonic sensors so that an object’s range
from the GROVER can be calculated. A means of communicating with our LCD is also
required. I/O pins for interfacing with our PIR sensors, Air Soft weaponry, and other small
ECE 477 Final Report Spring 2005
-7-
components must also be taken into consideration. Based upon these requirements, we chose the
Atmel ATmega32 and the Freescale MC9S12C32 for consideration.
The MC9S12C32 sports 32KB of Flash as does the Atmel offering [3] [1]. Both
microcontrollers are also capable of fulfilling the interfacing requirements of our project.
However, the Freescale chip allows for room to grow.
Max
I/O
Pins
Freq.
Max
(MHz)
PWM
(Channels)
Timers
(Channels)
ADC
(Channels)
SPI
MC9S12C32 33 25 6 8 (16-bit) 8 (10-bit) 1
ATmega32 32 16 4 2 (8-bit)
1 (16-bit)
8 (10-bit) 1
Table 3-1: Microcontroller Comparison
Both Freescale and Atmel offer development tools that allow for the use of C code in the
project [3] [1]. However, the Atmel IC is offered as a 40-pin DIP package for a reasonable
$8.28. A 32-pin DIP package of the MC9S12C32 is made available in the form of the
M68MOD912C32 [2]. For $24.95, the Freescale module comes with the requisite capacitors,
resistors, BDM header, and an RS232 IC. This package has the advantage of serving as a
development platform as well plugging into our PCB for use in the “end product.” The
ATmega32 DIP package is just the chip itself. Additional time and money would be needed to
bring the chip to the point where it could be used as a development platform.
Experience developing commercial software using the Metrowerks CodeWarrior IDE as
well as industry contacts should help mitigate the time and cost of development. Combined with
our group’s general familiarity with the HCS12’s instruction set and capabilities, the Freescale
microcontroller came out ahead of the Atmel.
3.2.2 Ultrasonic sensors
Two ultrasonic sensors were considered, the Devantech SRF04 and Devantech SRF08.
The SRF08 has twice the sensing range of SRF04, but requires an I2C bus connection [6] [7].
Further comparison can be found in Table 3-2 below.
ECE 477 Final Report Spring 2005
-8-
Devantech SRF04 Devantech SRF08
Cost $33.50 $56.00
Interface to the
microcontroller
A single input line for the
trigger pulse and a single
output line for the echo
pulse
I2C bus
Average current
consumption
50 mA max, typically 30
mA
275 mA max, typically 40
mA
Range Max: 3 m, Min: 3 cm Max: 6m, Min: ~ 1 cm
Table 3-2: Ultrasonic Comparison
The component selected was the SRF04 because it is cheaper, has a reasonable range to be used
in the design, and the interface is much simpler because it doesn’t require an I2C bus interface.
3.2.3 PIR sensors
The criteria used to select the PIR sensors were mainly the availability and ease of
interfacing with the microcontroller. Three alternatives were considered, the Heath/Zenith SL-
6030-WH5, Heath/Zenith SL-5408-WH, and Kitsrus K30 [10] [9] [8]. The Heath/Zenith PIR
sensors can be easily purchased from a local Wal-Mart or hardware store, while the Kitsrus K30
has to be ordered through an online retailer.
ECE 477 Final Report Spring 2005
-9-
Heath/Zenith SL-
5408-WH
Heath/Zenith
SL-6030-WH5
Kitsrus K30
Cost $9.99 $19.99 $20.95
Output form 110 VAC Half sine-wave
with about 3V
peak value
9V DC pulse
Power supply 110 VAC 3 VDC 9 VDC
Modifications needed
to interface with the
microcontroller
Need to remove the
relay, convert the
output to DC and
add DC power
supply
Need to make the
output in the form
of pulses
Reduce output
voltage from 9V to
about 5 V
Assembly needed minimal none full
Table 3-3: PIR Comparison
The PIR sensor that was chosen was the Kitsrus K-30 because of its ready to use output
for interfacing. The two other alternatives needed some extensive modifications to make them
ready for interfacing. The modifications needed for the Heath/Zenith SL-5408-WH PIR sensor
were considered too much and overshadowed the cost and easiness of purchase [9]. For the
Heath/Zenith SL-6030-WH5, the price was slightly cheaper, but the amount of effort needed to
modify the circuit to make it ready for interfacing was also considered too much [10]. The need
to assemble the Kitsrus PIR sensor was considered a very small nuisance because the assembly
process was well documented and the instructions included with the kit were very easy to follow
[8].
3.2.4 Robot base
There are many reasons we chose the Rogue ATR Robot Base over others [13]. The first
factor was the overall look and flexibility of the base. Our group chose the ATR Base over the
BLUE Base because of the solid rectangular base, tread system, dual gear motor, and dual H-
bridge [13]. Since our robot needs to be able to climb over obstacles to a certain degree, we
decided a treaded system would be better than a two 3” wheels [13]. The rectangular base also
gives our group more flexibility when fitting the paintball gun turret and servo because of the
ECE 477 Final Report Spring 2005
-10-
multiple levels and strong controller mounting standoffs. Although the Rogue ATR Robot Base
was a little more expensive than the Rogue Blue Robot Base, we believe the ATR is an excellent
choice for our project and we are very confident that it will meet all of our requirements.
3.2.5 LCD
The Hitachi LM044L and the OPTREX DMC20261A were the two alternatives
considered for the LCD. Both allow the use of the Hitachi HD44780A00 driver [11] [12].
Hitachi LM044L OPTREX DMC20261A
Cost $10.00 Free
# of characters displayed 20 chars x 4 lines 20 chars x 2 lines
Driver Hitachi HD44780A Hitachi HD44780A
Backlit no yes
Table 3-4: LCD Comparison
Both alternatives were quite similar, but we chose the OPTREX DMC20261A because it was
obtainable for free since a group member happened to have one handy. The OPTREX LCD also
has backlighting which presents a nicer look. While the Hitachi LCD can display more
characters, it was concluded that the 2 lines x 20 chars was sufficient.
3.2.6 Paintball gun
The main idea of this project is basically to use some sort of weapon to fire on heated
targets. Due to the size of the selected robot base, a smaller weapon must be used so that the
design is not too top heavy. Our initial idea involved the use of a semi-automatic CO2 powered
Spyder paintball gun. This weapon was readily available for our free usage, but the size and
weight of this weapon was a little too much for our project. The stepper motor required to rotate
the gun would have to be very large and powerful, and the robot base would have to be much
larger to compensate for the gun weight and firing power. Another setback of that choice was
that it was semi-automatic and not fully automatic. This meant that we would have to develop
some sort of mechanical device to rapidly pull the trigger of this gun. The size, weight, and
firing method factors pushed us in another direction.
ECE 477 Final Report Spring 2005
-11-
The next idea was to use an Airsoft electronic weapon. This weapon was a fully
automatic, battery powered machine gun that was capable of shooting 6 millimeter paintballs or
pellets very rapidly. Being electronic, the gun is much easier to fire on command successfully
without mechanical failure. The electronic interface also became more realistic and more useful
for our microcontroller. The gun also weighs less than one pound, does not require CO2, and is
only 12” in length. It is fairly cheap and can easily be cut down in size since it is made of
plastic. This Mini Electric Airsoft machine gun easily became the logical choice.
ECE 477 Final Report Spring 2005
-12-
4.0 Patent Liability Analysis
4.1 Results of Patent Search
Although there is no United States patents found that completely encompassed the
GROVER project, there were several patents for components of the GROVER project that may
be infringed upon. With the use of United States Patent and Trademark Office website [35] and
a previous ECE 477 project [36], the patents in Table 1.0 were found that may cause possible
infringement.
U.S. Patent
Number
Abstract
6,414,457
Filing Date:
16 Aug 00
An autonomous rolling robot is in the form of a hollow sphere containing at
least two sets of rotors. Each set of rotors includes a rotor mounted on a shaft
which is driven by a motor. All of the shafts are radially mounted within the
hollow sphere so that an extension of the shafts would intersect at the
geometric center of the sphere. The center of mass of the robot is also located
at the geometric center of the sphere. [30]
6,532,404
Filing Date:
1 Mar 02
System of guidance and positioning relative to a fixed station for an
autonomous mobile robot utilizing at least a directional infra-red beam emitted
by the fixed station, the mobile robot being provided with a directional system
of detection of infra-red emission connected to a microcomputer incorporated
in the said robot, the robot moving on a work surface in an essentially random
manner, the microcomputer including an algorithm able to control the return to
fixed station by displacement of the robot towards the direction of emission of
said infra-red beam, characterized in that the infra-red beam is a narrow
directional beam and in that the system of detection is located on a frame at the
center of rotation of the robot, oriented in the direction of movement of the
robot, precise positioning in the fixed station being carried out by rotation of
the machine around a vertical axis according to an algorithm based on the
detection of the narrow beam. [31]
6,339,735
Filing Date:
There is disclosed a utility robot for operating in multiple modes, in particular,
at least one autonomous mode and at least one manual mode. The robot is
ECE 477 Final Report Spring 2005
-13-
29 Dec 98 configured with a recognition system for recognizing a signal indicating the
particular mode in which to operate, and adjusts its control system accordingly.
Methods for operation of this utility, performing various tasks, such as lawn
mowing, vacuuming, floor cleaning and snow removing are also disclosed.
[32]
6,515,614
Filing Date:
11 Oct 01
An autonomous moving apparatus moving to a destination while detecting and
avoiding an obstacle includes a radar device for scanning a horizontal plane in
its traveling direction to thereby detect a position of an obstacle and an
obstacle sensor for detecting an obstacle in a space different from the scanning
plane of the radar device. The apparatus moves to the destination under such
control as to avoid the obstacle based on detection information from the radar
device and the obstacle sensor from a detection output provided by a specific-
configuration detecting element for detecting a present specific configuration
from scanning information by the radar device. By providing such a specific-
configuration detecting element that detects a specific configuration based on
the scan information by the radar device that can accurately know about
position information, it is possible to guess an obstacle having an upper
structure, thus providing efficient avoidance. [33]
6,539,284
Filing Date:
25 Jul 01
A robot for performing substantially autonomous movement includes a
processing device, a memory, and a mobility structure controlled by the
processing device. The processor directs the robot to move with any
predetermined safe area having a boundary and a reference point. Optionally,
the robot also exhibits features of social interactivity by accepting an input
from a human, selecting dynamic content from a data base wherein the
dynamic content is responsive to the input, and presenting the human with a
response corresponding to the dynamic content selection. [34]
Table 4-1: United States Patents researched for project GROVER [35]
ECE 477 Final Report Spring 2005
-14-
4.2 Analysis of Patent Liability
4.2.1 U.S. Patent 6,414,457 [30]
This patent relates to an autonomous rolling robot with rotors mounted on a shaft which
is driven by a motor. The GROVER project is also an autonomous robot with rotors driven by
two motors. The two robots differ in that the patent describes the robot as a “hollow sphere
containing at least two sets of rotors” and the GROVER project has multiple rotors driven by two
motors connected by a tank base. Though the two differ in shape and construction, this could be
an infringement under the doctrine of equivalents, but since there is so much prior art that is
similar it is highly unlikely.
4.2.2 U.S. Patent 6,532,404 [31]
This patent relates to the guidance and positioning of an autonomous robot. The
GROVER project uses both ultrasonic and passive infrared (PIR) sensors with a microprocessor
for the guidance and positioning. From the above patent, an infrared beam and microcomputer
are used in the guidance and positioning of the autonomous robot. Though it is difficult to
extract the exact meaning of what the patent is trying to convey, it seems that both autonomous
robots are using the same method for guidance and positioning, but again since there is prior art
this is probably not an issue.
4.2.3 U.S. Patent 6,339,735 [32]
This patent relates to the use of multiple modes, automatic and manual. Through the use
of an RF transmitter, the GROVER project has the ability to turn the autonomous robot on and
off for safety purposes. Because the GROVER is used as a weapon, there needs to be a mode
where the user can refill ammunition or just move the GROVER when necessary. Though the
patent describes multiples modes, this can be contested because the GROVER does not
necessarily have a “manual” mode, just an automatic and an off. With that said, this may be seen
as an infringement under the doctrine of equivalents because of the multiple modes, but two
modes would probably not make it an issue.
ECE 477 Final Report Spring 2005
-15-
4.2.4 U.S. Patent 6,515,614 [33]
This patent is similar to GROVER in the aspect of “autonomous moving apparatus
moving to a destination while detecting and avoiding an obstacle.” The GROVER uses
ultrasonic sensors to avoid obstacles and compute distances as it roams around a designated area.
The device described in the patent uses a “radar device” to avoid obstacles, but the patent does
not discuss the details of how this works. This could possibly be seen as an infringement under
the doctrine of equivalents because both devices are detecting and avoiding an obstacle through
some method of sensors, but due to the lack of detail on the patent it can be argued that
ultrasonic is not radar therefore not infringing upon this patent.
4.2.5 U.S. Patent 6,539,284 [34]
This patent relates to the use of a “robot for performing substantially autonomous
movement includes a processing device, a memory, and a mobility structure controlled by the
processing device” and “social interactivity.” The GROVER is an autonomous robot that uses
sensors and a microprocessor to detect and fire upon heat-emitting sources, including humans.
This could possibly be seen as infringement under the doctrine of equivalents because the
GROVER is using practically the same components with social interactivity. However, the
patent does describe the social interactivity as “input from a human,” and in the case of
GROVER, the input would be the human’s body heat. Although not entirely clear, there are
substantial similarities between the two devices for infringement.
4.3 Action Recommended to Avoid Infringement
In the case where there are possible infringement liabilities, a few things could be done.
First of all, before obtaining any licenses or paying any royalties, the GROVER project team
would look to the assistance of a patent lawyer. If the patent lawyer found that the infringement
liabilities were real, as stated above, the team would need to purchase any licenses or pay
royalties for any component that is used on the GROVER. For instance, a license would
probably need to be purchased for the use of PIRs and a microprocessor for the guidance and
positioning of the autonomous robot [33]. The other alternative, if the team is not able to
purchase a license or the owner is not willing to sell, would be to design GROVER in a way that
accomplishes the same task but with out infringing on the particular patent. For instance, instead
ECE 477 Final Report Spring 2005
-16-
of having multiple modes, GROVER could possibly be in automatic mode without an alternate
mode. Although this is not efficient, it is possible and it eliminates the need for that particular
patent [32].
ECE 477 Final Report Spring 2005
-17-
5.0 Reliability and Safety Analysis
5.1 Reliability Analysis
The following components were determined to be most likely to fail based on the
operating temperature and the amount of current produced/consumed:
1. Freescale 9S12C32 microcontroller [28]
2. Linear Tech LT 1374-5 switching regulator [41]
3. Linear Tech LT 1376-5 switching regulator [40]
4. 4N28 phototransistor output optocoupler [42]
5.1.1 Freescale 9S12C32 Microcontroller Reliability Analysis
5.1.1.1 Assumptions
Variable Value Assumption / Explanation
C1 0.28 16-bit CMOS microprocessor [28] [39]
EA 0.35 eV VHSIC CMOS [39]
TJ 125º C Maximum operating temperature for the microprocessor [28] [39]
πT 3.1 Values corresponding to device’s EA & TJ [39]
C2 0.13 Based on 28 functional pins and nonhermetic surface mount package
[39]
πE 4.0 Ground Mobile installation [39]
πQ 1.0 Assumed as class B [39]
πL 1.0 Assume first production date the same as original datasheet release date
(01/25/2003) so years in production > 2 years [28] [39]
Table 5-1: Assumed values for reliability analysis of Freescale 9S12C32 microcontroller
5.1.1.2 Calculations
The predicted number of failures every 106 hours is calculated using the following formula:
λλλλp = (C1 πT + C2 πE) πQ πL Failures / 106 hours
For Freescale 9S12C32, using the values assumed above, the number of failures every 106 hours
is:
λλλλp = 1.388 Failures / 106 hours
Therefore the mean time to failure (MTTF) is
ECE 477 Final Report Spring 2005
-18-
MTTF = 1 / λλλλp
= 1 / (1.388 x 10-6)
= 7.205 x 105 hours
5.1.2 Linear Tech LT 1374-5 Switching Regulator Reliability Analysis
5.1.2.1 Assumptions
Variable Value Assumption / Explanation
C1 0.040 Linear CMOS with 301-1000 transistors [39]
EA 0.65 eV Linear MOS [39]
TJ 125º C Maximum operating temperature for the regulator [41] [39]
πT 58 Values corresponding to device’s EA & TJ [39]
C2 0.0025 Based on 6 functional pins and nonhermetic surface mount package
[39]
πE 4.0 Ground Mobile installation [39]
πQ 1.0 Assumed as class B [39]
πL 1.0 Assume first production date the same as datasheet copyright date
(1998) so years in production > 2 years [41] [39]
Table 5-2: Assumed values for reliability analysis of Linear Tech LT 1374-5 switching
regulator
5.1.2.2 Calculations
The predicted number of failures every 106 hours is calculated using the following formula:
λλλλp = (C1 πT + C2 πE) πQ πL Failures / 106 hours
For Linear Tech LT 1374-5, using the values assumed above, the number of failures every 106
hours is:
λλλλp = 2.33 Failures / 106 hours
Therefore the mean time to failure (MTTF) is
MTTF = 1 / λλλλp
= 1 / (2.33 x 10-6)
= 4.292 x 105 hours
ECE 477 Final Report Spring 2005
-19-
5.1.3 Linear Tech LT 1376-5 Switching Regulator Reliability Analysis
5.1.3.1 Assumptions
Variable Value Assumption / Explanation
C1 0.040 Linear CMOS with 301-1000 transistors [39]
EA 0.65 eV Linear MOS [39]
TJ 125º C Maximum operating temperature for the regulator [40] [39]
πT 58 Values corresponding to device’s EA & TJ [39]
C2 0.0025 Based on 6 functional pins and nonhermetic DIP package [39]
πE 4.0 Ground Mobile installation [39]
πQ 1.0 Assumed as class B [39]
πL 1.0 Assume first production date the same as datasheet copyright date
(1995) so years in production > 2 years [40] [39]
Table 5-3: Assumed values for reliability analysis of Linear Tech LT 1376-5 switching
regulator
5.1.3.2 Calculations
The predicted number of failures every 106 hours is calculated using the following formula:
λλλλp = (C1 πT + C2 πE) πQ πL Failures / 106 hours
For Linear Tech LT 1376-5, using the values assumed above, the number of failures every 106
hours is:
λλλλp = 2.33 Failures / 106 hours
Therefore the mean time to failure (MTTF) is
MTTF = 1 / λλλλp
= 1 / (2.33 x 10-6)
= 4.292 x 105 hours
ECE 477 Final Report Spring 2005
-20-
5.1.4 4N28 Phototransistor Output Optocoupler Reliability Analysis
5.1.4.1 Assumptions
Variable Value Assumption / Explanation
λλλλb 0.013 Phototransistor output, single device [39]
TJ 100º C Maximum operating temperature [42] [39]
πT 6.6 Value corresponding to device’s TJ [39]
πE 8.0 Ground Mobile installation [39]
πQ 8.0 Plastic [39]
Table 5-4: Assumed values for reliability analysis of 4N28 phototransistor output
optocoupler
5.1.4.2 Calculations
The predicted number of failures every 106 hours is calculated using the following formula:
λλλλp = λλλλb x πT x πx x πQ Failures / 106 hours
For 4N28, using the values assumed above, the number of failures every 106 hours is:
λλλλp = 5.4912 Failures / 106 hours
Therefore the mean time to failure (MTTF) is
MTTF = 1 / λλλλp
= 1 / (5.4912x 10-6)
= 1.8211 x 105 hours
5.1.5 Conclusion of System Reliability
The limiting factor of the reliability analysis is the 4N28 output optocoupler. Its MTTF
value of 1.8211 x 105 hours is the shortest of the four analyzed components. The optocoupler,
however, is not the limiting factor of the system’s reliability. The system’s reliability is limited
by the mechanical parts that are used in the system. Mechanical parts, such as the rubber treads,
motors, and AirSoft gun, have been determined to have a lifespan of 1 to 2 years. Consequently,
mechanical parts will fail sooner than the electronic components. Higher durability mechanical
components should be substituted when GROVER is manufactured to mitigate this factor. Easy
access to spare parts should be provided to the customer as well as a 3 year warranty to cover
initial breakdown of mechanical parts.
ECE 477 Final Report Spring 2005
-21-
5.2. Failure mode, Effects and Criticality Analysis (FMECA)
5.2.1 Major Functional Blocks
For the failure mode, effects, and criticality analysis (FMECA), the design has been
divided into 7 major functional blocks; chip power supply, motors power supply, microcontroller
and interface headers, PIR interfaces, LCD interface, H-Bridge and servo motor interfaces and
gun interface.
5.2.1.1 Chip Power Supply (Block A)
The chip power supply block contains a switching regulator, a few capacitors and diodes
and an inductor. The power supply can supply up to 1.25 A of current.
Figure 5-1: Schematic of functional block A (chip power supply)
5.2.1.2 Motors Power Supply (Block B)
The motors power supply block contains a switching regulator, a few capacitors and
diodes and an inductor. The power supply can supply up to 4.25 A of current.
Figure 5-2: Schematic of functional block B (motors power supply)
ECE 477 Final Report Spring 2005
-22-
5.2.1.3 Microcontroller and interface headers (Block C)
This block contains the Freescale 9S12C32 microcontroller unit (MCU) that is embedded
in a 32-pin DIP module. This block also contains interface headers to the MCU module.
Figure 5-3: Schematic of functional block C (MCU)
5.2.1.4 PIR interfaces (Block D)
This is the PIR sensors interface to the chip. The input voltage from the PIR sensors is
divided using a voltage divider.
Figure 5-4: Schematic of functional block D (PIR interfaces)
5.2.1.5 LCD interface (Block E)
This block contains a shift register to shift data to be displayed on the LCD. This block
also contains the necessary circuitry to supply power, data and command to the LCD module.
ECE 477 Final Report Spring 2005
-23-
Figure 5-5: Schematic of functional block E (LCD interface)
5.2.1.6 H-Bridge and Servo motor interfaces (Block F)
This block contains interfaces to the H-bridge and servo motor
Figure 5-6: Schematic of functional block F (H-bridge and servo interfaces)
5.2.1.7 Gun interface (Block G)
This block contains a 4N28 opto-isolator, a TIP 122 Darlington transistor, a diode, and a
couple resistors.
ECE 477 Final Report Spring 2005
-24-
Figure 5-7: Schematic of functional block G (gun interface)
5.2.2 FMECA Worksheet
For the FMECA worksheet, two criticality levels, high level and low level, for types of
failures in the output of the design have been determined. A failure rate λ smaller than 10-9 has
been deemed necessary for failures with “high” level of criticality. This criticality level is given
to a failure that can possibly cause injury to the user, unpredictable robot actions, permanent
damage to the microcontroller and other discrete components and/or lost of user control over the
robot’s actions. Failure rate λ between 10-9 and 10-4 has been assigned for “low” level of
criticality. This criticality level is given to a failure that can cause the robot not functioning
properly but does not cause bodily injury to the user and/or the robot just not functioning at all.
The FMECA worksheet can be found in Appendix H.
ECE 477 Final Report Spring 2005
-25-
6.0 Ethical and Environmental Impact Analysis
6.1 Ethical Impact Analysis
During GROVER’s design process, system safety and predictability were deemed
primary concerns. Due to GROVER’s stated objective of interacting with humans in an
aggressive fashion, improper use could result in serious injury. Secondary to safety, the
product’s lifespan was also given a great deal of thought. GROVER was designed to have a
minimal failure rate and maximum durability. Much of the design process for both durability
and safety is synergistic in nature. A durable product is less prone to failure and a product less
likely to fail is safer. Thoughtful design not only spares the company of possible legal expenses,
it also pays dividends in customer satisfaction and brand loyalty.
6.1.1 Safety Concerns
As an ethically-conscious design team, our primary concern is the safety of our
customers. Countless hours have been spent to ensure that the system will not cause injury to the
user in normal operation or in the event that a failure occurs.
One concern is the possibility that the system could go to an unpredictable state due to a
software bug, a damaged sensor or other component, or a combination of failures. This concern
was addressed by adding an RF “kill-switch.” If the system were to go into an erroneous state,
power to GROVER can be cut off from a distance by depressing a button on the key-fob. While
this addition adds to the cost of production, ensuring customer safety is considered more
valuable.
Another safety concern is that the munitions fired from GROVER’s weaponry may cause
injury to the user. By affixing warning labels on the robot and in the user manual, users are
informed of the potential danger and advised of actions they should take to minimize their risk.
Warning labels will state that those using GROVER should always wear protective eyewear and
a regulation paintball chest protector. This will not be hard to enforce since GROVER’s
intended use is in paintball arenas. Paintball arenas require that participants wear protective
gear or sign a waiver prior to entering the arena.
The possibility of electric shock from exposed electrical components or stripped wires
was also contemplated during GROVER’s design. By using covered connection headers to
connect the interfaced components to main PCB and using electrical tape, heat shrink, or wire
ECE 477 Final Report Spring 2005
-26-
caps to cover exposed connections, this concern was mitigated. As an extra safety precaution,
warning labels will be affixed to the robot and in the user manual. The warning labels shall warn
the user of the danger of electric shock if the packaging of GROVER is opened or if wires
become exposed.
6.1.2 Product Lifespan
An ethical organization should not sell products that have an unreasonably short lifespan
or a particularly high occurrence of failure. In keeping with this philosophy, the design team has
done extensive testing and analysis of possible failure modes. A Safety and Reliability Analysis
report, including an FMECA (Failure Mode, Effect, and Criticality analysis) worksheet, was
completed by team members. From the report, most critical failures can be identified. Since the
product is currently in its development stage, the MTTF (Mean Time-To-Failure) values of the
critical components are not as high as one would like them to be. Through the analysis of current
components failures, improvements can be made to ensure the end product will have a markedly
longer lifespan.
6.2 Environmental Impact Analysis
As responsible designers, we must be cognizant of the potential hazards associated with
not only GROVER’s normal usage, but also the environmental ramifications associated with its
manufacture and disposal.
6.2.1 Product Manufacture
GROVER’s design utilizes a number of printed circuit boards (PCBs) throughout its
structure linked to a common main board. The main board, as well as the H-bridge, ultrasonic
range finder, RF switch, and the four PIR sensors, constitutes a potential environmental hazard.
During the various stages of PCB manufacturing, a number of hazardous by-products are
generated. Industrial wastewater and treatment residues, spent process baths, acids used for
cleaning equipment, copper sulfate crystals, and re-flow oil constitute the typical waste generated
by PCB manufacturers [18]. While elimination of all wastes is unrealistic, certain actions can be
taken by both board designers and manufacturers to minimize waste. If GROVER were to go
into mass production, many of the through-hole and dual-in-line package (DIP) components
ECE 477 Final Report Spring 2005
-27-
could be replaced with their surface mount technology (SMT) equivalents. SMT parts allow for
closer contact area of chip leads compared to through-hole components. By using SMT parts
when possible, the PCB needs to be only 35 to 60 percent as large as a board designed with
through-hole components [19]. Efforts by manufacturers can also help to curb waste. Material
substitution, such as abrasives and non-chelated cleaners for conventional halogenated solvents
for board preparation, and reusing/recycling the various rinses and baths employed during
manufacture, can lead to a significant reduction in generated waste [19].
6.2.2 Normal Use
During normal use, GROVER presents minimal environmental concerns. GROVER’s
principle source of power is a pair of 7.2-Volt nickel-metal-hydride batteries. Nickel-metal-
hydride is considered to be environmentally friendly [20]. Although the main derivative is
nickel, which is considered semi-toxic, each battery contains also contains electrolyte, which is
hazardous in large amounts. The sum total of electrolyte present in two batteries is of little
concern. GROVER’s PIR sensors, however, utilize a 9-Volt alkaline battery. Alkaline batteries
contain a strong alkali, potassium hydroxide electrolyte [21]. If the alkaline battery were to be
damaged or mishandled, it is possible for the potassium hydroxide to leak out of the battery. In
the event that the electrolyte comes into contact with the skin or eyes, severe chemical burns can
result [21]. By providing proper handling instruction for the batteries in the instruction manual,
as well as encouraging battery recycling, GROVER’s potential environmental hazard is
negligible.
6.2.3 Disposal
GROVER’s greatest impact on the environment occurs after its operational life has drawn
to a close. Although the customer is ultimately responsible for determining how the unit is
disposed, as a company one can offer information and incentives to encourage the customer to
make an environmentally responsible decision.
Since the bulk of PCBs consist of materials that classify them as hazardous or “special”
waste, it is important that they be properly disposed. Each of GROVER’s PCBs can be
processed to recover raw materials such as silver, lead, copper, and gold [22]. If this process
were handled by the manufacturer, the reuse of materials could lower production costs.
ECE 477 Final Report Spring 2005
-28-
The two nickel-metal-hydride batteries, while considered to be environmentally friendly,
should be recycled. During the recycling process, nickel-metal-hydride batteries produce enough
nickel to pay for the recycling process [20]. As both environmentally and economically friendly,
users should be encouraged to recycle these batteries through the use of stickers on the batteries
themselves. Furthermore, a list of recycling centers should be included in the product
documentation.
Since 1993, alkaline batteries produced in the United States contain no added mercury
and are essentially mercury-free [23]. Alkaline batteries can therefore be safely disposed of with
normal household waste. However, it is important not to dispose of a large quantity of batteries
in a group. Since disposed batteries are often not completely “dead,” a large grouping of used
batteries increases the risk that “live” batteries could come into contact with one another,
creating safety risks [24]. At this time, “proven cost-effective and environmentally safe
recycling processes are not yet universally available for alkaline batteries [24].”
GROVER’s recognizable blue base is made out of aluminum. “Although aluminum is
less than one percent of the nation's municipal solid waste stream, it remains one of the most
valuable recyclable materials [25].” With a majority of GROVER’s components recyclable, it
makes sense for the manufacturer to accept the entire GROVER assembly as recyclable material.
Those customers who recycle their GROVER should be rewarded with a coupon good towards
future purchases. In addition to being an environmentally friendly policy, it would also serve as
a marketing tool to elicit repeat customers.
ECE 477 Final Report Spring 2005
-29-
7.0 Packaging Design Considerations
7.1. Commercial Product Comparison
7.1.1 Foster-Miller Talon Robot
The Foster-Miller Talon Robot is the military version of our robot GROVER. The Talon
robot is 22.5 inches wide, 34 inches long, and between 11 to 62 inches tall depending on whether
the robotic arm is stretched or not [17]. The Talon can be fitted with a variety of devices and
weapons depending on the mission. The most common interfaces are the robotic arm, the night
vision camera, and an M16 riffle [17]. The Talon is tread driven with the peripherals mounted
on top of the robot similar to those of GROVER. The robot is controlled by an RF based
operator control unit (OCU) and powered using a lead acid battery located inside the chassis of
the treaded base [17].
Figure 7-1: Foster-Miller Talon Robot and the Operator Control Unit
ECE 477 Final Report Spring 2005
-30-
As shown in Figure 7-1, the Talon is controlled based on the vision recorded by the
camera mounted on a robotic arm on top of the robot base. This will create a liability for the
system because the robotic arm is not as sturdy as other parts of the robot so it can easily be bent
or broken. The robotic arm, which sticks up from the robot base, will limit the robot’s
movement inside small channels or openings.
The usage of an RF based OCU both has positive and negative sides. On the positive
side, the OCU will give more control over the robot’s actions. This is very important because
the robot might be equipped with destructive weaponry and for safety purposes it is common
sense to not leave the decision of firing the weapon to a computer. The negative side is that the
RF signal could be blocked making it impossible to control the robot allowing it to be lost or
destroyed. For GROVER, we take care of the imperfections of the Talon by using sensors
mounted on the robot base’s sides for object avoidance while not using an RF based radio control
or camera. Based on the sensors’ inputs to our system, the microcontroller on board will make a
decision on which direction it needs to go. Because our robot is only equipped with a paintball
gun, gun fire control is not as crucial as the Talon’s, so decision to fire based on sensor inputs is
enough. As a safety feature, we have added an RF transmission based on/off switch for easy
power shutdown.
Another good aspect of the packaging is the usage of treads to drive the Talon robot.
This will allow the robot to explore harsh terrains with little or minimal difficulty. This is why
we are using a tread driven robot base. A treaded robot base also allows for easier turning and
drive control. Like the Talon, we also put our circuitry and power supplies inside the robot
base’s chassis for protection.
ECE 477 Final Report Spring 2005
-31-
7.1.2 Roomba Robotic Floor Vacuum
The Roomba is a commercial example of our project minus the weapon attachment and
vacuum capabilities. A 16-bit processor from Freescale Semiconductor powers the new
generation of Roomba floor vacuums and the advanced power system NiMh battery pack lasts a
full two hours [15]. The physical dimensions of the Roomba are 4 ¼” H x 13 ½” Diam and
weighs 7 ½ lbs [14]. This is approximately the same weight as GROVER.
Figure 7-2: Roomba Discovery SE Robotic Floor Vacuum
Roomba uses four sensors to navigate. These sensors include the Wall Following Sensor,
a Cliff Avoidance Sensor, a Virtual Wall Sensor and the bumper of the Roomba is a contact
sensor. The three non-contact sensors send invisible light in front of them and the robot
navigates by sensing the light’s reflections [16]. A positive aspect of the Roomba is that it is
compact and weighs very little. This is one aspect we are hoping to achieve with the GROVER.
Another aspect of the Roomba which will go in our design is the use of a remote control to
power the robot on/off. The Roomba however is dependent upon the remote control whereas our
design is only used in emergency instances.
ECE 477 Final Report Spring 2005
-32-
7.2 Grover Illustrations
o See Appendix B.
7.3 Materials List
Material Quantity Purpose
Plastic Wall Socket Mounts 2 Turret Shell
Medium Sized L Brackets 3 Support servo for turret
Small Sized L Brackets 12 Mounting LCD/Batteries
Aluminum Standoffs 30 Mounting PIR Sensors/Ultrasonics
Expanding Tank Area
Mounting Hardware (Nuts,
Bolts)
50 Mounting Sensors/Components
Holding tank together
Table 7-3: Materials List
7.4 Tooling Requirements
Since the tank base has been already constructed from a kit, the main factor for building
GROVER is the construction of the turret. We will be using a dremel saw bit to cut down the
Airsoft gun size. We will reduce its length from 12.5 inches to about 9 inches. We will also
remove the handle and trigger so that it fits nicely in the turret case. We will use the dremel to
also cut the plastic casing for the turret to hold the gun. Holes will need to be drilled through the
metal tank plates to mount each sensor. Other than that, no special tools will be required for the
construction of GROVER.
ECE 477 Final Report Spring 2005
-33-
7.5 Component List With Estimate of Packaging Weight and Cost
Table 7-4: Estimate of Packaging Weight and Cost
Part Unit Cost Quantity Final Cost Total Weight
(Max Estimate)
Micro-Controller $24.95 1 $24.95 1 oz
PIR Motion
Detector
$20.95 4 $83.80 4 oz
H-Bridge $ 0.00 1 $ 0.00 2 oz
Ultrasonic Range
Finder
$33.50 1 $33.50 2 oz
Robot Base $139.95 1 $139.95 24 oz
Robot Extra Level
Kit
$29.95 1 $29.95 3 oz
LCD $0.00 1 $0.00 2 oz
Airsoft/Paintball
Gun
$18.50 1 $18.50 14 oz
RF switch $45.95 1 $45.95 2 oz
Servo $23.00 1 $23.00 4 oz
Gun Mount $20.00 1 $20.00 6 oz
PCB $0.00 1 $0.00 3 oz
Alkaline Batteries $4.00 4 $16.00 8 oz
7.2v 2100mAh
NiCD Battery Pack
$31.99 2 $63.98 25 oz
Miscellaneous
Mounts, Wires,
Small Components
$15.00 1 $15.00 4 oz
Total: $514.58 104 oz (6.5 lbs)
ECE 477 Final Report Spring 2005
-34-
8.0 Schematic Design Considerations
8.1 Theory of Operation
8.1.1 M68MOD912C32
The M68MOD912C32 module contains a Freescale 9S12C32 microcontroller, an RS232
transceiver circuit, an 8-MHz crystal oscillator, a PLL circuit, a local 5V low-dropout 100 mA
regulator, a standard 6-pin BDM connector, and an on-chip serial monitor [2]. The Freescale
microcontroller will be the “brain” of the robot and based on sensor input, it should be able to
assert the proper control signals to the peripherals to achieve its goal.
The microcontroller will be integrated with four PIR (passive IR) sensors to detect
moving heat emitting objects. Upon target detection, the microcontroller will receive a 5V pulse.
Four general purpose I/O (Input/Output) pins, AN0 to AN3, will be used to receive the outputs
from the sensors.
An LCD will be interfaced to the microcontroller utilizing the microcontroller’s SPI
capability. For this, four pins of the microcontroller will be used. Pin PM5 will be used to supply
SCK to the shift register. Three general purpose I/O pins, PM2 to PM4, will be used to supply
the SDO, Enable, R/W (read/write), and RS (Register Select) bits to the LCD module.
An additional four general purpose I/O pins, PT0 to PT3, will be used as output pins to
the H-bridge to drive the direction of the robot. The output pins shall output 5V or 0V pulses
depending on the direction the robot is driven to. Pin PT4 will be used to output pulses, regulated
by the built-in PWM, to the servo to rotate the gun turret, while pin PM0 will be used as a
general purpose I/O pin to supply 5V to the gun’s switch to start firing the weapon.
The robot will also be equipped with an ultrasonic sensor for obstacle avoidance. The
ultrasonic will be interfaced through pins PT6 and PT7. Pin PT7 will output trigger pulse to the
sensor, while pin PT6 will receive the input from the ultrasonic sensor. The microcontoller’s
built-in timer-capture function will calculate how long it takes for an echo to be received. Using
the speed of sound and the “time of flight” of the pulse, one can calculate the distance of the
object.
The microcontroller will be supplied with 8 MHz oscillator which means the internal
clock speed will be 4 MHz [2]. This clock speed is chosen because the module was built with
that speed and the speed was deemed adequate for our application. The power source of the
ECE 477 Final Report Spring 2005
-35-
microcontroller will come from the switching power regulator at 5V. This is an optimal voltage
because most of our peripherals will also be supplied using that level.
8.1.2 Power supply components
8.1.2.1 Generic 7.2V NiCad rechargeable batteries
Two generic RC batteries will be connected in series as the main power supply. Because
of the series connection, the power supply input voltage will be 14.4 V. This voltage will then be
stepped down using various switching regulators to fulfill the various voltage requirements of the
circuit.
8.1.2.2 Linear Tech LT 1376-5 Switching Regulator Step Down Converter
This regulator will be used to supply the M68MOD912C32, the ultrasonic sensor, the
LCD and the H-bridge circuit with 5V. This regulator is capable of supplying up to 1.25A and
can take an input voltage from 6 to 25 Volts. This switching regulator is preferred over a linear
regulator because of its efficiency, which can be close to 90% [40]. The voltage and current
supplied by this regulator is sufficient for the microcontroller module and its input range readily
accepts the 14.4 V supplied by the batteries. This regulator can also supply enough current to
drive the LCD and various chips on the PCB (such as the 74HC164 and the 4N28 optical
isolator). Because a switching regulator is used, external components need to be used to help
regulate the voltage, as shown in Figure 8-1.
Figure 8-1: Implementation of the step down Buck converter using the LT 1376-5
ECE 477 Final Report Spring 2005
-36-
8.1.2.3 Linear Tech LT 1374-5 Switching Regulator Step Down Converter
This regulator will be used to supply the drive motors, the gun motor, and the servo with
5V. The power supplies for the motors were separated to reduce noise and electro-magnetic
interference to sensitive chips and microcontroller. This regulator is capable of supplying up to
4.25A and can take an input voltage from 6 to 25 Volts [41]. This switching regulator is
preferred over a linear regulator because of its efficiency. The Voltage and Current supplied by
this regulator is sufficient for the motors and its input range can readily accept the 14.4 V
supplied by the batteries. Because a switching regulator is used, external components need to be
used to help regulate the voltage, as shown in Figure 8-2.
Figure 8-2: Implementation of the step down Buck converter using the LT 1374-5
8.1.2.4 Additional external batteries
An off-shelf 9V batteries will be used to power the PIR sensors. They will connected
directly to the components they are powering
.
ECE 477 Final Report Spring 2005
-37-
8.1.3 Peripherals
8.1.3.1 Devantech SRF04 Ultrasonic sensor
The ultrasonic sensor will be interfaced through pins PT6 and PT7. Pin PT7 will output
trigger pulse to the sensor that should be held high for at least 10 µs to signify that the sensor is
triggered. Pin PT6 will receive the input from the ultrasonic sensor and the built in timer will
calculate the time of the input pulse is held high [6]. Based on how long the pulse, the distance of
the object can be known. The pins will be connected to the sensor through a header. The
ultrasonic sensor’s power will be regulated by the LT 1376-5 converter.
8.1.3.2 PIR sensors
The microcontroller will be integrated with four PIR (passive IR) sensors to detect heat
emitting moving objects. Four general I/O (Input/Output) pins, AN0 to AN3, will be used to
receive the inputs from the sensors, which are connected through the header. The PIR sensor will
output 9V pulse when a heat emitting moving target is detected [8]. Because the microcontroller
can only take up to 5V pulse, a voltage divider is used. Resistors with the values 1kΩ and 1.2 kΩ
will be used as the voltage divider.
Vout = (Rbelow/(Rup+Rbelow)) * Vin
5 = (Rbelow/(Rup+Rbelow)) * 9
Rbelow/(Rup+Rbelow) = 5/9
1.2 kΩ / (1kΩ + 1.2 kΩ) ≈ 5/9
The PIR sensors will be powered using an external 9V battery. The voltage divider circuit
is shown in Figure 8-3.
Figure 8-3: PIR voltage divider circuit
ECE 477 Final Report Spring 2005
-38-
8.1.3.3 LCD
The LCD will be interfaced to the microcontroller utilizing the SPI capability of the
microcontroller. For this, four pins of the microcontroller will be used. A shift register,
74HC164, will be used to register data to be displayed on the LCD. Pin PM5 will be used to
supply SCK to the shift register. Four general I/O pins will be used to supply SDO to the shift
register, Enable signal, R/W (read/write) bit and RS (Register Select) bit to the LCD module[12].
These pins are PM2 to PM4. The LCD will be connected to the PCB by a 7x2 header. Both the
LCD and the shift register powers are regulated by the LT 1376-5 converter.
8.1.3.4 Servo
Pin PT4 will be used to output pulses regulated by the built-in PWM to the servo to rotate
the gun turret [43]. The servo’s power will be regulated by the LT 1374-5 converter.
8.1.3.5 Paintball Gun
Pin PM0 will be used as a general purpose I/O pin to switch the gun to start fire. The
gun’s motor will be optically isolated using the 4N28 optical isolator. The optical isolator’s
power will be regulated by the LT 1376-5 converter while the gun’s motor will be regulated by
the LT 1374-5 converter.
8.1.3.6 Drive Motors and H-Bridge
Four general purpose I/O pins, PT0 to PT3, will be used as output pins to the H-bridge to
drive the direction of the [44]. The drive motors will be connected and powered through the H-
bridge. The power supply to the drive motors will be regulated by the LT 1374-5 converter,
while the H-bridge’s power will be regulated by the LT 1376-5 converter.
8.2 Documentation for Circuit Design
8.2.1 OrCAD schematic
o See Appendix C-1
8.2.2 OrCAD design rule check report
o See Appendix C-2
ECE 477 Final Report Spring 2005
-39-
8.2.3. OrCAD bill of materials report
o See Appendix C-3
ECE 477 Final Report Spring 2005
-40-
9.0 PCB Layout Design Considerations
9.1 PCB Layout Design Considerations:
9.1.1 Board Size
The robot tank base is approximately 4.5” by 8” so the design is limited to a fairly small
area. The dimensions of the board are 4.25” by 5.575” and drill holes have been placed on the
design using a printout and the tank base. Board size was not as much of a challenge as it is was
for some groups because the GROVER board only has about 50 components and using a 32-pin
microcontroller module made routing and placement much easier.
9.1.2 Component Placement
Because of the small number of components and relatively large board space, component
placement was quite simple. Some consideration came into play with the power supplies for the
motor and the microcontroller. A main consideration was keep the diodes and capacitors as
close to the components as possible without causing difficult and unneeded routing problems.
None of the components were placed on the bottom of the board because there was no need for
this. If the design became tight on space placing parts on the bottom of the board would be
essential.
9.1.3 Signal Routing
For our PCB, signal routing was dependent upon current needs for each component. For
the majority of the routing on the PCB a 12 mil connection was used except for power and
ground routing in which 50 mil was used. One component to notice is the voltage regulator for
the motor power in which 50 mil routing was needed for 4 of the 8 pins. However this became
tricky because the pins are so close together, so 50 mil was used up to the pin and then changed
to 40 mil which is still enough to handle the current needs. All together, 19 vias were used in the
final routing of the board.
9.1.4 Footprints
Choosing footprints was probably the most tedious part of the layout process. For each
part a measurement of the component was taken and then the appropriate footprint was found
using the OrCAD library. The group had about 80% of the parts in hand, so most of the
ECE 477 Final Report Spring 2005
-41-
footprints were found. However, one or two parts were created using the OrCAD Layout library
tool. Once the footprints were found for each component, the parts there were in hand were
placed on a 1 to 1 ratio printout to double check size and pin placement was correct. With the
use of parts in hand, data sheets, and printout measurements, all footprints were found to fit
properly.
ECE 477 Final Report Spring 2005
-42-
10.0 Software Design Considerations
The lack of extensive library use combined with our team’s experience writing assembly
using Motorola’s instruction set led us to choose assembly as the language we would write our
application code in. Metrowerks’ CodeWarrior IDE (integrated development environment) [26]
belies the true complexity associated with the MC9S12C32 memory model and generates
suitable startup code for the microcontroller. In addition, CodeWarrior’s generated include file
[27] associates mnemonics with all of the memory-mapped registers and ports allowing
programmers to write code more efficiently.
10.0.1. Memory Model
The memory of the MC9S12C32 consists of 32 kilobytes of Flash EEPROM (erasable in
512-byte sectors) and 2 kilobytes of RAM. As shown in Table 10-1., 2 kilobytes of the Flash
memory is occupied by the Serial Monitor, which leaves approximately 30K for our program to
reside in. Since our program is implemented in assembly and does not have extensive library
overhead, the program size limitation should not constitute a design constraint.
10.0.2. Memory Map
Addresses $0000 through $FFFF of the MC9S12C32 map as follows [28]:
Address Range Maps to:
$0000 - $03FF 1K Register Space
$0400 - $07FF Unused
$0800 - $0FFF 2K RAM
$1000 - $3FFF Unused
$4000 - $7FFF 16K Lower Block of Flash
$8000 - $BFFF 16K Middle Block of Flash
$C000 - $FFFF 16K Upper Block of Flash
- $F780 - $F7FF User-defined Interrupt Vectors
- $F800 - $FFFF Protected (Serial Monitor)
Table 10-1: MC9S12C32 Memory Map
ECE 477 Final Report Spring 2005
-43-
While the MC9S12C32 has 32K of physical Flash memory, there is 48K of addressable space.
Both the upper and lower Flash address blocks map to physical memory, while the 16K middle
block of flash maps to either the lower or upper block. Both the register space and the RAM are
mappable to any 2K boundaries. The use of Metrowerks’ CodeWarrior IDE resolves memory
mapping issues allowing the programmer to focus attention on application code.
10.0.3. Startup Code
Startup code is automatically generated by the CodeWarrior IDE. By selecting an
MC9S12C32 stationary, CodeWarrior automatically creates the appropriate memory map,
interrupt vectors, and I/O device mapping as well as an entry point for our application code [27].
10.0.4. Organization of Embedded Application Code
The application code is organized in the form of a polling loop (shown in Figure 10-1.).
Coming out of reset, GROVER goes through its initialization routines and resets all of its
variables. A 10 second delay allows those who do not wish to be seen as a potential target to get
out of GROVER’s range. GROVER then enters its main polling loop. If any of the perimeter
PIR sensors have been triggered, GROVER halts its drive motors and begins turning its turret
towards the target (based on which perimeter sensor was triggered). As the turret is turning,
GROVER polls its narrow focus PIR sensor located on the turret. If the turret PIR sensor is
triggered, GROVER knows that the target is directly in front of the weapon. GROVER stops the
turret and fires a 5-shot burst at the target. The engagement flag is set and GROVER returns to
its main polling loop.
If, while searching for a target, the turret has reached its maximum turning potential and
the target has not been located, GROVER resets its turret to the forward position. GROVER
then engages the drive motors to rotate the entire vehicle 90 degrees in the direction of the target
and returns to the main polling loop to reevaluate the PIR perimeter sensors given its new field
of vision.
In the event that only the forward perimeter PIR sensor is triggered, GROVER uses a
modified searching sweep shown in Figure 10-2. By quickly checking only the area not covered
by the side-mounted PIR sensors, GROVER can locate and engage targets that may be slightly
ECE 477 Final Report Spring 2005
-44-
askew with the front of the vehicle. Since the two side sensors can clearly indicate to GROVER
the direction in which to turn its turret, they have priority over the front sensor.
When the area is void of targets, GROVER is free to roam. Using an ultrasonic range
finder, GROVER checks to make sure no obstacles lay in its immediate path. If the path is clear,
GROVER will update its engagement display, reset the turret to the forward position, and engage
its drive motors forward. GROVER then returns to polling the perimeter PIR sensors and
ultrasonic sensors.
When an obstacle is detected in GROVER’s immediate path, GROVER disengages both
drive motors to avoid a collision. The vehicle is then rotated 90 degrees to the right and returns
to the polling loop. The drive motors will automatically be engaged if the new path is clear and
there are no potential targets in the area by virtue of the polling loop.
The polling loop will continue until power is turned off by the RF remote or GROVER is
out of ammo. Whenever GROVER fires its weapon, the ammo count is updated to reflect the
spent munitions. If, after firing, the ammo quantity is zero, GROVER will halt and wait to be
reloaded and reset.
10.1. Software Design Narrative
GROVER’s application code consists of seven basic modules: Grover, Ultrasonic, H-
Bridge, PIR, Servo, AirSoft, and LCD. Each module contains the necessary initialization and
program code for its namesake component with the Grover module tying everything together.
10.1.1. Grover
The Grover module contains the main polling loop, grover_loop. Coming out of reset,
the application entry point is grover. It is here that all components (ultrasonic range finder, h-
bridge, PIR sensors, servo, and AirSoft gun) are initialized and variables reset. A 10 second
delay is then called for those who wish to escape GROVER’s sensor range. GROVER then
enters grover_loop and begins searching for targets. The microcontroller will remain in this loop
until it is powered down or GROVER runs out of ammunition.
ECE 477 Final Report Spring 2005
-45-
10.1.2. Ultrasonic
The ultrasonic module consists of the ultrasonic initialization code as well as routines for
determining object distance. u_sonic_init properly sets the trigger pulse pin as an output and the
echo reception pin as an input. The timer subsystem is also initialized by a call to tim_ini and an
initial value for the trigger pulse output is set. Determining an object’s distance, as well as
taking any needed action, is handled by the u_sonic_ping subroutine.
The ultrasonic sensor requires that its input line, be held low (logic “0”) and then brought
high (logic “1”) for a minimum of 10µs to trigger a sonic pulse. The pulse is generated on the
falling edge of this trigger input. A start time, based on the microcontroller’s free running
counter, is stored to variable tm_start on this falling edge. A falling edge on the echo line, is
indicative of echo reception (or a timeout occurring) and the free running counter’s time is stored
to tm_end on this edge. By subtracting tm_start from tm_end, one can determine the time-of-
flight of the ultrasonic pulse (the longer the time-of-flight, the greater the object’s distance). If
the distance is within one foot, the subroutine motor_halt is called to stop the vehicle in order to
avoid a collision. GROVER can then turn to search for an obstacle free path.
10.1.3. H-Bridge
The H-Bridge module consists of initialization code as well as routines for controlling the
movement of Grover. General purpose output pins PT0 – PT3 provide signals to the H-Bridge as
to the motor/direction pairs to activate. The functions motor_halt, motor_forward, motor_right,
and motor_left set pins PT0-PT3 to attain the desired result as summarized in Table 10-2.
Stop Forward Right Turn Left Turn
PT0 0 1 1 0
PT1 0 0 0 1
PT2 0 1 0 1
PT3 0 0 1 0
Function motor_halt motor_forward motor_right motor_left
Table 10-2: H-Bridge Configuration Signals
ECE 477 Final Report Spring 2005
-46-
In addition to setting the motors to turn GROVER, motor_right and motor_left call delay
loops to only enable the motors long enough to make an approximately 90-degree turn.
motor_forward and motor_halt simply set PT0 – PT3 appropriately and return.
10.1.4. PIR
The PIR module contains initialization code and polling routines for GROVER’s various
PIR sensors. pir_poll checks each of the three perimeter PIR sensors input ports sets the lower
three bits of variable pir_data to correspond to the values read. The value in variable pir_airsoft
is set based on the polling of the turret mounted narrow-range PIR sensor called by pir_poll_t.
A logic “1” signal indicates that a target has been detected. The main polling loop code
in the Grover module interprets pir_poll, while pir_airsoft is read by a Servo module subroutine
so that it knows when a target is lined up with the weaponry and to stop rotating the turret.
10.1.5. Servo
Initialization code as well as routines to incrementally change the turret’s position is
contained in the servo module. By altering the duty cycle sent to the servo’s input using the
HC(S)12’s timer module, the position of the servo (and consequently the turret) is changed.
servo_rst resets the turret so that it faces forward. servo_right and servo_left, incrementally
move the servo in fifteen degree increments in their respective directions. After the servo has
moved each increment, pir_poll_t is called to determine whether or not the turret is aligned with
its target. If it is, the servo holds its position and the weapon is fired. Otherwise, the servo
continues incrementing until it reaches its limit. At that time servo_rst is called and GROVER is
rotated 90 degrees in the direction the turret was traveling when it reached its limit. The
subroutine then returns to grover_loop so that the target’s position can be reevaluated.
10.1.6. AirSoft
The AirSoft module consists of an initialization routine and a firing routine. The
initialization routine, airsoft_init, properly configures the data direction register and sets an
initial value to the output port. The firing routine, airsoft_fire, fires a five shot burst and updates
the remaining ammunition variable, ammo.
ECE 477 Final Report Spring 2005
-47-
10.1.7. LCD
The LCD module consists of the initialization routine for the LCD as well as subroutines
to update the LCD’s display. LCD_init initializes the LCD so that it will be ready for 8-bit
parallel communication with the microcontroller. PTM_init initializes the data direction registers
of Port M so that those pins may be used for SPI communication with the shift register. After
calling PTM_init, LCD_init completes the initialization process as shown in Figure 10-3.
Several other routines in the LCD module help display information on the LCD. SPIgen
generates a clock cycle and a data cycle for the SPI transmission based on the data in the variable
SPI_data. After each transmission, the data is shifted left by one and stored back in SPI_data for
the next transmission. SPI_send sends 8 bits of data through the SPI by calling SPI_gen for each
bit. send_E generates the enable pulse, E, for the LCD to signify the start of a data write
operation.
For displaying non-whitespace characters on the LCD, functions have been written to
display individual characters as well as full words. Individual character functions can display
characters such as ‘G’, ‘A’, ‘R’, ‘’, etc. while full word functions display messages such as
‘PWR ON’, ‘GROVER ARMED’, etc.
For generating white space characters, functions for displaying space, backspace, new
line, etc. were written. cursor_reset returns the LCD’s display cursor to its original position
while clear_disp clears the LCD.
ECE 477 Final Report Spring 2005
-48-
10.2. Software Documentation
10.2.1 Flowcharts
Figure 10-1: Program Flow
ECE 477 Final Report Spring 2005
-49-
Figure 10-2: Center Sweep
10.2.2. Listing
o See Appendix F
ECE 477 Final Report Spring 2005
-50-
11.0 Version 2 Changes
• All parts surface mount
Design the PCB so that as many parts as possible can be surface mounted to make
PCB more compact.
• Bigger…better…base!
Utilize a bigger and sturdier base for the robot, so more space is available for
batteries and other peripherals.
• Fiberglass shell
Utilize fiberglass to make a better outer shell so the robot is more durable and
aesthetically more pleasant.
• Secondary control through internet
Design and add a secondary control option through wireless internet connections.
• Remotely fire gun with key fob
Design and add gun fire control using the key fob.
• Fit more to main PCB
Place and route the PCB more compactly so more peripheral circuitry such as the
H-bridge or PIR sensors could fit on the PCB.
ECE 477 Final Report Spring 2005
-51-
12.0 Summary and Conclusions
12.1 Accomplishments This semester we accomplished the complete design of an autonomous robot named
GROVER from scratch. We were able to come up with a block diagram, design a schematic,
and create a layout to form our own printed circuit board. We researched and ordered all of the
necessary parts and created a working circuit board with a microcontroller and power supplies.
Although this entire process was new to us, our circuit design turned out to be very successful.
We were able to write software to have the microcontroller communicate with 9 peripheral
devices. GROVER was able to avoid obstacles using ultrasonic sensors and detect targets
utilizing passive infrared sensors. We were able to put together a robot that had a small mind of
its own. We met all of our success criteria and therefore created an excellent project.
12.2 Lessons Learned This semester we learned several important lessons while completing our project. One
major lesson involved making sure components meet the required specifications. We found this
out quickly while working with our switching regulator circuit. This was our first experience
working with power supply designs, so we didn’t know exactly what we were doing. We placed
the parts on the PCB and tested the power supply and it seemed to work until we tested it with
the gun motor. It turns out that the inductor used as the regulator choke was only rated for 150
mA. The problem was that we were drawing almost 1 A through it at the time of explosion.
After the smoke screen cleared, we took a look at the datasheet and realized that the rating was a
little low. We won’t ever forget this lesson.
Another lesson we learned is to use consistent colors when creating wire connections for
different components. To be more specific, power and ground should be clearly marked and
kept the same color throughout the project. On at least one occasion, the colors got mixed up
and circuits were destroyed. In the end, it pays to take a little extra time to organize the wires
and keep track of what they mean. This saves a lot of headaches later on.
The biggest lesson that we learned was that teamwork can really make a project easier.
Having teammates to talk to and double check work is a very important aspect of a successful
design. This project would be very difficult for one person to do alone in a semester. Working
ECE 477 Final Report Spring 2005
-52-
together and listening to each other’s ideas was very important in our project. Mistakes were
caught early causing a lot less suffering in the end.
ECE 477 Final Report Spring 2005
-53-
13.0 References
[1] “ATmega32 Product Card” [Online Document], Available HTTP:
http://www.atmel.com/dyn/products/product_card.asp?part_id=2014
[2] “M68MOD9S12C32 Product Summary Page” [Online Document],
Available HTTP:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=M68MOD912C32&
parentCode=MC9S12C32&nodeId=01624684492994
[3] “MC9S12C32 Product Summary Page” [Online Document], Available HTTP:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MC9S12C32&nodeI
d=01624684492994
[4] “Rolling Code 2-Channel UHF Remote Control Data Sheet” [Online Document],
Available HTTP: http://info.hobbyengineering.com/specs/DIY-k157v2.pdf
[5] “Stepper Motor Data Sheet” [Online Document], Available HTTP:
http://info.hobbyengineering.com/specs/PX-27964.pdf
[6] “Devantech SRF04” [Online Document], Available HTTP:
http://info.hobbyengineering.com/specs/devantech-srf04-tech.pdf
[7] “Devantech SRF08” [Online Document], Available HTTP:
http://info.hobbyengineering.com/specs/devantech-srf08-tech.pdf
[8] “PIR Sensors: Kitsrus K30” [Online Document], Available HTTP:
http://info.hobbyengineering.com/specs/DIY-k30.pdf
[9] ”Heath/Zenith SL-5408-WH” [Online Document], Available HTTP:
http://12.153.20.71/heath/mainProduct.asp?page=security&type=Motion+Sensing+Securi
ty+Lighting&model=SL-5408
ECE 477 Final Report Spring 2005
-54-
[10] “Heath/Zenith SL-6030-WH5” [Online Document], Available HTTP:
http://www.homedepot.com/prel80/HDUS/EN_US/diy_main/pg_diy.jsp?prod_id=16173
1&cm_mmc=1hd.com2msn-_-product_feed-_-D27X-_-161731
[11] “LCD: Hitachi LM044L” [Online Document], Available HTTP:
http://www.datasheetarchive.com/datasheet/pdf/17/170557.html
[12] “OPTREX DMC20261A” [Online Document], Available HTTP:
http://www.ece.unh.edu/courses/ece649/documentation/axiom/lcd_Dmcman_full.pdf
[13] “Product Web Page for Rogue ATR and Blue Base Robots” [Online Document],
Available HTTP: http://www.hobbyengineering.com/rogue.html
[14] “Roomba Reference (Height and Weight)” [Online Document], Available HTTP:
http://www.hammacher.com/publish/71545.asp?source=google&keyword=roomba&cm_
ven=NewGate&cm_cat=Google&cm_pla=Roomba%20%20&cm_ite=roomba#
[15] “Roomba Reference (General)” [Online Document], Available HTTP:
http://www.pcworld.com/news/article/0,aid,116854,00.asp
[16] “Roomba Reference (Sensors)” [Online Document], Available HTTP:
http://www.realestatejournal.com/housegarden/toolsgadgets/20021105-mossberg.html
[17] “Foster-Miller Talon brochure” [Online Document], Available HTTP:
http://www.foster-miller.com/literature/documents/TALON_Brochure.pdf
[18] “Fact Sheet: Printed Circuit Board Manufacturers” [Online Document], Available HTTP:
http://es.epa.gov/techinfo/facts/vdwm/va-fs6.html
ECE 477 Final Report Spring 2005
-55-
[19] “Guides to Pollution Prevention – The Printed Circuit Board Manufacturing Industry”
[Online Document], Available HTTP: http://www.p2pays.org/ref/02/01050.pdf
[20] “Recycling Batteries” [Online Document], Available HTTP:
http://www.batteryuniversity.com/partone-20.htm
[21] “Fact Sheet: Disposal of Alkaline Batteries” [Online Document], Available HTTP:
http://es.epa.gov/techinfo/facts/pro-act5.html
[22] “Printed Circuit Board Recycling” [Online Document], Available HTTP:
http://p2library.nfesc.navy.mil/P2_Opportunity_Handbook/2_II_8.html
[23] “Household Battery Fact Sheet” [Online Document], Available HTTP:
http://www.dec.state.ny.us/website/dshm/redrecy/battery.htm
[24] “Battery Disposal” [Online Document], Available HTTP:
http://www.duracell.com/care_disposal/disposal.asp?id=62&
[25] “Aluminum Recycling” [Online Document], Available HTTP:
http://www.anchoragerecycling.com/alumfact.htm
[26] “CodeWarrior Development Studio for Freescale HC(S) 12 Microcontrollers.”
Metrowerks. Available HTTP:
http://www.metrowerks.com/MW/Develop/Embedded/HC12/Default.htm
[27] “mc9s12c32.inc” Generated by [26].
[28] “MC9S12 Family Device User Guide V01.11” [Online Document], Available HTTP:
http://www.freescale.com/files/microcontrollers/doc/data_sheet/9S12C128DGV1.pdf
ECE 477 Final Report Spring 2005
-56-
[29] “OPTREX DOT MATRIX CHARACTER LCD MODULE USER’S MANUAL”
[Online Document], Available HTTP:
http://www.optrex.com/SiteImages/LitCentral/Dmcman_full.pdf
[30] “Autonomous Rolling Robot,” [Online Document], Available HTTP:
http://patft.uspto.gov/netahtml/srchnum.htm patent # 6,414,457
[31] “Mobile Robots and their Control System,” [Online Document], Available HTTP:
http://patft.uspto.gov/netahtml/srchnum.htm patent # 6,532,404
[32] “Method for Operating a Robot,” [Online Document], Available HTTP:
http://patft.uspto.gov/netahtml/srchnum.htm patent # 6,339,735
[33] “Autonomous Moving Apparatus having Obstacle Avoidance Function,” [Online
Document], Available HTTP: http://patft.uspto.gov/netahtml/srchnum.htm patent #
6,515,614
[34] “Socially Interactive Autonomous Robot,” [Online Document], Available HTTP:
http://patft.uspto.gov/netahtml/srchnum.htm patent # 6,539,284
[35] “United States Patent and Trademark Office” [Website], Available HTTP:
http://www.uspto.gov
[36] “ECE 477 Group 1 Project Autonomous Robot” [Online Document], Available
HTTP: http://shay.ecn.purdue.edu/~dsml/ece477/Webs/S03-Grp01/index.html
[37] “Motorola AN1259” [Online Document], Available HTTP:
http://shay.ecn.purdue.edu/%7Edsml/ece477/Homework/Spr2005/AN1259.pdf
ECE 477 Final Report Spring 2005
-57-
[38] “Designing for Reliability, Maintainability, and safety” [Online Document], Available
HTTP:
http://shay.ecn.purdue.edu/~dsml/ece477/Notes/PDF/4-Mod10_ref.pdf
[39] “MILITARY HANDBOOK: RELIABILITY PREDICTION OF ELECTRONIC
EQUIPMENT” [Online Document], Available HTTP:
http://shay.ecn.purdue.edu/~dsml/ece477/Homework/Spr2005/Mil-Hdbk-217F.pdf
[40] “Linear Tech LT 1376-5 Switching Regulator Step Down Converter Datasheet” [Online
Document], Available HTTP:
http://www.linear-tech.com/pc/downloadDocument.do?navId=H0,C3,P1544,D2896
[41] “Linear Tech LT 1374-5 Switching Regulator Step Down Converter Datasheet” [Online
Document], Available HTTP:
http://www.linear-
tech.com/pc/downloadDocument.do?navId=H0,C1,C1003,C1042,C1032,C1064,P1620,D
5227
[42] “4N28 Phototransistor Output Optocoupler Datasheet” [Online Document], Available
HTTP:
http://www.fairchildsemi.com/ds/4N/4N28.pdf
[43] “Parallax #900 servo” [Online Document], Available HTTP:
http://info.hobbyengineering.com/specs/PX-900-00005F.pdf
[44] “Low Cost H-Bridge datasheet” [Online Document], Available HTTP:
http://shay.ecn.purdue.edu/~477grp7/LCHB-100.pdf
ECE 477 Final Report Spring 2005
-A1-
Appendix A: Individual Contributions A.1 Contributions of Joel Stubbs:
This semester we were given the challenge of a very open ended project to complete.
This, like many other classes at Purdue, involved the cooperation and development of a team of
people. At the start of the semester, we put together a team that we thought could work well
together and complete any task that needed to be accomplished. Throughout the semester, we
each obtained roles in the group and worked on things that we were interested in. I was chosen
to be team leader and had the opportunity to organize and lead the team as well as participate in
each part of the design and testing process. Aside from taking a leadership role, a few of my
project contributions are listed below.
One major contribution I made to our team involved the research, development, and
testing of the initial software prototyping and communication for the ultrasonic module and the
servo. I knew that it would take some time to get back into the routine of writing assembly and
communicating with the microcontroller. Early in the semester, I borrowed one of the old
Motorola 68HC12 development boards to work with. I tested some old code from EE362 and
relearned some assembly language. After I became familiar with it again, I researched how the
ultrasonic module worked. I learned about the special communication and timing of the system.
I then wrote some software to test the measurement of distances from objects. I did the same
thing with the servo. I found out that it needed a 1.5 ms pulse to face forward and used pulses
plus or minus 0.5 of that to change to other directions. I again wrote some test software and
tested the operation of the servo. Both of these were in working order for when we needed them
later on in the semester.
Another major contribution I made involved the development and testing of the gun opto-
isolator circuit. This is something that I was very interested in. The firing of the gun was crucial
to our project’s success. Therefore, this was done almost immediately after receiving the AirSoft
machine gun in the mail. I looked through some old EE362 notes and found a circuit used to
control a motor. This circuit involved an active low output pin from the microcontroller. An
optical isolator was used to isolate the output pin from the motor. This circuit also contained an
ECE 477 Final Report Spring 2005
-A2-
arc suppression diode to keep any current spikes from damaging the circuit. This circuit turned
out to work very well for firing the automatic electric machine gun.
Some other major contributions involved populating the PCB with components, helping
debug hardware and software, and developing packaging. The PCB was something that we put
together as soon as we received it. We were in the lab the night that it arrived and were able to
solder it together in a very timely fashion. I was also in charge of creating all of the wire
harnesses for each interface connection. This was a very tedious job especially when some of
the connections required the crimping of 16 wires on both ends. Having bad wire connections
was something we didn’t need to deal with, so I made sure that every single wire in each bus was
connected very tightly. I performed continuity tests on each wire after the creation of each bus.
These busses made it very easy to connect each component to its corresponding header on the
PCB.
Once the main software started being developed, it was time to start completing the
packaging. I was able to contribute key ideas to the packaging scheme and I started building up
temporary packaging for testing purposes. We didn’t have all of the mounting hardware at first,
so we pulled together some stuff from around the lab to test the servo, ultrasonic, and gun
software. To test all of these together, we had to have somewhat of a working package for the
robot. I assisted in debugging the software with Andrew once we had working packaging put
together.
Overall, I think each team member played an important role in our project. Everybody
contributed their part and I think the tasks were pretty evenly divided. I think everybody worked
very well together and that made it pretty easy to pull together a working project. After
demonstrating all of our success criteria, I feel that we had a very successful team and that
everybody deserves an ‘A’.
ECE 477 Final Report Spring 2005
-A3-
A.2 Contributions of Stan Miller: This past semester I have really enjoyed ECE 477 because of the freedom you are
allowed in creating your project. I believe Team GROVER did an outstanding job working
together and getting everything done ahead of schedule. Below is an overview of what I feel I
contributed to the group this past semester.
My main focus this semester was the printed circuit board and overall packaging design.
I was the only electrical engineer in the group so my contributions to software design and testing
would be minimal. I wanted to make sure I was putting in my fair share of work in the hardware
and packaging areas and I feel I accomplished that. For the printed circuit board I spent a
majority of my time finding/creating footprints, untangling “rubber bands”, placing the parts
where they would work the best, and finally routing. This process took a total of about 50 man
hours included the other team members’ time. I designed 3 different boards because the first two
had fatal errors and it was just easier to start over. Overall, our board was fairly simplistic, but I
put a fair amount of time into this part of the design.
The contribution that I had the most fun with this semester was the overall packaging of
GROVER. To start off I built the motors that moved the tank. I ended up having to build the
motor 2 different ways because we first built it for high-speed, low-torque, but as the project
moved on and weight was added, I had to go back and rebuild for higher torque. I was also in
charge of mounting the servo, the gun, and the turret, which was just 2 wall mounts screwed
together. At the end of the project we needed to fix the center of gravity so using L-brackets I
mounted the batteries to the side of the tank and the PIR 9-volt batteries to the top. I also
dropped a level down and mounted the LCD to the top level using 4 L-brackets and made it more
user-friendly.
I was also tasked with the Patent Liability Analysis which consisted of finding patents
using the United States Patent and Trademark Website. I found patents that our project possibly
infringed upon either literally or through the doctrine of equivalents.
I thoroughly enjoyed my time with Team GROVER and I believe we did an overall
outstanding job this semester. I have learned a lot and hope to keep designing in the future.
ECE 477 Final Report Spring 2005
-A4-
A.3 Contributions of Andrew Parcel:
With the exception of the LCD module, I wrote, commented, tested, and debugged the
final application software. This consists of the main polling loop as well as the servo, ultrasonic,
PIR, H-bridge, and AirSoft modules. Based on the preliminary interfacing work done with Joel
on the evaluation board, I modified the code to work with our HC(S)12 derivative and added
functionality. For instance, during our preliminary work, we were able to determine the extent to
which we could turn the servo left and right. I took this knowledge and created the algorithms
for incrementally stepping the servo and looking for the presence of targets. If the servo’s limit
was reached without having found a valid target, GROVER would reset its turret, turn its base 90
degrees in the last known direction of the target, and re-evaluate its perimeter sensors to find the
target.
Having designed the overall program flow and written the overwhelming majority of the
application code, completion of the Software Design Consideration homework wasn’t overly
challenging. I wrote the Ethical and Environmental Analysis homework and contributed heavily
in group assignments (proposals, presentations, user manual, final report) as well. I also served
as an unofficial editor, offering grammatical corrections and phraseology suggestions to other
members in my group.
During our first integration test, we found that the PIR sensors were too sensitive for their
intended use. In addition, when a target was detected by the sensor, it would output a logic ‘1’
signal for 6-8 seconds. Having to constantly wait to ensure we were using up-to-date data before
firing was unacceptable. I came up with fixes for both problems. In our final design,
GROVER’s PIR sensors were susceptible to “body mass,” but not lights or hands. Also, the
length of the asserted PIR output was reduced to less than a second. This shifted the burden of
acquiring up-to-date data to software, which was preferable. Furthermore, I soldered and helped
place the PIR sensor mounted inside the AirSoft gun.
I was also heavily involved with the preliminary packaging. I handled the placement of
the perimeter PIR sensors and ultrasonic sensor. I worked with Joel on determining the best
ECE 477 Final Report Spring 2005
-A5-
placement of the H-bridge and RF switch. Joel, Edwin, and I also worked on getting the board
populated in one night.
Early in the semester, I created the team’s website and designed the associated
graphics/logos. In lieu of programs such as FrontPage and Dreamweaver, I used the same type
of program I created my first web page on in 1996 to create the team’s website: a text editor. In
addition to creating basic lab notebooks for the team members to use, I also wrote a Python script
to generate printable views of the notebooks. Edwin and I shared photographing duties. We
each took pictures of GROVER documenting the evolution from individual components and a
bare circuit board to a complete and functional system.
ECE 477 Final Report Spring 2005
-A6-
A.4 Contributions of Edwin Tjandranegara:
My contributions to this project varied vastly across different disciplines and knowledge.
I was in charge of the project schematic design, software design and interfacing of the LCD and
shift register, reliability and safety analysis, and H-bridge and PIR sensors interfacing. I also
helped Andrew with his webmaster duties.
Due to my circuit design responsibilities, I was the person responsible for selecting power
supply chips and designing the power supply circuitry. I’m very proud of my schematic design.
It only underwent two revisions and both revisions are just minor additions to the schematic.
Since I created and designed the schematic, it only made sense if I was involved largely in
selecting and ordering components. I was also able to help Stan in creating and matching layout
footprints with the actual components.
I was also responsible for interfacing the MCU with the shift register/LCD in order to
display data on the LCD. Although never formally assigned this task, I decided to do it to ease
Andrew’s burden in writing the software. I had initially planned to only start the software and
let others build upon my work, but the more I tried to do it, the more fun I had. I ended up
finishing the entire LCD module. I also created a few subroutines that Andrew could call to
display data to the LCD.
I was the person in charge of initially interfacing the H-bridge and the PIR sensors. I also
assembled all five PIR sensors. I helped Andrew maintain and update the website as well. I had
a lot of fun doing this because I learned how to use Macromedia Dreamweaver. I also did a lot
of other chores like editing the demo clips, created presentation slides, and cleaning up the
workbench whenever we were done for the day.
I definitely learned a lot of new things regarding circuit design and electronic design in
general by taking this class. I am sure that the new skills I gained from this class will be very
useful in the future.
ECE 477 Final Report Spring 2005
B-1
Appendix B: Packaging
Figure B-1: Final Packaging of GROVER – Front/Side View
ECE 477 Final Report Spring 2005
B-2
Figure B-2: Final Packaging of GROVER – Top View
ECE 477 Final Report Spring 2005
C-1
Appendix C: Schematic C-1 OrCAD schematic
Figure C-1: OrCAD Schematic of GROVER
ECE 477 Final Report Spring 2005
C-2
C-2 OrCAD design rule check report
Checking Pins and Pin Connections
--------------------------------------------------
Checking Schematic: SCHEMATIC1
--------------------------------------------------
Checking Electrical Rules
Checking for Unconnected Nets
Checking for Invalid References
Checking for Duplicate References
Reporting Ports
Reporting Off-Page Connections
Reporting Globals
0
Checking Visible Unconnected Power Pins
Check Bus width mismatch
C-3 OrCAD bill of materials report
GROVER - Schematic Revised: Thursday, March 03, 2005
ECE477SP05 - GRP7 Revision: 1v0
ECE477 Group 7 Sp 2005
Purdue University - West Lafayette, IN
Bill Of Materials March 3,2005 14:06:06 Page1
Item Quantity Reference Part
______________________________________________
1 2 C4 0.01 uF
C5 0.01 uF
2 1 C6 22 uF
3 1 C7 1.5 nF
4 1 C8 0.27 uF
5 2 C9 100 uF, 10V Solid Tantalum
C13 100 uF, 10V solid tantalum
6 1 C10 33 uF
ECE 477 Final Report Spring 2005
C-3
7 1 C11 3.3 nF
8 1 C12 0.1 uF
9 1 D2 MBRS330T3
10 1 D3 CMDSH3
11 1 D4 1N4001
12 1 D5 1N5818
13 1 D6 1N914
14 2 D7 LED
D9 LED
15 2 J1 HEADER for debug
J2 HEADER for debug
16 1 J3 VIN
17 4 J6 HEADER to PIR
J7 HEADER to PIR
J8 HEADER to PIR
J9 HEADER to PIR
18 2 J11 Battery
J17 Battery
19 1 J12 Gun Battery
20 1 J14 Header Gun
21 1 J15 CAN HEADER
22 1 J16 5V, 4.25A
23 1 J18 5V, 1.25A
24 1 J19 HEADER 7X2
25 1 J20 DIPSOC-16x2
26 1 J21 HEADER to Servo
27 1 J22 HEADER to Hbridge
28 1 J23 HEADER to Usonic
29 2 L2 10 uH
L3 10 uH
30 1 Q1 TIP122
31 5 R1 1K
R3 1K
R5 1K
R7 1K
R17 1K
32 5 R2 1.2K
R4 1.2K
R6 1.2K
R8 1.2K
R13 1.2K
33 1 R12 2.2K
34 1 R16 220
35 1 R18 10K
36 1 SW1 RESET
37 1 SW2 SW KEY-SPST
38 1 U3 74HC164
39 1 U5 LT1374-5/SO
40 1 U6 4N28
41 1 U7 LT1376/SO8
42 1 W1 JUMPER1
ECE 477 Final Report Spring 2005
D-1
Appendix D: PCB Layout Top and Bottom Copper
Figure D-1: Top layer of PCB
ECE 477 Final Report Spring 2005
D-2
Figure D-2: Bottom layer of PCB
ECE 477 Final Report Spring 2005
E-1
Appendix E: Parts List Spreadsheet
Part Vendor Part Number Unit Cost Quantity Final Cost
Micro-Controller Motorola M68MOD912C32 $24.95 1 $24.95
PIR Motion Detector
Kitsrus K30 $20.95 4 $83.80
H-Bridge Rogue Robotics LCHB $0.00 1 $ 0.00
Ultrasonic Range Finder
Devantech SRF04 $33.50 1 $33.50
Robot Base Rogue Robotics RT-ATR $139.95 1 $139.95
Robot Extra Level Kit
Rogue Robotics RT-XLV $29.95 1 $29.95
LCD Optrex Corporation
DMC20261A $0.00 1 $0.00
Airsoft/Paintball Gun
KTC 210910 $18.50 1 $18.50
RF switch Kitsrus K157-A $45.95 1 $45.95
Servo Parallax Inc JR NES-537 $23.00 1 $23.00
30V Schottky Diodes
Central Semi 610-CMDSH-3
$0.66
1 $0.66
Switching regulator
Linear Tech LT1376-5 $4.35 1 $4.35
Switching regulator
Linear Tech LT1374-5 $5.00 1 $5.00
8-Bit SIPO Shift Reg
ST 5V Logic
511-M74HC164
$0.71
1 $0.71
10 uH inductor API Delevan 2474-13L $2.70 1 $2.70
BR/BK/BK/SL 10UH inductor
J.W. Miller 77F100K $0.55 1 $0.55
DIODE SCHOTTKY 30V 3A SMC
Central Semi MBRS330T3OSCT-ND
$0.34
1 $0.34
OPTOCOUPLER TRANS-OUT 6-DIP
National Semi 4N28-ND $0.52 1 $0.52
TRANS NPN DARL 100V 5A
National Semi TIP122FS-ND $0.60 1 $0.60
ECE 477 Final Report Spring 2005
E-2
TO-220
Resistors, Capacitors, switches and misc. Diodes
- - - - $30.00
Batteries & Chargers
- - - - $50.00
Total $544.53
Table E-1: Major Components Spreadsheet
ECE 477 Final Report Spring 2005
F-1
Appendix F: Software Listing ;*****************************************************************
;*****************************************************************
;* GROVER *
;*****************************************************************
;*****************************************************************
; export symbols
XDEF Entry ; export 'Entry' symbol
ABSENTRY Entry ; for absolute assembly:
; mark this as application entry
; point
; include derivative specific macros
INCLUDE 'mc9s12c32.inc'
ROMStart EQU $4000 ; absolute address to place
; code/constant data
ORG RAMStart
;**************************************************************
; Variables
;**************************************************************
start_tm fdb 2 ; echo start time
end_tm fdb 2 ; echo end time
pir_data rmb 1 ; perimeter pir trigger data
pir_airsoft rmb 1 ; turret pir trigger data
ammo rmb 1 ; ammo count
engage rmb 1 ; engagement count
e_flag rmb 1 ; engagment flag
SPI_data rmb 1
BIN_data rmb 1
ORG ROMStart
Entry:
;**************************************************************
;* Grover Project Code *
;**************************************************************
;bra Test
grover
lds #$0FFF ; initialize stack pointer
ldaa #$00 ; disable cop watchdog
staa COPCTL
; initializations
jsr motor_init ; initialize h_bridge
jsr servo_init ; initialize servo
jsr u_sonic_init ; initialize ultrasonic sensor
jsr pir_init ; initialize pir sensors
jsr airsoft_init ; initialize air_soft
jsr LCD_init ; initialize lcd display
jsr LCD_power ; display power on message
; reset variables
movb #$00,engage ; reset engagement count
movb #$00,e_flag ; reset engagement flag
movb #20t,ammo ; reset ammo count
movb #$00,pir_data ; reset perimeter pir flag
movb #$00,pir_airsoft ; reset turret pir flag
; reset turret
ECE 477 Final Report Spring 2005
F-2
jsr servo_rst ; make sure gun is facing forward
; pause for 10 seconds
jsr delay2_5s
jsr delay2_5s
jsr delay2_5s
jsr delay2_5s
grover_loop
nop ; poll pir sensors 26 times
ldx #$1A ; load x with 26
poll_loop
jsr delay20ms ; 20ms delay
jsr pir_poll ; poll pir sensors
ldaa pir_data
lbne target_det ; if sensors report a target, branch
dbne x,poll_loop ; if x != 0, continue pir polling loop
jsr u_sonic_ping ; otherwise, check for obstacles
lbra grover_loop ; continue infinite loop
target_det
jsr motor_halt ; if target detected, stop moving
ldaa pir_data ; check whether or not the right-side
anda #%00000100 ; pir sensor was triggered and
bne target_right ; branch to target_right if true
ldaa pir_data ; check whether or not the left-side
anda #%00000001 ; pir sensor was triggered and
bne target_left ; branch to target_left if true
ldaa pir_data ; check whether or not the center
anda #%00000010 ; pir sensor was triggered and
bne target_center ; branch to target_center if true
lbra grover_loop ; otherwise, branch back to the main loop
target_right
jsr servo_right ; start looking for the target on the right
jsr delay20ms ; pause 40ms before returning to the main loop
jsr delay20ms
lbra grover_loop
target_left
jsr servo_left ; start looking for the target on the left
jsr delay20ms ; pause 40ms before returning to the main loop
jsr delay20ms
lbra grover_loop
target_center
jsr center_sweep ; start center sweep
jsr delay20ms ; pause 40ms before returning to the main loop
jsr delay20ms
lbra grover_loop
;**************************************************************
;* Test Loops *
;**************************************************************
;* FOR DEVELOPMENT PURPOSES ONLY *
;**************************************************************
Test
lds #$0FFF ; initialize stack pointer
ldaa #$00 ; disable cop watchdog
staa COPCTL
jsr servo_init ; initialize servo
jsr LCD_init
jsr LCD_power
jsr delay2_5s
nop
ECE 477 Final Report Spring 2005
F-3
jsr airsoft_init ; initialize airsoft gun
nop
jsr airsoft_fire ; fire a 5-shot burst
jsr delay2_5s
jsr delay2_5s
jsr delay2_5s
jsr delay2_5s
Test_loop
jsr servo_right ; move servo right to left
jsr delay2_5s
jsr delay2_5s
jsr servo_left
jsr airsoft_fire
jsr delay2_5s
jsr delay2_5s
nop
bra Test_loop
stop
;**************************************************************
;* AirSoft *
;**************************************************************
;* Pin: PM0 - active low output to gun *
;**************************************************************
;--------------------------------------------------------------
; airsoft_init
;--------------------------------------------------------------
; Description: Sets the data direction of PM0 to output and
; sets PM0's initial value to 1
;--------------------------------------------------------------
airsoft_init
pshd
pshc
ldaa #%00111101 ; set PM0 as output
oraa DDRM
staa DDRM
;PREDATOR CODE FIX!
ldaa #%00000001 ; set PM0's initial value
oraa PTM ; to 1
staa PTM
pulc
puld
rts
;--------------------------------------------------------------
; airsoft_fire
;--------------------------------------------------------------
; Description: Fires a 5-shot burst from the AirSoft gun
;--------------------------------------------------------------
airsoft_fire
pshd
pshc
ldaa PTM ; fire gun
anda #$FE
staa PTM
jsr delay2_5s ; wait about 5 seconds
jsr delay2_5s ; (equivalent to 5 shots)
ldaa PTM ; cease fire
oraa #$01
staa PTM
ldaa ammo ; update the ammo count
suba #$05
staa ammo
ldaa ammo ; check whether or not GROVER
ECE 477 Final Report Spring 2005
F-4
suba #$00 ; is out of ammo
beq out_of_ammo
movb #$FF, e_flag ; set engagement flag
pulc
puld
rts
out_of_ammo
nop ; if out of ammo, display reload
jsr cursor_reset ; message and enter infinite loop
jsr Disp_POWER_ON_STNBY
i_loop nop
bra i_loop
stop
;--------------------------------------------------------------
; airsoft_test
;--------------------------------------------------------------
; Description: Initializes the AirSoft gun and fires 5-shot
; bursts followed by 10 seconds of cease fire in
; a loop
;--------------------------------------------------------------
airsoft_test
jsr airsoft_init
airsoft_test_l
jsr airsoft_fire ; fire a 5-shot burst
jsr delay2_5s ; wait about 10 seconds
jsr delay2_5s
jsr delay2_5s
jsr delay2_5s
bra airsoft_test_l
;**************************************************************
;* PIR Sensors *
;**************************************************************
;* Pin: AN0 - PIR 1 input - Left Side *
;* AN1 - PIR 2 input - Front *
;* AN2 - PIR 3 input - Right Side *
;* AN3 - PIR 4 input - Turret *
;**************************************************************
;--------------------------------------------------------------
; pir_init
;--------------------------------------------------------------
; Description: Sets the data direction of AN00 - AN03 as
; inputs and clear pir_data and pir_airsoft
;--------------------------------------------------------------
pir_init
pshd
pshc
ldaa #$F0 ; set AN0 - AN3 as inputs
anda DDRAD
staa DDRAD
movb #$FF,ATDDIEN
movb #$00,pir_data ; clear pir_data
movb #$00,pir_airsoft ; clear pir_airsoft
pulc
puld
rts
;--------------------------------------------------------------
; pir_poll
;--------------------------------------------------------------
; Description: Poll PIRs 1, 2, and 3 and store the data in
; bits 0, 1, and 2 of the variable pir_data
;--------------------------------------------------------------
pir_poll
ECE 477 Final Report Spring 2005
F-5
pshd
pshc
ldaa PTAD ; get PIR data from PIRs
anda #$07 ; 1, 2, and 3 and store in
staa pir_data ; pir_data
pulc
puld
rts
;--------------------------------------------------------------
; pir_poll_t
;--------------------------------------------------------------
; Description: Poll the PIR sensor on the turret and store the
; data in bit 3 of the variable, pir_airsoft
;--------------------------------------------------------------
pir_poll_t
pshd
pshc
ldaa PTAD ; get PIR data from PIR 4
anda #$08 ; and store in pir_airsoft
staa pir_airsoft
pulc
puld
rts
;**************************************************************
;* Servo *
;**************************************************************
;* Pin: PT4 - Output duty cycle to control servo rotation *
;* *
;**************************************************************
;--------------------------------------------------------------
; servo_init
;--------------------------------------------------------------
; Description: Sets the data direction of PT4 as an output and
; initialize the value to 0
;--------------------------------------------------------------
servo_init
pshd
pshc
ldaa #$10 ; set PT4 as an output
oraa DDRT
staa DDRT
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
pulc
puld
rts
;--------------------------------------------------------------
; servo_rst
;--------------------------------------------------------------
; Description: Resets the servo so that it is facing forward
;--------------------------------------------------------------
servo_rst
pshx
pshy
pshc
ldx #20t
servo_rst_l
ldaa PTT ; set PT4 to 1
oraa #$10
staa PTT
jsr delay1_5ms ; keep PT4 high for 1.5ms
ECE 477 Final Report Spring 2005
F-6
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
jsr delay20ms
dbne x,servo_rst_l
pulc
puly
pulx
rts
;--------------------------------------------------------------
; servo_right
;--------------------------------------------------------------
; Description: Turns the turret left until a target is
; detected or the turning limit is reached.
;
; If a target is detected, call airsoft_fire.
;
; If the turning limit is reached, call servo_rst
; and turn GROVER 90 degrees to the right and
; return
;--------------------------------------------------------------
servo_right
pshx
pshy
pshc
ldd #1755t ; initial time value
servo_right_i
ldx #10t
addd #240t
pshd
puly
pshd
servo_right_l
ldaa PTT ; set PT4 to 1
oraa #$10
staa PTT
pshy
jsr delay_turn
puly
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
jsr delay20ms
dbne x,servo_right_l
; poll turret pir sensor 10 times
; if a target is detected, branch to airsoft_fire
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
ECE 477 Final Report Spring 2005
F-7
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
; if the servo's limit is reached, branch
; to the right servo limit routine
puld
pshd
subd #3195t
beq servo_limit_r
; otherwise, continue executing the servo
; stepping routine
puld
lbra servo_right_i
servo_limit_r
nop ; reset the turret to the
jsr servo_rst ; forward position
nop
jsr motor_right ; turn GROVER 90 degrees to
nop ; the right
puld
pulc
puly
pulx
rts
servo_fire
jsr airsoft_fire ; fire the gun
jsr servo_rst ; reset the turret to the
nop ; forward position
puld
pulc
puly
pulx
rts
;--------------------------------------------------------------
; servo_left
ECE 477 Final Report Spring 2005
F-8
;--------------------------------------------------------------
; Description: Turns the turret right until a target is
; detected or the turning limit is reached.
;
; If a target is detected, call airsoft_fire.
;
; If the turning limit is reached, call servo_rst
; and turn GROVER 90 degrees to the left and
; return
;--------------------------------------------------------------
servo_left
pshx
pshy
pshc
ldd #2214t ; initial time value
servo_left_i
ldx #10t
subd #219t
pshd
puly
pshd
servo_left_l
ldaa PTT ; set PT4 to 1
oraa #$10
staa PTT
pshy
jsr delay_turn
puly
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
jsr delay20ms
dbne x,servo_left_l
; poll turret pir sensor 10 times
; if a target is detected, branch to airsoft_fire
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
ECE 477 Final Report Spring 2005
F-9
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
; if the servo's limit is reached, branch
; to the left servo limit routine
puld
pshd
subd #900t
beq servo_limit_l
; otherwise, continue executing the servo
; stepping routine
puld
lbra servo_left_i
servo_limit_l
nop ; reset the turret to the
jsr servo_rst ; forward position
nop
jsr motor_left ; turn GROVER 90 degrees to
nop ; the left
puld
pulc
puly
pulx
rts
;--------------------------------------------------------------
; center_sweep
;--------------------------------------------------------------
; Description: Turns the turret right approximately 30 degrees,
; resets the turret, and then turns the turret
; left approximately 30 degrees. All the while,
; it is looking for a target
;
; If a target is detected, call airsoft_fire.
;
; If sweep completes without locating a target,
; call servo_rst and return
;--------------------------------------------------------------
center_sweep
nop
sweep_right
pshx
pshy
pshc
ldd #1755t ; initial time value
sweep_right_i
ldx #10t
addd #240t
pshd
ECE 477 Final Report Spring 2005
F-10
puly
pshd
sweep_right_l
ldaa PTT ; set PT4 to 1
oraa #$10
staa PTT
pshy
jsr delay_turn
puly
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
jsr delay20ms
dbne x,sweep_right_l
; poll turret pir sensor 10 times
; if a target is detected, branch to airsoft_fire
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ECE 477 Final Report Spring 2005
F-11
; if the sweep's right limit is reached, branch
; to the sweep right limit routine
puld
pshd
subd #2235t
beq sweep_limit_r
; otherwise, continue executing the sweep
; stepping routine
puld
lbra sweep_right_i
sweep_limit_r
nop ; reset the turret to the
jsr servo_rst ; forward position
jsr sweep_left
puld
pulc
puly
pulx
rts
sweep_left
pshx
pshy
pshc
ldd #2214t ; initial time value
sweep_left_i
ldx #10t
subd #219t
pshd
puly
pshd
sweep_left_l
ldaa PTT ; set PT4 to 1
oraa #$10
staa PTT
pshy
jsr delay_turn
puly
ldaa PTT ; set PT4 to 0
anda #$EF
staa PTT
jsr delay20ms
dbne x,sweep_left_l
; poll turret pir sensor 10 times
; if a target is detected, branch to airsoft_fire
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ECE 477 Final Report Spring 2005
F-12
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
ldaa PTAD
anda #$08
lbne servo_fire
jsr delay20ms
jsr delay20ms
; if the sweep's right limit is reached, branch
; to the sweep right limit routine
puld
pshd
subd #1776t
beq sweep_limit_l
; otherwise, continue executing the sweep
; stepping routine
puld
lbra sweep_left_i
sweep_limit_l
nop ; reset the turret to the
jsr servo_rst ; forward position
puld
pulc
puly
pulx
rts
;--------------------------------------------------------------
; servo_test
;--------------------------------------------------------------
; Description: Initializes the servo and moves it from left to
; right in a loop
;
; NOTE: Must disble target acquisition and turning code
; in servo_left and servo_right to use
;--------------------------------------------------------------
servo_test
jsr servo_init ; initialize servo
jsr servo_rst ; move servo to the front
nop
servo_test_l
jsr servo_left ; increment servo to the left
nop
ECE 477 Final Report Spring 2005
F-13
jsr servo_right ; increment servo to the right
nop
bra servo_test_l
;**************************************************************
;* Ultrasonic Sensor *
;**************************************************************
;* Pin: PT6 - input - Echo *
;* PT7 - output - Trigger *
;**************************************************************
;--------------------------------------------------------------
; u_sonic_init
;--------------------------------------------------------------
; Description: Initializes the timer and sets the data
; direction of PT7 to output, PT6 to input, and
; sets PT7's initial value to 0
;--------------------------------------------------------------
u_sonic_init
jsr tim_ini ; initialize timer subsystem
ldaa #$80 ; set PT7 as an output
oraa DDRT
staa DDRT
ldaa #$BF ; set PT6 as an input
anda DDRT
staa DDRT
ldaa PTT ; set PT7 to 0
anda #$7F
staa PTT
rts
;--------------------------------------------------------------
; u_sonic_ping
;--------------------------------------------------------------
; Description: Determines the distance of an object. If an
; object is in GROVER's immediate path, it halts
; the vehicle and spins it 90 degrees to the
; right and returns. If the path is clear, it
; updates the engagement count, clears the
; engagement flag, and turns the motors on for
; forward movement before returning
;--------------------------------------------------------------
u_sonic_ping
pshd
pshc
ping_loop
jsr delay2_5s
movw #$0000,start_tm ; clear start time
movw #$0000,end_tm ; clear end time
ldaa PTT ; set PT7 to 1
oraa #$80
staa PTT
jsr delay11us ; wait for 11 microseconds
ldaa PTT ; set PT7 to 0
anda #$7F
staa PTT
ping_wait1
ldaa PTT
anda #$40
cmpa #$40
bne ping_wait1
ldd TCNT
std start_tm
ping_wait2
ldaa PTT
anda #$40
ECE 477 Final Report Spring 2005
F-14
cmpa #$00
bne ping_wait2
ldd TCNT
std end_tm
subd start_tm
cpd #$04dd
lbls ping_object
; check if engagement flag set
; if true, increment engagement count
; and clear flag
jsr back_space
ldaa e_flag
beq no_update
ldaa engage
adda #$01
staa engage
staa BIN_data
jsr send_num
no_update
movb #$00, e_flag
jsr motor_forward ; engage motors forward
nop
pulc
puld
rts
ping_object
jsr motor_halt ; turn off motors
jsr delay2_5s ; allow for robot to come to a
; halt
jsr motor_right ; turn robot 90 degrees right
pulc
puld
rts
;**************************************************************
;* Motors/H-Bridge *
;**************************************************************
;* Pin: PT0 - output - Motor 1 Forward *
;* PT1 - output - Motor 1 Reverse *
;* PT2 - output - Motor 2 Forward *
;* PT3 - output - Motor 2 Reverse *
;**************************************************************
;--------------------------------------------------------------
; motor_init
;--------------------------------------------------------------
; Description: Sets the data direction of PT0 - PT3 to output
; and sets their initial values to 0
;--------------------------------------------------------------
motor_init
pshd
pshc
ldaa #$0F ; set PT0-PT3 as outputs
oraa DDRT
staa DDRT
ldaa PTT ; set PT0-PT3 to 0
anda #$F0
staa PTT
pulc
puld
rts
;--------------------------------------------------------------
; motor_halt
ECE 477 Final Report Spring 2005
F-15
;--------------------------------------------------------------
; Description: Turns off Motor 1 and Motor 2
;--------------------------------------------------------------
motor_halt
pshd
pshc
ldaa PTT
anda #$F0 ; kill both motors
staa PTT
pulc
puld
rts
;--------------------------------------------------------------
; motor_forward
;--------------------------------------------------------------
; Description: Turns on Motor 1 Forward and Motor 2 Forward
;--------------------------------------------------------------
motor_forward
pshd
pshc
ldaa PTT ; set both motors forward
anda #$F0
oraa #$FA
staa PTT
pulc
puld
rts
;--------------------------------------------------------------
; motor_left
;--------------------------------------------------------------
; Description: Turns Grover approximately 90 degrees to the
; right
;--------------------------------------------------------------
motor_left
pshd
pshc
ldaa PTT ; set motor 1 forward and
anda #$F0 ; motor 2 reverse
oraa #$F9
staa PTT
jsr delay2_5s ; wait approximately 5 seconds
nop
jsr delay2_5s
nop
jsr motor_halt ; stop both motors
pulc
puld
rts
;--------------------------------------------------------------
; motor_right
;--------------------------------------------------------------
; Description: Turns Grover approximately 90 degrees to the
; left
;--------------------------------------------------------------
motor_right
pshd
pshc
ldaa PTT ; set motor 1 reverse and
anda #$F0 ; motor 2 forward
oraa #$F6
staa PTT
jsr delay2_5s ; wait approximately 5 seconds
nop
ECE 477 Final Report Spring 2005
F-16
jsr delay2_5s
nop
jsr motor_halt ; stop both motors
pulc
puld
rts
;**************************************************************
;* Timer Initialization *
;**************************************************************
tim_ini
movb #$80,TFLG2
movb #$80,TSCR1 ; Enable timer
movb #$00,TCTL1 ; disable capture
movb #$00,TCTL2
movb #$00,TCTL3
movb #$00,TCTL4
movb #$00,TIE
movb #$02,TSCR2 ; Set prescale factor to 8, enable
rts ; counter reset after OC7
;**************************************************************
;* LCD Stuff *
;**************************************************************
;* *
;**************************************************************
LCD_power
pshc
jsr wait15ms
jsr wait15ms
jsr Disp_POWER_ON_ARMED
jsr new_line
jsr Disp_ENG
ldaa #$00
staa BIN_data
jsr send_num
pulc
rts
LCD_test_loop
jsr back_space
ldaa #$00
staa BIN_data
jsr send_num
jsr wait15ms
jsr wait15ms
jsr back_space
ldaa #$01
staa BIN_data
jsr send_num
jsr wait15ms
jsr wait15ms
bra LCD_test_loop
stop
Disp_POWER_ON_ARMED
jsr Disp_PWR_ON
jsr arrow
jsr Disp_GROVER_ARMED
rts
Disp_POWER_ON_STNBY
jsr Disp_PWR_ON
jsr arrow
ECE 477 Final Report Spring 2005
F-17
jsr Disp_RELOAD_STNBY
rts
;--------------------------------------------------------------
; word display functions
;--------------------------------------------------------------
Disp_PWR_ON
jsr letter_P
jsr letter_W
jsr letter_R
jsr colon
jsr space
jsr letter_O
jsr letter_N
rts
Disp_GROVER_ARMED
jsr letter_G
jsr letter_R
jsr letter_O
jsr letter_V
jsr letter_E
jsr letter_R
jsr space
jsr letter_A
jsr letter_R
jsr letter_M
jsr letter_E
jsr letter_D
rts
Disp_RELOAD_STNBY
jsr letter_R
jsr letter_E
jsr letter_L
jsr letter_O
jsr letter_A
jsr letter_D
jsr space
jsr letter_S
jsr letter_T
jsr letter_N
jsr letter_B
jsr letter_Y
rts
Disp_ENG
jsr letter_E
jsr letter_N
jsr letter_G
jsr colon
jsr space
rts
;--------------------------------------------------------------
; char functions
;--------------------------------------------------------------
letter_P
ldaa #%01010000 ;send P
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
ECE 477 Final Report Spring 2005
F-18
jsr wait15ms
rts
letter_W
ldaa #%01010111 ;send W
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_R
ldaa #%01010010 ;send R
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_O
ldaa #%01001111 ;send O
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_N
ldaa #%01001110 ;send N
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_E
ldaa #%01000101 ;send E
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_G
ldaa #%01000111 ;send G
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
ECE 477 Final Report Spring 2005
F-19
jsr wait15ms
rts
letter_V
ldaa #%01010110 ;send V
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_A
ldaa #%01000001 ;send A
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_M
ldaa #%01001101 ;send M
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_D
ldaa #%01000100 ;send D
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_L
ldaa #%01001100 ;send L
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_S
ldaa #%01010011 ;send S
staa SPI_data
jsr SPI_send
jsr wait15ms
ECE 477 Final Report Spring 2005
F-20
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_T
ldaa #%01010100 ;send L
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_B
ldaa #%01000010 ;send L
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
letter_Y
ldaa #%01011001 ;send L
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
send_num
jsr bin2disp
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
arrow
ldaa #%01111110 ;send arrow
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
space
ldaa #%00100000 ;send :space
staa SPI_data
ECE 477 Final Report Spring 2005
F-21
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
colon
ldaa #%00111010 ;send colon
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%00001000
oraa PTM
staa PTM
jsr send_E
jsr wait15ms
rts
back_space
ldaa #%00010000 ;send backspace
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
jsr wait15ms
rts
new_line
ldaa #%11000000 ;send new line
staa SPI_data
jsr SPI_send
jsr wait15ms
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
jsr wait15ms
rts
;**************************************************************
;* LCD *
;**************************************************************
;* Pin: PM5 - SCK *
;* PM4 - Data *
;* PM3 - RS *
;* PM2 - E *
;* *
;**************************************************************
PTM_init
psha
ldaa #%00111100
oraa DDRM
staa DDRM
pula
rts
; synthetic SPI: load data you want to push data you want to SPI_data
ECE 477 Final Report Spring 2005
F-22
; (8bit)with format: 765432310
;--------------------------------------------------------------
; SPI Stuff
;--------------------------------------------------------------
SPI_send
pshx
pshy
psha
ldx #8t
loop
jsr SPIgen
dbne x, loop
pula
puly
pulx
rts
SPIgen
pshd
pshy
ldaa SPI_data
psha
lsla
staa SPI_data
pula
lsra
lsra
lsra
anda #%00010000
oraa #$01
staa PTM
jsr clkdelay
ldaa #%00100000
oraa PTM
staa PTM
jsr clkdelay
nop
nop
puly
puld
rts
clkdelay
pshx
pshy
pshc
ldy #1t
loopo
dbne y,loopo
pulc
puly
pulx
rts
;--------------------------------------------------------------
; LCD Initialization
;--------------------------------------------------------------
LCD_init
jsr wait15ms ;wait for 15ms
jsr wait15ms ;wait for 15ms
jsr wait15ms ;wait for 15ms
ldaa #%00110000 ;send 1st init command
staa SPI_data
jsr SPI_send
ECE 477 Final Report Spring 2005
F-23
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
jsr wait15ms ;wait for 15 ms
ldaa #%00110000 ;send 2nd init command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
jsr wait15ms
ldaa #%00110000 ;send 3rd init command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
ldaa #%00111100 ;send funct set command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
ldaa #%00001000 ;send disp off command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
ldaa #%00000001 ;send clear disp command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
ldaa #%00000110 ;send entry mode set command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
ldaa #%00001100 ;send disp on command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
send_E
jsr wait15ms
ldaa #%00000100
oraa PTM
staa PTM
jsr wait15ms
ldaa #%11111011
anda PTM
staa PTM
jsr wait15ms
ECE 477 Final Report Spring 2005
F-24
rts
;--------------------------------------------------------------
; Convert binary to display
;--------------------------------------------------------------
bin2disp
psha
ldaa BIN_data
oraa #%00110000
staa SPI_data
pula
rts
;--------------------------------------------------------------
; Scroll display
;--------------------------------------------------------------
scroll_disp
ldaa #%00011000 ;send scroll to left command
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
jsr wait15ms
jsr wait15ms
jsr wait15ms
rts
;--------------------------------------------------------------
; Function to return cursor to original position
;--------------------------------------------------------------
cursor_reset
ldaa #%10000000 ;send cursor reset
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
rts
;--------------------------------------------------------------
; Function to return cursor to original position
;--------------------------------------------------------------
clear_disp
ldaa #%00000001 ;send clear LCD
staa SPI_data
jsr SPI_send
ldaa #%11110111
anda PTM
staa PTM
jsr send_E
rts
;==============================================================
; Delay Loops
;==============================================================
;--------------------------------------------------------------
; 11us Delay
;--------------------------------------------------------------
delay11us
pshx
pshy
pshc
ECE 477 Final Report Spring 2005
F-25
ldy #1t
loopo11us
ldx #10t
loopi11us
dbne x,loopi11us
dbne y,loopo11us
pulc
puly
pulx
rts
;---------------------------------------------------------------
; 2.5s Delay
;--------------------------------------------------------------
delay2_5s
pshx
pshy
pshc
ldy #400t
loopo5s
ldx #2665t
loopi5s
dbne x,loopi5s
dbne y,loopo5s
pulc
puly
pulx
rts
;--------------------------------------------------------------
; 1.5ms Delay
;--------------------------------------------------------------
delay1_5ms
pshx
pshy
pshc
ldy #1t
loopo1_5ms
ldx #1995t
loopi1_5ms
dbne x,loopi1_5ms
dbne y,loopo1_5ms
pulc
puly
pulx
rts
;--------------------------------------------------------------
; 20ms Delay
;--------------------------------------------------------------
delay20ms
pshx
pshy
pshc
ldy #2t
loopo20ms
ldx #26661t
loopi20ms
dbne x,loopi20ms
dbne y,loopo20ms
pulc
puly
pulx
rts
;--------------------------------------------------------------
ECE 477 Final Report Spring 2005
F-26
; Turn Increment Delay
;--------------------------------------------------------------
delay_turn
pshx
pshc
loopi_inc
dbne y,loopi_inc
pulc
pulx
rts
;--------------------------------------------------------------
; 0.5ms Delay
;--------------------------------------------------------------
delay_5ms
pshx
pshy
pshc
ldy #1t
loopo_5ms
ldx #900t
loopi_5ms
dbne x,loopi_5ms
dbne y,loopo_5ms
pulc
puly
pulx
rts
;--------------------------------------------------------------
; 0.5ms Delay
;--------------------------------------------------------------
wait0_5ms
pshx
pshy
pshc
ldy #1t
loopo0_5ms
ldx #900t
loopi0_5ms
dbne x,loopi0_5ms
dbne y,loopo0_5ms
pulc
puly
pulx
rts
;--------------------------------------------------------------
; 4.5ms Delay
;--------------------------------------------------------------
wait4_5ms
psha
ldaa #7t
loop4_5ms
bsr wait0_5ms
dbne a, loop4_5ms
pula
rts
;--------------------------------------------------------------
; 15ms Delay
;--------------------------------------------------------------
wait15ms
psha
ldaa #4t
loop15ms
ECE 477 Final Report Spring 2005
F-27
bsr wait4_5ms
dbne a, loop15ms
pula
rts
;**************************************************************
;* Interrupt Vectors *
;**************************************************************
ORG $FFFE
fdb Entry ; Reset
ECE 477 Final Report Spring 2005
G-1
Appendix G: User Manual
GROVER Description
GROVER is the first robot ever to be used as an autonomous rogue agent in a paintball
arena. GROVER is designed to randomly patrol any sized area. This battery powered robot
travels on two rotating treads, similar to those of a tank, and includes a rotating turret that detects
heat-emitting targets by the use of PIR (Passive Infrared) sensors. The robot is capable of
obstacle avoidance using ultrasonic sensors and will travel in a straight obstacle free path until a
target is detected. Upon obstacle detection, the robot will halt, randomly face a new direction
and continue forward on its destruction path. Upon target detection, GROVER will stop and fire
an automatic weapon in the direction of the detected heat. An LCD screen will display the
number of engagements that GROVER has encountered during play. As a safety feature, the
referee of the game will be able to control a remote RF emergency shut-off switch. This can be
used after GROVER wipes out the entire floor of players and starts coming after the referees.
GROVER will provide a huge twist to the game of paintball and will keep everybody on the
move.
ECE 477 Final Report Spring 2005
G-2
GROVER Illustration
GROVER was designed to be a very highly autonomous vehicle. Therefore, there are
few controls in the system. As seen in Figure G-1 below, a standard ON/OFF toggle switch is
located behind the gun. This can be used to keep GROVER out of trouble when game play is not
desired. There is also an RF remote shut-off switch that can be used in emergencies or to keep
GROVER stable while trying to find him. The RF receiver is connected to the power supply
system and will completely disable GROVER when the larger button is held down. The
ammunition magazine is located at the very top of GROVER and can hold approximately 100
rounds of ammo.
Figure G-1: GROVER
ECE 477 Final Report Spring 2005
G-3
There is an LCD screen on the back end of GROVER for the display of the engagement
count. There are also 4 PIR sensors located on GROVER. One sensor is located on the front,
one is located on each side, and one narrow beam sensor is located just above the gun barrel.
The obstacle detection ultrasonic sensor is located on the front of GROVER as well. There are
also several batteries located on the robot. There is a 7.2V rechargeable RC battery located on
both sides of GROVER. There are also three 9V batteries located on the top tank deck for
powering the three lower PIR sensors. One 9V battery is also located in the turret for powering
the PIR sensor located in the gun. Each battery is easily accessible for changing or charging.
ECE 477 Final Report Spring 2005
G-4
GROVER Setup
CAUTION: Failure to follow the instructions contained in this manual may result in injury to the user or to other persons. SAFETY GLASSES: Always wear safety glasses when operating GROVER. Step 1: Unpack GROVER Carefully remove all items from the box. Remove all packaging material. Step 2: Install the NiMH Batteries Insert one (1) 7.2V NiMH battery into each of the battery docking bays with the battery cables facing rearward. Once the batteries are secure, connect the battery cables to the battery receptacles at the rear of the robot. NOTE: Charge the batteries
for 14-16 hours before initial use.
Warning: Always check that GROVER’s power switch is in the downward position (OFF) before connecting the batteries.
Step 3: Install the 9V Batteries Connect 9V batteries to each of GROVER’s four (4) sensors.
ECE 477 Final Report Spring 2005
G-5
Step 4: Load GROVER Load GROVER’s magazine with either 6mm plastic AirSoft pellets or 6mm paintballs. CAUTION:
Do not overfill magazine.
ECE 477 Final Report Spring 2005
G-6
GROVER Use
Once you have followed the GROVER setup instructions on page 5, you are ready to go. Due to the autonomous nature of GROVER, the user-interface is simple to understand and very easy to use.
Interface 1: On/Off Switch To turn the device on, press the switch forward. To turn the device off, pull the switch back. NOTE:
Switch is shown in the off position in the picture at the right.
Interface 2: Remote Control To reset the device, press and release the top button (bigger button). To shut the device down, press and hold the top button (bigger button).
ECE 477 Final Report Spring 2005
G-7
Interface 3a: LCD When the LCD reads “GROVER ARMED” this indicates that the device is activated and ready to fire after a sensor is triggered. CAUTION:
Proper safety procedures should be followed at this time.
Interface 3b: LCD When the LCD reads “RELOAD STNBY” this indicates that the device is out of ammo and needs to be filled in order to continue. CAUTION:
Although empty, caution should still be exercised to prevent injuries.
Interface 4: Reload Magazine As in step 4 or GROVER setup, load GROVER’s magazine with either 6mm plastic AirSoft pellets or 6mm paintballs. To resume action, reset GROVER as shown in Interface 2. CAUTION:
Do not overfill magazine. Overfilling may cause gun to jam.
ECE 477 Final Report Spring 2005
G-8
Troubleshooting
The following section contains troubleshooting tips. If the problem persists, contact our customer service. See the Product Support Information section of this user manual for our customer service department contact information. GROVER does not turn on:
• Make sure the batteries are properly connected and fully charged.
• Make sure there is power to the main board by checking the two power indicator LEDs found in the mid section of GROVER. If they are off and the batteries are properly connected and charged, contact technical support.
• Make sure the remote RF switch button is not being held down. The LCD is not displaying anything:
• Make sure there is power to the main board by checking the two power indicator LEDs found in the mid section of GROVER. If they are off and the batteries are properly connected and charged, contact technical support.
• Make sure the LCD is properly and tightly connected to the main board. LCD contrast is too bright or too dark: Adjust the LCD contrast by adjusting the potentiometer in the main board using a small flat-head screwdriver. Make sure there is no power to the main board when you are doing this by setting the main power switch to “OFF”. LCD is displaying foreign or incorrect characters: There is some problem with the LCD or microcontroller. Contact technical support. This problem can only be serviced by a certified technician. LCD is not displaying the correct number of engagements: There is some problem with the microcontroller. Contact technical support. This problem can only be serviced by a certified technician. GROVER does not detect target:
• Make sure the batteries of the PIRs are properly connected and fully charged.
• The PIRs need a warm up period of about 2 minutes after the batteries are connected to properly detect targets.
GROVER does not align gun: There is some problem with the servo or microcontroller. Contact technical support. This problem can only be serviced by a certified technician.
ECE 477 Final Report Spring 2005
G-9
GROVER does not align gun properly with the target:
• Make sure the battery of the gun PIR is properly connected and fully charged.
• The PIR needs a warm up period of about 2 minutes after the battery is connected to properly detect targets.
GROVER suddenly stops moving:
• Check the LCD and see if it is displaying “PWR: ON->RELOAD STNBY”. This means that GROVER is out of ammunition and needs to be reloaded. After the ammunition has been reloaded, reset GROVER.
• Make sure the remote RF switch button is not being held down.
• Make sure the batteries are properly connected and fully charged. GROVER does not move: There is some problem with the H-bridge or microcontroller. Contact technical support. This problem can only be serviced by a certified technician. GROVER does not turn or drive forward properly: Check the treads to make sure they are not loose. If they are, refit the treads. The RF remote does not disconnect power:
• Make sure you are in the RF remote’s range.
• Replace the RF remote’s battery.
• Make sure you are pressing the larger button on the remote. GROVER does not detect and avoid obstacles: There is some problem with the ultrasonic sensor or microcontroller. Contact technical support. This problem can only be serviced by a certified technician.
ECE 477 Final Report Spring 2005
G-10
Product Support Information If you have read the operation manual and require further product support you can contact us using the information below.
GROVER Product Support Mail: GROVER Support Centre
465 Northwestern Ave. West Lafayette, IN 47907-2035 United States of America
URL: shay.ecn.purdue.edu/~477grp7 E-Mail: [email protected] Phone: 1-800-SHOOT-ME (1-800-746-6863) Fax: 1-765-743-0484
EC
E 4
77 F
inal
Rep
ort
Spri
ng 2
005
H
-1
Ap
pen
dix
H:
FM
EC
A W
ork
shee
t F
ail
ure
N
o.
Fail
ure
Mod
e P
oss
ible
Cau
ses
Fail
ure
Eff
ects
M
eth
od
of
Det
ecti
on
C
riti
cali
ty
Rem
ark
s
A-1
O
utp
ut
= 0
V
LT
1376-5
sw
itch
ing r
egula
tor
dam
age,
cap
acit
or
bre
ak d
ow
n, to
ggle
sw
itch
dam
age,
in
duct
or
bre
akdow
n
no p
ow
er i
s su
ppli
ed t
o t
he
MC
U a
nd o
ther
ch
ips
causi
ng t
he
robot
not
funct
ionin
g a
t al
l
Obse
rvat
ion
Low
A-2
O
utp
ut
> 5
V
LT
1376-5
sw
itch
ing r
egula
tor
fail
ure
Per
man
ent
dam
age
to t
he
MC
U a
nd o
ther
dis
cret
e co
mponen
ts
Obse
rvat
ion
Hig
h
May
cau
se e
xce
ssiv
e hea
t dis
sipat
ion o
r ev
en f
ire
to t
he
com
ponen
ts
A-3
0 V
< O
utp
ut
<
5 V
C10, C
11, C
12,
C13, D
6, D
5,
LT
1376-5
sw
itch
ing r
egula
tor
dam
age
Hig
h r
ipple
or
unpre
dic
table
volt
age
outp
ut
Obse
rvat
ion
Low
B-1
O
utp
ut
= 0
V
LT
1374-5
sw
itch
ing r
egula
tor
dam
age,
cap
acit
or
bre
ak d
ow
n, to
ggle
sw
itch
dam
age,
in
duct
or
bre
akdow
n
no p
ow
er i
s su
ppli
ed t
o t
he
dri
ve
moto
rs,
gun m
oto
r an
d
serv
o m
oto
r ca
usi
ng t
he
robot
not
funct
ionin
g
at a
ll
Obse
rvat
ion
Low
EC
E 4
77 F
inal
Rep
ort
Spri
ng 2
005
H
-2
B-2
O
utp
ut
> 5
V
LT
1374-5
sw
itch
ing r
egula
tor
fail
ure
Per
man
ent
dam
age
to t
he
serv
o,
gun a
nd
dri
ve
moto
rs
Obse
rvat
ion
Hig
h
May
cau
se e
xce
ssiv
e hea
t dis
sipat
ion o
r ev
en f
ire
to t
he
com
ponen
ts
B-3
0 V
< O
utp
ut
<
5 V
C6, C
7, C
8, C
9,
D2, D
3,
LT
1374-5
sw
itch
ing r
egula
tor
dam
age
Hig
h r
ipple
or
unpre
dic
table
volt
age
outp
ut
Obse
rvat
ion
Low
C-1
R
obot
does
not
det
ect
obst
acle
S
oft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
ult
raso
nic
se
nso
r, b
ad
connec
tion f
rom
th
e se
nso
r to
the
MC
U
The
robot
wil
l not
stop m
ovin
g
and w
ill
not
avoid
obst
acle
Obse
rvat
ion
Hig
h
The
robot
wil
l hit
the
obst
acle
and m
ay
cause
ph
ysi
cal
dam
age
to t
he
robot
and t
he
obst
acle
obje
ct.
C-2
R
obot
does
not
det
ect
hea
t em
itti
ng t
arget
Soft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
PIR
se
nso
rs, bad
co
nnec
tion f
rom
th
e se
nso
rs t
o t
he
MC
U
The
robot
wil
l not
det
ect
and
alig
n g
un w
ith
the
targ
et
Obse
rvat
ion
Low
C-3
R
obot
does
not
move
forw
ard,
rever
se, or
turn
Soft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
h-b
ridge,
bad
connec
tion
from
the
MC
U t
o
the
h-b
rid
ge
The
robot
wil
l not
move
in a
ce
rtai
n d
irec
tion
Obse
rvat
ion
Low
EC
E 4
77 F
inal
Rep
ort
Spri
ng 2
005
H
-3
C-4
R
obot
does
not
alig
n g
un
Soft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
ser
vo,
bad
connec
tion
from
the
MC
U t
o
the
serv
o
The
robot
wil
l not
alig
n g
un i
n
the
dir
ecti
on o
f th
e ta
rget
Obse
rvat
ion
Low
C-5
R
obot
does
not
fire
gun
Soft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
gun
inte
rfac
e ci
rcuit
, bad
connec
tion
from
the
MC
U t
o
the
gun i
nte
rfac
e ci
rcuit
The
robot
wil
l not
fire
the
gun
at t
he
targ
et
Obse
rvat
ion
Low
C-6
R
obot
does
not
dis
pla
y d
ata
on
the
LC
D
Soft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
LC
D
inte
rfac
e ci
rcuit
, bad
connec
tion
from
the
MC
U t
o
the
LC
D i
nte
rfac
e
The
robot
wil
l not
dis
pla
y d
ata
on t
he
LC
D
Obse
rvat
ion
Low
D-1
P
IR h
igh l
evel
in
put
to t
he
MC
U >
5 V
Volt
age
div
ider
dam
age
Per
man
ent
dam
age
to t
he
MC
U
Obse
rvat
ion
Hig
h
May
cau
se e
xce
ssiv
e hea
t dis
sipat
ion o
r ev
en f
ire
to t
he
com
ponen
ts
E-1
N
o d
ata
input
to
the
LC
D m
odule
S
oft
war
e fa
ilure
, dam
aged
MC
U,
dam
aged
74H
C164
shif
t re
gis
ter,
bad
co
nnec
tion
No d
ata
wil
l be
dis
pla
yed
on t
he
LC
D
Obse
rvat
ion
Low
EC
E 4
77 F
inal
Rep
ort
Spri
ng 2
005
H
-4
E-2
L
CD
pow
er =
0
V
Dam
aged
chip
pow
er s
upply
, bad
co
nnec
tion f
rom
th
e ch
ip p
ow
er
supply
No p
ow
er t
o t
he
LC
D
Obse
rvat
ion
Low
E-3
L
CD
pow
er >
5
V
Dam
aged
chip
pow
er s
upply
P
erm
anen
t dam
age
to t
he
LC
D m
odule
Obse
rvat
ion
Hig
h
May
cau
se e
xce
ssiv
e hea
t dis
sipat
ion o
r ev
en f
ire
to t
he
com
ponen
ts
F-1
M
oto
rs p
ow
er =
0 V
D
amag
ed c
hip
pow
er s
upply
, bad
co
nnec
tion f
rom
th
e m
oto
rs p
ow
er
supply
No p
ow
er t
o t
he
moto
rs
Obse
rvat
ion
Low
G-1
N
o s
ignal
to t
he
gun
Dam
age
to U
6, D
4,
Q1, S
oft
war
e fa
ilure
, dam
aged
M
CU
, bad
connec
tion
the
gun w
ill
not
fire
O
bse
rvat
ion
Low
G-2
G
un
conti
nuousl
y
firi
ng
Dam
age
to 4
N28,
Q1
The
gun w
ill
conti
nuousl
y f
ire
Obse
rvat
ion
Hig
h
Conti
nuous
unst
oppab
le s
hots
ca
n c
ause
bodil
y
inju
ry t
o t
he
use
r
Tab
le H
-1:
FM
EC
A W
ork
shee
t