You are on page 1of 37

Final Project – Group B

Firefighting Wheeled Mobile Robot

UNIVERSITY AT BUFFALO

2010
Authored by: Jenna Curry, Ian Duncan, Ian Clark, Chris Van Loon, Ilya Gartseev
Table of Contents
Abstract 2
Introduction 2
Theoretical Background 2
Construction 4
User Instructions 12
Schematic 13
Components List 16
Hardware Flow Chart 17
Calibrations 17
Code Walk Through 23
Photographs 25
Potential Applications 27
Problems Encountered 27
Future Considerations 28
Appendix 29
References 35
Contributions 36
Final Project – Group B | 5/10/2010

1
Final Project – Group B
Firefighting Wheeled Mobile Robot

Abstract
This project involved the creation and calibration of a “fire fighting” robot. The robot includes features such as the
ability to find and follow a light source and activating a fan when close enough to the light. This project was done in
an effort to explore the division of tasks between two microcontrollers and the communication between them. Basic
Stamp II microcontrollers were used for this task. It also allowed us to gain experience in creating mobile robots. All
goals were accomplished successfully.

Introduction
The central part of the project involved using light sensors to guide a mobile robot to a light source. In this case, the
light sensors were photoresistors. Two were placed on the front of the robot at about 45 degrees from straight ahead
to the left and right. The resistance values of these photoresistors are read by ADCs. The robot starts by spinning in
a circle to locate the brightest light source then continues to spin until it reaches this source again. The two
photoresistors are then repeatedly read and compared to determine whether the robot should turn right, turn left, or
go straight. This continues until the ADC values are decrease to a predetermined level. The robot then stops and
turns on a fan to “fight the fire”. The division of tasks among the microcontrollers was very clear. One
microcontroller drove the servo motors, while the other read the sensors and controlled the siren and LEDs. The
boards were connected in parallel since we had enough pins to do so. The other features included were a light bar of
5 LEDs, and a siren. The LEDs blink in different patterns according what mode the robot is in. The siren is set to
play the charge theme after the initial scan and then play a traditional two tone siren once the robot stops.

Theoretical Background
Photo Resistors

A photo resistor is light dependent resistor in which its resistance is based on


light intensity. It is similar to potentiometer in the fact that it varies its
resistance based on light intensity where as a potentiometer is resistance Final Project – Group B | 5/10/2010
changes by a knob. An example of a setup is seen adjacent.

As you increase the amount of light that hits the photo resistor, it decreases its
resistance to zero, in which it will conduct electricity very well. It does the
exact opposite if light is absent and it increases it resistant to decrease the flow
of electricity. It is made of high cadmium sulfide which is also and as a CdS cell.

2
Voltage Dividers

A voltage divider is a simple circuit that produces an output voltage that is a


fraction of the input voltage being supplied. A simple example of a voltage
divider, seen adjacent, consists of two resistors in series, and is commonly used
to create reference signal.

The point of this type of circuits is to be able to control voltage by altering the
resistors used. Often time you cannot alter you power supply, but with circuits
like these it allows us to control the voltage we want to be supplied to a
specific circuit as to not overload it.
F IGURE : V OLTAGE DIVIDER EXAMP LE

Transistors

Transistors are current controlled electronic circuits that can be used to amplify current or as digital switches. There
are multiple types of transistors, including bipolar junction transistors and Field-effect transistors. Transistors are
made from semiconductor materials, such as germanium, gallium oxide, and silicon. In bipolar junction transistors,
there are three sections of doped semiconductor material. A current in the base of the semiconductor can be used to
amplify the current flowing between the emitter and collector. A NPN transistor is shown below. When a positive
voltage is applied excited electrons enter the base region. These carrier electrons diffuse through the doped p-type
base, where holes are the majority carriers. The base layer is thin to minimize the number of electrons that
recombine with the holes in the p region. The electrons that diffuse through the base are drawn into the collector by
the electric field. Transistors are absolutely essential for the modern electronic devices and systems.
Final Project – Group B | 5/10/2010

Robots and their Applications

Mobile robots have numerous applications. Their uses in many fields can help to reduce cost by limiting the
need for human labor, using intelligent control to efficiently control systems around the world from a single location,

3
remotely monitoring and taking data for long periods of time, handling dangerous tasks, and controlling and
navigating vehicles. This field is constantly advancing to include more versatile functions of mobile robots and more
uses. As the ability to reduce the size of transistors and other electronic devices has decreased to about 20 nm, the
potential to use robotic devices in micro- and nano-technologies has increased. Potential uses of these smaller mobile
robots are in gathering intelligence, looking for survivors after earthquakes, completing complex tasks by wirelessly
communicating with each other, and in the biomedical field. Much research has gone into robot communication for
these applications. One example that was developed at the Laboratory of Intelligent System in Switzerland is the s-bot
mobile robot, which illustrates how mobile robots can communicate and interact to complete tasks. The s-bot could
complete tasks, such as using their gripper arms to combine and bypass obstacles that individually they could not and
using an integrated force sensor to locate a target without explicit communicating.

Analog to digital conversion (ADC)

An ADC0831 ADC chip was used in this experiment. This chip takes an analog signal and converts it into digital data
that can be used by the microcontroller. This chip uses a successive approximation analog to digital conversion
process. This process compares the analog voltage to each bit one at a time from the most significant bit to the least
significant bit. This is done using a comparator, and a digital to analog converter generating a reference voltage. The
bits that are kept in this process form the binary output of the ADC. In the case of this ADC, the resolution is 8 bits.

Communication Types

There are a number of ways to communicate between microcontrollers. The first is serial. This involves sending and
receiving data one bit at a time. There are two ways to regulate this transmission. One is synchronous the other is
asynchronous. Synchronous serial communication is controlled through an external clock. Asynchronous serial
communication uses signals within the data stream to divide between bytes, words, or other units of digital
information.

The second way to communicate and the type we used is parallel communication. In this type of communication data
is sent over more than one line at once. This can speed data transmission significantly. In our case a nibble is sent
over 4 lines to control motor function.

Servomotors

A servomotor is a device that combines an electric motor with a potentiometer and other electronics. They are used Final Project – Group B | 5/10/2010
to provide and maintain specific angular displacements. Error feedback is used to correct motions made by the
motor. The device is controlled using a pulse width modulation signal. As the signal changes so does the speed of the
motor. In our case this allowed us to match the speeds of the two motors and control the rate of turns.

Construction
This section will document the construction of the robot itself. This was the first task completed by our
team. The first thing we did (shown below) is bolt the servo motors to the robot with 1 inch #4 bolts from home
depot. One motor was purchased from Parallax website because one motor we were offered was not functional.

4
Next, we screwed in the first board (used for the Servo Motor control) with ¼ inch machine screws also
from home depot as shown in the figure below:
Final Project – Group B | 5/10/2010

Next a right angled bracket was bolted with 1 inch # 4 bolts just as with the servo motors. This was used as
a support for the second BS2 board which is the master board that makes calculations and send sends data to the other
board.

5
Next the board was mounted with the same bolts used previously. The board sits pretty well on the
top and is in a great location for the parallel communication used between the two boards.

Final Project – Group B | 5/10/2010

Next, the wheels were installed by placing the female and male gear parts together and screwing in the
provided screw.

6
Next, we began making the mount for the sensors. Our group planned on making it as a module to be added
to the robot in one final piece. By a stroke of creativity, we used a foam piece that was for holding ICs. Each sensor’s
leads were fed through the foam out the top and bottom.
Final Project – Group B | 5/10/2010

Next we soldered the leads of the photo resistors to wires that could be easily placed on the appropriate
breadboard.

7
Finally, we wrapped the sensor module in electrical tape and had the leads of each sensor color coded exiting
out the back.

.
Final Project – Group B | 5/10/2010
The next task involved making shields for the sensors to get a cleaner reading from the sensor. To do this we
took the “incubator” from the kit we bought and cut it into 1 cm strips with a hacksaw. The remaining slivers of tube
were fastened to the module again with electrical tape. This process is shown below.

