Book Image

Internet of Things from Scratch

By : Renaldi Gondosubroto
Book Image

Internet of Things from Scratch

By: Renaldi Gondosubroto

Overview of this book

Develop the skills essential for building Internet of Things solutions with this indispensable guide. In an era where industries heavily rely on IoT, this book will quickly familiarize you with its foundations, widespread use, implementation guided by best practices, and the crucial technologies that allow it to work effectively. Starting with the use of IoT in real-life scenarios, this book offers comprehensive insights into basic IoT hardware, protocols, and technologies. You’ll then learn about architecting and implementing solutions such as wireless sensor networks, cloud computing with AWS, and crucial security considerations. You’ll understand how these systems are operated and monitored over time and work with simple to complex, industry-grade systems, adhering to best practices. In later chapters, you’ll be apprised of future IoT trends and strategies to manage the risks and opportunities that come with them. You’ll also get to grips with a diverse set of tools, including hardware such as ESP32 and Raspberry Pi, and software such as Mosquitto and ChatGPT for generative AI capabilities. By the end of this IoT book, you’ll be able to independently build and design complex, industry-standard solutions fully aligned with best practices.
Table of Contents (22 chapters)
1
Part 1: Getting Started with the Internet of Things
6
Part 2: Developing and Optimizing IoT Systems for Smart Environments
11
Part 3: Operating, Maintaining, and Securing IoT Networks
16
Part 4: Delving into Complex Systems and the Future of IoT

What is IoT?

IoT, coined by computer scientist Kevin Ashton in 1999, is the term used to refer to the continuously growing network of physical objects that are connected to the internet, having them send and receive data. These objects vary from objects you find in your everyday life, such as smart fridges and mobile phones, to objects spanning entire industries or even cities, such as smart agriculture and smart cities.

Starting from just within your home, IoT has revolutionized how we live and interact with our environment. Some benefits of IoT within the household include the following:

  • Increased convenience: Devices can be programmed and controlled remotely. For example, imagine adjusting your home’s lighting or heating using just your smartphone even when you’re miles away.
  • Energy efficiency: Smart thermostats or lighting systems can optimize their operations based on your usage patterns, saving energy and cutting down on utility bills.
  • Safety and security: IoT-enabled security systems and cameras can notify homeowners of potential breaches, and smart locks can grant or deny entry based on recognized users.
  • Health monitoring: Smart wearables and devices can track health metrics and provide real-time feedback, potentially notifying users or medical professionals of concerning changes.
  • Enhanced user experience: Devices can learn and adapt to users’ preferences, ensuring tailored and improved interactions over time.

Including the smart home, some vastly popular areas IoT has been implemented in can be seen in the following figure:

Figure 1.1 – Areas of use for IoT

Figure 1.1 – Areas of use for IoT

As can be seen, the applications of IoT reach beyond just smart homes; they also assist with smart vehicles by facilitating GPS tracking and allowing you to upload images online from your smart camera. What makes this extremely powerful is that many actions that are put through this system can be automated through actuators. Actuators convert a control signal sent from the internet to perform certain motions, such as locking doors, turning off lights, and many more. These actions can be set to take place based on thresholds that are exceeded. For example, if the temperature of a room dips below 15°C, a user can use a smart thermostat and remotely schedule it to turn off the air conditioning until it reaches a temperature of at least 25°C, at which point it will turn on again.

The vision of the IoT

The original vision of the internet since the era of the World Wide Web (WWW) intends to focus on providing the convenience of searching for information and communicating with others. The widely held vision of the IoT, on the other hand, built up further from there and aims to be able to create a world where convenience of life can be granted in the form of having everyday things that are connected to the internet that in turn can communicate between themselves and with people, allowing for a vast number of capabilities. We have already seen this in a myriad of industries, particularly how it has helped reduce the manual labor that is needed to perform certain tasks.

IoT is often seen as a convergence of three different visions: the Internet Vision, the Things Vision, and the Semantic Vision. Each of these visions has its own part to play within the dynamic picture of the IoT.

Figure 1.2 – Visions of IoT

Figure 1.2 – Visions of IoT

Things Vision

The Things Vision focuses on the technologies that are related to making things smarter; that is, those that can add capabilities to devices that allow them to communicated with the internet and with each other, alongside the data that they generate. The key aim here is to be able to gather and analyze data from a myriad of devices to gain insights and make better decisions. This is what has resulted in its evolution into smart sensor networks today.

Internet Vision

The Internet Vision focuses on the connectivity of the things that are connected to the internet and each other. The key aim of this vision is to be able to accelerate the ability and performance of the connectivity aspect as part of the IoT. As part of this, the storage and management of the data that has been gathered or generated is a key consideration, as it is important to understand the constraints, challenges, and opportunities of creating such solutions for the communication of the things. This was what led to the creation of many standards and communities, such as the open source Internet Protocol for Smart Object (IPSO) communities, which focus on finding solutions for smart sensor communication.

Semantic Vision

The Semantic Vision of IoT focuses on understanding the meaning of the data that is generated as part of the connected devices. It focuses on the challenge of interoperability; that is, how we can work with devices from different manufacturers and allow them to communicate with one another despite the different standards they may abide by. Interoperability is a big challenge within the industry, particularly with the different standards that many smart objects follow, and we are going to cover it in more depth in Chapter 8, Designing for Interoperability.

