R2-D2
Mobile Robot


 
Front View
Bottom View
Back View

PROJECT DESCRIPTION

     David A. Ward ward@suu.edu, Associate Professor of Electronics Engineering Technology at Southern Utah University in Cedar City, Utah has basically taken a Boe-Bot www.stampsinclass.com and placed its electronics in the body of Star War’s R2-D2.  During the summer of 1999 Kentucky Fried Chicken stores were offering 32 ounce soft drink cups featuring Star Wars characters.  Dave bought four of the R2-D2 cups before they ran out and was going to use them as trophies for Southern Utah University’s mobile robotics contest to be held in the spring of 2000.  Upon further examination of the cups he decided to put the electronic components from a Boe-Bot inside of the drink cup and give R2-D2 some flashing LED’s, a speaker so it could play the Star Wars theme, two servo motors to give it motion, and finally two limit switches for object detection and avoidance.  The operational R2-D2 could then be used as a show piece to generate interest in the mobile robotics contest to be held on April 25, 2000.

    The R2-D2 Boe-Bot has the following electronics incorporated into it:
8-AA batteries (2 parallel banks of 4 series cells totaling 6V)
1-Parallax Board of Education using the Stamp II
2-Futaba FP-S14B servo motors modified to allow a full 360 degrees of motion
8-Various LED’s placed into R2-D2’s head
1-Hycom Hy-05 Piezo electric speaker mounted into the straw hole in the back of R2-D2’s head
2-Limit switches located on the front corners for object detection and avoidance

    R2-D2’s mechanical assembly is made from a thin sheet of aluminum bent into a “U” shape which holds the servo motors and is then screwed to the bottom of R2-D2’s feet.  On the front and rear of the aluminum platform are two bent screws with small wooden balls for balance wheels.
    R2-D2’s program begins by having the eight LED’s flashing with random numbers for several seconds.  Next the program plays the first part of the Star Wars theme.  A switch located on the back can be set for either mode 1, pattern-bot mode, or mode 2, bumper-bot mode.  Mode 1 has R2-D2 run a pattern which is currently about a 2 ½ foot square.  In mode 2 the servo motors begin moving R2-D2 straight ahead and after a number of pulses the LED’s will flash and the theme will be played again.  If either limit switch is hit during forward motion R2-D2 will stop, then back-up a little, turn away from the switch that was hit, and begin moving forward again.

    Electrical connections to the Stamp pins are listed below:

P0 through P7 are connected to the LED anodes which have 150 ohm resistors connected in series with them
P8 and P9 are connected to the limit switches and are tied to the ground through 10K ohm resistors, when the switches
    are closed the pins are pulled up to +5V
P12 is the mode selection switch, mode 1 is a pattern running mode and mode 2 is an obstacle avoidance mode
P13 is connected to the Hycom piezo electric speaker
P14 and P15 are connected to the 2 servo motors
 


PBASIC SOFTWARE LISTING

'Star Wars program to run R2-D2
'P0-P7 outputs to LED anodes
'P8 input from left limit switch
'P9 input from right limit switch
'P12 input from mode switch
   'if mode = 0 then run a stored pattern
   'if mode = 1 then run bumper mode
'P13 output for piezo electric speaker
'P14 right servo motor
'P15 left servo motor
'pulsout 650 = right servo FWD, left servo REV
'pulsout 850 = right servo REV, left servo FWD
'approximately 36 pulses for 360 degrees
dirs = %1110110011111111
X   var word  'duration of musical note in mS
Y   var word  'pitch of musical note
C   var word  'lookup counter
steps  var word  'number of steps to take
lft  var word  'direction for left motor
rght  var word  'direction for right motor
right_servo con 14
left_servo  con 15

Start:
'flash LED's
for Y=0 to 5
   for X=0 to 7
      pause 20
      gosub number
   next
next
Pause 500
'play Star Wars theme
for C=0 to 17
Lookup C,[392,587,523,494,440,784,587,0,523,494,440,
784,587,0,523,494,523,440],Y
Lookup C,[1000,1200,500,500,500,1200,500,500,500,500,500,1200,
500,500,500,500,500,800],X
   freqout 13,X/4,Y*3
   gosub number
   pause 20
Next
pause 200
'determine pattern mode (in12=0) or bumper mode (in12=1)
if in12 = 0 then Pattern
'beep 3 times for bumper mode
for X=0 to 2
   freqout 13,100,3000
   pause 20
next
'bumper mode
forward:
for x=0 to 500
   pulsout right_servo,650
   pulsout left_servo,850
   gosub number
   pause 20
   if in8 =1 then right
   if in9 =1 then left
next
goto start
left:
gosub backup
for x=0 to 25
   pulsout right_servo,850
   pulsout left_servo,850
   pause 20
   next
goto forward
backup:
for X=0 to 2
   freqout 13,100,3000
   pause 20
next
for x=0 to 50
   pulsout right_servo,850
   pulsout left_servo,650
   gosub number
   pause 20
next
return
right:
gosub Backup
for x=0 to 25
   pulsout right_servo,650
   pulsout left_servo,650
   pause 20
next
goto Forward
Pattern:
'beep 5 times for pattern mode
for X=0 to 4
   freqout 13,100,3000
   pause 20
next
'go forward
steps = 250
rght=650
lft= 850
gosub go
'turn right 90 degrees
steps = 40
rght= 850
lft= 850
gosub go
'go forward
steps = 250
rght =650
lft = 850
gosub go
'turn right 90 degrees
steps = 40
rght = 850
lft = 850
gosub go
'go forward
steps = 250
rght =650
lft = 850
gosub go
'turn right 90 degrees
steps = 40
rght = 850
lft = 850
gosub go
'go forward
steps = 250
rght =650
lft = 850
gosub go
'turn right 90 degrees
steps = 40
rght = 850
lft = 850
gosub go
goto start
go:
for x=0 to steps
   pulsout right_servo,rght
   pulsout left_servo,lft
   gosub number
   if in8 or in9 = 1 then Back
   pause 20
next
pause 500
return
Back:
for x=0 to 50
   pulsout right_servo,850
   pulsout left_servo,650
   gosub number
   pause 20
next
pause 500
goto Pattern
number:
random outl
return
end

Back