Book Image

Internet of Things Programming Projects

By : Colin Dow
Book Image

Internet of Things Programming Projects

By: Colin Dow

Overview of this book

The Internet of Things (IOT) has managed to attract the attention of researchers and tech enthusiasts, since it powerfully combines classical networks with instruments and devices. In Internet of Things Programming Projects, we unleash the power of Raspberry Pi and Python to create engaging projects. In the first part of the book, you’ll be introduced to the Raspberry Pi, learn how to set it up, and then jump right into Python programming. Then, you’ll dive into real-world computing by creating a“Hello World” app using flash LEDs. As you make your way through the chapters, you’ll go back to an age when analog needle meters ruled the world of data display. You’ll learn to retrieve weather data from a web service and display it on an analog needle meter, and build a home security system using the Raspberry Pi. The next project has a modern twist, where we employ the Raspberry Pi to send a signal to a web service that will send you a text when someone is at the door. In the final project, you take what you've learned from the previous two projects and create an IoT robot car that you can use to monitor what your pets are up to when you are away. By the end of this book, you will be well versed in almost every possible way to make your IoT projects stand out.
Table of Contents (21 chapters)

What this book covers

Chapter 1, Installing Raspbian on the Raspberry Pi, sets us off on our Raspberry Pi IoT journey by installing the Raspbian OS on our Raspberry Pi. We will then take a look at some of the programs that come pre-installed with Raspbian.

Chapter 2, Writing Python Programs Using Raspberry Pi, covers how Windows, macOS, and Linux are operating systems that are familiar to developers. Many a book on developing the Raspberry Pi involves using one of these operating systems and accessing the Raspberry Pi remotely. We will take a different approach in this book. We will use our Raspberry Pi as a development machine. In this chapter, we will get our feet wet with using the Raspberry Pi as a development machine.

Chapter 3, Using the GPIO to Connect to the Outside World, explains how, if the Raspberry Pi was just a $35 computer, that would be enough for many of us. However, the real power behind the Raspberry Pi is the ability of the developer to access the outside world through the use of the General Purpose Input Output (GPIO) pins. In this chapter, we will delve into the GPIO and start to connect the Raspberry Pi to the real world. We will create a Morse code generator for our project using an outside LED and then use this generator to blink out simulated weather information.

Chapter 4, Subscribing to Web Services, explores a few web services offered by some of the biggest companies in the world. Our project will use the virtual version of the Raspberry Pi Sense HAT as a ticker to display current weather information from the Yahoo! Weather web service.

Chapter 5, Controlling a Servo with Python, introduces the concept of creating an analog meter needle using a servo motor connected to the Raspberry Pi.

Chapter 6, Working with the Servo Control Code to Control an Analog Device, continues the theme of working with servo motors as we build our first real IoT device, a weather dashboard. Not only will this weather dashboard feature an analog needle; it will use the needle to point to a picture of a suggested wardrobe based on the weather conditions.

Chapter 7, Setting Up a Raspberry Pi Web Server, goes into how to install and configure the web framework CherryPy. We will conclude the chapter by building a local website that displays weather information.

Chapter 8, Reading Raspberry Pi GPIO Sensor Data Using Python, covers how to read the state of a button before moving on to a PIR sensor and distance sensor. We will conclude the chapter by building simple alarm systems.

Chapter 9, Building a Home Security Dashboard, explains how to build a home security dashboard using the Raspberry Pi as a web server serving up HTML content containing sensory data collected from the GPIO.

Chapter 10, Publishing to Web Services, goes into how to measure room temperature and humidity and publish these values to the web through the use of an IoT dashboard. We will also set up and run a text messaging alert using the service Twilio.

Chapter 11, Creating a Doorbell Button Using Bluetooth, turns our focus to using Bluetooth in this chapter. Bluetooth is a wireless technology that allows for transmission of data over short distances. For our project we will explore the BlueDot app from the Android Play Store. We will use this app to build a simple Bluetooth connected doorbell.

Chapter 12, Enhancing Our IoT Doorbell, will take the simple doorbell we created in Chapter 11, Creating a Doorbell Button Using Bluetooth, and turn it into an IoT doorbell using the knowledge we learned in Chapter 10, Publishing to Web Services.

Chapter 13, Introducing the Raspberry Pi Robot Car, starts us off on our journey into the IoT robot car by introducing This Amazing Raspberry-Pi Automated Security Agent (T.A.R.A.S). This chapter will begin by outlining the components we need to build T.A.R.A.S and then we will proceed to putting it all together.

Chapter 14, Controlling the Robot Car Using Python, goes into how to write Python code for our robot car. We will utilize the GPIO Zero library to make the car wheels move forward, move the servo motors holding the camera, and light up the LEDs at the back of the robot car.

Chapter 15, Connecting Sensory Inputs from the Robot Car to the Web, helps us understand that in order to turn our robot car into a true IoT device we have to connect it to the internet. In this chapter we will connect the distance sensor from our robot car to the internet.

Chapter 16, Controlling the Robot Car with Web Service Calls, continues to turn our robot car into an Internet of Things device by taking a deeper look at the internet dashboard we created for the robot car.

Chapter 17, Building the JavaScript Client, moves our attention away from Python, switching our focus to JavaScript instead. We will use JavaScript to build a web-based client that communicates over the internet using the MQTT protocol.

Chapter 18, Putting It All Together, covers how we will connect our robot car, T.A.R.A.S, to a JavaScript client, and control it over the internet using the MQTT protocol.