PIC RoboticsThis page intentionally left blank. PIC RoboticsA Beginner’s Guide to Robotics Projects Using the PICmicro John Iovine McGrawHill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto Copyright © 2004 by The McGrawHill Companies, Inc. All rights reserved. Manufactured in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. 0071394559 The material in this eBook also appears in the print version of this title: 0071373241. All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps. McGrawHill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. For more information, please contact George Hoare, Special Sales, at george_hoare@mcgrawhill.com or (212) 9044069. TERMS OF USE This is a copyrighted work and The McGrawHill Companies, Inc. (“McGrawHill”) and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGrawHill’s prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms. THE WORK IS PROVIDED “AS IS.” McGRAWHILL AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGrawHill and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGrawHill nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGrawHill has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGrawHill and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise. DOI: 10.1036/0071394559 For more information about this title, click here. Contents Preface xi Chapter 1. Robot Intelligence 1What Is a Microcontroller? 1Why Use a Microcontroller? 1Designer Computers—So Many Microcontrollers 2The Compiler 2PIC Programming Overview 2Software and Hardware 2PicBasic and PicBasic Pro Compilers 3EPIC Programmer 4Firmware 5Consumables 516F84 PIC Microcontroller 5Step 1: Writing Code (the Basic Program) 6Step 2: Using the Compiler7Step 3: Installing the Firmware, or Programming the PIC Chip7Ready, Steady, Go 8Parts List 8Chapter 2. Installing the Compiler 11Installing the PicBasic Compiler Software 11Installing the PicBasic Pro Compiler 12Chapter 3. Installing the EPIC Software 19Installing the EPIC Software in Windows 19Installing the EPIC Software, DOS Version 22Supplemental—Applications Directory 22Chapter 4. CodeDesigner 23CodeDesigner Features 23Software Installation 25v vi Contents Setting CodeDesigner Options 25First Program 31The EPIC Programming Board Software 33Parts List 35Chapter 5. Using DOS to Code, Compile, and Program 37Compile 39Programming the PIC Chip 43The EPIC Programming Board Software 44Using EPIC DOS Version 45Continuing with the wink.bas Program 45Chapter 6. Testing the PIC Microcontroller 49The PIC Microntroller 49The Solderless Breadboard 49Three Schematics, One Circuit 50Wink 53Troubleshooting the Circuit 54PIC Experimenter’s Board and LCD Display 54PIC Experimenter’s Board 56Use 56Simple Experiment 58Builtin LCD 60Using the LCD: PicBasic and PicBasic Pro Examples63Introduction to Binary and the PIC Microcontroller 65Using TRIS and Port Registers 68Accessing the Ports for Output 70Counting Program 71Counting in Binary by 1 71Input 72The button Command 72A button Example 74peek 75peek and PicBasic Pro 76Basic Input and Output Commands 77Servomotors 78Parts List 79Chapter 7. Intelligence 83Approaches to Building Intelligence 83Where’s the Intelligence? 85Layered Behavioral Responses 85BehaviorBased Robotics 86Chapter 8. Walter’s Turtle 87BehaviorBased Robotics 87William Grey Walter—Robotics Pioneer 87Four Modes of Operation 88Contents vii Observed Behavior88 Building a Walter Tortoise89 Drive and Steering Motors90 Modifying the HS425BB Servomotor91 Sheet Metal Fabrication97 Shell99 Finding the Center of Gravity100 Attaching Bumper to Robot Base101 Bumper Switch104 Mounting the Steering Servomotor107 Photoresistor109 Trimming the Sensor Array112 Schematic114 Program115 Adding Sleep Mode121 Power121 Behavior121 Fudge Factor121 Light Intensity121 Handedness123 Parts List123 Chapter 9. Braitenberg Vehicles125 Neural I/O Relationships126 Vehicles126 Building Vehicles128 Back Wheels129 Front Wheels131 CdS Photoresistor Cells133 Trimming the Sensor Array137 PIC 16F84 Microcontroller139 Testing139 Second Braitenberg Vehicle (Avoidance Behavior) 141Parts List 141Chapter 10. Hexapod Walker 143Imitation of Life 143Six Legs—Tripod Gait 143ThreeServomotor Walker Robot 144Function 144Moving Forward 145Moving Backward 146Turning Left 147Turning Right 148Construction 148Mounting the Servomotors 151Leg Positioning 152Linkage 154viii Contents Center (Tilt) Servomotor 154Sensors 155Electronics 158Microcontroller Program 159Parts List 164Chapter 11. Speech Recognition 165Applications 167Software Approach 167Learning to Listen 167SpeakerDependent and SpeakerIndependent Recognition 167Recognition Style 168Speech Recognition Circuit 168Circuit Construction 168Keypad 169To Train 169Testing Recognition 172Error Codes 172Clearing the Trained Word Memory 172Independent Recognition System 172Voice Security System 173Speech Interface Control Circuit 173How the Circuit Works 174PIC 16F84 Microcontroller Program 176Active High Output 177SPDT Relay Output 177Circuit Construction 177Programming the Speech Recognition Circuit: Training, Testing, and Retraining 177SRI02 and SRI03 Interfaces 180Robot Control 180Parts List 181Chapter 12. Robotic Arm 185Servomotor Building Blocks for Robotics 185Basic Servomotor Bracket Assembly 186Assembling MultipleServomotor Assemblies 189Building a FiveServomotor Robotic Arm 192Servomotors 197Servomotor Controllers 199Simple Servomotor Controller 200Four and FiveServomotor Controllers 204Increasing the Lifting Capacity of the Robotic Arm 215Adding a Robotic Arm Base 216Parts List 223Chapter 13. Bipedal Walker Robot 225A Question of Balance? 226A Little Feedback 227Servomotors 227Document Outline
- TeamLiB
- Cover
- Contents
- Preface
- Chapter 1. Robot Intelligence
- What Is a Microcontroller?
- Why Use a Microcontroller?
- Designer Computers So Many Microcontrollers
- The Compiler
- PIC Programming Overview
- Software and Hardware
- PicBasic and PicBasic Pro Compilers
- EPIC Programmer
- Firmware
- Consumables
- 16F84 PIC Microcontroller
- Step 1: Writing Code (the Basic Program)
- Step 2: Using the Compiler
- Step 3: Installing the Firmware, or Programming the PIC Chip
- Ready, Steady, Go
- Parts List
- Chapter 2. Installing the Compiler
- Installing the PicBasic Compiler Software
- Installing the PicBasic Pro Compiler
- Chapter 3. Installing the EPIC Software
- Installing the EPIC Software in Windows
- Installing the EPIC Software, DOS Version
- Supplemental Applications Directory
- Chapter 4. CodeDesigner
- CodeDesigner Features
- Software Installation
- Setting CodeDesigner Options
- First Program
- The EPIC Programming Board Software
- Parts List
- Chapter 5. Using DOS to Code, Compile, and Program
- Compile
- Programming the PIC Chip
- The EPIC Programming Board Software
- Using EPIC DOS Version
- Continuing with the wink.bas Program
- Chapter 6. Testing the PIC Microcontroller
- The PIC Microntroller
- The Solderless Breadboard
- Three Schematics, One Circuit
- Wink
- Troubleshooting the Circuit
- PIC Experimenter's Board and LCD Display
- PIC Experimenter's Board
- Use
- Simple Experiment
- Built-in LCD
- Using the LCD: PicBasic and PicBasic Pro Examples
- Introduction to Binary and the PIC Microcontroller
- Using TRIS and Port Registers
- Accessing the Ports for Output
- Counting Program
- Counting in Binary by 1
- Input
- The button Command
- A button Example
- peek
- peek and PicBasic Pro
- Basic Input and Output Commands
- Servomotors
- Parts List
- Chapter 7. Intelligence
- Approaches to Building Intelligence
- Where's the Intelligence?
- Layered Behavioral Responses
- Behavior-Based Robotics
- Chapter 8. Walter's Turtle
- Behavior-Based Robotics
- William Grey Walter Robotics Pioneer
- Four Modes of Operation
- Observed Behavior
- Building a Walter Tortoise
- Drive and Steering Motors
- Modifying the HS-425BB Servomotor
- Sheet Metal Fabrication
- Shell
- Finding the Center of Gravity
- Attaching Bumper to Robot Base
- Bumper Switch
- Mounting the Steering Servomotor
- Photoresistor
- Trimming the Sensor Array
- Schematic
- Program
- Adding Sleep Mode
- Power
- Behavior
- Fudge Factor
- Light Intensity
- Handedness
- Parts List
- Chapter 9. Braitenberg Vehicles
- Neural I/O Relationships
- Vehicles
- Building Vehicles
- Back Wheels
- Front Wheels
- CdS Photoresistor Cells
- Trimming the Sensor Array
- PIC 16F84 Microcontroller
- Testing
- Second Braitenberg Vehicle (Avoidance Behavior)
- Parts List
- Chapter 10. Hexapod Walker
- Imitation of Life
- Six Legs Tripod Gait
- Three-Servomotor Walker Robot
- Function
- Moving Forward
- Moving Backward
- Turning Left
- Turning Right
- Construction
- Mounting the Servomotors
- Leg Positioning
- Linkage
- Center (Tilt) Servomotor
- Sensors
- Electronics
- Microcontroller Program
- Parts List
- Chapter 11. Speech Recognition
- Applications
- Software Approach
- Learning to Listen
- Speaker-Dependent and Speaker-Independent Recognition
- Recognition Style
- Speech Recognition Circuit
- Circuit Construction
- Keypad
- To Train
- Testing Recognition
- Error Codes
- Clearing the Trained Word Memory
- Independent Recognition System
- Voice Security System
- Speech Interface Control Circuit
- How the Circuit Works
- PIC 16F84 Microcontroller Program
- Active High Output
- SPDT Relay Output
- Circuit Construction
- Programming the Speech Recognition Circuit Training, Testing, and Retraining
- SRI-02 and SRI-03 Interfaces
- Robot Control
- Parts List
- Chapter 12. Robotic Arm
- Servomotor Building Blocks for Robotics
- Basic Servomotor Bracket Assembly
- Assembling Multiple-Servomotor Assemblies
- Building a Five-Servomotor Robotic Arm
- Servomotors
- Servomotor Controllers
- Simple Servomotor Controller
- Four- and Five-Servomotor Controllers
- Increasing the Lifting Capacity of the Robotic Arm
- Adding a Robotic Arm Base
- Parts List
- Chapter 13. Bipedal Walker Robot
- A Question of Balance?
- A Little Feedback
- Servomotors
- Servomotor Brackets
- Footpads
- Assembly
- Schematic
- Program
- Subroutines M1, M2, and M3
- Going Further
- Parts List
- Chapter 14. Color Robotic Vision System
- CMU Camera
- Serial Communication
- VB Application Program
- Interfacing the CMU Camera to a Robot
- PIC 16F84 Runs at 16 MHz
- Program 1
- Program 2
- Incandescent or Fluorescent Lighting
- Servomotors for Robot
- Program 3
- Running the Program
- Going Further
- Parts List
- Suppliers
- Index
Add New Comment
Showing 1 comment