1. Introduction to IOT
Chapter Goal: Understand What the IOT Is and How to Prototype IOT Devices
Topics Covered in This Chapter:
What is IOT
Choosing a Raspberry Pi Model
Choosing your IOT Device
Characterization of IOT Devices
Buying the right tools to deal with Hardware
Writing code in Python and in the Arduino IDE
The IOT is a name for the vast collection of things that are being networked together in the home and workplace (up to 20 billion by 2020 according to Gardner, a technology consulting firm). That is a very vast collection. And they may be underestimating it.
We all have large numbers of computers in a modern house. I just did a walkthrough of my house, ignoring my office (which is filled with another 100 computers). I found 65 different devices having embedded computers. Im sure I missed some of them. Now of those computer-based devices, I counted 20 of them that have IP addresses, although I know that I am missing a few (such as the thermostat). So in a real sense, this house has 20 IOT devices. And it is only 2016 as of the writing of this book. With over 100 million households in the United States alone, 20 billion IOT devices somehow dont seem so many.
So what are the three defining characteristics of the IOT?
Networking - these IOT devices talk to one another (M2M communication) or to servers located in the local network or on the Internet. Being on the network allows the device the common ability to consume and produce data.
Sensing - IOT devices sense something about their environment.
Actuators - IOT devices that do something. Lock doors, beep, turn lights on, or turn the TV on.
Of course, not every IOT device will have all three, but these are the characteristics of what we will find out there.
Is the IOT valuable? Will it make a difference? Nobody is sure what the killer application will be, but people are betting huge sums of money that there will be a killer application. Reading this book and doing the projects will teach you a lot about the technology and enable you to build your own IOT applications.
Choosing a Raspberry Pi Model
The Raspberry Pi family of single board computers (see Figure ). They have sold over 9 million of these small, inexpensive computers. The Raspberry Pi runs a number of different operating systems, the most common of which is the Raspian release of Unbuntu Linux.
Figure 1-1.
Raspberry Pi 2
Like Windows, Linux is a multitasking operating system, but unlike Windows, it is an open source system. You can get all the source code and compile it if you wish, but I would not recommend that to a beginner.
One of the best parts of the Raspberry Pi is that there are a huge number of device and sensor drivers available, which makes it a good choice for building IOT projects, especially using it as a server for your IOT project. The Raspberry Pi is not a low-power device, which limits its usage as an IOT device. However, it is still a great prototyping device and a great server.
There is a rather bewildering variety of Raspberry Pi boards available. I suggest for this book that you get a Raspberry PI 2 or Raspberry Pi 3. While the $5.00 Raspberry Pi Zero is tempting, it takes quite a bit of other hardware to get it to the point where it is usable. While the Raspberry Pi 3 is more expensive ($35), it comes with a WiFi interface built in and extra USB ports.
Note that we are using the Raspberry Pi A+ for building the IOTWeatherPi weather station later in this book. The reason for that is power consumption: one-half to one-third of the power used by the more powerful Raspberry Pi models.
There are many great tutorials on the Web for setting up your Raspberry Pi and getting the operating system software running.
Choosing an IOT Device
If you think the list of Raspberry Pi boards available is bewildering, then wait until you look at the number of IOT devices that are available. While each offering is interesting and has unique features, I am suggesting the following devices for your first projects in the IOT. Note that I selected these based upon the ability to customize the software and to add your own devices without hiding ALL the complexity, hence reducing the learning involved. That is why I am not using Lego-type devices in this book.
We will be using the following:
Characterizing an IOT Project
When looking at a new project, the first thing to do to understand an IOT project is to look at the six different aspects for characterizing an IOT project.
Communications
Processor Power
Local Storage
Power Consumption
Functionality
Cost
When I think about these characteristics, I like to rate each one on a scale from 110, 1 being the least suitable for IOT and 10 being the most suitable for IOT applications. Scoring each one forces me to think carefully about how a given project falls on the spectrum of suitability.
Communications
Communications are important to IOT projects. In fact, communications are core to the whole genre. There is a trade-off for IOT devices. The more complex the protocols and higher the data rates, the more powerful processor you need and the more electrical power the IOT device will consume.
TCP/IP base communications (think web servers; HTTP-based commutation (like REST servers); streams of data; UDP - see Chapter ) provide the most flexibility and functionality at a cost of processor and electrical power.
Low-power BlueTooth and Zigbee types of connections allow much lower power for connections with the corresponding decrease in bandwidth and functionality.
IOT projects can be all over the map with requirements for communication flexibility and data bandwidth requirements.
IOT devices having full TCP/IP support are rated the highest in this category, but will probably be marked down in other categories (such as Power Consumption).
Processor Power
There are a number of different ways of gauging processor power. Processor speed, processor instruction size, and operating system all play in this calculation. For most IOT sensor and device applications, you will not be limited by processor speed as they are all pretty fast. However, there is one exception to this. If you are using encryption and decryption techniques (see Chapter ), then those operations are computationally expensive and require more processor power to run. The trade-off can be that you have to transmit or receive data much more slowly because of the computational requirements of encrypting/decrypting the data. However, for many IOT projects, this is just fine.