Download Final Report for Minesweeper One | ECE 480 and more Exams Principles of Theater Design in PDF only on Docsity!
Mine Sweeper One
Team 16 Final Report
Troy Druelle
Nathan Markey
Chad Umscheid
Di Shi
Stephen Luebkert
Executive Summary
The purpose of this document is to describe Team 16 minesweeper project. This
document states the final design procedures, objectives, implementation, and
performance. The purpose of this project was to use the knowledge of electrical and
computer engineering to design and test a working robot to detect mines upon a playing
field and react to the mines and boarders via sensors.
Design Objectives
Team 16’s main objective was to sense as many magnets within 3 minutes as possible.
Given a 4x4 white board wrapped with black electrical tape along the sides of the
boarders, Team 16 was given the task to design a magnetic robot that would sense
magnets and boarders. The robot was to cruise the playing field and upon sensing a
magnet it would go into a special state. In this state the robot would beep 3 times,
backup, allow for a user to remove the mine, and then continue searching the playing
field. If the robot were to sense a boarder, then it would sense the boarder and turn away
and continue to search the playing field until another boarder or magnet was found.
Design Specification
This project was a competition between two teams. The design specifications for this
project required that the teams use some specific parts. The team was given the
following which had to be incorporated into their design. The robot had to be propelled
by modified RC servo motors that were given to the team. The servos were modified so
that they could be used as digitally-controlled variable speed motors. Wheels were also
provided to attach to the motors. A simple aluminum chassis with a simple stabilizer ball
was constructed in advance for the teams use to hold all of the robots hardware. The
robot itself was required to autonomously controlled using a PIC16F87x-based controller.
It was required that no sensors (or additional devices) be placed more than 2” from the
front and 1” from the sides of the chassis. To run all of the electronic components, a
standard 7.2 volt 1500 mA-hr Nicad battery was required to be used.
Final Design Implementation
In designing the robot, team 16 wanted to implement a simple raster scan search pattern.
This search pattern is very similar to the way that most people cut their grass (See
Appendix). The robot would go straight forward until reaching a boarder, turn, go up the
length of the robot, turn, and go the other direction straight until a boarder is sensed, then
repeat. Team 16 modified the pattern to incorporate a random turn between 45 and 90
degrees. The robot can not go exactly straight because of the lack of precision in the
servos, the raster scan pattern would be in accurate. By adding in this random turn, the
robot would search more of the field. The final design implementation was broken up
into many parts. The parts are broken down as follows.
Hardware
The hardware was selected with respect to cost, effectiveness, quality, and usability.
Team 16 chose to use reed switches to sense the magnets. These reed switches operated
with a contact and a metal flap, incased in plastic. When the sensor came in contact with
a magnetic field, the field would cause the metal to touch the contact and create a
connection. This would send a pulse down the line to the pic controller.
The boarder sensors were opto-reflective sensors. Team 16 made the opto-reflective
sensors check the playing field for a boarder every 20 ms. The opto-reflective sensors
would shine light onto the boarder and reflect light back to a photo-transistor. The white
playing field was shiny and reflected light back to the photo-transistor. The black
layout simple as it did not require a lot of customization for the team’s specific design.
The software itself helped make the ordering procedure easy, as it had a simple ordering
system built in. Another plus was the turnaround time from sending the design in to the
company, to when it arrived to its destination.
The software that was necessary to program the PIC included the CCS Compiler as well
as MPLAB by CCS. The CCS Compiler is a C code compiler that allowed us to program
the PIC using the standard C language. The benefit to the CCS compiler is that with the
inclusion of a library specific to our PIC, we could implement all of the needed
functionality using C-code rather than using machine language. The MPLAB software
interfaced with the PIC via an In-Circuit Debugger (ICD) allowing us to program and
debug our PIC program.
In writing the program for the PIC, many small snippets of code were used for specific
functions. In the end, they were plugged into a higher level code with determined the
behavior of the robot (or how the robot would respond to certain inputs/stimuli). The
snippets were categorized as follows: digital input, digital output, analog to digital input,
and motor control (or pulse width modulation). In the high level code, we used these
snippets to create specific functions such as “check_for_border ()”, “robot_forward ()”,
“turn left ()”, and “mine detected ()”.
The only specific instance where the digital input feature was used in the program
corresponded to the magnet detection. The sensors that were used were actually
magnetic reed switches. The switches would be pulled closed when a magnet was inside
its operating range which was found to be about 0.7”. A logic high value was sent out of
the PIC into the array of reed switches (which were connected in parallel). Once any of
the switches closed, the logic “1” would be allowed to travel to the digital input on the
PIC and thus our digital input. To keep the input at logic “0” when all of the switches
were open, a pull-down resistor was used. This made the input so that it was not floating.
The digital output feature was used in many instances in the code. It was basically used
to turn LEDs on and off as well as the piezo buzzer. The IR LEDs that are inside of the
reflective object sensor package are controlled by digital outputs from the PIC. Before
we take readings of the sensors, we turn the LEDs on. The piezo buzzer and the warning
LED were controlled in the same fashion. Turn on the LED/buzzer and delay for a short
amount of time, and then turn off the LED/buzzer. This creates the beep or flash affect
that we so desire.
The analog to digital input is used to get readings from the reflective object sensors.
When light strikes the photo-transistor, there is a specific voltage output on the emitter of
the transistor. This voltage corresponds to the color. In the case of this project, it was
only necessary to distinguish between dark and light colors. In the code, there are a few
settings that need to be used in order to set the “A” pins to be analog inputs. Before
taking the reading, it is necessary to set the proper channel that is desired to read. Then,
the “Read_ADC ()” function can be run. The value is stored in a long integer and it
corresponds to a voltage. The storage is 10-bit and it is linear, so with a reference of 5
volts, you can calculate the value. For black borders the typical output is below 0.1 volts,
so the integer 21 corresponds to the nearest value that matches it. To check for black, the
voltage output is compared to 21. If the output is less than 21, it is assumed that you
have encountered a black surface.
The last function of the PIC that was used is the pulse width modulation (PWM). This is
synchronized with the oscillator that is used on the circuit. In the case of team 16’s
project, a 1 MHz oscillator was used in order to create a PWM output with a 100 Hz
frequency. To adjust the direction and speed of the motor, the width of the pulse was
changed. In order to complete that function, the duty-cycle of the pulse was changed for
each motor individually.
The high-level code is what makes the decisions of the robot. It is the behavior of the
robot corresponding to how it moves and signals. The basis is shown in the flow chart in
the appendix. Originally, a raster scan pattern was developed, but due to inefficiencies in
the motors, it was changed to a more random approach. At any time, during operation,
the mine checking sequence is run every 20 milliseconds to ensure that a magnet is not
being missed. If a mine was detected, the robot would call the following snippets in
order: stop, signal audio/visual (buzzer/LED), backup, stop, delay three seconds, forward.
In the rest of the program it flows as follows:
(1) Find a border and determine which way to turn first
(2) Turn and Continue Straight
(3) If a border is found, turn random angle (~ 45-90 deg)
(4) Go forward ~ 1 length of the car
(5) Turn in the same direction as (3) random angle (~ 45-90 deg)
(6) Toggle whichWayToTurn (RIGHT or LEFT)
(7) Continue straight -- Goto (3)
The program would continue this loop every 20 milliseconds. It is in this fashion that the
robot would cover a majority of the board in the three-minute time limit given.
Options considered for final design
When sitting down to discuss the approach early in the semester components were chosen
with aesthetics and functionality in mind. To create the simplest and best working design,
the components with the simplest difficulty of use for the given specifications were used.
Reed sensors, which are simply switches activated by magnetic fields, were chosen
instead of the usual Hall Effect sensors because of the ease of maintenance and use. With
the given power source, there was no way to burn out one of the reed sensors, but some
other sensors could have burnt out easily, which also added to our choice of the reed
sensors. To detect the borders, a few different options of reflective object sensors were
researched, and the one chosen fit the specifications precisely. Saturation was a problem
that was taken in to account with the border sensors, so testing was needed to determine
which sensors would not saturate given the requirements set forth. To make the
minesweeper look more professional as well as make it more tolerant of connecting
various things for maintenance a printed circuit board was chosen. To get the PCB back
Technical role - PCB design and construction, component testing, hardware
design/maintenance, chassis construction, analysis of robot
functionality
Summary of Key Intellectual Contributions by Member
Troy Druelle
Troy Druelle showed significant technical and non-technical advancements throughout
this entire project. Troy was responsible for a lot of the hardware on the robot including
mounting, building, and designing mechanical parts. Troy designed and built the
brackets for the front of the minesweeper robot as well as helped in the mounting and
building of the PCBs and sensors. Troy’s major contribution was the design and testing
of the power regulator that powered the servomotors. Troy also was the document
preparation man. He managed all the papers by email and group discussion. Troy also
ended up writing a significant amount of the papers and was responsible to make sure
they got finished.
Stephen Luebkert
Stephen showed good technical advancements to the team and served as a software coder.
Stephens’s main contribution to the team was the high level code. Stephen wrote and
tested the code that linked all the small snippets of coding together.
Nathan Markey
Nathan Markey showed significant technical and non-technical ability and performed as
the group’s main software coder. Nathan was responsible for writing the code that
operated the robot and programming this code into the PIC controller. Nathan also
worked a lot on servo motor control pertaining to proper angles and rotations to turn the
robot. Nathan also made and managed all of the PowerPoint slides and helped write
some of the reports for the team.
Di Shi
Di showed an overall technical and non-technical contribution as well to the team. Di
worked primarily on servo motor control and search patterns. Di researched many
different search patterns and narrowed it down to a Raster scan pattern that Team 16 used
in their final design. Di also tested the servomotors and researched the proper
modulation needed to operate these motors.
Chad Umscheid
Chad Umscheid was a strong leader during this project. Chad showed significant
technical and non-technical roles throughout the course of the semester. Chad was
responsible for hardware of the robot. Chad helped to build the mechanical portions of
the robot as well as designing the printed circuit board. Chad used ExpressPCB to layout
the circuit board and ordered it from the manufacture.
Suggestions for Future Improvement
Our initial goal was to implement a simple raster scan of the playing surface in order to
cover as much of the board as possible in the three-minute time limit. The problem in
implementing this type of search pattern was the fact that it required very precise control
over the motors. The team was not able to control the motors to the precision needed for
this type of search pattern. One suggestion would be to try and use a different type of
motor that would allow for a greater amount of control. In the case of this particular
project, the design specifications required that the TS-53 RC Servos were to be used in
the final design implementation.
Another suggestion would be to replace the current stabilizing ball with a simple caster to
allow for free movement in any direction. The problem was noticeable when the ball
would constantly stick and create a considerable amount of drag. Since the stabilizing
ball was not exactly centered, the drag that it applied caused the robot to veer off slightly
to the right.
To help clean up the visual appearance and to help protect the main components from
external damage, it might be beneficial to put an enclosure around the robot. This could
be done using a standard injection molded cover such as those that might be seen on a
standard radio controlled car sold by RadioShack®.
Conclusion
In conclusion the most effective strategies we utilized were teamwork and dividing up
our responsibilities. Everyone had something to work on during each phase of the project
as was specified by the Gantt Chart. The hands-on experience was also another great way
to learn the material. Teamwork is an indispensable strategy that is necessary in industry,
and is better learned through experience amidst a team. We learned several key strategies
to appropriately interact with team members and how to behave in a team environment. It
has been interesting to observe the way everyone’s ideas and contributions meshed to
create a cohesive group and a positive work environment that brought about a spectacular
project. Aside from the design being successful, the skills we developed relating to time
management, team interaction, and the overall design process, have been worthwhile and
beneficial to our futures. We can all take with us our experiences pertaining to this course
and the project into the workforce where we will make a positive impact and a lasting
impression on our respective teams, companies, and ourselves for the future.
References
ECE Course e-Notes – Copyright © 2002, G.M. Weirzba
Notes for an Introductory Course On Electrical Machines and Drives – E.G. Strangas
Hobby Servo Fundamental – Darren Sawicz
(http://www.winnipegrobotics.com/Papers/How%20To/servo.pdf)
PCB, PCM, & PCW C Compiler Reference Manual , Copyright © July 1999
CCS Compiler: PWM Basics – Dale Grover
http://www.digikey.com - Copyright © 1995-2003, Digi-Key Corporation
http://www.expresspcb.com - Copyright © 2003, Engineering Express
http://www.microchip.com - Copyright © 2001, Microchip Technology Inc.
http://www.ccsinfo.com - Copyright © 2002, CCS Inc.
Circuit Schematic Voltage Input VS. Voltage Output
Power Regulation
Printed Circuit Board
Layout Created with ExpressPCB Software - http://www.expresspcb.com
High Level Code – Flow Chart
PIC 16F
ICD-S
WHT BLK RED GRN YEL BLU
1 2 3 4 5 6
(40) RB7/PGD (39) RB6/PGC (36) RB3/PGM
Vdd
(1) MCLR/VPP
OSC 4
8 5
Vdd
Gnd
Gnd
(13) OSC1/CLKIN
R
(12) Vss (31) Vss
Gnd
(11) Vdd (32) Vdd
Vdd
Gnd
CCP1 C (17)
Signal Output
PIC and ICD Circuit Connections
Software
/* ECE 480 - Senior Design / / Spring 2003 / / / / Team #16 / / Minesweeper One / / / / Final Code / / Version 3.5 / / / / Description: Using the CCS Compiler, this code works with the PIC 16F874 / / microprocessor to control a Minesweeping robot. / / / / This version of the program functions as follows: / / (*) At any time, if a magnet is detected stop and signal / / (1) Find a border and determine which way to turn first / / (2) Turn and Continue Straight / / (3) If a border is found, turn random angle (~45-90 deg) / / (4) Go forward ~ 1 length of the car / / (5) Turn in the same direction as (3) random angle (~45-90 deg) / / (6) Toggle whichWayToTurn (RIGHT or LEFT) / / (7) Continue straight -- Goto (3) / / / / ----------------------------------------------------------------------------- / / PIC I/O Pins Breakdown / / ----------------------------------------------------------------------------- / / AN0 / / AN1 Analog Input - from Right Border Sensor / / AN2 / / AN3 Analog Input - from Left Border Sensor / / AN4 / / AN5 Analog Input - from Middle Border Sensor / / AN6 / / AN7 / / RB0 IR LED -- Middle Border Sensor / / RB1 Warning Buzzer / / RB2 Warning LED / / RB3 ICD use / / RB4 IR LED -- Left Border Sensor / / RB5 IR LED -- Right Border Sensor / / RB6 ICD use / / RB7 ICD use / / RC0 / / RC1 CCP2 -- Right Motor Control Signal / / RC2 CCP1 -- Left Motor Control Signal / / RC3 / / RC4 / / RC5 Debug LED (1) / / RC6 Debug LED (2) / / RC7 / / RD0 / / RD1 / / RD2 Output -- Logic "1" to the Reed Switch Array / / RD3 Input -- From Reed Switch Array / / */ /*********************************************************************************/
#include <16F874.H> #fuses HS, NOWDT, NOPROTECT
// Main Program Operations //==========================================================================
//ROBOT FORWARD robot_forward();
do{
random++; //Increment random variable mine_check(); test_for_borders();
//--------------------------------------------------- if(ORcenter) { //Backup robot_backup(); delay_ms(500); //Stop stop_motors(); delay_ms(400); //Turn Left turn_left(); delay_ms(450); //Stop stop_motors(); delay_ms(400); //Forward robot_forward();
random++; //Increment random variable } else { if( ORleft || ( ORleft && ORcenter ) ) { whichWayToTurn = RIGHT; break; }
if( ORright || ( ORright && ORcenter ) ) { whichWayToTurn = LEFT; break; }
if (straighten > 50 ) { output_high(PIN_C5);
pwm_value = 0; set_pwm1_duty(pwm_value); //Left Motor STOP pwm_value = 83;
set_pwm2_duty(pwm_value); //Right Motor Forward delay_ms(120); pwm_value = 104; set_pwm1_duty(pwm_value); //Left Motor Forward
straighten = 0;
output_low(PIN_C5);
random++; //Increment random variable random++; //Increment random variable }
straighten++; delay_ms(20);
} while(1);
//STOP ROBOT
stop_motors();
output_high(PIN_B2); //LED output_high(PIN_B1); //Buzzer delay_ms(300); output_low(PIN_B2); output_low(PIN_B1); delay_ms(300);
//-------------------------------------------------------------------------------------------
//Run the turn right or left feature straighten = 0;
// MAIN SEARCH PATTERN for (;;) { random++; //Increment random variable
// Check for Mines mine_check(); // Check for Borders test_for_borders();
//------------------------------------------------------------------ // Act on which (if any) have found a border
if( ORcenter || ORleft || ORright ){ //STOP MOTORS stop_motors(); delay_ms(250);
//Backup robot_backup(); delay_ms(300); //was 600
//STOP MOTORS
stop_motors(); delay_ms(250);
//Check if Right or Left if (whichWayToTurn == LEFT) { //Left Turn 90 degrees pwm_value = 65; set_pwm1_duty(pwm_value); //Left Motor back pwm_value = 83;