05/13/22 1 Controlling YOUR ROBOT Controlling YOUR ROBOT
04/21/23 1
Controlling YOUR ROBOTControlling YOUR ROBOT
04/21/23
Basic StampBasic Stamp Basic StampBasic Stamp
Input - output pins
Interpreter Chip Power supply: 5 Volts voltage
Memory: EEPROM
Clock - 20 MHz Oscillator
04/21/23
Board of EducationBoard of Education
Intelligent programmable controller boardIntelligent programmable controller board accepts the Basic Stamp II controller chip accepts the Basic Stamp II controller chip
04/21/23
ServosServos
MotorsMotors Connected to your micro controllerConnected to your micro controller Receives power from power source and signals Receives power from power source and signals
from controllerfrom controller Moves the wheels based on the signals receivedMoves the wheels based on the signals received
04/21/23
How Servos WorkHow Servos Work
Power Source
Ground
04/21/23
Powering the ServoPowering the Servo Pulses Pulses Electric Power Electric Power Mechanical Mechanical
PowerPowerhigh
low
Low: 0 volts No power-pause
High: 5 volts Power Supplied
04/21/23
Width of High PulseWidth of High Pulse Pulse TimingsPulse Timings
Pulses are sent to the servos in terms of milliseconds
1 ms high times and 20 ms low time. The high time tells the servos what to do.
04/21/23
Width of High PulseWidth of High Pulse Direction of movementDirection of movement
Range: 1ms – 2ms.
Full Speed: 1ms: clockwise. Forward for right wheel and backwards for left
wheel.
2ms: anticlockwise. Backwards for right wheel and forward for left wheel.
Partial Speeds: 1.1ms – 1.4ms: clockwise. Forward for right wheel and backwards
for left wheel.
1.6ms – 1.9ms: anticlockwise. Backwards for right wheel and forward for left wheel.
Full Stop 1.5ms
04/21/23
Width of Low PulseWidth of Low Pulse
Pause DurationPause Duration
Right Wheel
High Pulse Width = 1.25ms
Low Pulse Width = 2seconds
04/21/23
CommandsCommands
Reset (to low pulse)Reset (to low pulse) ‘low port#’ Example: ‘low 12’ sets p12 to output low Compulsory at the beginning of every program
Set high pulse widthSet high pulse width ‘pulsout port#, value’ Values range from 500 – 1000.
500 = 1ms, 1000 = 2ms Example: ‘pulsout 12, 500’ send 1ms pulses to p12
04/21/23
CommandsCommands
PausePause ‘pause time (ms)’ Example: ‘pause 20’ waits for 20ms after each full
wheel spin
LoopsLoops ‘goto loop name ’ Starts from the command line after loop Example: ‘goto loop’ looks for the ‘loop:’ in the program
and repeats the commands from that point
04/21/23
Example ProgramExample Program
04/21/23
Running the ProgramRunning the Program Name the program descriptively and save itName the program descriptively and save it
Click the file menu Select save (or save as) Type in the file name and make sure the file type
is *.bs2
Run the ProgramRun the Program Click ‘Run’ Select Run’
Make sure the wheel is turning as Make sure the wheel is turning as commandedcommanded
04/21/23
Now Your TurnNow Your Turn Make the right wheel turn Make the right wheel turn
counterclockwisecounterclockwise Make the left wheel turn clockwiseMake the left wheel turn clockwise Make the left wheel turn Make the left wheel turn
counterclockwisecounterclockwise Make the robot move forward - both Make the robot move forward - both
wheels turn clockwisewheels turn clockwise
04/21/23
Moving ForwardMoving Forward
04/21/23
Now Your TurnNow Your Turn
Make the robot move backwardsMake the robot move backwards
Make the robot stay stillMake the robot stay still
Make the robot spin left Make the robot spin left
Make the robot spin rightMake the robot spin right