You are on page 1of 40

Jazzing Up Your Microprocessor/Microcontroller Course Through the Infusion of Mobile Robotic Agents Utilizing Basic Stamp II Microcontrollers for

Autonomous Navigation

Emphasis of the Presentation


(1) How you can infuse the use of a Basic Stamp microcontroller into a microprocessor or microcontroller course in electronics.
A) Lab Experiments B) Boe-Bots C) Custom Ground-up Mobile Robots

(2) How to construct and integrate this type of project into the ITEC curriculum beyond the formal curricula.
A) Independent Studies B) Honors Theses C) Student Organization Competitions

Programming Languages
High-Level Languages
BASIC, C, C++, etc.

Assembly Language
Use of mnemonics

Hex Machine Language


The programmer writes the program using hex codes to represent the op codes, operand addresses, and data (Trocci & Ambrosio, 2003, p 171).

Machine Language
Remember, the microprocessor does not process mnemonics, op codes, or hexadecimal numbers; it works on binary words (Gilmore, 1996).

Laboratory Exercises (Before)


HeathKit 6800 Trainers

Hex!

Programming Experiments
Binary/Decimal Conversion Hex/Decimal Conversion Straight Line Programs Arithmetic and Logic Instructions Program Branching Additional Instructions (ADC, SBC, etc.) Other Addressing modes (Extended & Indexed)

Interfacing Experiments
Memory Circuits Clock Address Decoding Data Output Data Input D/A & A/D

High-Level Language Need Coupled with the Need for Better I/O Capability
The Contenders Bot Board featuring the Motorola 68HC11/12
More powerful, faster, more I/O, Industry Standard

Boe-Bot featuring the BASIC STAMP 2


Popular with Educational Technology/Engineering Institutions, very user friendly, curriculum and training available, many expandable features

The Decision!
When choosing a processor it is important to avoid religious wars. Yes, some processors are faster than others for a given application, and some have very irritating instruction sets. Nevertheless the bottom line is, Can it do the job and can you get the parts for an appropriate cost? Beyond that, there are good and bad aspects to every processor family (Morton, 2001, p 19).

Advantages to Parallax, Inc.


Ease of Use PBASIC Training Documentation (Books & Manuals) Accessories Sensors Support Sample Code Online Groups Customization of Packages BOE-Bot Kit

Available Books (Curricula)


Great for Lab Experiments
Whats a Microcontroller* Basic Analog & Digital Digital Robotics* Advanced Robotics Applied Sensors Industrial Controls** More

Available Downloads (examples)


Parallax Stamps in Class Educational Curriculum
Download the individual texts at the related information link. Includes all curricula from What's a Microcontroller through Industrial Control.

Matlab-Based Graphical User Interface Development for BASIC Stamp 2 Microcontroller Projects.
The name Matlab is derived from Matrix Laboratory. Matlab is a powerful software package that allows for plotting data in multiple dimensions. This article demonstrates it's usage.

Internet-Based Remote Control using a Microcontroller and an Embedded Ethernet Board.


This article shows a developed DC motor position control experimental setup that can be accessed via the Internet. The experiment consists of two primary elements communicating with each other: i) a server consisting of a low-cost microcontroller, Parallaxs 40-pin Basic Stamp 2 module (BS2P40), interfaced with an embedded ethernet IC, Cirrus Logics Crystal CS8900A, and ii) a client computer.

Some Powerful Stamp 2 Accessories


Stepper Motor Controller Boards Bluetooth Technology Field Programmer Graphing Software (Stamp Plot) Real Time Data Acquisition Software

What About Industry Grade?


Parallax offers
Basic Stamp 2 Industrial Module - Our industrial version of the BASIC Stamp 2 module has an extended temperature range of -40 C to +85 C (-40 F to +185 F). This module normally has no shortage of program space or I/O pins. Serial PC interface provides enhanced debug features. Industrial boards 16 or 32 I/O Optically Isolated (Opto22)

Laboratory Exercises (After)


HeathKit 6800 Trainers

Hex!
Binary/Decimal Conversion Hex/Decimal Conversion Straight Line Programs Arithmetic and Logic Instructions Program Branching Calculator Challenge

Laboratory Exercises (After)


