00002345

Embed Size (px)

Citation preview

  • 7/30/2019 00002345

    1/40

    Jazzing Up You r Microp rocesso r/Microcon trol lerCourse Through the Infus ion o f Mobi le Robo t ic

    Agents Ut i lizing Basic Stamp IIMicrocont ro l lersfor Autonomous Navigat ion

  • 7/30/2019 00002345

    2/40

    Emphasis of the Presentation

    (1) How you can infuse the use of a BasicStamp microcontroller into a microprocessoror microcontroller course in electronics.

    A) Lab Experiments

    B) Boe-Bots

    C) Custom Ground-up Mobile Robots

    (2) How to construct and integrate this type ofproject into the ITEC curriculum beyond theformal curricula.

    A) Independent Studies

    B) Honors Theses

    C) Student Organization Competitions

  • 7/30/2019 00002345

    3/40

    Programming Languages

    High-Level LanguagesBASIC, C, C++, etc.

    Assembly LanguageUse of mnemonics

    Hex Machine LanguageThe programmer writes the program using hex codes torepresent the op codes, operand addresses, and data(Trocci & Ambrosio, 2003, p 171).

    Machine Language

    Remember, the microprocessor does not processmnemonics, op codes, or hexadecimal numbers; it workson binary words (Gilmore, 1996).

  • 7/30/2019 00002345

    4/40

    Laboratory Exercises (Before)

    HeathKit 6800 Trainers

    Hex!Programming Experiments

    Binary/Decimal Conversion

    Hex/Decimal Conversion

    Straight Line Programs

    Arithmetic and LogicInstructions

    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

  • 7/30/2019 00002345

    5/40

    High-Level Language NeedCoupled with the Need for

    Better I/O Capability

    The Contenders

    Bot Board featuring the Motorola 68HC11/12More powerful, faster, more I/O, Industry Standard

    Boe-Bot featuring the BASIC STAMP 2Popular with Educational Technology/Engineering

    Institutions, very user friendly, curriculum and trainingavailable, many expandable features

  • 7/30/2019 00002345

    6/40

    The Decision!

    When choosing a processor it is important toavoid religious wars. Yes, some processorsare 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 anappropriate cost? Beyond that, there are goodand bad aspects to every processor family(Morton, 2001, p 19).

  • 7/30/2019 00002345

    7/40

    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

  • 7/30/2019 00002345

    8/40

    Available Books (Curricula)Great for Lab Experiments

    Whats a Microcontroller*

    Basic Analog & Digital

    Digital

    Robotics*Advanced Robotics

    Applied Sensors

    Industrial Controls**More

  • 7/30/2019 00002345

    9/40

    Parallax Stamps in Class Educational CurriculumDownload the individual texts at the related information link. Includes allcurricula from What's a Microcontroller through Industrial Control.

    Matlab-Based Graphical User Interface Developmentfor BASIC Stamp 2 Microcontroller Projects.

    The name Matlab is derived from Matrix Laboratory. Matlab is a powerfulsoftware package that allows for plotting data in multiple dimensions. Thisarticle demonstrates it's usage.

    Internet-Based Remote Control using a Microcontrollerand an Embedded Ethernet Board.This article shows a developed DC motor position control experimentalsetup that can be accessed via the Internet. The experiment consists of

    two primary elements communicating with each other: i) a serverconsisting of a low-cost microcontroller, Parallaxs 40-pin Basic Stamp 2module (BS2P40), interfaced with an embedded ethernet IC, CirrusLogics Crystal CS8900A, and ii) a client computer.

    Available Downloads(examples)

  • 7/30/2019 00002345

    10/40

    Some Powerful Stamp 2Accessories

    Stepper Motor ControllerBoards

    Bluetooth Technology

    Field ProgrammerGraphing Software (StampPlot)

    Real Time Data AcquisitionSoftware

  • 7/30/2019 00002345

    11/40

    What About Industry Grade?

    Parallax offersBasic Stamp 2 Industrial Module - Our industrialversion 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)

  • 7/30/2019 00002345

    12/40

    Laboratory Exercises (After)

    HeathKit 6800 Trainers

    Hex!Binary/Decimal Conversion

    Hex/Decimal Conversion

    Straight Line Programs

    Arithmetic and Logic Instructions

    Program Branching

    Calculator Challenge

  • 7/30/2019 00002345

    13/40

    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/SubroutinesTactile Navigation

    - Navigation with whiskers

    - If/Then Statements

    - Logic (XOR, Not, etc.)

    Light Sensitive Navigation with Photoresistors

    - Measuring RC time

    - DeadbandObject Detection Using Infrared

    - Frequency manipulation (Freqout)

    - Real-time Navigation

  • 7/30/2019 00002345

    14/40

    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 InstructionsCommunicating with the Microprocessor

    Memory

    Mass Storage

    Introduction to MicrocontrollersThe Basics of PBASIC

    Advanced PBASIC Instructions

  • 7/30/2019 00002345

    15/40

    Why Dont We Just EliminateTeaching Assembly?

    An assembly language program makes very compactcode, but it takes a great deal of programming time.High-level languages take much less development time

    but take much more memory space than assemblyprograms (Gilmore, 1996).

    However, semiconductor memory costs continue to drop.

    Its a question of whats more expensive:

    Extra MemoryExtra Engineering Development Time

    Product quantity plays a huge role!

  • 7/30/2019 00002345

    16/40

    Beyond the TraditionalClassroom

    Honors Thesis Topic:

    Independent Study

    MU Robotics Team

  • 7/30/2019 00002345

    17/40

    Honors Thesis Topic

    Honors Thesis: Creating an equation todetermine of the optimum number of IRsensors needed for object detection.

    The basis for this study was to prove that theoptimal number of IR sensors (timed efficiencyvs. cost) is directly related to an objects size ina given array.

  • 7/30/2019 00002345

    18/40

    Major Components Used

    BASIC Stamp 2 with carrier boardThis allows for powerful capabilities of interfacing sensorsto control your output but the PBASIC is simple enoughto program with limited programming background.

    Parallax S.S.I.R SensorsInfrared detection unit which is made to be used with thestamp directly with no other interfacing.

    BOE Bot

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

  • 7/30/2019 00002345

    19/40

    Reason For Using TheseComponents

    Object of the study was to determine sensoroptimization in general. The Stamp is a simple wayto draw conclusions that can be later transferred tomore advanced systems.

    The Parallax S.S.I.R is designed specifically for usewith the stamp therefore all the circuitry foroperation is already included on the chip.

    Although the BOE bot is simple, it is also extremelyreliable. All components can be bought in a kit andassembled quickly. The only fabrication needed isfor the sensor mounting.

  • 7/30/2019 00002345

    20/40

    Using IR

    The S.S.I.R. is an infrared detection unitUses an LED to emit infrared light, which whenbounced off an object can be detected.

    Both the emitter and the detector use the sameport 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.

    O /Off l

  • 7/30/2019 00002345

    21/40

    BOE BOT

    On/Off control in two zones

    Nine sensors will be placed in an array infront of the BOE bot.

    When an object is detected by a sensor,

    the Stamp sets a variable as high todesignate detection on that side.

    The stamp then turns the oppositedirection of which ever zone the objectwas detected in.

    The BOE bot turns until the center IRdetects the object. The BOE Bot thendrives forward until it reaches the object.

    The array field is divided up into two zones

    each with on/off control logic.

    Left Zone Right Zone

    Al i h

  • 7/30/2019 00002345

    22/40

    Algorithm

    No

    Start

    BOE bot Drives

    forward for .2

    seconds

    BOE Bot checks

    status of sensors

    Is there

    detection in

    the left zone?

    Is there

    detection in

    the right

    zone?

    BOE bot turns right

    for .2 seconds

    Yes

    BOE Bot checks

    status of sensors

    Does the

    center IR

    detect the

    can?

    No

    No

    Yes

    Yes

    No

    BOE bot turns left

    for .2 seconds

    BOE Bot checks

    status of sensors

    Does the

    center IR

    detect the

    can?

    No Yes BOE bot Drivesforward for .2

    seconds

    BOE Bot checks

    status of Limit

    Switch

    Is the limit

    switch

    touched?

    Yes

    Object Found

    Initial Search Centering the BOE bot on the Object Driving to the Object

  • 7/30/2019 00002345

    23/40

    Experiment SetupTo test our hypothesis we will need to set up

    an experiment:An object will be placed within the arrays arc butout of its range.

    A number of sensors will be turned on starting

    with three in the first trial and ending with ninein the last trial.

    The three sensors include a middle sensor, one at theleft limit, and one at the right limit.

    Each trial will increase the number of sensors turnedon 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.

    E i t S t C ti d

  • 7/30/2019 00002345

    24/40

    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 differentsizes (TBD).

    Graphs will be formulated using the averagetimes, number of sensors and object size.

    These graphs will be used to draw conclusionsabout the relationship between object size and

    number of sensors, based on time.

  • 7/30/2019 00002345

    25/40

    Assumptions/LimitationsAssumptions:

    Objects will always beplaces in the sameposition in relation to theBOE Bot.

    Power supply is constant

    Timing will be from startof motion to the end ofmotion.

    Code will not be altered(Except for turningsensors on and off).

    Limitations:Experiment is to be doneon a flat smooth indoorsurface.

    Object will be a solidcolor.

    Sensor range is limited toapproximately two feet.

    All servo and wheelcomponents will bestandard Parallaxcomponents that havecome with the BOE botkit.

    I P

  • 7/30/2019 00002345

    26/40

    In Progress

    This study is currently in progress.The exact code has not been finalized norhave any of the trials been run.

    I expect the trials to be run and myconclusions to be drawn in the Spring of2005 at which time I will defend myfindings in front of my thesis committee atMillersville University.

    d h d l

  • 7/30/2019 00002345

    27/40

    Beyond the TraditionalClassroom

    Honors Theses Topic:

    Independent Study

    MU Robotics Team

    I d d t St d

  • 7/30/2019 00002345

    28/40

    Independent Study

    The purpose of this study was to establish asemi-autonomous mode in order to control arobotic device and then complete an assignedtask.

    The integration of the two modes allow forboth tele-operated functions from the user andautomated control when the Basic Stamp II

    was in operation.

    S i A C l

  • 7/30/2019 00002345

    29/40

    Semi-Autonomous ControlScheme Overview

    2.4 GHz

    (Bluetooth/Stamp)

    75.51 MHz (RF/Manual)

    2.4 GHz (Vision)

    h d d

  • 7/30/2019 00002345

    30/40

    The New Communication Standard

    Bluetooth is a wireless communication technologythat was chiefly employed for data transfer andcontrol during the study.

    Bluetooth class one technology has a range of 100m

    or about 330ft.The use of Bluetooth technology as a low cost, lowpower, high data rate transfer mechanism helped tomake the real time control and semi-autonomousmodes a reality.

    Th C l Li k

  • 7/30/2019 00002345

    31/40

    The Control Link

    Bluetooth technology allowed for the seamlessintegration of control.

    Information was sent through theEmbeddedBlue 500. which is available

    through parallax Inc.The Bluetooth technology allows forcommunication through any other class I

    Bluetooth device.

    l S l

  • 7/30/2019 00002345

    32/40

    Virtual Serial Port

    The program is first downloaded into the stamp via

    hardwire connection.All of the Bluetooth code must be preprogrammed into facilitate communication between computer andBasic Stamp II.

    Once the code is downloaded into the Basic Stamp IIthe user opens up HyperTerminal.

    HyperTerminal communication must be configured

    and then the virtual serial port link can be established.

    R l Ti M it i

  • 7/30/2019 00002345

    33/40

    Real Time Monitoring& One Key Control

    Real Time Monitoring:With the serial communication establish information can besent 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 IIspreprogrammed functions by a single key stroke.

    In the study for example subroutines were used to check for userinput and then execute a set of instructions.

    User-override feature utilized.

    S i Si l St th

  • 7/30/2019 00002345

    34/40

    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 bethe answer because of the Basic Stamp IIs superiorsignal strength it was able to lock-out functions from

    the tele-operated receiver.The Basic Stamp II only locks-out outputs which theprogram sends digital signals to this means that atruly semi-autonomous state can be achieved thus

    Real time monitoring was developed.

    B d th T diti l

  • 7/30/2019 00002345

    35/40

    Beyond the TraditionalClassroom

    Honors Theses Topic:

    Independent Study

    MU Robotics Team

    Latest Design (SA 1)

  • 7/30/2019 00002345

    36/40

    Latest Design (SA-1)

    Semi-Autonomous One

    2004 MU Robotics Team

    T t Cit d

  • 7/30/2019 00002345

    37/40

    Texts Cited

    Gilmore, C. M. (1996). Microprocessors Principles and

    Applications 2nd

    Edition. Glencoe McGraw-Hill, New York.Morton, T. D. (2001). Embedded Microcontrollers. PrenticeHall, Upper Saddle River, New Jersey.

    Tocci R. J. (2003). Microprocessors and MicrocomputersHardware and Software 6th Edition. Prentice Hall, Columbus,

    Ohio.

  • 7/30/2019 00002345

    38/40

    P ll St (A di A)

  • 7/30/2019 00002345

    39/40

    Parallax Stamps (Appendix A)

    BS2 (Low-end Model)

    Processor Speed 20 MHzProgram Execution Speed ~4,000 instructions/sec.

    RAM Size 32 Bytes (6 I/O, 26 Variable)

    EEPROM (Program) Size 2K Bytes, ~500 instructions

    Number of I/O pins 16 + 2 Dedicated Serial

    Cost $49 each

    BS2p40 (High-end Model)

    Processor Speed 20 MHz Turbo

    Program Execution Speed ~12,000 instructions/sec.

    RAM Size 38 Bytes (12 I/O, 26 Variable)

    EEPROM (Program) Size 8x2K Bytes, ~4,000 instructionsNumber of I/O pins 32 + 2 Dedicated Serial

    Cost $89 each

    Motorolas Microcontrollers

  • 7/30/2019 00002345

    40/40

    Motorola s Microcontrollers(Appendix B)

    68HC11512 bytes of RAM

    2K bytes EEPROM

    40 I/O pins

    2 MHz45-100 Million Instructions per Second

    Used with the BOT Board

    68HC121024 bytes of RAM

    4K bytes EEPROM

    96 I/O pins

    8 MHz

    Note: Both can be

    programmed with SBASIC

    developed by Karl Lunt