Computer Science 014
LEGO Robot Engineering

Williams College
Winter 2007


Lab 1: Introduction: Soldering and Testing
Due: 10:00 AM, Thursday, January 4, 2007


During the Winter Study period, you will be building and programming small vehicular robots. The robots are controlled with the Handy Board, based on the Motorola 68HC11 microprocessor. Each robot will have at least two motors, as well as touch and light sensors. (Later in the month we'll add sonar, etc.)

Soldering the Components

To get started, you will wire the motors, touch sensors, and light sensors, so that they may be plugged into the Handy Board and test them to make sure they work correctly.

I will demonstrate how to solder each component, then you will do the soldering necessary to connect motors and sensors to the vehicular robot you will build this month.

Each group must appropriately wire:

Pages 39-41 of the Handy Board Technical Reference manual (available in the lab) summarize the steps required to solder the components for this lab. For a quick summary of soldering techniques, please refer either to your notes from the demonstration or to the separate handout.

Getting Started with the Handy Boards

You will interact with the Handy Boards through a serial connection from the Macs in TCL 312b. To get set up, you will need to perform the following steps:

  1. Log into one of the Macs in TCL 312b. If you have taken a Computer Science course that used the Macs in TCL 217a or TCL 216, your account should still exist. If this is your first Computer Science course, you will be provided with your userid and an initial password. Each group should make sure all group members can log in with their own accounts.
  2. Once you are logged in, start a Finder window and locate the "Interactive C (IC)" folder in "Applications".
  3. Next, connect the Handy Board to the USB port of one of the Macs in the lab. To do this, you will need to connect the Handy Board to the Serial Interface board with the telephone cable. Then connect the Serial Interface board to the Keyspan adapter using the modem cable. The adapter should then be plugged into the USB port on the Mac keyboard.
  4. Before actually using IC, you'll need to download the IC firmware to the board. To do this, just double click on Interactive C 4.30 in the Interactive C folder. This will take you through the process of downloading the firmware.
  5. If you've just downloaded the firmware, then you're in the right place to write and run Interactive C code. If you're coming back to the lab after a break, just double click on the Interactive C 4.30 icon that took you through the firmware downloading process. It will start up IC for you.

Interactive C provides you with the ability to either write and run full programs or test single expressions or statements in the IC interpreter. The IC window has a central gray area, with a white text area below it. To test individual statements, you can type them into the white text area. Try out a few IC commands such as

1 + 3;

which should give you the value 4.

Now try

printf("Hello Handy Board\n");

which will print the message Hello Handy Board on the LCD screen on the board.

Testing the Components

You should have the two motors, two touch sensors, and three light sensors that you wired earlier. In order to make the testing of your motors easier, I will provide you with Lego wheels that can be attached directly to the motors. You can use these to get a sense of the direction and speed of your motors.

Record the results of each of your tests. The product to be turned in for credit for this lab is a summary of your test results.

Motors
You should test a number of attributes of your motors: whether they turn on both forward and backward; whether they change speed; whether they turn off. Connect one of your motors to motor port 0. Then turn it on in the forward direction by typing:
fd(0);
This should turn on the motor at full power. Now try changing the power of the motor:
motor(0, 10);
Try a variety of power levels. Now turn off the motor:
off(0);
Does the motor work correctly? Record your results. What if you turn it on in the backward direction? Does it still work correctly? Now repeat this in each of the motor ports on your Handy Board. Do the same for your second motor. To summarize:
  1. Test motor 1 in each port.
    • Does it turn on in the forward direction?.
    • Does it turn on in the backward direction?
    • Does changing the power level affect the speed of the
    • motor?
  2. Test motor 2 in each port.
    • Does it turn on in the forward direction?.
    • Does it turn on in the backward direction?
    • Does changing the power level affect the speed of the
    • motor?
  3. Make any necessary repairs to your wiring.
Touch Sensors
Connect one of your digital (touch) sensors to port 7. (The digital ports are those numbered 7-15.) Now type the following in IC:
digital(7);
Record the result. Now do the same, but with the sensor depressed, and record the result. Next, move the sensor to port 8, and test the sensor there. Does your sensor work correctly? Are both ports operating appropriately? Repeat this for each digital port, recording the results for each port. Now test your second digital sensor in the same way. To summarize:
  1. Test touch sensor 1 in each port.
    • Record result when sensor not pressed.
    • Record result when sensor pressed.
  2. Test touch sensor 2 in each port.
    • Record result when sensor not pressed.
    • Record result when sensor pressed.
  3. Make any necessary repairs to your wiring.
Light Sensors
Testing light sensors will be a bit more complicated. You will begin by testing each of your light sensors in a manner similar to that above for digital sensors. Test each sensor in each port. (The analog ports are those numbered 0-6.) In each instance, record the reading of the sensor when covered (by your hand, for example) and when fully illuminated (with a flashlight, for example). Once you have completed this, select a single port for each of your sensors, and explore the full range of readings for each one. Try a variety of different lighting conditions (overhead light on, overhead light off, flashlight pointed directly at the sensor, flashlight pointed directly but at increasing distances, sensor covered by hand, etc.) What do high values correspond to? Low values? What value do you get for the port when no sensor is connected? Now shield your photocell light sensor. (See page 83 of Martin or my sample light sensors for an example.) What sort of readings do you get now? Try a number of different lighting conditions. Finally, get a piece of white reflective paper and some black electrical tape. Record the reading you get with each sensor when it is positioned over the white paper and then over the black tape. To summarize:
  1. Test the photocells in each port.
    • Record results when sensors fully covered.
    • Record results when sensors fully lit.
  2. Test the Lego light sensor in each port.
    • Record result when sensor fully covered.
    • Record result when sensor fully lit.
  3. Plug photocell 1 into the port of your choice.
    • Record results under a variety of lighting conditions.
  4. Plug photocell 2 into the port of your choice.
    • Record results under a variety of lighting conditions.
  5. Plug Lego sensor into the port of your choice.
    • Record results under a variety of lighting conditions.
  6. Shield the photocells.
  7. Test photocells over white reflective paper and black electrical tape.
  8. Test Lego sensor over white reflective paper and black electrical tape.
  9. Make any necessary repairs to your wiring.

Each group must turn in a summary of all of their test results. Keep individual copies as well. You will find these results, especially the light sensor results, useful as we move forward.