O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programming for the Internet of Things: Using Windows 10 IoT Core and Azure IoT Suite

Book Description

Rapidly implement Internet of Things solutions

Creating programs for the Internet of Things offers you an opportunity to build and program custom devices whose functionality is limited only by your imagination. This book teaches you to do exactly that, with solutions presented in a step-by-step format. When you read this book, you not only learn the fundamentals of device programming, you will also be ready to write code for revolutionizing devices and robots.

You don’t need to be an expert in low-level programming to benefit from this book. It explains basic concepts and programming techniques before diving into the more complicated topics. Each of the book’s chapters and appendices contains a suitable level of detail to help you quickly master device programming.

MCP Dawid Borycki shows you how to:

  • Build Universal Windows Platform (UWP) applications that target interconnected embedded devices

  • Design and implement background apps for seamless integration with hardware components

  • Use intrinsic UWP functionality to detect and track human faces

  • Build artificial auditory, visual, and learning systems

  • Process audio signals to blink LEDs to the rhythm of music

  • Use OpenCV to develop custom image-processing algorithms

  • Communicate with external devices by using serial, USB, Wi-Fi, and AllJoyn connectivity

  • Design and implement applications to control DC, stepper, and servo motors for robotics

  • Use Microsoft Cognitive Services to detect human emotions

  • Build predictive analysis and preventive maintenance systems by using the Azure IoT Suite

  • Table of Contents

    1. Cover
    2. Title Page
    3. Copyright Page
    4. Contents
    5. Introduction
      1. Audience and expected skills
      2. Tools and required hardware
      3. Organization of this book
      4. Conventions
      5. About the companion content
      6. Acknowledgments
      7. Errata and book support
      8. We want to hear from you
    6. Part I. Essentials
      1. Chapter 1. Embedded devices programming
        1. What is an embedded device?
          1. Special-purpose firmware
          2. Microcontroller memory
        2. Embedded devices are everywhere
        3. Connecting embedded devices: the Internet of Things
        4. Fundamentals of embedded devices
        5. Embedded device programming vs. desktop, web, and mobile programming
          1. Similarities and user interaction
          2. Hardware abstraction layer
          3. Robustness
          4. Resources
          5. Security
        6. Benefits of the Windows 10 IoT Core and Universal Windows Platform
        7. Summary
      2. Chapter 2. Universal Windows Platform on devices
        1. What is Windows 10 IoT Core?
        2. The power of Universal Windows Platform for devices
        3. Tools installation and configuration
          1. Windows 10
          2. Visual Studio 2015 or later
          3. Windows IoT Core project templates
          4. Windows 10 IoT Core Dashboard
        4. Device setup
          1. Windows 10 IoT Core Starter Pack for Raspberry Pi 2 and Pi 3
          2. Windows 10 IoT Core installation
          3. Configuring the development board
        5. Hello, world! Windows IoT
          1. Circuit assembly
          2. Using C# and C++ to turn the LED on and off
        6. Useful tools and utilities
          1. Device Portal
          2. Windows IoT Remote Client
          3. SSH
          4. FTP
        7. Summary
      3. Chapter 3. Windows IoT programming essentials
        1. Connecting Raspberry Pi 2 to an external display and boot configuration
        2. Headed and headless modes
        3. Headless applications
          1. C#
          2. C++
          3. Summary
        4. An entry point of the headed application
          1. C#/XAML
        5. Asynchronous programming
          1. Worker threads and thread pool
          2. Timers
          3. Worker threads synchronization with the UI
        6. Blinking the LED using DispatcherTimer
        7. Summary
      4. Chapter 4. User interface design for headed devices
        1. UI design of UWP apps
        2. Visual designer
        3. XAML namespaces
        4. Control declaration, properties, and attributes
        5. Styles
          1. Style declaration
          2. Style definition
          3. StaticResource and ThemeResource markup extensions
          4. Visual states and VisualStateManager
          5. Adaptive and state triggers
          6. Resource collections
          7. Default styles and theme resources
        6. Layouts
          1. StackPanel
          2. Grid
          3. RelativePanel
        7. Events
          1. Event handling
          2. Event handlers and visual designer
          3. Event propagation
          4. Declaring and raising custom events
        8. Data binding
          1. Binding control properties
          2. Converters
          3. Binding to the fields
          4. Binding to methods
        9. Summary
    7. Part II Device programming
      1. Chapter 5. Reading data from sensors
        1. Bits, bytes, and data types
        2. Decoding and encoding binary data
          1. Bitwise operators
          2. Shift operators, bit masking, and binary representation
          3. Byte encoding and endianness
          4. BitConverter
          5. BitArray
        3. Sense HAT add-on board
        4. User interface
        5. Temperature and barometric pressure
        6. Relative humidity
        7. Accelerometer and gyroscope
        8. Magnetometer
        9. Sensor calibration
        10. Singleton pattern
        11. Summary
      2. Chapter 6. Input and output
        1. Tactile buttons
        2. Joystick
          1. Middleware layer
          2. Joystick state visualization
        3. LED array
        4. Joystick and LED array integration
        5. Integrating LED array with sensor readings
        6. Touchscreen and gesture handling
        7. Summary
      3. Chapter 7. Audio processing
        1. Speech synthesis
        2. Speech recognition
          1. Background
          2. App capability and system configuration
          3. UI changes
          4. One-time recognition
          5. Continuous recognition
        3. Device control using voice commands
          1. Setting up the hardware
          2. Coding
        4. Waves in time and frequency domain
          1. Fast Fourier Transformation
          2. Sampling rate and frequency scale
          3. Decibel scale
        5. Waveform spectrum analyzer
          1. Reading a file
          2. Waveform audio file format reader
          3. Signal windowing and Short Time Fourier Transform
          4. Spectrum Histogram
          5. Spectrum display: putting things together
          6. Spectrum display on the LED array
        6. Summary
      4. Chapter 8. Image processing
        1. Image acquisition using a USB camera
        2. Face detection
        3. Face tracking
          1. Face location display in the UI
          2. Face location display on the LED array
        4. OpenCV and native code interfacing
          1. Solution configuration and OpenCV installation
          2. Image thresholding
          3. Visualization of processing results
          4. Object detection
          5. Machine vision for object recognition
          6. Contour approximation
          7. Object identification
          8. Final notes
        5. Summary
      5. Chapter 9. Connecting devices
        1. Serial communication
          1. UART loopback mode
          2. Project skeleton
          3. Serial device configuration
          4. Writing and reading data
        2. Writing the app for intra-device communication
          1. Connecting a converter
          2. Controlling an IoT device remotely
          3. Headed client app
        3. Bluetooth
          1. Setting up the connection
          2. Project architecture and Bluetooth device enumeration
          3. LED color command
          4. LedArray class adopted to Windows Runtime requirements
          5. Headed client app
        4. Wi-Fi
        5. AllJoyn
          1. Introspection XML file
          2. AllJoyn Studio
          3. Producer
          4. IoT Explorer for AllJoyn
          5. Custom Consumer
        6. Windows Remote Arduino
        7. Summary
      6. Chapter 10. Motors
        1. Motors and device control fundamentals
        2. Motor HATs
        3. Pulse-width modulation
          1. Driver
        4. DC motor
          1. Implementation of the motor control with PWM signals
          2. Headed app
        5. Stepper motor
          1. Full-step mode control
          2. Headed app
          3. Automatic speed adjustment
          4. Micro-stepping
        6. Servo motor
          1. Hardware assembly
          2. Headed app
        7. Providers
          1. Lightning providers
          2. PCA9685 controller provider
          3. DC motor control
        8. Summary
      7. Chapter 11. Device learning
        1. Microsoft Cognitive Services
          1. Emotions detector
          2. Indicating emotions on the LED array
          3. Computer Vision API
        2. Custom artificial intelligence
          1. Motivation and concepts
          2. Microsoft Azure Machine Learning Studio
        3. Anomaly detection
          1. Training dataset acquisition
          2. Anomaly detection using a one-class support vector machine
          3. Preparing and publishing a Web service
          4. Implementing a Web service client
          5. Putting it all together
        4. Summary
    8. Part III. Azure IoT Suite
      1. Chapter 12. Remote device monitoring
        1. Setting up a preconfigured solution
        2. Provisioning a device
          1. Registering a new device
          2. Sending device info
        3. Sending telemetry data
        4. Receiving and handling remote commands
          1. Updating device info
          2. Responding to remote commands
        5. Azure IoT services
        6. Summary
      2. Chapter 13. Predictive maintenance
        1. Preconfigured solution
          1. Solution dashboard
          2. Machine Learning Workspace
          3. Cortana Analytics Gallery
        2. Azure resources
        3. Azure Storage
          1. Predictive maintenance storage
          2. Telemetry and prediction results storage
          3. DeviceList
        4. Azure Stream Analytics
        5. Solution source code
        6. Event Hub and the machine learning event processor
          1. Machine learning data processor
          2. Azure Table storage
        7. Simulator WebJob
        8. Predictive Maintenance web application
          1. Simulation service
          2. Telemetry service
        9. Summary
      3. Chapter 14. Custom solution
        1. IoT Hub
          1. Client app
          2. Device registry
          3. Sending telemetry data
        2. Stream analytics
          1. Storage account
          2. Azure Tables
          3. Event Hub
          4. Stream Analytics Job
        3. Event processor
        4. Data visualization with Power BI
        5. Notification Hub
          1. Store association
          2. Notification client app
          3. Notification Hub creation and configuration
          4. Sending toast notifications with the event processor
        6. Deploying the Event Hub processor to the cloud
        7. Summary
    9. Appendix A. Code examples for controlling LED using Visual Basic and JavaScript
      1. Headed app using Visual Basic/XAML
      2. Headless app using Visual Basic/XAML
      3. Headed app using JavaScript, HTML, and CSS
      4. An entry point of the headed JavaScript app
    10. Appendix B. Raspberry Pi 2 HDMI modes
    11. Appendix C. Bits, bytes, and data types
      1. Binary encoding: integral types
      2. Binary encoding: floating numbers
      3. Hexadecimal numeral system
      4. Numeral values formatting
      5. Binary literals and digit separator
    12. Appendix D. Class library for Sense HAT sensors
      1. Portable Class Library
      2. Universal Windows Class Library
      3. Universal Windows Platform application
    13. Appendix E. Visual C++ component extensions
      1. User interface and event handling
      2. Event declaration and event arguments
      3. Concurrency
      4. Data binding
        1. Value converters
      5. Summary
    14. Appendix F. Setting up Visual Studio 2017 for IoT development
      1. Installation
      2. Visual C# project template
        1. Creating a project
        2. IoT extensions
        3. Implementation
        4. Configuring and deploying solutions
      3. Portable Class Library
    15. Index