Computer Engineering Project report
1
Boe-Bot Activity
The Boe-Bot robot
2
Image source: Robotics with the Boe-Bot —Student Guide
Boe-Bot Circuit Board – Rev D
3
Moving the Boe-Bot
P.S. Nair 4
The Boe-Bot is equipped with servo motors and a microcontroller (“brain” ), which can be programmed by the user
The Boe-Bot’s wheel movement is controlled by the rotation of these servo motors
The servo motors’ rotation are, in turn, controlled by electrical pulses applied to specific circuit pins of the Boe-Bot’s “brain”
Each such pin has a number
Pulses of varying widths can be sent to the pins by the user (you!) via a program Controlled rotation of servo motors Controlled movement of the Boe-Bot!
Pulses
P.S. Nair 5
Each HIGH pulse rotates the servo motor
The direction of rotation is determined by the width (duration)
of the HIGH pulse
Successive HIGH pulses are separated from each other by a
PAUSE
Pulses – cont’d
P.S. Nair 6
A HIGH pulse lasting for 1.3 ms (milliseconds) rotates the servo motor clockwise
A HIGH pulse lasting for 1.7 ms rotates the servo motor counter-clockwise
A HIGH pulse lasting for 1.5 ms causes the servo motor to stay still
How to apply pulses to pins via
programming?
P.S. Nair 7
Use the PULSOUT command of the PBASIC programming language
The PULSOUT command’s argument generates a pulse (at pin N) that lasts for Argument * 0. 002 milliseconds i.e.
Actual duration of pulse = Argument * 0. 002 milliseconds
Rearranging the equation,
PULSOUT Argument = Actual Duration in milliseconds * 500
Example: The command,
PULSOUT 12, 650
generates a HIGH pulse lasting 1.3 ms at pin 12, causing the servo motor connected to pin 12 to rotate full-speed clockwise
Example Code: Moving Boe-Bot for 3 seconds
8
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Boe-bot is running the program“
counter VAR Byte
FOR counter = 1 TO 122 'Runs the FOR loop 122 times; initially, counter = 1
PULSOUT 13, 850 'Generates 1.7 ms pulse at pin 13 (pin 13 servo rotates counterclockwise)
PULSOUT 12, 650 ' Generates 1.3 ms pulse at pin 12 (pin 12 servo rotates clockwise)
PAUSE 20 'Pause for 20 ms between pulses
NEXT 'Increment counter by one and repeat loop (repeat till counter = 122)
'Time overhead due to the number of instructions in the loop = 1.6 ms
'TIME TAKEN FOR ONE LOOP EXECTION = 1.7 + 1.3 + 20 + 1.6 = 24.6 ms
'TOTAL TIME OF BOE-BOT MOVEMENT= 122 * 24.6 ms = 3 seconds (approx.)
END
P.S. Nair
Exercises
9
Read slides 4 through 8
In the program handouts given, replace the question mark
symbols (??) with actual numbers to achieve desired Boe-Bot
movement
Test your answers on Boe-Bot
P.S. Nair
Exercise 1: Moving Boe-Bot backwards for 5 seconds
10
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Boe-bot is running the program“
counter VAR Byte
FOR counter = 1 TO ??
PULSOUT 13, ??
PULSOUT 12, ??
PAUSE 20 'Pause for 20 ms between pulses
NEXT 'Increment counter by one and repeat
'Time overhead due to the number of instructions in the loop = 1.6 ms
'TIME TAKEN FOR ONE LOOP EXECTION = 1.7 + 1.3 + 20 + 1.6 = 24.6 ms
END
P.S. Nair
Exercise 2: Keeping the Boe-Bot still for 3 seconds
11
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Boe-bot is running the program“
counter VAR Byte
FOR counter = 1 TO 122
PULSOUT 13, ??
PULSOUT 12, ??
PAUSE 20 'Pause for 20 ms between pulses
NEXT 'Increment counter by one and repeat
'Time overhead due to the number of instructions in the loop = 1.6 ms
END
P.S. Nair
Exercise 3: Identify the wheel controlled by pin 12
12
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Boe-bot is running the program“
counter VAR Byte
FOR counter = 1 TO 122
PULSOUT 13, ??
PULSOUT 12, ??
PAUSE 20 'Pause for 20 ms between pulses
NEXT 'Increment counter by one and repeat
'Time overhead due to the number of instructions in the loop = 1.6 ms
END
P.S. Nair
13
Questions??
P.S. Nair
14
Thank you!!
P.S. Nair