Robot:
|
|
Click to enlarge
This robot I did not design nor fabricate from scratch like some of the others on this web page. The robot comes from Diversified Enterprises industires and is a comercial spin off the development being done at the link to the right. I bought the robot in kit form and had an absolute blast putting it together. The steps for assembly are detailed with photos on the next four sections of this website.
Pocket-Bot Specs
Technical Specifications
Size Length 63mm Width 48mm Height 38mm Weight 48g Power Drive and Computer One 9 volt Alkaline Battery Required Typical Current Draw 200mA while motors are on Typical Battery Life 2 Hours of constant operation Computer BASIC Stamp II Ref: Parallax Inc. BS2-IC Available I/O 3 Non-Dedicated Documentation Supplied with BS2-IC Example Programs Supplied with BS2-IC Drive System Speed Control Variable Differential Steering Yes Independent L-R Yes Drive Wheels 2 or 4, Configurable Encoder Resolution 3.0 Counts/cm Special Characteristics Assembly Full, Partial, or Kit Form Sensors Obstacle Detection Standard Light/Dark Detection Available Option Thermal Detection Available Option Line Follower Available Option Special Characteristics (continued) Prototyping Space Location Top, Front Area 40mm X 28mm # Through Holes 175 Through Hole Spacing 0.1" OC
Software
Pocket-Bot's onboard BS2 computer is manufactured by Parallax Inc. Section III of this manual, Programming Pocket-Bot's BASIC Stamp II Computer, is a subset of the documentation also provided by Parallax. Complete software, manuals, and application notes covering the BS2 computer may be obtained at no charge from either ww w.radioshack.com/sw/swb/projects/bstampidx.htm or www.parallaxinc.com.
Installing the Software - Insert the floppy disk provided with Pocket-Bot into your computer's floppy drive. From this drive run the install program specifying the target drive where the software is to be placed. This is done by typing "INSTALL C:", assuming the software is to be placed on your computer's "C" drive.
With the installation procedure complete, a new directory called POCKET will be found on your specified target drive. From within the POCKET Directory run the STAMP2.EXE program by typing "STAMP2". This command will load the BASIC Stamp II editor/downloader software, a programming environment from which routines for Pocket-Bot can be developed. Refer to Section III of this manual for further information on developing programs with the BASIC Stamp II editor/downloader software.
Downloading Programs - Once a Pocket-Bot routine has been written and is ready to download, attach the Programming Cable as described under "Connecting the Programming Cable". With a fully charged battery installed, turn the On-Off switch to the "on" position. Within the Editor Program type "ALT R" to download the program into Pocket-Bot's BS2. Pocket-Bot will immediately begin executing your program.
Example Programs - These sample programs are designed to help you get started programming your Pocket-Bot. They are to be typed into the editor program, 'STAMP2.EXE.' It is assumed that you have already familiarized yourself with the Programming Cable and editor/downloader software.
Motor test program:
dira = %1111 'set first four stamp pins as outputs outa = %1010 'set pins to go forward pause 1000 'pause for 1000ms (1sec) with motors on outa = %0000 'turn off motorsThis program will make Pocket-Bot move forward for one second, then stop. The descriptive information on the right are called comments and including them is good programming practice. Trying to fix a program without good comments can be nearly impossible. Any words after a ' on a line are ignored by the downloader. Since they are not sent to Pocket-Bot, they do not require any program memory.
The DIRA command is used to tell the computer to set the first four pins (pins 0,1,2,3) as outputs. The second command, OUTA, tells the computer to set high the first and third pin, and set low the second and fourth pins. A high means that 5 volts is sent out the pin, and a low means that the voltage is pulled down to 0 volts (ground). This combination causes both motors to run forward. The first two numbers are for the left gearbox, and the next two are for the right one. The direction that the motor turns is determined by which pins are high or low. For example, the command OUTA = %0101 tells both motors to run backwards. OUTA = %1001 will cause the left motor to run forward, and the right one to run backward, causing the robot to turn to the right.
Modify the program by adding pauses and motor commands as you please, and develop a feel for using them, as they are the only commands necessary for Pocket-Bot mobility and are used extensively in programs. If you make an error, the editor will likely let you know when you attempt to download your program to the robot. Don't forget to turn Pocket-Bot's power switch on or you'll get a 'hardware not found' error!
Simple motion and obstacle avoidance program: (column alignment only necessary to ease editing)
dira = %1111 'sets pins 0-3 as outputs dirb = %0000 'sets pins 4-7 as inputs forward: 'program tag outa = %1010 'motors forward if in4 = 1 then checkr 'If bumper not hit, jump to 'checkr' outa = %0101 'bumper hit; back up pause 400 outa = %1001 'Turn right, away from obstacle at left pause 200 goto forward 'return to top of program at forward tag checkr: if in5 = 1 then forward 'If bumper not hit, go to top outa = %0101 'back up pause 400 outa = %0110 'turn left pause 200 goto forward 'go back to topThis program will make Pocket-Bot move forward until a bumper switch is sensed, then it will back up, turn away, and resume its forward motion.
Program tags are inserted as 'jump to' markers for use during the execution of the program. They are used to mark code that you only want to execute under certain conditions.
The IF command is used to compare values and go to a different part of the program if the comparison is true, therefore altering the program results based on the conditions of the comparison. You may compare many different kinds of data, including input pins as we do here. The command, 'if in4 = 1 then checkr' means "if input pin 4 is high (equal to 1) then go to tag checkr," skipping the section of code that makes Pocket-Bot back up and turn.
'in4' is called a variable because it is a name that represents a value that can change (or vary) during the execution of the program. Input pins can have two values, high or low. If the input pin has voltage on it (more than 2 volts or so) then it is considered high, or a 1. Low voltage is ground or a 0, as is the case when the grounded bumper pushes against the sense wire, which is connected to that pin. The special word IN followed immediately by a number is a variable that represents the status of the pin associated to the number (0-15). It is a simple method of checking input pins, although many more flexible methods exist.
Standard Programs - A selection of routines are included on the standard Pocket-Bot distribution floppy. These allow you to immediately operate Pocket-Bot without programming when downloaded through the BASIC Stamp II editor/downloader software. Select one of these programs within the editor software using the Load command "ALT L".
Pin Assignments - When writing your own programs the following Pocket-Bot/BS2 pin out assignments will be needed for pin number referencing. Pins 12-15 can be used for your own circuits.
P0 Right Motor Reverse P6 Left Gearbox P12 Left CdS Eye P1 Right Motor Forward P7 Right Gearbox P13 Available P2 Left Motor Reverse P8 Gearbox Sense On P14 Available P3 Left Motor Forward P9 LEDs On P15 Available P4 Left Bumper P10 Right CdS Eye P5 Right Bumper P11 Center CdS Eye
Parts List
1 Parallax BS2-IC microcontroller
1 Motor driver IC (L293D, 16 pin DIP)
1 317 voltage regulator IC (3 pin TO-220)
1 Processor PCB
1 Battery PCB
1 Chassis PCB
2 Front wheels
2 Rear wheels (larger)
2 Rubber tires
2 Rubber drive belts
4 Brass axles (nails)
1 Male battery snap
1 Female battery snap
1 Multicolored ribbon cable
1 Thin purple wire
1 Black stranded wire
1 Black Teflon insulation tube
1 Small jumper (hookup) wire
2 Nylon ties2 Motor/gearbox assemblies
6 Paper clips
1 SPDT power switch
1 Potentiometer
2 12 pin SIP sockets
1 4 pin SIP header
3 0.1uf capacitors
3 CdS photo cells
2 330 ohm resistors (org-org-brn, 1/4 w)
4 33k ohm resistors (org-org-org, 1/8 w)
2 370 ohm resistors (org-blu-brn, 1/8 w)
1 10k ohm resistor (brn-blk-org, 1/8 w)
1 39 ohm resistor (org-whi-blk, 1/4 w)
2 High-output LEDs
1 5 foot, 4-conductor cable
1 Female DB-9 serial connector
1 DB-9 plastic hood with hardware
1 4-position female header plug
4 Female header crimp pins in strip
![]() ![]() ![]() ![]() ![]()
|