8
Final Project – Group B | 5/10/2010

9
The final module was then put on the front of the robot to read the light levels.
Final Project – Group B | 5/10/2010

10
The last component added to the robot was the turn signal LEDs. The LEDs were also installed as a module.
Each of the 5 LEDs used was individually soldered to a 470 ohm resistor and a wired. All of the LEDs negative leads
were soldered together for one common ground point. The LEDs were again fed through a foam casing for ICs and
covered in electrical tape. This was placed on the back of the Robot to indicated turning and different modes the
robot was involved with.
Final Project – Group B | 5/10/2010

The final product, before circuit work and programming is shown below with the light to be used:

11
User Instructions
The set of user instructions below are to operate Group B’s BSII setup. It assumes the program has been loaded to the
modules memory and the power supply is plugged in. The basic operation of this setup is to start the robot and allow
it work autonomously. Since it does it this way there is no true basic set of instructions on how to operate it, but I
will elaborate on how it works.

Power Supply

 Insert the two 9-volt batteries

Scan Mode

 As soon as the power is supplied to the robot, it will start scan mode. It will rotate 360o looking for the
greatest light source. After it has been found, it will rotate a full circle once more, and begin playing the
charge song from the piezo-speaker, also the LED’s will be flashing. It will move toward the source in the
Target mode Final Project – Group B | 5/10/2010

Target mode

 This is when the robot begins moving toward the light source it has detected. It may move in a rather jagged
pattern but this is normal. (The robot is basically moving in a way to maintain the resistive difference
between the photo resistors, because one motor is more powerful than the other due to the age difference of
the servos). Also note that the robot will change its direction if the light source is moved.

“Fire Extinguish” mode

12
 Once the robot has reached its predetermined distance it will stop, turn on the DC fan (to simulate the fire
being extinguished) and play a siren note, and the LED’s will flash, to alert us it has found the light source
and has extinguished it

Schematic
The schematic of the hardware is shown in the figure below. The design was made with two StampWorks TM
Boards of Education. The circuit parts that belong to each board are combined by blue dashed rectangles on the
figure. The Main/Sensors board is used for receiving data from sensors and control the speaker (Fire Alarm Imitator) and
the fan (Fire Extinguisher Imitator). In addition, this board has five LED elements to indicate special information about
state of the system and act as turn signals. The Actuators board is used for the control of the two servomotors. This
board is controlled by the Main/Sensors Controller through a parallel interface, which contain four signals: MotorEN,
RightWheel, LeftWheel, SpinEN.
Final Project – Group B | 5/10/2010

13
Final Project – Group B | 5/10/2010

14
The integration circuits U1 and U4 depict Basic Stamp II (BS2) modules.

D1, D2, D4, D5, D6 are LEDs, which can be used for different indication purposes.

LS1 is a Piezo Speaker for audio feedback and an indication of fire alarm. It is also used for to play the charge
song when the light is found.

SERVO1 and SERVO2 are continuous rotation servos, which rely on pulses to control the speed and
direction of the servo shaft.

The R1 and Q1 elements show the control circuit for the fan. Because the BS2 cannot supply enough power
for the fan, the transistor Q1 (2N3904) is used for powering instead. R1 controls the base current for the Q1.

The integrated circuits U2 and U3 are ADC0381, which are 8-bit successive approximation analog-to-digital
converters with a serial I/O and configurable input multiplexer with one channel.

The LDR1 and LDR2 are CdS cell photo resistors are used for measuring intensity of the light.

For integrated circuits U1 and U4, signals GROUND and POWER are not shown but implied.
Final Project – Group B | 5/10/2010

15
Components List

Quantity References Value Order Code


