Book Image

Mastering IOT

By : Colin Dow, Perry Lea
Book Image

Mastering IOT

By: Colin Dow, Perry Lea

Overview of this book

The Internet of Things (IoT) is the fastest growing technology market. Industries are embracing IoT technologies to improve operational expenses, product life, and people's well-being. We’ll begin our journey with an introduction to Raspberry Pi and quickly jump right into Python programming. We’ll learn all concepts through multiple projects, and then reinforce our learnings by creating an IoT robot car. We’ll examine modern sensor systems and focus on what their power and functionality can bring to our system. We’ll also gain insight into cloud and fog architectures, including the OpenFog standards. The Learning Path will conclude by discussing three forms of prevalent attacks and ways to improve the security of our IoT infrastructure. By the end of this Learning Path, we will have traversed the entire spectrum of technologies needed to build a successful IoT system, and will have the confidence to build, secure, and monitor our IoT infrastructure. This Learning Path includes content from the following Packt products: Internet of Things Programming Projects by Colin Dow Internet of Things for Architects by Perry Lea
Table of Contents (34 chapters)
Title Page
Copyright
About Packt
Contributors
Preface
Free Chapter
1
The IoT Story
Index

Modifying Hello LED using infrared sensor


We will continue our exploration of sensors by modifying our original Hello LED code. In this project, we will combine a distance sensor with our PIR sensor, and flash an LED based on the values of these sensors. This circuit will not only tell us that someone is approaching, but will also give us an indication of how close they are.

We will cover the following in this section:

  • Configuring a distance sensor
  • Taking Hello LED to another level

Configuring a distance sensor

We will start by configuring the distance sensor and running some code. The following is a circuit diagram of our distance sensor circuit:

The following are the connections to be made:

  • VCC from the motion sensor connects to the 5 V DC output from the Raspberry Pi
  • GPIO pin 17 connects to Trig on the distance sensor
  • Echo on the distance sensor connects to a 330 Ohm resistor
  • GND on the distance sensor connects to GND on the Raspberry Pi and a 470 Ohm resistor
  • The other end of the 330 Ohm resistor...