Smart Sensors and Applications Student Guide - Parallax Inc Smart Sensor activities ... avalanche risk meters are just two ... Smart Sensors and Applications “ “ “Smart Sensors and

  • Published on
    07-Feb-2018

  • View
    214

  • Download
    1

Embed Size (px)

Transcript

<ul><li><p>Smart Sensors and Applications </p><p>Student Guide </p><p>VERSION 1.0 </p></li><li><p>WARRANTY Parallax Inc. warrants its products against defects in materials and workmanship for a period of 90 days from receipt of product. If you discover a defect, Parallax Inc. will, at its option, repair or replace the merchandise, or refund the purchase price. Before returning the product to Parallax, call for a Return Merchandise Authorization (RMA) number. Write the RMA number on the outside of the box used to return the merchandise to Parallax. Please enclose the following along with the returned merchandise: your name, telephone number, shipping address, and a description of the problem. Parallax will return your product or its replacement using the same shipping method used to ship the product to Parallax. </p><p>14-DAY MONEY BACK GUARANTEE If, within 14 days of having received your product, you find that it does not suit your needs, you may return it for a full refund. Parallax Inc. will refund the purchase price of the product, excluding shipping/handling costs. This guarantee is void if the product has been altered or damaged. See the Warranty section above for instructions on returning a product to Parallax. COPYRIGHTS AND TRADEMARKS This documentation is copyright 2006 by Parallax Inc. By downloading or obtaining a printed copy of this documentation or software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication of this documentation for commercial uses is expressly prohibited by Parallax Inc. Duplication for educational use is permitted, subject to the following conditions: the text, or any portion thereof, may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction with Parallax products, and the user may recover from the student only the cost of duplication. This text is available in printed format from Parallax Inc. Because we print the text in volume, the consumer price is often less than typical retail duplication charges. BASIC Stamp, Stamps in Class, Board of Education, Boe-Bot SumoBot, SX-Key and Toddler are registered trademarks of Parallax, Inc. HomeWork Board, Propeller, Ping))) Parallax, and the Parallax logo are trademarks of Parallax Inc. If you decide to use trademarks of Parallax Inc. on your web page or in printed material, you must state that "(trademark) is a (registered) trademark of Parallax Inc. upon the first appearance of the trademark name in each printed document or web page. Other brand and product names are trademarks or registered trademarks of their respective holders. </p><p>ISBN 1-928982-39-5 </p><p>DISCLAIMER OF LIABILITY Parallax Inc. is not responsible for special, incidental, or consequential damages resulting from any breach of warranty, or under any legal theory, including lost profits, downtime, goodwill, damage to or replacement of equipment or property, or any costs of recovering, reprogramming, or reproducing any data stored in or used with Parallax products. Parallax Inc. is also not responsible for any personal damage, including that to life and health, resulting from use of any of our products. You take full responsibility for your BASIC Stamp application, no matter how life-threatening it may be. </p><p>3RD PRINTING </p></li><li><p>We maintain active web-based discussion forums for people interested in Parallax products. These lists are accessible from www.parallax.com: </p><p> Propeller chip This list is specifically for our customers using Propeller chips and products. BASIC Stamp This list is widely utilized by engineers, hobbyists and students who share their </p><p>BASIC Stamp projects and ask questions. Stamps in Class Created for educators and students, subscribers discuss the use of the Stamps in </p><p>Class curriculum in their courses. The list provides an opportunity for both students and educators to ask questions and get answers. </p><p> Parallax Educators A private forum exclusively for educators and those who contribute to the development of Stamps in Class. Parallax created this group to obtain feedback on our curricula and to provide a place for educators to develop and obtain Teachers Guides. </p><p> Robotics Designed for Parallax robots, this forum is intended to be an open dialogue for robotics enthusiasts. Topics include assembly, source code, expansion, and manual updates. The Boe-Bot, Toddler, SumoBot, HexCrawler and QuadCrawler robots are discussed here. </p><p> SX Microcontrollers and SX-Key Discussion of programming the SX microcontroller with Parallax assembly language SX Key tools and 3rd party BASIC and C compilers. </p><p> Javelin Stamp Discussion of application and design using the Javelin Stamp, a Parallax module that is programmed using a subset of Sun Microsystems Java programming language. </p><p>ERRATA While great effort is made to assure the accuracy of our texts, errors may still exist. If you find an error, please let us know by sending an email to editor@parallax.com. We continually strive to improve all of our educational materials and documentation, and frequently revise our texts. Occasionally, an errata sheet with a list of known errors and corrections for a given text will be posted to our web site, www.parallax.com. Please check the individual product pages free downloads for an errata file. </p></li><li><p>Table of Contents Page i </p><p>Table of Contents </p><p>Preface........................................................................................................................iii Introduction and Author's Note ...................................................................................... iii Overview.........................................................................................................................v Before you Start..............................................................................................................v The Stamps In Class Educational Series ...................................................................... vi Foreign Translations ..................................................................................................... vii Special Contributors ..................................................................................................... vii </p><p>Chapter 1: The Parallax Serial LCD Display ............................................................1 LCDs in Products............................................................................................................2 The Parallax Serial LCD - Your Mobile Debug Terminal ................................................2 Activity #1: Connecting and Testing the LCD .................................................................4 Activity #2: Displaying Simple Messages .......................................................................8 Activity #3: Timer Application........................................................................................17 Activity #4: Custom Characters and LCD Animation ....................................................19 Activity #5: Scrolling Text Across the Display...............................................................25 Summary ......................................................................................................................34 </p><p>Chapter 2: The Ping))) Ultrasonic Distance Sensor ..............................................41 How Does the Ping))) Sensor Work?............................................................................41 Activity #1: Measuring Echo Time ................................................................................42 Activity #2: Centimeter Measurements .........................................................................46 Activity #3: Inch Measurements....................................................................................49 Activity #4: Mobile Measurements ................................................................................51 Activity #5: Temperature's Effect on the Speed of Sound ............................................58 Summary ......................................................................................................................61 </p><p>Chapter 3: The Memsic Dual-Axis Accelerometer ................................................65 The MX2125 Accelerometer How it Works................................................................67 Activity #1: Connecting and Tilt-Testing the MX2125 ...................................................68 Activity #2: Mobile Measurements ................................................................................71 Activity #3: Scaling Down and Offsetting Input Values .................................................76 Activity #4: Scaling to 1/100 g.......................................................................................83 Activity #5: Measuring 360 Vertical Rotation...............................................................85 Activity #6: Measure Tilt From the Horizontal ...............................................................98 Summary ....................................................................................................................112 </p><p>Chapter 4: The Hitachi HM55B Compass Module ...............................................119 Interpreting the Compass Measurements...................................................................119 Activity #1: Connecting and Testing the Compass Module ........................................120 Activity #2: Compass Module Calibration ...................................................................128 </p></li><li><p>Page ii Smart Sensors and Applications </p><p>Activity #3: Testing the Calibration .............................................................................138 Activity #4: Improve Compass Measurements by Averaging .....................................143 Activity #5: Mobile Measurements..............................................................................148 Summary ....................................................................................................................159 </p><p>Chapter 5: Accelerometer Gaming Basics .......................................................... 167 Activity #1: PBASIC Graphic Character Display.........................................................168 Activity #2: Background Store and Refresh with EEPROM........................................179 Activity #3: Tilt the Bubble Graph ...............................................................................188 Activity #4: Game Control...........................................................................................196 SUMMARY .................................................................................................................205 </p><p>Chapter 6: More Accelerometer Projects ............................................................ 211 Activity #1: Measure Heights of Buildings, Trees, Etc. ...............................................211 Activity #2: Record and Playback ...............................................................................213 Activity #3: Use EEPROM to Toggle Modes ..............................................................219 Activity #4: Remote Datalogging of Acceleration........................................................223 Activity #5: RC Car Acceleration Study ......................................................................230 Activity #6: Skateboard Trick Acceleration Study .......................................................240 Activity #7: Bicycle Distance.......................................................................................247 Summary ....................................................................................................................255 </p><p>Chapter 7: LCD Bar Graphs for Distance and Tilt .............................................. 261 Activity #1: Custom Character Swapping ...................................................................261 Activity #2: Horizontal Bar Graphs for Ping))) Distance..............................................271 Activity #3: Two-Axis Bar Graph for Accelerometer Tilt..............................................281 Summary ....................................................................................................................294 </p><p>Appendix A: ASCII Chart ....................................................................................... 303 Appendix B: Parallax Serial LCD Documentation .............................................. 305 Appendix C: Hexadecimal Character Definitions ............................................... 317 Appendix D: Parts Listing ..................................................................................... 321 Index........................................................................................................................ 323 </p></li><li><p>Preface Page iii </p><p>Preface </p><p>INTRODUCTION AND AUTHOR'S NOTE The first time I saw the term "smart sensor" was in Tracy Allen's Applied Sensors text (then known as Earth Measurements). Tracy aptly applied this term to the DS1620 digital thermometer, which has built-in electronics that simplify microcontroller temperature measurements. In addition, it can remember settings it receives from a microcontroller and even function on its own as a thermostat controller. In contrast to smart sensors, primitive sensors are devices or materials that have some electrical property that changes with some physical phenomenon. An example of a primitive sensor from What's a Microcontroller? is the cadmium sulfide photoresistor. Its resistance changes with light intensity. With the right circuit and program, microcontroller light measurements are possible. Other examples of common primitive sensors are current/voltage output temperature sensors, microphone transducers, and even the potentiometer, which is a rotational position sensor. Inside every smart sensor is one or more primitive sensors and support circuitry. The thing that makes a smart sensor "smart" is the additional, built-in electronics. The electronics make these sensors able to do one or more of the following: </p><p> Pre-process their measured values into meaningful quantities Communicate their measurements with digital signals and communication </p><p>protocols Orchestrate the actions of primitive circuits and sensors to "take" measurements Make decisions and initiate action based on sensed conditions, independent of a </p><p>microcontroller Remember calibration or configuration settings </p><p> During my first encounter with a smart sensor, I thought to myself, "Wow, an entire kit full of these smart sensors with a book could be REALLY interesting! I sure hope somebody does a kit and book like that soon..." Little did I know that "soon" would end up being almost six years later...</p></li></ul>