Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Internet of Things with Python

You're reading from   Internet of Things with Python Create exciting IoT solutions

Arrow left icon
Product type Paperback
Published in May 2016
Publisher Packt
ISBN-13 9781785881381
Length 388 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Gaston C. Hillar Gaston C. Hillar
Author Profile Icon Gaston C. Hillar
Gaston C. Hillar
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Understanding and Setting up the Base IoT Hardware FREE CHAPTER 2. Working with Python on Intel Galileo Gen 2 3. Interacting with Digital Outputs with Python 4. Working with a RESTful API and Pulse Width Modulation 5. Working with Digital Inputs, Polling and Interrupts 6. Working with Analog Inputs and Local Storage 7. Retrieving Data from the Real World with Sensors 8. Displaying Information and Performing Actions 9. Working with the Cloud 10. Analyzing Huge Amounts of Data with Cloud-based IoT Analytics A. Exercise Answers Index

What this book covers

Chapter 1, Understanding and Setting up the Base IoT Hardware, start us off on our journey towards Internet of Things (IoT) with Python and the Intel Galileo Gen 2 board. We will learn the different features offered by this board and visualize its different components. We will understand the meaning of the different pins, LEDs, and connectors. We will learn to check the board's firmware version and to update if necessary.

Chapter 2, Working with Python on Intel Galileo Gen 2, leads us through many procedures that make it possible to work with Python as the main programming language to create IoT projects with our Intel Galileo Gen 2 board. We will write a Linux Yocto image to a microSD card, configure the board to make it boot this image, update many libraries to use their latest versions, and launch the Python interpreter.

Chapter 3, Interacting with Digital Outputs with Python, teaches us how to work with two different libraries to control digital outputs in Python: mraa and wiring-x86. We will connect LEDs and resistors to a breadboard and write code to turn on between 0 to 9 LEDs. Then, we will improve our Python code to take advantage of Python's object-oriented features, and we will prepare the code to make it easy to build an API that will allow us to print numbers with LEDs with a REST API.

Chapter 4, Working with a RESTful API and Pulse Width Modulation, has us working with Tornado Web Server, Python, the HTTPie command-line HTTP client, and the mraa and wiring-x86 libraries. We will generate many versions of RESTful APIs that will allow us to interact with the board in computers and devices connected to the LAN. We will be able to compose and send HTTP requests that print numbers in LEDs, change the brightness levels for three LEDs, and generate millions of colors with an RGB LED.

Chapter 5, Working with Digital Inputs, Polling and Interrupts, explains the difference between reading pushbutton statuses with polling and working with interrupts and interrupt handlers. We will write code that will allow the user to perform the same actions with either pushbuttons in the breadboard or HTTP requests. We will combine code that reacts to changes in the statuses of the pushbuttons with a RESTful API built with Tornado Web Server. We will create classes to encapsulate pushbuttons and the necessary configurations with the mraa and wiring-x86 libraries.

Chapter 6, Working with Analog Inputs and Local Storage, explains how to work with analog inputs to measure voltage values. We will measure voltages with an analog pin and both the mraa and the wiring-x86 libraries. We will be able to transform a variable resistor into a voltage source and make it possible to measure the darkness level with an analog input, a photoresistor, and a voltage divider. We will fire actions when the environment light changes, and we will work with both analog inputs and outputs. We will register events by taking advantage of the logging features included in the Python standard library and the USB 2.0 connector included in the Intel Galileo Gen 2 board.

Chapter 7, Retrieving Data From the Real World with Sensors, has us working with a variety of sensors to retrieve data from the real world. We will take advantage of the modules and classes included in the upm library that will make it easy for us to start working with analog and digital sensors. We will learn the importance of considering units of measurement because sensors always provide values measured in a specific unit, which we must consider. We will measure the magnitude and direction of proper acceleration or g-force, ambient temperature, and humidity.

Chapter 8, Displaying Information and Performing Actions, teaches us about different displays the we can connect to our board through the I2C bus. We will work with an LCD display with an RGB backlight, and we will then replace it with an OLED dot matrix. We will write code that takes advantage of the modules and classes included in the upm library to work with LCD and OLED displays and show text on them. We will also write code that interacts with an analog servo. We will control the shaft to allow us to create a gauge chart to display the temperature value retrieved with a sensor. Our Python code will make things move.

Chapter 9, Working with the Cloud, teaches you how to combine many cloud-based services that will allow us to easily publish data collected from sensors and visualize it in a web-based dashboard. We will work with the MQTT protocol and its publish/subscribe model to process commands in our board and indicate when the commands are successfully processed through messages. First, we will work with the PubNub cloud that works with the MQTT protocol under the hood. Then, we will develop the same example with Mosquitto and Eclipse Paho. We will be able to write applications that can establish bidirectional communications with our IoT devices.

Chapter 10, Analyzing Huge Amounts of Data with Cloud-based IoT Analytics, explains the close relationship between IoT and Big Data. We will work with Intel IoT Analytics, a cloud-based service that allows us to organize huge amounts of data collected by multiple IoT devices and their sensors. We will use the requests package to write a few lines of Python code to interact with the Intel IoT Analytics REST API. We will learn about the different options that Intel IoT Analytics offers us to analyze huge amounts of data, and we will define rules to trigger alerts.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime