Charles Bell

Windows 10 for the Internet of Things

Controlling Internet-Connected Devices from Raspberry Pi

2nd ed.
Charles Bell
Warsaw, VA, USA
ISBN 978-1-4842-6608-3e-ISBN 978-1-4842-6609-0
© Charles Bell 2021
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.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Distributed to the book trade worldwide by Springer Science+Business Media LLC, 1 New York Plaza, Suite 4600, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

This book is dedicated to the medical professionals who have gone above and beyond what is humanly possible during this tragic moment in history. God bless you all.

Introduction

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.

Intended Audience

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.

How This Book Is Structured

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 include 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 five detailed and increasingly complex projects for you to explore and enjoy as you develop IoT solutions with Windows 10. The book also provides two chapters that show you how to work with Microsoft Azure to store and visualize your IoT data via a bonus sixth project. 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 2019. 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 Visual Basic: This chapter is a crash course on the basics of Visual Basic 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 Visual Basic 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: Remote Control Hardware: This chapter presents one method for building IoT solutions that control hardware remotely using a web page.

  • Chapter 15 , Azure IoT Solutions: Cloud Services: This chapter introduces the Microsoft Azure IoT products including a tutorial on how Azure IoT applications work.

  • Chapter 16 , Azure IoT Solutions: Building an Azure IoT Solution: This chapter presents a bonus project that builds on the Azure tutorial from Chapter 15.

  • 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. Others may want to know how to take their solutions into the enterprise. This chapter shows you how to do just that.

  • Appendix: The appendix contains a list of the required hardware components for each chapter.

How to Use This Book

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 19 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 learn the concepts.

Downloading the Code

The code for the examples shown in this book is available on the Apress website, 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.

Contacting the Author

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].

Acknowledgments

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.

I’d like to also thank the nice folks at AAEON for their expertise and generosity in the loan of one of their enterprise IoT boards and a special thanks to Michelle Tseng for her patience answering and brokering my questions.

Most importantly, I want to thank my wife, Annette, for her unending patience and understanding while I spent so much time with my laptop.

Table of Contents
Index 661
About the Author
Charles Bell
../images/416714_2_En_BookFrontmatter_Figb_HTML.jpg

conducts research in emerging technologies. He is a member of the Oracle MySQL Development team working on the MySQL Database Service project. He lives in a small town in rural Virginia with his loving wife. He received his Doctor of Philosophy in Engineering from Virginia Commonwealth University in 2005. Dr. Bell is an expert in the database field and has extensive knowledge and experience in software development and systems engineering. His research interests include 3D printers, microcontrollers, three-dimensional printing, database systems, software engineering, and sensor networks. He spends his limited free time as a practicing maker focusing on microcontroller projects and refinement of three-dimensional printers. Dr. Bell maintains a blog on his research projects and many other interests.

 
About the Technical Reviewer
Reggie Burnett
../images/416714_2_En_BookFrontmatter_Figc_HTML.jpg
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.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.29.145