Nick -> Projects -> Legobot AI -> VESTA Board

The Programmable VESTA Microcontroller Board


Introduction:

The Vesta SBC88A is a microcontroller board which uses an Intel 8088 processor. You will be using it to control your LegoBot. Add-on hardware designed by Nate Myers is provided with the microcontroller to drive the motors and to provide easy-to-use input ports for the sensors. Since the microprocessor on the board is an i8088, the assembly language is the same as that for the desktop PCs. Therefore, you may use any compiler (such as Microsoft C) or any assembler (such as MASM) on your PC to develop programs for the microcontroller. Here are some relevant specifications on the Vesta SBC88A:

Processor: Intel 8088
Speed: 4 MHz
EPROM: 8K bytes
RAM: 24K bytes
Digital inputs: Two 8-bit ports (10H and 20H)
Digital Outputs: Two 8-bit ports (10H and 20H)
Bit-addressable inputs: Seven bits (OH through 6H)
Bit-addressable Outputs: Seven bits (OH through 6H)
Analog inputs: Eight channels, 8-bit resolution
Serial Communications: One RS-232 port, 110-4800 baud, software UART
Size: 5.5" x 4.5"
Power Requirements: +5V

The add-on hardware has enough circuitry to support the following input and output devices:

The remainder of this document describes how to use the microcontroller to control the motors and receive input from the sensors.


Connecting Devices to the Microcontroller
Figure 1 shows a top-view diagram of the microcontroller board. Use this diagram to plug the motors and sensors into the correct ports. All of the ports are either 2-pin, 3-pin, or 4-pin ports. Ports where one of the pins is highlighted are directional, and one should take care to plug the device in correctly. The highlighted pin denotes pin 1; the devices also have some sort of marking to denote pin 1.

In the early stages of your design, try to place the microcontroller in an easily accessible location on the robot since you will be modifying the connections often. Also try to place the microcontroller as close to the center of the robot as you possibly can so that the length of the wires which reach out to the sensors and motors can be kept at a minimum. Keep in mind that your robot must be large enough and sturdy enough to support the microcontroller, the motor battery pack, and the AA battery pack.

Reading the Value of a Digital Sensor
Digital sensors return either 0 or 1. Each digital sensor is connected directly to a single bit of one input port. To read data in from a digital input port, one should use [inp] in C language or [in] in Assembly language. Then one must mask out the appropriate bits. When using [inp] in C language one should data types of insigned char. The following snippets of code demonstrate how to read the status of microswitch (bump sensor) #3, which is located on port 20H, bit 6.

Reading the Value of an Analog Sensor
Analog sensors return a voltage between 0V and 5V. This voltage is converted by an analog-to-digital (A/D) converter to a byte value between 0 and 255. The Vesta microcontroller has eight analog input channels. Reading the value of an analog is slightly more complicated. We must first write to port 10H to "tell the microcontroller which channel we wish to read from (only the least 3 significant cant bits are important). Then we must write a 0 to port 30H to initiate the conversion. Approximately 200 microseconds later, the digital byte can be read from port 30H. To write a value to a port, one should use [outp] in C language or [out] in Assembly language. When using [outp] in C language, one should data types of unsigned char. Notice that when one writes to port 10H, the motor speeds of DC motors 1 and 2 will be affected. So it will be important to set output port 10H back to its original value after the analog read is complete. The following snippets of code demonstrate how to read the current position of potentiometer #2, located on analog channel 3.


Writing to the Motor Ports
Each DC motor is controlled by a combination of two ports. One of the ports is used to control the speed of the motor, and the other is used to control the direction of the motor. The speed of each DC motor is a 4-bit value, with 0 being the slowest speed (essentially off) and 15 being the fastest speed. The direction is a single bit value with 0 being forward and 1 being reverse. The following snippets of code demonstrate how to set the speed of DC motor 1 to about 50% (speed value = 7) and set it running forward. The speed of motor 1 is located on port 10H, bits 0-3. The direction of motor 1 is located on port 0H.

The servo motor is controlled by a 4-bit value which is directly proportional to the desired angle. Using this microcontroller, the servo motor has a total of approximately 90 degrees of rotation. One cannot control the speed of the servo motor; it moves at a fixed low speed with hign torque. The following snippets of code demonstrate how to set the servo motor to roughly 45-degrees. The servo will move there slowly and stop automatically when it gets there. The servo is located on port 20H, bits 4-7.


Downloading Your Program to the Microcontroller
Once you have written your program in C language or Assembly language, you will need to compile it or assemble it into an executable file. This file gets downloaded to the RAM in the microcontroller through a serial cable using a program called RDEB. A step-by-step process is given below it is recommended that you create batch files for steps 2 and 3 as you will be performing these two steps frequently.

Serial communication
Since the robots you are building must be entirely autonomous, there is actually no need for any kind of serial communication once the program is running on the robot's microcontroller. However, for debugging purposes, it might be useful to be able to communicate with the PC (assuming you leave the serial cable still connected even after you are done downloading your program). There are a few ways to communicate with the PC:


potentiometer The Potentiometers
A potentiometer is used to measure rotation. The shaft of the potentiometer can be interfaced directly to a gear on your robot to perhaps measure the position of an arm. It is an analog sensor which will return a value of 0 at one extreme and 255 at the other. The microcontroller has two potentiometer ports which can be read from analog input channels 3 and 5.