PBASIC! Boe-Bot (BS2)
Whats a Microcontroller - Basics - Set-up Detecting the Outside World - Inputs - Variables (bit, nib, byte, word) Micro-controlled Movement - Servo Motor Control - For/Next Loops - Time Delays Simple Automation - Debug (Print) - Tying it all together Measuring an Input - Interfacing to Integrated Circuits (555) Assembling & Testing Your Boe-Bot - Basics - Set-up - Tuning the servos (calibration) Programming the Boe-Bot to go Places - Low battery indicator - Distance control - Turning/Maneuvers - Ramping Speeds - EEPROM Navigation - Branching/Subroutines Tactile Navigation - Navigation with whiskers - If/Then Statements - Logic (XOR, Not, etc.) Light Sensitive Navigation with Photoresistors - Measuring RC time - Deadband Object Detection Using Infrared - Frequency manipulation (Freqout) - Real-time Navigation

Suggested Course Lectures


What is a Microprocessor? Basic Microprocessor Architectural Concepts (part I) Basic Microprocessor Architectural Concepts (part II) Inside the Microprocessor An Introduction to Microprocessor Instructions Communicating with the Microprocessor Memory Mass Storage Introduction to Microcontrollers The Basics of PBASIC Advanced PBASIC Instructions

Why Dont We Just Eliminate Teaching Assembly?


An assembly language program makes very compact code, but it takes a great deal of programming time. High-level languages take much less development time but take much more memory space than assembly programs (Gilmore, 1996). However, semiconductor memory costs continue to drop. Its a question of whats more expensive:
Extra Memory Extra Engineering Development Time

Product quantity plays a huge role!

Beyond the Traditional Classroom


Honors Thesis Topic: Independent Study MU Robotics Team

Honors Thesis Topic


Honors Thesis: Creating an equation to determine of the optimum number of IR sensors needed for object detection.

The basis for this study was to prove that the optimal number of IR sensors (timed efficiency vs. cost) is directly related to an objects size in a given array.

Major Components Used


BASIC Stamp 2 with carrier board
This allows for powerful capabilities of interfacing sensors to control your output but the PBASIC is simple enough to program with limited programming background.

Parallax S.S.I.R Sensors


Infrared detection unit which is made to be used with the stamp directly with no other interfacing.

BOE Bot
Board of Education Bot carries the stamp carrier board and allows for movement with virtually no fabrication.

Reason For Using These Components

Object of the study was to determine sensor optimization in general. The Stamp is a simple way to draw conclusions that can be later transferred to more advanced systems.

The Parallax S.S.I.R is designed specifically for use with the stamp therefore all the circuitry for operation is already included on the chip. Although the BOE bot is simple, it is also extremely reliable. All components can be bought in a kit and assembled quickly. The only fabrication needed is for the sensor mounting.

Using IR
The S.S.I.R. is an infrared detection unit
Uses an LED to emit infrared light, which when bounced off an object can be detected. Both the emitter and the detector use the same port which gives added efficiency. Tuning the S.S.I.R. is possible by changing the frequency of the LED.
Frequency changes your range of detection.

On/Off control in two zones


The array field is divided up into two zones each with on/off control logic.
Nine sensors will be placed in an array in front of the BOE bot. Left Zone When an object is detected by a sensor, the Stamp sets a variable as high to designate detection on that side. The stamp then turns the opposite direction of which ever zone the object was detected in. Right Zone

BOE BOT

The BOE bot turns until the center IR detects the object. The BOE Bot then drives forward until it reaches the object.

Algorithm
Initial Search
Start No BOE bot Drives forward for .2 seconds

Centering the BOE bot on the Object


Does the center IR detect the can?

Driving to the Object


BOE bot Drives forward for .2 seconds No BOE Bot checks status of Limit Switch

Yes Yes Does the center IR detect the can?

BOE Bot checks status of sensors

BOE Bot checks status of sensors

BOE bot turns left for .2 seconds

BOE Bot checks status of sensors

Is there detection in the left zone?

No

No Is there detection in the right zone?

Is the limit switch touched? Yes Object Found

No

Yes

BOE bot turns right for .2 seconds

Yes

Experiment Setup
To test our hypothesis we will need to set up an experiment:
An object will be placed within the arrays arc but out of its range. A number of sensors will be turned on starting with three in the first trial and ending with nine in the last trial.
The three sensors include a middle sensor, one at the left limit, and one at the right limit. Each trial will increase the number of sensors turned on by two (one for each side) spaced equally apart. The sensors will be turned on and off within the code.

The operation will then be started and timed.

Experiment Setup Continued


We will perform all four trials 10 times each and come up with an average time for each trial. This will be done with several objects of different sizes (TBD). Graphs will be formulated using the average times, number of sensors and object size. These graphs will be used to draw conclusions about the relationship between object size and number of sensors, based on time.

