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

Designing a simple IoT system diagram

Designing an IoT diagram is a skill that you will need to pick up and get familiar with when working with system/network deployments, especially in designing and presenting industry-grade solutions within the industry, as you will be architecting solutions and showing your thought processes behind certain design choices. The technical depth of your design will also differ from user to user. For example, a CIO might not care that much about the full list of services that you use on AWS to ingest, process, and analyze data that you have obtained on your sensor and have sent to be processed; rather, they would just like to see how it works overall. The technical depth may be more suited for an engineering manager or another developer on the team to help them better understand the design choices that are being proposed and why certain choices have been made. This will also serve as a reference for you to go back to when considering which parts of the architecture you can revise in the future.

In this section, we will start by looking at two high-level design flows: one for the flow of a smart lightbulb’s communication with a user interface and one for a design flow that is based on AWS. In the following chapters, we will be discussing how to create more complex diagrams, so this will help you get used to how these flows can be represented and what the best practices are to make them presentable to your target audience.

A high-level design flow for a smart lightbulb

In this diagram, we can see the design flow of how a smart lightbulb communicates to reach the user interface:

Figure 1.8 – Communication flow diagram of a smart lightbulb

Figure 1.8 – Communication flow diagram of a smart lightbulb

To start off with, we can assume that we have a smart lightbulb that is able to detect a change to its state; that is, when it is turned on and off. The smart lightbulb—fitted with a sensor—communicates its ON status to the gateway. This gateway can be a Wi-Fi router, which then transmits the status to the AWS cloud. The AWS cloud then uses a service such as Amazon Simple Notification Service (SNS), which sends a notification to the user’s phone stating the lightbulb has been turned on.

This simple flow illustrates at a high level the communication flow. As you can already tell by seeing the picture and reading the description (or if you are already familiar with AWS), we have omitted illustrating the services that oversee receiving and delivering the communication from the gateway and to the phone. As mentioned, we have intended this to be a high-level overview of the process. In the next chapters, you will see more of the inner workings of the infrastructure and learn about how the message gets passed through more deeply.

Now, here are a couple of exercises for you to try out yourself:

  • Draw a diagram that illustrates the flow of a smart fridge alerting a user’s laptop that it is currently empty
  • Draw a diagram that illustrates a user’s phone alerting another phone through AWS that it is lost

For your drawings, you can find a lot of tools either offline or online that can help you draw properly. Some tools that you can use for this may be the following:

  • Draw.io and Lucidchart: Both are great free online tools that you can use to create different types of diagrams.
  • Draw by hand: You can create drawings by hand, although it is best to do so digitally to make them easily editable and presentable later. In industry-based settings, drawings are almost always done digitally.
  • Microsoft Word and PowerPoint: These are great and convenient to make diagrams and sketches on due to the availability of different shapes and icons that you can search for, although it’s hard to make them scalable later.

Note that there are no correct or wrong answers here; simply design sample diagrams based on the technologies and flows that you have learned within this chapter!

A high-level design flow for AWS

Now, we will look at a sample of a design flow based on AWS; a zoom-into-the-cloud icon from the previous example, if you will. AWS diagrams can be created via AWS’ Workload Discovery tool or using other tools that were mentioned in the last subsection. If you do use other tools, AWS also provides a set of architecture icons to make illustrating your workloads much simpler, which can be found at https://aws.amazon.com/architecture/icons/.

In this example, we see the communication of a smart device storing data be processed further in a downstream application:

Figure 1.9 – Communication flow diagram of a smart device via the cloud

Figure 1.9 – Communication flow diagram of a smart device via the cloud

In this flow, we can see a smart device sending data to AWS IoT Core, which is a service that allows multiple IoT devices to connect at one time and route the messages accordingly, which, in this case, is to a lambda function. The lambda function then runs analytical workloads before storing the data in Amazon S3 and sends some that require further processing to a downstream application to be reported on.

As can be seen, these diagrams show in detail how communication occurs from a device to its endpoint. It is because of this that creating effective diagrams is key to communicating design decisions within architecting IoT solutions. It is also useful for your own documentation purposes to help you keep track of changes that you make to the solution.

We will discuss more about AWS, its cloud computing offerings, and its capabilities in helping us work with our IoT solutions in Chapter 7, Working with Cloud Computing to Power IoT Solutions.

With this, we have been able to get a high-level understanding of developing simple IoT system diagrams based on both smart objects and AWS, the latter of which will be imperative in our discussion in Chapter 7, Working with Cloud Computing to Power IoT Solutions as it plays a crucial role within the world of IoT. In the next section, we will discuss how we can dig deeper into the overview and how we can define the flows of processes and data of smart objects through further understanding how they move from source to destination.