8 resistors
5 R1, R4, R6, R7, 470, 1/4W, 5% 150-04710
R8
1 R1 10K, 1/4W, 5% 150-01030
2 R2, R3 1K, 1/4W, 5% 150-01020
4 integrated Circuits
2 U1, U4 BS2-IC, Basic Stamp II module BS2-IC
2 U2, U3 ADC0831 ADC0831
1 U3 QRB1114 QRB1114
1 U4 LM358 602-00015
9 Miscellaneous
2 StampWorksTM Board of Education 28150
1 Fan 12 VDC brushless fan 700-00040
1 Q1 2N3904 500-00001
2 Servo1, Servo2 Continuous Rotation Servo 12560
1 LS1 Piezo Speaker 900-00001
2 LDR1, LDR2 Photoresistor - VT935G-B 350-00009

Final Project – Group B | 5/10/2010

16
Hardware Flow Chart
The diagram below demonstrates the general layout of how the hardware communicates.
Final Project – Group B | 5/10/2010

Calibrations
Sensor Calibration
To calibrate the photo resistors we set out to calibrate them in two different scenarios. The first scenario
was using complete darkness; the second was using artificial light within a classroom. By utilizing both scenarios we
increase the robots robustness, and allowing it to work in a various scenarios. We used a classroom and set up the
robot to be tile distances away from the light source. We calibrated the robot using five line tiles, center, right
center, left center, right and left. Ultimately we used the center calibrations with the light on to set up the robot. We
also made sure not inhibit the light source, by shadows, when done in the dark, and also made sure to mark the tile
colors within our data file in case reflections from the tile affected our calibrations

17
Setup

Turning the lights off, we set the robot twelve


tiles away from the light source. We then
move it one tile space forward for twelve
steps and stopped it at a tile space away from
it. This will be used as our ideal stopping point
for our robot to activate the “fire extinguish”
mode. The same set up was used to when
placing it to other 5 locations, right, left,
center right, and center right. The same set
up was used in the light as well.

Data

Nocturnal Calibration Light Calibration

Center Center

Distance(Tile) Resistance[R](ohms) Resistance[L](ohms) Distance(Tile) Resistance[R](ohms) Resistance[L](ohms)

12 1887 1414 12 1560 1210

11 2020 1475 11 1590 1270

10 1600 1163 10 1320 1010

9 1470 1070 9 1280 975

8 1300 891 8 1165 867

7 1039 754 7 966 724

6 904 640 6 833 625


Final Project – Group B | 5/10/2010
5 728 522 5 712 515

4 572 394 4 545 403

3 421 287 3 405 292

2 319 207 2 306 208

1 306 182 1 310 181

18
As you can each photo resistor is not yielding the same value. This may be due to the way they were laid out in the
robot. A symmetrical layout was used to place the robots photo resistors, and they are surrounded by glass and
wrapped by black tape to help avoid non direct light affecting our calibration. We suspect it was due to the fact that
we had one new photo resistor and one that was significantly older.

Notice our values for each of the pair of photo resistors are is depending on the surrounding conditions. With darker
conditions our photo resistors are very sensitive to the location it is place in. Our calibration charts can be seen
below.

Nocturnal Calibration
2000
y = 165.36x - 27.697
R² = 0.9727
1500
Resistance (Ohms)

1000
Center Reistance[R](ohms)
y = 124.81x - 61.379 Center Resistance[L](ohms)
500 R² = 0.9762

0
-1 1 3 5 7 9 11 13
Tile space
Final Project – Group B | 5/10/2010

19
Light Calibration
1600

1400
y = 128.94x + 77.864
R² = 0.9842
1200
Reisitance (Ohms)

1000

800
y = 104.61x + 10.045 Center Reistance[R](ohms)
600 R² = 0.9842
Center Resis[L](ohms)
400

200

0
-1 1 3 5 7 9 11 13
Tile Space

The charts reinforce the idea of sensitivity of the photo resistor when in the dark. It also shows that out light more
accurate in both photo resistors when in the light. This may be due to the fact that the artificial light emission is
consistent, where as in the dark small shadows and slight reflections can affect the calibration.

