Copyright 2017 by McGraw-Hill Education. All rights reserved. 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.
ISBN: 978-1-25-964454-2
MHID: 1-25-964454-5.
The material in this eBook also appears in the print version of this title: ISBN: 978-1-25-964453-5, MHID: 1-25-964453-7.
eBook conversion by codeMantra
Version 1.0
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.
McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions or for use in corporate training programs. To contact a representative, please visit the Contact Us page at www.mhprofessional.com .
Information has been obtained by McGraw-Hill Education from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, McGraw-Hill Education, or others, McGraw-Hill Education does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from the use of such information.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education 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 McGraw-Hill Educations 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. McGRAW-HILL EDUCATION 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. McGraw-Hill Education 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 McGraw-Hill Education 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. McGraw-Hill Education has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill Education 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.
This book is dedicated to my three wonderful grandchildren,
Hudson and Holton Norris and Evangeline Kachavos.
They are an absolute joy to be with, although I am sure
that sentiment is not always shared by their parents.
About the Author
Donald Norris has a degree in electrical engineering and an MBA specializing in production management. He is currently teaching undergrad and grad courses in the IT subject area at Southern New Hampshire University. He has also created and taught several robotics courses there. He has over 36 years of teaching experience as an adjunct professor at a variety of colleges and universities.
Mr. Norris retired from civilian government service with the U.S. Navy, where he specialized in acoustics related to nuclear submarines and associated advanced digital signal processing. Since then, he has spent more than 22 years as a professional software developer using C, C#, C++, Python, Node.js, and Java, as well as 5 years as a certified IT security consultant.
Mr. Norris started a consultancy, Norris Embedded Software Solutions (dba NESS LLC), that specializes in developing application solutions using microprocessors and microcontrollers. He likes to think of himself as a perpetual hobbyist and geek, and is always trying out new approaches and out-of-the-box experiments. He is a licensed private pilot, photography buff, amateur radio operator, and avid runner.
Besides the present book, Mr. Norris is the author of Raspberry PiProjects for the Evil Genius, Programming the IntelEdison: Getting Started with Processing and Python, and three other TAB books.
CONTENTS
PREFACE
This is the first book written on the MicroPython language. Although several good tutorials are available on the Web, especially at www.micropython.org , I have found that a book format is often an attractive alternative for readers who do not wish to invest the time and energy needed to wade through online tutorials. In addition, and without disparaging online authors, a well-written and -organized book often provides readers a good path to understanding a new and innovative technology such as MicroPython.
I have also presented a few projects in this book, which should interest most readers. There is one on a robotic car, another on building a global positioning system (GPS) sentence decoder, two on how to use Pyboard skins, and one on a let ball detector for those readers who play tennis. The theme of all of the projects is to learn how to interface a MicroPython microcontroller with external devices and sensors.
I cover three separate modules that run MicroPython in this book. The first is the Pyboard, which was designed by Dr. Damien George, who is also the creator of the MicroPython language. All of the introductory scripts are run on the Pyboard, as well as all of the books projects. The other two boards discussed are the ESP8266 and the WiPy. These boards run MicroPython, but they also have a built-in wireless radio system, which is lacking in the Pyboard. In fact, the WiPy has four separate wireless radio systems, which makes it quite a chameleon if you need a module that can connect to a variety of wireless protocols. Learn all about it in .
The reader should expect a great increase in knowledge of and experience with MicroPython if a commitment is made to read all of the introductory material as well as to complete most of the projects. I personally always learn a great deal while designing and finishing them. Often, things work out just fine, whereas at other times they are fraught with problems. However, thats what I consider the joy of experimenting. As the renowned Professor Einstein once stated, Anyone who has never made a mistake has never tried anything new.
I would caution any experienced Linux developers to at least review the beginning chapters because MicroPython, although modeled after Python 3, does have a few gotchas that one should be aware of before wading too deeply into the MicroPython pool. I have tried to provide many useful hints and techniques throughout the book to assist readers in this MicroPython adventure.