![]() |
Mobile Robot |
![]() |
![]() |
![]() |
PROJECT DESCRIPTION
Another mobile robot Dave Ward ward@suu.edu
worked on during the summer of 1999 was his “Stepper-Bot”. Dave wanted
to use stepper motors from old 5 ¼” floppy disk drives to make a
mobile robot.
The Stepper-Bot has the following electronics on
it:
1-Parallax Board of Education using the Stamp II www.parallaxinc.com
or www.stampsinclass.com
1-Serial 2 line LCD serial backpack display from Scott Edwards Electronics
www.seetron.com
2-12V unipolar stepper motors from old 5 ¼” floppy disk drives
2-UCN 5804 unipolar stepper motor driver IC’s from Allegro Microsystems
www.allegromicro.com
4-9V rechargeable batteries consisting of 2 parallel banks of 2 series
batteries for a total of 18V
1-Hycom Hy05 piezo electric speaker
2-limit switches for object detection and avoidance
1-SPST slide switch for mode selection
Stamp electrical connections:
P0 left stepper motor step pulse
P1 left stepper motor direction
P2 right stepper motor step pulse
P3 right stepper motor direction
P4 start button
P5 piezo electric speaker
P6 right limit switch
P7 left limit switch
P8 mode selection switch
P13 serial output to LCD display
The Stepper-Bot software runs in one of two modes. In the Stepper-Bot mode it moves forward until a limit switch is hit, backs-up, turns away from the object and then continues on in forward motion. In the “pattern-bot” mode the Stepper-Bot follows a pattern that is entered into the program by the user before it is downloaded to the Stamp. The pattern that is currently in the software listing makes a 5 foot square and then several turns at the end.
Stepper motors allow for great accuracy and repeatability of movement, but they consume a lot of current even when they are not being stepped. So they haven’t worked out as well in a mobile robots as servo motors because of their tremendous power consumption and relatively small torque. However, it’s a good way to gain experience with stepper motors.
PBASIC SOFTWARE LISTING
'Stepper_bot.bs2 2 mode program
'P0 left stepper step pulse
'P1 left stepper direction
'P2 right stepper step pulse
'P3 right stepper direction
'P4 start button
'P5 piezo electric speaker
'P6 right side limit switch
'P7 left side limit switch
'P8 mode selection switch 1=mode 1 (bumper-bot), 0=mode 2 (pattern-bot)
'P13 serial output to 2 line LCD display
Dirs = %1111111000101111
N9600 con $4054 'serial settings for LCD
F Var Word
N Var Word
T Var Word
X Var Word
Y Var Word
Z Var Word
Fix Var Word
Direction Var Word
Distance Var Word
FWD con %1101
RV con %0111
Right con %0101
SlRight con %0001
Left con %1111
SlLeft con %1100
Beginning:
serout 13,N9600,[254,1,2]
serout 13,N9600,[" Stepper-Bot"]
serout 13,N9600,[254,192]
serout 13,N9600,["Program by David A. Ward"]
Pause 500
for Y = 0 to 23
Pause 300
serout 13,N9600,[254,24]
next
Pause 1000
serout 13,N9600,[254,1,2]
serout 13,N9600,["Pick Mode, Press"]
StartLoop:
X = X+1
If X >= 20000 then Sound
If in8=1 then Dsp_Mode1
serout 13,N9600,[254,192,"Button, Mode 2"]
goto Dsp_Wait
Dsp_Mode1
serout 13,N9600,[254,192,"Button, Mode 1"]
Dsp_Wait
If In4=0 then StartLoop
If in8=1 then Mode_1
Mode_2:
serout 13,N9600,[254,1,2,"Mode 2"]
serout 13,N9600,[254,192,"Pattern-Bot"]
Pause 1000
Goto Start_Mode2
Mode_1:
serout 13,N9600,[254,1,2,"Mode 1"]
serout 13,N9600,[254,192,"Bumper-Bot"]
Pause 1000
F = 2500
Gosub Sound
Running:
serout 13,N9600,[254,1,2]
serout 13,N9600,["Moving Forward"]
Distance = 1222:gosub Move
F = 2500:Gosub Sound
Goto Running
end
Move:
for Z= 20 to 1 step -1
outA=FWD
outA=%0000
If In6=0 Then FixL
If In7=0 Then FixR
Pause Z+10
Distance = Distance - 1
Next
for X= 1 to Distance
outA=FWD
outA=%0000
If In6=0 Then FixL
If In7=0 Then FixR
pause 10
Next
Pause 500
return
Backup:
F = 3000
Gosub Sound
For T= 0 to 200
OutA=RV
OutA=%0000
Pause 10
Next
For T= 0 to 50
OutA=Fix
OutA=%0000
Pause 10
Next
F = 2500
Gosub Sound
Return
FixL:
Fix = Left
serout 13,N9600,[254,1,2]
serout 13,N9600,["Avoiding Object"]
serout 13,N9600,[254,192,"on Right"]
Goto Backup
FixR:
serout 13,N9600,[254,1,2]
serout 13,N9600,["Avoiding Object"]
serout 13, N9600,[254,192,"on Left"]
Fix = Right
Goto Backup
Sound:
For X = 1 to 3
freqout 5,150,F
Pause 50
next
X = 0
Return
'Pattern-Bot = Mode 2
Start_Mode2:
'Enter your direction data here
serout 13,N9600,[254,1,2]
serout 13,N9600,["FWD 1222"]
Direction = FWD:Distance = 1222:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["Right 114"]
Direction = Right:Distance = 114:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["FWD 1222"]
Direction = FWD:Distance = 1222:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["Right 114"]
Direction = Right:Distance = 114:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["FWD 1222"]
Direction = Fwd:Distance=1222:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["Right 114"]
Direction = Right:Distance=114:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["FWD 1222"]
Direction = FWD:Distance = 1222:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["Right 114"]
Direction = Right:Distance = 114:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["Pause 2 Sec"]
Pause 2000
serout 13,N9600,[254,1,2]
serout 13,N9600,["Left 400"]
Direction = Left:Distance = 400:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["SlRight 400"]
Direction = SlRight:Distance = 400:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["SlLeft 400"]
Direction = SlLeft:Distance = 400:gosub Move1
serout 13,N9600,[254,1,2]
serout 13,N9600,["End Program"]
Pause 5000
Goto Beginning
Move1:
for Z= 20 to 1 step -1
outA=Direction
outA=%0000
If In6=0 Then Halt1
If In7=0 Then Halt1
Pause Z+10
Distance = Distance - 1
Next
for X= 1 to Distance
outA=Direction
outA=%0000
If In6=0 Then Halt1
If In7=0 Then Halt1
pause 10
Next
Pause 500
return
Halt1:
F=2500
Gosub Sound
serout 13,N9600,[254,1,2]
serout 13,N9600,["Hit an Object"]
serout 13,N9600,[254,192,"Program Halt"]
Pause 2000
For N=0 to 100
outA=RV
outA=%0000
Pause 15
Next
serout 13,N9600,[254,1,2]
serout 13,N9600,["Continuing"]
serout 13,N9600,[254,192,"Program"]
Pause 2000
F=3500
Gosub Sound
Goto Move1
End