The Expansion Board sensor inputs are numbered from 16 to 31. The standard analog() and digital() functions have been augmented allow arguments from 2 to 31:
There are nine digital output pins, numbered from 0 to 8. Digital outputs 0 through 7 are located on headers on the edge of the board (see diagram above); digital output 8 is a PCB pad located in the upper left corner of the prototyping area.
The digital outputs are controlled with the following functions:
The output signals are provided on the upper row of pins (labeled I/O Signal in the diagram). These are CMOS outputs, capable of driving just 5 mA per output.
The Expansion Board provides outputs for six servo motors, numbered from 0 to 5. The following function is used to enable and disable the servo control signals:
In addition, six global variables are provided for controlling the position of the six servo motors. These globals are named servo0, servo1, servo2, servo3, servo4, and servo5, for servo outputs 0 through 5 respectively.
When the Expansion Board servo drivers are loaded, these variables are defined as globals in the Interactive C environment. Modify these globals with simple assignment statements; e.g., servo3= 1500;
The values determine the length of the timing pulse provided to each servo, which in turn corresponds to a rotational position of the servo motor. Valid values range from 0 to about 3000.
The servo units from the servo[0-5] globals are 0.5 us (microsecond) units added to a 250 us minimum period. In other words, if you set the servo global to 0, you will get a 250 us period. If you set it to 1500, you will get (1500 * 0.5) + 250 us period (1000 us).
The default value for each servo global is 2540. Per above, this yields a period of 1520 us, which is the nominal centerpoint of the Futaba S148 servo.
The software does not protect against out-of-range numbers, which will cause the servo to attempt to turn to positions it cannot reach.
Servo motors connect via a three-wire plug. The three signals (from left to right on the Expansion Board) are ground, power, and control. These are typically indicated with black, red, and white wires (respectively) on the servo motor. Make sure to plug the servo motor in properly.
Servo motors come with different kinds of connectors. The Expansion Board is designed for servos with a female header connector on tenth-inch spacing. The Futaba S148 is an example of a good basic servo that uses this connector.
Power is provided to the servo from the Handy Board's internal battery, through the five large diodes near the servo connectors. These diodes will get warm during servo operation. If the diodes get too hot to touch, an external servo power supply will be required.
On the flip side of the Expansion Board is a trace labeled CUT HERE FOR EXT SERVO PWR. Using a sharp razor knife, slice through this trace, making sure it is completely severed. Then, connect an external power supply of 5 to 6 volts (e.g., four C or D cells) to the External Servo Power PCB pads. Be sure to get the + and - polarity correct.
Sensor ports 28 through 31 are compatible with the LEGO reflectance sensor and LEGO angle sensor. Wire either of these sensors to the Handy Board plug as shown below (the angle sensor is depicted):
The LEGO reflectance sensor contains a red emitter LED and a visible detector LED. In normal usage, the device is positioned about 1/2 inch away from a surface, and its reading indicates the reflectivity of the surface. Used in this fashion, typical readings range from 180 to 210 (depending on ambient lighting), with smaller values indicating more light (and greater reflectivity).
The analog values are read using the lego globals. These should be used to obtain readings from the LEGO reflectance sensor, or any other resistive sensor used in these ports when the LEGO driver is loaded.
The LEGO angle sensor is a quadrature (direction--sensitive) rotation sensor. It can be used to measure the angular position of a LEGO axle with a precision of 16 counts per revolution. The drivers count upward when turning in one direction and downward when counting in the opposite direction. Hence, the angle sensor can be used to keep track of the precise position of a mechanical system even as its direction of rotation changes.
The drivers also provide a velocity measurement. The velocity readings are updated every 1.024 seconds.
The counts values are reset to zero every time the Handy Board is reset. To reset the counts to zero under software control, simply assign the global variable to zero; e.g.:
The encoder values are polled by the software at a rate of 250 samples per second. This allows a maximum rotational velocity of about 16 revolutions per second. If the axle turns any faster than that, the software will not be able to keep up and counts will be missed.
Because the software must read the four LEGO-compatible inputs 250 times a second, some CPU power is lost to this operation. If you are not using any LEGO sensors, it is advisable to unload the explego.icb driver. Simply remove it from the lib_hb.lis file.
Please note that direct analog readings using the analog() routine will not work properly for ports 28 through 31 (the LEGO-compatible inputs) when the explego.icb driver is loaded. Use the lego0 through lego3 globals instead.
The Expansion Board implements the same Polaroid 6500 driver circuit as previously published. To connect the 6500 board into the Expansion Board, perform the following steps:
The Handy Board and Expansion Board library routines are split across multiple files. These are:
Download the complete set of libraries for Wintel or for Macintosh.
The Expansion Board libraries were last modified March 3, 1999.
HB site by fredm at handyboard.com / last page update at Fri Aug 8 20:04:05 2003