ADC Calibration
The following calibration was completed once the ADCs were part of the circuit with the photo-resistors.
The calibration served a few purposes:
i. Allowed us to determine the ADC values we would get at different distances
ii. Analyze the sensitivity of the device (in terms of ADC value per unit distance) Final Project – Group B | 5/10/2010
iii. Properly choose a resistor to share the voltage divider circuit in order get good ADC readings
iv. Normalize the values between to two sensors so that they would read the same light reading when the
robot faces the light

This calibration was successful in fulfilling all of these purposes as you will see in the following discussion.

The calibration was performed much like that of the other calibration measuring the resistance output, only,
we simplified the process by just having the robot travel down a path directly in front of the light. This task was
performed in 214 Norton Hall with the lights both on and off. The results are shown below.

20
The table below is the ADC readings from both sensors with the light off. The distance is in units of tiles on
the floor (about .2 m) where 24 tiles is approximately the length of the room.

Distance Right Left ADC Delta


in Tiles ADC
24 213 206 7
20 209 198 11
16 194 180 14
12 169 154 15
10 160 140 20
8 141 120 21
6 118 99 19
5 105 86 19
4 91 73 18
3 75 58 17
2 61 45 16
1 55 49 6

The following graph demonstrates how the ADC values varied with distance:

ADC Variation with Distance


250

200
ADC value

150

100 Right ADC


Left ADC
50

0
0 5 10 15 20 25 30
Final Project – Group B | 5/10/2010

Distance (Tiles)

A few important conclusions can be made here:

i. The voltage divider with the 1000 ohm resistor used works perfect for the application in this room as
the ADC value indicates that the voltage is within the 0 to 5 V range.
ii. The sensitivity of the device is very good as the robot can tell the difference between one or two tiles on
the floor.
iii. The ADC value varies predictably

21
Another graph we made (shown below) is one that demonstrates the difference between the two sensor readings
(when they should be the same). This helped in our decision of normalization.

Difference in Sensor Readings


DIfference (ADC Value) 25

20

15

10

0
0 2 4 6 8 10 12
Distance (Tiles)

This graph shows the difference in readings as the robot approached the light. When the robot was further away
the differences were slightly lower, but at these distances that is negligible. Since these values were more or less equal
at all of these distances, to normalize the values we just subtracted 17 ADC values from the right sensor reading.

A similar analysis was completed with the lights on to see its effects and determine any limitations of the device.

Right with light Left with light Delta

175 162 13
171 159 12
164 150 14
150 137 13
144 126 18
133 114 19
113 96 17
102 84 18 Final Project – Group B | 5/10/2010
89 72 17
75 58 17
60 44 16
54 49 5

22
ADC Variation with Distance (Light ON)
200
180
160
ADC Value 140
120
100
80 Right ADC
60 Left ADC
40
20
0
0 5 10 15 20 25 30
Distance (Tiles)

This allowed us to conclude that there were similar readings when the light was on. The only small drawback is
its range in the dark. If the room were bigger with the lights on, the robot may eventually have difficulty finding the
light from a long distance.

Code Walk Through


This section will thoroughly describe the function of the code found in the appendix of the report. There is
one program for each stamp, one that controls the motors, and one for the sensors, peripherals and calculations.

Sensor, Peripheral and Calculation Program

The program begins by declaring the variables and constants that will be used. The pins describe the inputs
to the Basic Stamp from the Analog to Digital Convertor and the outputs to the motor stamp, speaker, and LED. The
variables and constants that will be used throughout the program are also initialized at this time.

The program begins by initializing the variable, vlowest to be 500. This is a value that describes the level of light
to compare against, when searching for the greatest source of light. This value is chosen due to the fact that 255 is the
highest value the ADC could output, 500 was chosen arbitrarily. The vctr variables and vspin variable are also
Final Project – Group B | 5/10/2010

initialized to zero at this time and a DEBUG message is output. A zero value for the vspin variable means that the scan
for the greatest light source has not yet occurred. The StopMotor subroutine is run to ensure that the servo motors
are currently inactive by setting the general ENABLE pin for the wheel servos to zero. Then there is a two second
pause to allow the system to settle.