reflective sensors The Reflective Object Sensors
The reflective object sensor, OPB730F, can measure how reflective a surface is in the infrared range. For example, you could use this sensor to detect when your robot is over a black surface am opposed to an orange surface since the orange surface reflects more. This sensor is an analog sensor which returns approximately 45 for complete reflection and 255 or zero reflection. In order for the sensor to work it must placed approximately 1/16" to 1/8") from the surface you are trying to measure. The distance from the surface WILL affect the reading, so the separation must be made consistent. The reflective object sensors are mounted on red and blue Lego pieces. The microcontroller has four reflective object sensor ports which can be read from analog input channels 0, 2, 4, and 6.

phototransistor The Phototransistors
The phototransistors, MRD370, can measure the intensity of visible light reaching it. They are highly directional (they must be pointed directly at the light source to detect it). One possible use for the phototransistor is to place a light bulb (which is always lit) directly across from it, and use the sensor to detect when an object (e.g. a ping-pong ball) has come in the way. The phototransistor is an analog sensor which reads 0 when no light reaches it and higher values (up to 255) depending on the amount of light reaching it. The microcontroller has two phototransistor ports which can be read from analog ports 1 and 7.

infrared receiver The Infrared Receivers
The infrared receivers detect light only in the infrared range at 40kHz. They can receive from a wide range of directions, and so they may need to be shielded with some type of a tunnel-shaped device around it. They are digital sensors which return 1 when not receiving IR and 0 when receiving IR. The microcontroller has two IR receiver ports which can be read from digital port 10H, bits 4 and 6.

DIP switches The DIP switches
The DIP switches, which are mounted directly on your microcontroller can be used to set options or modes for your robot. They return digital values of 0 when closed and 1 when open. The microcontroller has four DIP switches which you can use as inputs. They can be read from digital port 20H, bits O, 1, 2, and 3.

microswitches The Microswitches
The microswitches, or bump sensors, are simply low-force switches which are excellent for detecting collisions with obstacles. They return digital values 0 depressed and 1 when depressed. The microcontroller has four microswitch ports which can be read from digital port 20H, bits 4, 5, 6, and 7.

The Hexadecimal Display
hexadecimal display The hexadecimal display is mounted directly on the microcontroller, and can be used for debugging purposes or however you see fit. It can display hexadecimal values from 0 to F. To display a hexadecimal number, you must do four separate writes to ports 3H, 4H, 5H, and 6H. The following table summarizes how this works:

Port 6H Port 5H Port 4H Port 3H Hex Display
1 1 1 1 0
1 1 1 0 1
1 1 0 1 2
1 1 0 0 3
1 0 1 1 4
1 0 1 0 5
1 0 0 1 6
1 0 0 0 7
0 1 1 1 8
0 1 1 0 9
0 1 0 1 A
0 1 0 0 B
0 0 1 1 C
0 0 1 0 D
0 0 0 1 E
0 0 0 0 F

To save on batteries, you may turn the hexadecimal display off when you are not using it by flipping one of the DIP switches located on the microcontroller (see Figure 1).

The DC Motors
The microcontroller supports three DC motors and can drive them forward or backward at any of sixteen different speeds. A speed of 0 will essentially turn the motor off, and a speed of 15 will turn the motor on at its top speed.

The Servo Motor
The microcontroller supports one high-torque servo motor. A servo motor can be commanded to go to any angle (within its range). It will start moving towards that position at a fixed speed and will stop automatically when it gets there. Setting the servo port to 0 will send it to one extreme, and setting it to 15 will send the servo to the other extreme. The two extremes are approximately 90 degrees apart.


Resources
The following resources are available for your use if you have questions, comments, suggestions, or problems. They are also quite useful if you would like to explore certain topics m greater detail.

Spring 1995 LegoBot staff:
Dennis Culley, Doug Gerwitz, Rajeev Goel, Matt Merten, Nate Myers, John Knapowski, Jonathan Kua

ECE291 7A 's
Dennis Culley, Joseph Gebis, John Knapowski, Brandon Long, Nate Myers, Doug Stirrett

ECE 291 Professor:
Professor W. Kent Fuchs

Robotics Newsgroup: comp.robotics
Type "nn comp.robotics" from your EWS account for a discussion of current problems and discoveries in robotics. Many of the active users of this newsgroup have built Lego robots.

Robotics Mailing List robot-board@oberon.com
To subscribe to this mailing list, send e-mail to "listserv@oberon.com" with a subject of "subscribe robot-board your name". Discussions on this mailing list range from topics like Lego robots to different types of sophisticated sensors.

M.I.T.6.270 Course Manual
The 1992 and 1994 versions of M.l.T.'s 6.270 course manual are located in the ECE 291 lab. This is the course at M.l.T. which has inspired many universities (including U of I now) to develop courses where students design Lego robots. The course manual contains oodles of useful information.

Mobile Robots -- Inspiration to Implementation
This book, by Joseph L. Jones and Anita M. Flynn, is also located in the ECE 291 lab, and is a very well written book. It contains examples of robots, many of which are built from Lego parts.

Robot-Building Lab and Contest at the 1993 National Al Conference
This is an article by Carl Kadie which describes his experiences when he participated in a Lego robot contest sponsored by AAAI,

Vesta Hardware Manual
The beige binder contains more detailed information about the Vesta SBC88A microcontroller you are using. It is actually rather poorly written and somewhat cryptic in nature, but might still be of some use with enough patience.

C-Thru-ROM User's Manual
This manual contains information on how to use RDEB, the software we use to download programs to the microcontroller. It also supposedly allows you to debug the code while it is running on the microcontroller, but this feature has never been exploited yet.

Document History

Copyright © 2001 by Nick Shin. All Rights Reserved.
These pages are designed by ESTSS.