Assumptions/Limitations
Assumptions:
Objects will always be places in the same position in relation to the BOE Bot. Power supply is constant Timing will be from start of motion to the end of motion. Code will not be altered (Except for turning sensors on and off).

Limitations:
Experiment is to be done on a flat smooth indoor surface. Object will be a solid color. Sensor range is limited to approximately two feet. All servo and wheel components will be standard Parallax components that have come with the BOE bot kit.

In Progress
This study is currently in progress.
The exact code has not been finalized nor have any of the trials been run. I expect the trials to be run and my conclusions to be drawn in the Spring of 2005 at which time I will defend my findings in front of my thesis committee at Millersville University.

Beyond the Traditional Classroom


Honors Theses Topic: Independent Study MU Robotics Team

Independent Study
The purpose of this study was to establish a semi-autonomous mode in order to control a robotic device and then complete an assigned task. The integration of the two modes allow for both tele-operated functions from the user and automated control when the Basic Stamp II was in operation.

Semi-Autonomous Control Scheme Overview


75.51 MHz (RF/Manual)

2.4 GHz (Bluetooth/Stamp)

2.4 GHz (Vision)

The New Communication Standard


Bluetooth is a wireless communication technology that was chiefly employed for data transfer and control during the study. Bluetooth class one technology has a range of 100m or about 330ft. The use of Bluetooth technology as a low cost, low power, high data rate transfer mechanism helped to make the real time control and semi-autonomous modes a reality.

The Control Link


Bluetooth technology allowed for the seamless integration of control. Information was sent through the EmbeddedBlue 500. which is available through parallax Inc. The Bluetooth technology allows for communication through any other class I Bluetooth device.

Virtual Serial Port


The program is first downloaded into the stamp via hardwire connection. All of the Bluetooth code must be preprogrammed in to facilitate communication between computer and Basic Stamp II. Once the code is downloaded into the Basic Stamp II the user opens up HyperTerminal. HyperTerminal communication must be configured and then the virtual serial port link can be established.

Real Time Monitoring & One Key Control


Real Time Monitoring:
With the serial communication establish information can be sent and received through the uplink.
This allows for Real Time Monitoring of any sensors interfaced with the basic Stamp II.

One Key Control:


The User can then initiate the Basic Stamp IIs preprogrammed functions by a single key stroke.
In the study for example subroutines were used to check for user input and then execute a set of instructions. User-override feature utilized.

Superior Signal Strength


Interfacing the Basic Stamp II, motor speed controller and tele-operated receiver was interesting. Wiring the entire system in parallel turned out to be the answer because of the Basic Stamp IIs superior signal strength it was able to lock-out functions from the tele-operated receiver. The Basic Stamp II only locks-out outputs which the program sends digital signals to this means that a truly semi-autonomous state can be achieved thus Real time monitoring was developed.

Beyond the Traditional Classroom


Honors Theses Topic: Independent Study MU Robotics Team

Latest Design (SA-1)


Semi-Autonomous One
2004 MU Robotics Team

Texts Cited
Gilmore, C. M. (1996). Microprocessors Principles and Applications 2nd Edition. Glencoe McGraw-Hill, New York. Morton, T. D. (2001). Embedded Microcontrollers. Prentice Hall, Upper Saddle River, New Jersey. Tocci R. J. (2003). Microprocessors and Microcomputers Hardware and Software 6th Edition. Prentice Hall, Columbus, Ohio.

Parallax Stamps (Appendix A)


BS2 (Low-end Model) Processor Speed Program Execution Speed RAM Size EEPROM (Program) Size Number of I/O pins Cost 20 MHz ~4,000 instructions/sec. 32 Bytes (6 I/O, 26 Variable) 2K Bytes, ~500 instructions 16 + 2 Dedicated Serial $49 each

BS2p40 (High-end Model) Processor Speed Program Execution Speed RAM Size EEPROM (Program) Size Number of I/O pins Cost

20 MHz Turbo ~12,000 instructions/sec. 38 Bytes (12 I/O, 26 Variable) 8x2K Bytes, ~4,000 instructions 32 + 2 Dedicated Serial $89 each

Motorolas Microcontrollers (Appendix B)


68HC11
512 bytes of RAM 2K bytes EEPROM 40 I/O pins 2 MHz 45-100 Million Instructions per Second Note: Both can be Used with the BOT Board

68HC12
1024 bytes of RAM 4K bytes EEPROM 96 I/O pins 8 MHz

programmed with SBASIC developed by Karl Lunt

You might also like