In the main loop, the value of the variable vspin is checked. If the variable is equal to zero, the robot enters a loop
that will spin and scan the area. If the variable is not zero, this means that the spin and scan has already occurred and
this step is skipped. In the loop, a low is output to the ADC2 that corresponds to the left sensor, which enables the
ADC. The data from the left sensor is then read as a digital value by using the SHIFTIN command on the data pin for
ADC. SHIFTIN takes inputs from a synchronous serial device, such as the ADC. A high is then output to the A2DCs2
pin, to switch the ADC back to its inactive state. Then this value from the ADC, vLeftSensor, is compared to see

23
whether it is less than the vlowest value discussed above. If the vLeftSensor is lower, meaning a greater source of
light, then the vlowest value is replaced with the value vLeftSensor. The counter vCtr is then incremented to count
the number of times through the loop. If the value of the vCtr is equal to 800, then this loop is exited This value was
determined through trial and error as 800 iterations of the loop corresponds to a complete circle. If the value is less
than 800, then the main routine continues by entering the subroutine Spin. This subroutine enables the motor stamp
to output a spin value. Then, in the main loop, the LEDs are flashed. This is done by alternating which pins are high
using the vctr variable (the number of times through the loop) to create the time interval, in increments of 100. First,
the two outside LEDs are lit, and then the two next to them, and finally the middle LED is lit. This loop is terminated
when the loop has been executed 800 times. The motor is stopped by outputting a 0 on the ENABLE pin for the
wheel servos, which puts them in an inactive state and there is a 1second pause to allow the user to know that the
scan is complete. vlowest is increased by 30, which decreases the threshold slightly to ensure that the robot can find
the light source again. This ensures that an abnormal reading that is on the low side above (for vlowest which is equal
to vLeftSensor) will not prevent the robot from finding the direction of the greatest light source. Then a new
variable, vLastSensor, is initialized to be equal to vLeftSensor.

Then a new loop is started. The left sensor is once again read by enabling the corresponding ADC and using
the SHIFTIN command. The ADC is then disabled. vDirection=vLeftSensor-vLastSensort is then calculated. This
compares the current value that is read by the left sensor with the previous value. If the lowest value, vlowest, is
equal to the current value of the left sensor, vLeftSensor then vDirection is also checked to see whether vDirection is
greater than 1000, which would correspond to a negative value, which indicates that the sensor is getting a brighter
reading. If it is, the loop is exited. The spin subroutine is entered to begin scanning again to find the direction of the
greatest light source that was encountered on the first spin of the robot. The variable vLastSensor is then set equal to
the current value from the left sensor. When vDirection is greater than 1000 the loop is exited and vSpin is set equal
to 1, to show that the spin and scan is complete. When this loop is exited, it signifies that the robot has found its
target direction. The motor is stopped and the charge tune is played by using FREQOUT to output the appropriate
frequencies and durations to the speaker pin.

Now finally the right sensor is read by outputting a low to the A2DC1 to enable the ADC that corresponds
to the right sensor. This ADC is then disabled and the other sensor, the left sensor, is read. If the left sensor is less
than 45, a value that was determined by trial and error, to be an adequate distance from the “fire”, then the
subroutine, Fire, is entered. In this subroutine, the sound of an ambulance is imitated by alternating between a high
and low frequency on the speaker. The LEDs are also flashed; first a high is output on the 3 middle LEDs, then the 2
outside LEDs. During this subroutine, the fan is also turned on to “put out” a fire. This subroutine will loop infinitely.