The evolution of the IoT

The concept of the IoT started with a lesser-known story based at Carnegie Mellon University in the 1980s, where a group of researchers developed a soda machine. The researchers wanted to track the content of the machine remotely, which led to them modifying the machine by installing a board that was able to obtain the status of indicator lights that show whether the sodas were currently stocked or empty. The status of each column within the soda machine was checked a few times per second. If a light went from off to on to off again in a matter of seconds, they would know that a Coke had been purchased. If the light stayed on for more than five seconds, it was assumed that the column was empty. With this kind of logic, alongside other indicators, they were able to create what the world regards as the first IoT-based machine.

Despite this, it was not until the 21st century that IoT really took off, powered by the development of low-cost and low-power consumption microelectromechanical systems (MEMS) sensors. This trend toward energy efficiency was crucial, especially as many IoT devices are battery-powered and need to operate efficiently for extended periods, so more hardware and software optimizations were made to conserve more energy. Another significant push came from the widespread adoption of internet-connected smartphones. The popularity of IoT further skyrocketed with the launch of the Raspberry Pi and the release of the IPv6 protocol, and now we have billions of IoT devices around the world. With technologies such as 5G and edge computing, it is only expected to grow further, as we can see how the performance capabilities of IoT networks only increase further with the new additions that are put forward by innovations.

Over time, there have been evolutions of concepts that have overlaps and may have been thought to be the same as IoT but are different. The next section presents comparisons to three main concepts: the web of things, machine-to-machine, and cyber-physical systems.

IoT versus the Web of Things

The Web of Things (WoT) is based on the connection and interoperability of smart devices through utilizing web standards and protocols. It aims to enable seamless communication and integration between a myriad of devices and systems without differentiating their underlying platforms. This usually uses web APIs to allow access for devices to interact with each other. IoT is about the connected devices themselves, but WoT is about the web infrastructure that allows the devices to interact and interoperate with each other over the web.

IoT versus machine-to-machine

Machine-to-machine (M2M) is based on the communication between two machines without the need for human intervention, which can be achieved through several technologies such as RFID or Bluetooth. IoT has a much wider range of applications compared to M2M, given that it is about the connection of an ecosystem of devices and systems, compared to the communication method of M2M, which is based on a closed system.

IoT versus cyber–physical systems

Cyber-physical systems (CPSs) are based on systems that integrate computational elements with physical components to allow for the capability of sensing, analyzing, and controlling physical processes. Such systems are intended to work in real time and are used in critical infrastructure such as emergency services, power grids, and transportation systems. Although they share common elements in the sense that they both use sensors and integrate computational and physical elements in powering actions to be taken, CPSs are usually more complex and pose more requirements based on the need for real-time performance and reliability.

The four pillars of IoT

There are four pillars of IoT that together form the IoT ecosystem, which ensures that devices can communicate with each other and other systems, enabling the generation of valuable data and insights.

Figure 1.3 – Four pillars of IoT

Figure 1.3 – Four pillars of IoT

Let’s understand these pillars.

Device

The first pillar of IoT is device, which refers to anything around you, including phones, cars, and other electronic appliances, that can connect to the internet. With its dependence on the internet, it requires a wireless network or other connectivity solutions to allow it to continually transmit data to the internet and support the other pillars of IoT. Because of this, the question of where the data is to be stored temporarily if the device cannot connect to the internet should be considered when picking the appropriate devices.

Data

The second pillar of IoT is data, which is all about the information that is obtained by the connected devices as part of the IoT network. This data is then further analyzed and used for various purposes, including improving the deployed network, making decisions, and more. This is a pillar we will be seeing clearly throughout the exercises that we do in this book, as we will be referring to it to improve our data-gathering systems and make better decisions based on them.

Connectivity

The third pillar of IoT is connectivity, which is about the transmission of data and ensuring that all the pillars are connected. The importance of this pillar increases with the need for real-time data processing where no interruption to the connection to the internet is imperative, as missing data points could alter the interpretation of a system. For example, there could be data points that are gathered from a smart fire alarm system that signals that there is a fire, but if it is not connected to the internet, this may not go through and the actuators that would have been put in motion to alert the fire emergency services and sprinklers would not work, putting lives in danger. Because of this, considering the environment of your use case and the different edge cases that you may need for your deployment to work effectively is paramount to any IoT system that we are looking to build.

Analytics

The final pillar of IoT is analytics, which is all about analyzing the collected data, whether it be directly on the device, on an edge location such as a gateway, or on the cloud. It is a powerful step in the data collection process, as it is all about interpreting the data that we have obtained and understanding how it will impact our decisions. Some workloads may have simple analytical processes, such as simply generating charts based on the data that is obtained to summarize important insights, while others may go through more strenuous workloads, such as letting machine learning models analyze them on the cloud to derive more insights from them.

Important note

It is important to note that other books or standards may propose other pillars of IoT, though, in reality, most of them abide by the principles of the four pillars just mentioned, as it really is the functionality that is communicated by the pillars. In this book, we intend to provide the principles that are most universal around the IoT community, as just seen.

Now that you have a good idea of what IoT is about, we can move ahead and explore how we can set up the development environment for this book.