Draft: June 26, 1997.
The goal of this section is to learn the basic anatomy and operation of the robot. Important components of the robot are the basic mechanical structure, the microcontroller card and auxiliary card, and the batteries. Operating the robot means primarily editing, compiling, downloading, and running software.
The main components of the robots we hand out are:
- Chassis and drive train. Two wheels drive and turn the robot in a configuration known as Differential Drive or Skid Steering. Each wheel is driven by an electric motor through a set of gears and a pulley belt. A ceramic knob provides a third support.
- Electronics. The GCB11 board containing an HC11 microprocessor, and an auxiliary board containing motor drive electronics, buttons, switches and light-emitting diodes (LEDs).
- Batteries. The electronics are powered by an alkaline 9 volt battery which should last days with normal usage. The motors are powered by a rechargeable 6 volt battery which should last 90 minutes with normal usage.
- Sensors. Two light sensors and two bump sensors.
The mechanical structure is constructed from standard Lego Technic parts.
You must use care when handling the electronic parts. Try to use the edges of the cards, and avoid contact with the pins, the legs of the ICs, and all other metallic parts. Static electricity is deadly to the integrated circuit chips. You should also be careful not to bend the pins.
Put the robot on "jack stands" -- the heavy Lego bricks work well -- so that the wheels are not touching the workbench. Set the DIP switches to "off". Plug the serial line into the connector on the GCB11 card. We left an opening in the robot on the right side for access to the four-pin connector. Now boot your PC, start a DOS shell, and at the DOS command prompt do the following:
C:>cd \al\intro C:\AL\INTRO\>..\setup C:\AL\INTRO\>gpc
The first line switches to the "\AL\INTRO" directory. The second line runs sets up the paths. (You only need to do that once after booting the PC.) The third line starts the GPC program which manages communication over the serial cable with robot. Now turn the robot power on and press the reset switch. You should see a message such as:
GROM 2.01 A:00 D:0000 IX:0000 SP:0000 CCR:00 (00000000) B:00 IY:0000 PC: (SXHINZVC) 0000: 7F 00 FF CLR $00FF ]
If you don't see such a message, your communications may be messed up. Check the settings by pressing F9 and change them if necessary. The port should probably be COM2. 9600.
Another possible cause of the problem is that your robot's "Run on Reset" register is set. Hold down Button 2 on the interface card as you push and release the red reset button. You might get a GPC prompt; if not, type alt-B. Now at the GPC prompt type
mg gbugrr 0 U
Now try the red reset switch again. If you're still having problems, get help.
Now you can download a robot program. At the GPC prompt "]" type the command "td". Now GPC is waiting for "s-records". Press F7 and then provide the file name "intro.s19" and press enter. GPC will count lines as it downloads the program, and then give you another command prompt. Type "r 400". That starts program execution at the standard address.
Now you can disconnect the serial cable, take the robot off the jackstands, and put it on the floor. Turn DIP switch 2 on. (On your robot, it is entirely possible that DIP switch 2 is labelled DIP switch 1. Oops!) It tries to head for bright places, but when it runs into something it backs and turns in response. To see the light-seeking behavior at its best, point a flashlight directly at the robot.
The source code for the example program is in the file "intro.c". Suppose you don't like this backing and turning behavior. (Maybe you are entering a robot demolition derby.) To fix the program, exit GPC by typing shift-F10 to get a DOS prompt. Assuming you are still in the INTRO directory, type "edit intro.c". Do a "Save As" and give the file a new name (let's say "bash.c") so you don't overwrite the original.
We are going to look at this program in detail later. For now you are just learning to edit and compile. Go to the definition of main and comment out the line that checks bumpers. Save the file and exit the editor.
To compile, type "build bash". Assuming you haven't made any errors, it will compile the file, link it, and generate an object file suitable for downloading. Check to see if a new file "bash.s19" is present. Now put your robot back on the bench, download the new program, and check it out.
When the 9 volt battery fails, the microprocessor resets, which means the robot stops moving, downloads don't work correctly, and so forth. If the robot seems to behave randomly, suspect the 9 volt battery. Put the battery in the recycle bin and install a new one.
When the 6 volt battery fails, the motors start to run slower and will eventually stop. Pull out the battery and put it in your "recharge" bin. Put in a fresh one. At the end of the day put any discharged batteries on chargers and set the timer for a 15 hour charge.
By the way, the 6 volt battery is a Nickel Metal Hydride (NiMH) battery, which gives us the high currents required, with almost double the capacity of a Nickel Cadmium (NiCad). On the downside, excessive currents will cause a NiMH battery to vent hydrogen. Since hydrogen is explosive, we ask you that be careful not to short the batteries, and to follow guidelines when charging. Use only the battery chargers provided, and don't charge batteries without discharging them. (Actually, the guys that sold us the battery chargers do not recommend them for NiMH. No smoking in the lab.)
Lego sometimes comes apart. When that happens, put it back together. Better yet, redesign it to stay together. But remember: no glue.
For ninety nine percent of all failures the causes are obvious---after you've found them. It is almost always something dreadfully simple. Finding them is a matter of checking all of the little things that go wrong.