If the value from the left sensor is not yet less than 45, then the right and left sensors are compared to
Final Project – Group B | 5/10/2010
determine which direction to go in order to get closer to the light. First, the sensors must be normalized, since they
were not constructed to be exactly the same. This is done by subtracted a value, cSensOffset, from the vRightSensor.
This makes the two sensors read equivalently. Then, the difference between the two sensors can be found;
vLeftSensor is subtracted from vRightSensor. If the difference is less than ten but greater than negative 10, the robot
is approximately facing the light source, and the robot is instructed to go straight. The lights are changed to indicate
the direction by lighting the middle LED. The robot goes straight by entering a subroutine that outputs a high to both
the right and left servo motor. Since the wheels are then turning at the same rate, the robot moves straight. PinSpin is
also set to zero, so that the robot does not spin. If the difference is negative, the robot will move toward the left. The
lights change to indicate this by outputting highs to the left two LEDs. In the subroutine, MoveLeftOfCenter, a low is
output onto the right motor pin, and a high is output to the left motor pin. This causes the robot to turn to the left,
since the left wheel is moving faster than the right wheel. Again a low is output to the pinSpin. If none of these other

24
conditions are true, then the robot moves to the right. The lights are again changed to indicate this by lighting the two
right LEDs. In the MoveRightOfCenter subroutine, a low is output onto the left motor pin, and a high is output to
the right motor pin. This causes the robot to turn to the right, since the right wheel is moving faster than the left
wheel. This continues and the robot continuously corrects its direction until the value of the left sensor is less than 45
and the robot enters the subroutine, Fire, and stops to “put out” the fire.

Motor Program

Much of the program is logically understood in the first comment section. This section illustrates a legend
that corresponds to the code received from the other stamp. When a 0 on the enable pin is received, the motors stop.
When a 1 on enable and a 1 on spin are received, the robot spins counter clockwise and when a 1 on enable, 0 on spin
and a 1 or 0 is on the other pins, the robot turns left or right or goes straight.

The program begins by setting constants. These constants were determined by doing small tests with the
motor. We would set the motor on the ground and output different PULSOUT commands to determine what values
of duration the PULSOUT command would turn the motor at various speeds. These values are shown in the
appendix, but basically, values were determined to stop the motor, go fast and go slow. The further the variation
from 750 in duration of the PULSOUT command affected the speed. The Pins for each motor, and the pins for
communication with the other stamp were then declared.

The program then starts with a 5 second delay to stabilize the system. It then tests to see if the received pin
ENABLE pin is 0. If so, the set-motor variable durations are set to the 750 constant. The program then tests to see if
the spin pin is set to 1. If so, the motor constants are set to spin the right motor fast and the left motor at a stand still.
This causes the robot to spin counter-clockwise. If neither or these conditions are met, a new set of conditions are
test to see what way the robot is asked to turn. If the left or right motor pin is high, the corresponding motor will
spin at the predetermined fast rate, and the set-motor variable is equated. If it is 0, a slower speed is set. This allows
the robot to ride more smoothly. Finally, with the set-motor variables made, the PULSOUT command is
implemented and the motor is turned. The program then returns to the main routine and repeats the task.

Photographs
Shown in the pictures below is the final robot built:
Final Project – Group B | 5/10/2010

25
Final Project – Group B | 5/10/2010

26
Potential Applications
With our project set up we can see there are a host of potential and real world applications that can be
implemented. A more aggressive and robust algorithm will be needed to apply into these possible
situations.

 Fire fighting
o Forest fires often cause a significant amount of damage and with our robot we can help
reduce the damage by allowing robots to move to epicenter of the cause of the fire and
extinguish it without endangering human life. It could make use of the photo resistive
sensors as we have to seek out the fire itself.
 Security
o Trespassers are often a nuisance and in areas of darkness, they require light to maneuver
around. With the robot of this similar style or setup, it will be able to detect light sources
within its vicinity, and be able to alert the victim and/or notify the authorities. It may be
even used as a defense mechanism to deter trespasser as well.
 Toys
o The wonderful thing about robots is that they can be dressed up in any form and will be
able work correctly. A robot say disguised as a household pet, a dog or a cat, can be
utilized to follow it slight source dressed as yarn, or a bone, trained to follow it. The light
source can be calibrated for specific light wave spectrums as to not interfere or go hay
wire with outside sources.

