Charles Bell
Charles Bell
Warsaw, Virginia, USA
Any source code or other supplementary materials referenced by the author in this text are available to readers at www.apress.com . For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/ . Readers can also access source code at SpringerLink in the Supplementary Material section for each chapter.
ISBN 978-1-4842-2107-5
e-ISBN 978-1-4842-2108-2
DOI 10.1007/978-1-4842-2108-2
Library of Congress Control Number: 2016956879
© Charles Bell 2016
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Printed on acid-free paper
—I dedicate this book to my good friend Russ, who thought I had given up on Windows. Clearly, I haven’t.
Internet of Things (IoT) solutions are not nearly as complicated as the name may seem to indicate. Indeed, the IoT is largely another name for what we have already been doing. You may have heard of connected devices or Internet-ready or even cloud-enabled. All of these refer to the same thing—be it a single device such as a toaster or a plant monitor or a complex, multidevice product like home automation solutions. They all share one thing in common: they can be accessed via the Internet to either display data or interact with the devices directly. The trick is applying knowledge of technologies to leverage them to the best advantages for your IoT solution. Until the release of Windows 10 IoT Core, those who use Windows wanting to experiment with IoT solutions and in particular hardware like the Raspberry Pi had to learn a new operating system in order to get started. That is no longer true! In this book, we explore how to leverage Windows 10 in your IoT solutions.
I wrote this book to share my passion for IoT solutions and Windows 10. I especially wanted to show how anyone could use Windows 10 along with a low-cost computing board to create cool IoT projects—all without having to learn a new operating system!
The intended audience therefore includes anyone interested in learning how to use Windows 10 for IoT projects, such as hobbyists and enthusiasts, and even designers and engineers building commercial Windows 10-based IoT solutions.
The book was written to guide the reader from a general knowledge of IoT to expertise in developing Windows 10 solutions for the IoT. The first several chapters cover general topics, which includes a short introduction to the Internet of Things, the Windows 10 IoT Core technologies, and some of the available hardware for IoT. Additional chapters are primers on how to write IoT solutions in a variety of programming languages. Rather than focusing on a single language, which often forces readers unfamiliar with the language to learn new skills just to read the book, I’ve included tutorials in a number of languages to make the book usable by more readers. Throughout the book are examples of how to implement IoT solutions in the various languages. As you will see, some languages are better suited for certain projects. The book contains six detailed and increasingly complex projects for you to explore and enjoy as you develop IoT solutions with Windows 10. There is even a chapter that shows you how to work with Arduino-compatibe microcontroller boards. The book concludes with a look at how to grow beyond the material presented. An appendix listing the hardware components for each chapter is included for your convenience. The following is a brief overview of each chapter in this book.
Chapter 1 : What Is the Internet of Things? This chapter answers general questions about the IoT and how IoT solutions are constructed. You are introduced to some terminology describing the architecture of IoT solutions and you are provided examples of well-known IoT solutions. The chapter concludes with a brief introduction to Windows 10.
Chapter 2 : Introducing the Windows 10 IoT Core . This chapter presents a version of Windows 10 called the Windows 10 IoT Core that runs on low-cost computers, such as the Raspberry Pi. You discover the basic features of Windows 10, including how to prepare your PC and get started with Windows 10 on your device. You will also see how to boot up the Raspberry Pi with Windows 10!
Chapter 3 : Introducing the Raspberry Pi . This chapter explores the Raspberry Pi and how to set up and configure it using the Linux operating system in order to understand the platform and supporting technologies. You’ll also discover a few key concepts of how to work with Linux and get a brief look at writing Python scripts, which are used to write Windows 10 IoT applications in later chapters.
Chapter 4 : Developing IoT Solutions with Windows 10 . This chapter presents a demonstration on how to get started using Visual Studio 2015. The chapter introduces several Windows 10 IoT Core–compatible hardware boards, including the layout of the GPIO headers. The chapter demonstrates how to build, deploy, and test your first Windows 10 IoT Core application.
Chapter 5 : Windows 10 IoT Development with C++ . This chapter provides a crash course on the basics of C++ programming in Visual Studio, including an explanation of some of the most commonly used language features. As such, this chapter provides you with the skills that you need to understand the growing number of IoT project examples available on the Internet. The chapter concludes by walking through a C++ example project that shows you how to interact with hardware.
Chapter 6 : Windows 10 IoT Development with C# . This chapter offers a crash course on the basics of C# programming in Visual Studio, including an explanation of some of the most commonly used language features. As such, this chapter provides you with the skills that you need to understand the growing number of IoT project examples available on the Internet. The chapter concludes by walking through a C# example project that shows you how to interact with hardware.
Chapter 7 : Windows 10 IoT Development with Python . This chapter is a crash course on the basics of Python programming in Visual Studio, including an explanation of some of the most commonly used language features. As such, this chapter provides you with the skills that you need to understand the growing number of IoT project examples available on the Internet. The chapter concludes by walking through a Python example project that shows you how to interact with hardware.
Chapter 8 : Electronics for Beginners . This chapter presents an overview of electronics for those who want to work with the types of electronic components commonly found in IoT projects. The chapter includes an overview of some of the basics, descriptions of common components, and a look at sensors. If you are new to electronics, this chapter gives you the extra boost that you need to understand the components used in the projects in this book.
Chapter 9 : The Adafruit Microsoft IoT Pack for Raspberry Pi . This chapter explores the Adafruit Microsoft IoT Pack for Raspberry Pi 3 and demonstrates a small project that uses the components in the kit (well, mostly) to read data from a simple sensor.
Chapter 10 : Project 1: Building an LED Power Meter . This chapter walks through a project using LEDs to display power (volts). You see how to use a potentiometer as a variable input device, read from an analog to digital converter (ADC), learn how to set up and use a serial peripheral interface (SPI), discover a powerful debugging technique, and learn how to create a class to encapsulate functionality.
Chapter 11 : Project 2: Measuring Light . This chapter explores a solution that demonstrates how to measure light using a sensor. The project measures the ambient light in the room and then calculates how much power to send to the LED using a technique called pulse-width modulation (PWM).
Chapter 12 : Project 3: Using Weather Sensors . This chapter demonstrates a very common type of IoT solution—a weather station. In this case, the project uses sensors from the Adafruit kit and implements the code by mixing C# and C++ in the same solution, reusing existing code, and combining it with new code in another language.
Chapter 13 : Project 4: Using MySQL to Store Data . This chapter revisits the project from Chapter 12 and modifies it to store the IoT data collected in a MySQL database. Thus, you see an example of how to complete the data storage element of your IoT solutions.
Chapter 14 : Project 5: Using a Web Server to Control Hardware . This chapter presents one method for building IoT solutions that control hardware remotely using a web page.
Chapter 15 : Project 6: Windows IoT and Arduino . In this chapter, you explore the Arduino platform along with the three Arduino technologies from Microsoft. You begin with a short tutorial on the Arduino and an in-depth look at using the Arduino Wiring libraries. This project combines many of the techniques and components from the previous chapters.
Chapter 16 : Azure IoT Solutions: Cloud Services . This chapter presents a few of the newer concepts and features of Microsoft Azure at a high level and in context of a sample project. You can therefore consider this chapter a bonus project chapter.
Chapter 17 : Where to Go from Here? This chapter explores what you can do to continue your craft of building IoT solutions. Most people want to simply continue to develop projects for themselves, either for fun or to solve problems around the home or office. However, some want to take their skills to the next level. This chapter shows you how to do just that.
Appendix . Contains a list of the required hardware components for each chapter.
This book is designed to guide you through learning more about what the Internet of Things is, discovering the power of Windows 10 IoT Core, and seeing how to build your IoT solutions using the best language suited for the task.
If you are familiar with some of the topics early in the book, I recommend you skim them so that you are familiar with the context presented so that the later chapters—especially the examples—are easy to understand and implement on your own. You may also want to read some of the chapters out of order so that you can get your project moving, but I recommend going back to the chapters you skip to ensure that you get all of the data presented.
If you are just getting started with Windows 10 or are not well versed in using Visual Studio, I recommend reading Chapters 1 – 9 in their entirety before developing your own IoT solution or jumping to the example projects. That said, many of the examples permit you to build small examples that you can use to help learn the concepts.
The code for the examples shown in this book is available on the Apress web site, www.apress.com . You can find a link on the book’s information page on the Source Code/Downloads tab. This tab is located in the Related Titles section of the page.
Should you have any questions or comments—or even spot a mistake you think I should know about—you can contact me, the author, at [email protected] .
I would like to thank all of the many talented and energetic professionals at Apress. I appreciate the understanding and patience of my editor, Jonathan Gennick, and managing editor, Jill Balzano. They were instrumental in the success of this project. I would also like to thank the army of publishing professionals at Apress for making me look so good in print. Thank you all very much!
I’d like to especially thank the technical reviewer, Reggie Burnett, for his often-profound insights, constructive criticism, and encouragement. I’d also like to thank my friends for their encouragement and suggestions for things to include in the book.
Most importantly, I want to thank my wife, Annette, for her unending patience and understanding while I spent so much time with my laptop.
Charles Bell
conducts research in emerging technologies. He is a member of the Oracle MySQL Development team as a senior developer working on a variety of database administration and high-availability projects. He lives in a small town in rural Virginia with his loving wife. He received his doctorate of philosophy in engineering from Virginia Commonwealth University in 2005. His research interests include database systems, software engineering, sensor networks, and 3D printing. He spends his limited free time as a practicing maker, focusing on microcontroller and 3D printers and printing projects.
Reggie Burnett
is currently employed as senior software development manager for Oracle Corp., where he is in charge of development projects spanning many different platforms and architectures. Specializing in Windows and .NET technologies, Reggie has written articles for publications such as the .NET Developers Journal .
Reggie is married and has four children. He lives in central Tennessee where he plays golf and pool and works on his next geeky project.
3.133.144.197