Problems Encountered
The main problem we encountered had to do with a tired person in the initial stages programming (Don’t
worry, the person writing this section is the one who made the mistake). In one of the initial stages in programming,
we mixed up the left and right servos, which lead to a lot of confusion as to why the robot was behaving the way it
was (Turning away from the light and turning improperly). This mistake was clearly realized after some trouble
shooting.

Another unsolved problem had to do with the scan mode that the robot enters before attacking the light.
When scanning, the robot takes readings from one of the sensors and sees where the lowest (highest light) reading
occurred. Initially, our group was using the right sensor to do this. However, after 300 iterations in the loop, the
sensor would rise sharply, then just read 0. We had no explanation and tested it for hours. Eventually, we tried using
Final Project – Group B | 5/10/2010

the left sensor and didn’t have this problem. We are still uncertain as to it its cause.

Except for other minor instances of confusion and a final decision as to the content of our project, our group
didn’t have any more major errors that we found difficult to overcome.

27
Future Considerations
I always like to take a look back and ask myself what I would do differently next time to improve the project
if given more time and more resources. One thing we would have liked to explore would be the use of infrared
sensors to determine if there were obstacles in our way of the light. This could be used in order to avoid these
obstacles and measure distances. We could also have the robot display the distance to an object or a distance to the
“fire”. This was one of the major topics our group discussed when developing ideas. Unfortunately, due to time it
never materialized.

Final Project – Group B | 5/10/2010

28
Appendix
The following code was used for the main BS2 sending information to the Motor BS2
Final Project – Group B | 5/10/2010

29
Final Project – Group B | 5/10/2010

30
Final Project – Group B | 5/10/2010

31
Final Project – Group B | 5/10/2010

The following code was used for the motor BS2.

32
Final Project – Group B | 5/10/2010

33
Final Project – Group B | 5/10/2010

34
References

http://en.wikipedia.org/wiki/Microbotics

http://en.wikipedia.org/wiki/Moore%27s_law

http://www.mobilerobots.com/RobotApplications.aspx

http://www.swarm-bots.org/index.php?main=3&sub=35

http://en.wikipedia.org/wiki/S-bot_mobile_robot

http://en.wikipedia.org/wiki/Transistor

http://en.wikipedia.org/wiki/Bipolar_junction_transistor

http://hyperphysics.phy-astr.gsu.edu/hbase/solids/trans.html

"Photoresistors (Photocell) Sensors." Welcome to the Mechatronics Design Lab! Web. 07 May 2010.
<http://mechatronics.mech.northwestern.edu/design_ref/sensors/photocells.html>.

Wikipedia contributors. "Photoresistor." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 3 May.
2010. Web. 7 May. 2010.

Wikipedia contributors. "Voltage divider." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 28
Mar. 2010. Web. 12 Apr. 2010

"Voltage Dividers." Web. 12 Apr.


2010.<http://www.facstaff.bucknell.edu/mastascu/eLessonsHtml/Resist/Resist3.html#Analysis>.

http://en.wikipedia.org/wiki/Servomechanism

http://www.seattlerobotics.org/guide/servos.html

http://en.wikipedia.org/wiki/Analog-to-digital_converter

http://www.national.com/ds/DC/ADC0831.pdf
Final Project – Group B | 5/10/2010

http://www.allaboutcircuits.com/vol_4/chpt_13/6.html

http://en.wikipedia.org/wiki/Serial_communication

http://en.wikipedia.org/wiki/Comparison_of_synchronous_and_asynchronous_signalling

http://en.wikipedia.org/wiki/Parallel_communication

35
Contributions
Group Member Report Sections

Jenna Curry -Code walkthrough, Theoretical


Background

Ian Duncan -Wikipage, Theoretical Background,


User Instruction, Calibration
(Ohms), Potential Applications

Ian Clark -Theoretical Background,


Introduction, Abstract

Chris Van Loon -ADC Calibration, Fine tuning of


robot movement, construction
section, initial build of robot, future
considerations, problems
encountered, Wikipage

Ilya Gartseev -Attended most of group


construction, schematic

The build of the robot was shared as equally as possible as we gathered in groups

Final Project – Group B | 5/10/2010

36

You might also like