Reader small image

You're reading from  Internet of Things from Scratch

Product typeBook
Published inFeb 2024
PublisherPackt
ISBN-139781837638543
Edition1st Edition
Right arrow
Author (1)
Renaldi Gondosubroto
Renaldi Gondosubroto
author image
Renaldi Gondosubroto

Renaldi Gondosubroto is an accomplished software engineer and developer advocate in the tech community. With a wealth of experience in developing proprietary and open-source solutions, he has made significant contributions to numerous organizations and communities. Currently, he holds all 12 AWS certifications, along with 20 Microsoft Azure certifications. He has a Bachelor of Science in Computing and Software Systems from the University of Melbourne and a Master of Science in Computer Science from Columbia University. Outside of the industry, he is active in the academic community, with his research focused on IoT and Artificial Intelligence. Having spoken at over 40 events, conferences, and workshops, he has been an international speaker for the past six years, sharing his experiences and projects. He aims to build open-source solutions and deliver content that can help people achieve more value in what they do and promote best practices for practitioners.
Read more about Renaldi Gondosubroto

Right arrow

Creating Applications on the Edge

Edge computing is a nascent technology that facilitates the processing of data near or at its point of generation, rather than in a central hub such as the cloud. This will break down a centralized computing problem and instead create a decentralized, distributed way of processing data, allowing for real-time decision-making, faster response times, and a reduction in data transmission costs. This enables you to cut costs associated with traditional investments required for centralized data processing, such as setting up a data center or cloud infrastructure. Instead, you can utilize the same devices used to collect the data to perform a portion or all of the required processing work.

Often, this is a solution that many turn to when they start looking at bigger, more complex workloads. In many cases, challenges such as processing multiple streams of data that may involve hundreds or thousands of streams at the same time in a centralized system may...

Technical requirements

This chapter will require you to have the following hardware and software installed:

  • Hardware:
    • ESP32 microcontroller
    • DHT11 temperature and humidity sensor
    • Keyestudio Arduino Super Starter Kit
    • Ultrasonic distance sensor (HC-SR04)
    • Servo motor (SG90)
    • Red, yellow, and green LEDs
    • 220-ohm resistors
    • Breadboard
    • Jumper wires
  • Software:
    • Arduino IDE
    • TensorFlow
    • TensorFlow Lite

TensorFlow

TensorFlow is an open source software (OSS) library and platform for machine learning (ML) and deep learning (DL) that was developed by the Google Brain team. It is very popularly used within industry, academia, and research due to its performance, flexibility, and scalability. It allows developers to design and build ML models that are both on cloud-based platforms and edge devices. This includes a wide variety of features such as model training and deployment, data visualization, and distributed computing.

In this chapter, we will be using TensorFlow as a service to run an...

Edge computing fundamentals and its benefits for IoT

As mentioned previously in the chapter, there are a great many benefits that are derived from edge computing. However, its nature of implementation is different than the paradigms of implementation based on the IoT networks we’ve seen thus far.

In this section, we will be examining the architecture and the benefits of edge computing, understanding more about how components within an edge network perform and where it sits within the overall picture of IoT.

Edge computing architecture

Edge computing architecture is generally composed of four different layers that play a role in the successful deployment of the network. There are two types of processing: near edge and far edge. Near edge refers to processing and data handling that occurs close to the IoT devices, often within the same local network or facility, optimizing for low latency and immediate response. Conversely, far edge involves processing done at more distant...

Requirements of IoT for edge computing

One of the biggest challenges of edge computing is understanding the proper allocation of resources, given its unique setup and the constraints that it provides. Having to set up resources in a decentralized way may seem simple in theory, though they pose a lot of considerations. In the following subsections, we highlight several requirements that are required as part of managing resources and understanding the laws of IoT that govern how we decide to construct our networks.

Resource management

Managing resources within IoT for edge computing is very important, as there are costs to consider as part of the requirements. The following are some common considerations:

  • Scalability: This refers to having the network address many edge devices with differing capabilities and types, ensuring that they work and interoperate with each other well through the appropriate communication protocols.
  • Security: Selecting a proper security mechanism...

Optimizing edge computing on networks

Optimizing edge computing on networks is a crucial step in ensuring that edge devices are utilized effectively and efficiently. In this section, we will explore various strategies for optimizing edge computing workloads, including workload distribution, resource allocation, data processing techniques, and security considerations. By understanding and applying these strategies, developers and system architects can harness the full potential of edge computing, delivering efficient, responsive, and secure IoT solutions. Additionally, we will briefly touch on optimizing the network infrastructure and communication protocols to be able to achieve this while also learning how to evaluate edge networks and will finally use all these tools to look at a smart city case study.

Strategies for optimizing edge computing workloads

We will discuss three main strategies to optimize edge computing workloads: load balancing, resource allocation, and data management...

Practical – smart traffic control with edge computing

In this practical, we will create a simple yet effective smart traffic control system using an ESP32 microcontroller. This project will utilize edge computing to analyze and optimize traffic flow at an intersection in real time. By the end of this practical, you will understand how IoT benefits from edge networks and learn how to architect simple edge deployments.

Assembling the circuit

Now, we must wire up the circuit. Instructions for doing so and a corresponding diagram have been provided for your convenience as follows:

Figure 6.6 – Connection diagram for the practical

Figure 6.6 – Connection diagram for the practical

  1. Connect the ultrasonic distance sensor (HC-SR04) to the ESP32 device. Connect the VCC pin to 5V, GND pin to GND, Trig pin to pin 17, and Echo pin to pin 18 of the ESP32 module.
  2. Connect the servo motor’s (SG90) VCC pin to 5V, GND pin to GND, and data pin to pin 16 on the ESP32 module.
  3. Connect...

Summary

In this chapter, we learned the fundamentals of edge computing and discussed the benefits that can be derived from it. Although it certainly requires more understanding of its setup and has its own set of challenges based on the decentralized network it needs to abide by, it provides a cost-effective way for large workloads to be performed while ensuring that they do not get congested when they are directed toward a centralized hub, as with most solutions. We looked at an exercise where an edge device in the form of an ESP32 device was built to retrieve information from a DHT11 sensor and used for both obtaining data and running an ML model on it, seeing how powerful edge computing can be. Toward the end, we also did a practical on creating a simple network for edge computing and further learned about strategies that can be used to optimize edge networks, evaluate them, and make appropriate design decisions based on them, while also applying the knowledge that we have learned...

Further reading

For more information about what was covered in this chapter, please refer to the following links:

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Internet of Things from Scratch
Published in: Feb 2024Publisher: PacktISBN-13: 9781837638543
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Renaldi Gondosubroto

Renaldi Gondosubroto is an accomplished software engineer and developer advocate in the tech community. With a wealth of experience in developing proprietary and open-source solutions, he has made significant contributions to numerous organizations and communities. Currently, he holds all 12 AWS certifications, along with 20 Microsoft Azure certifications. He has a Bachelor of Science in Computing and Software Systems from the University of Melbourne and a Master of Science in Computer Science from Columbia University. Outside of the industry, he is active in the academic community, with his research focused on IoT and Artificial Intelligence. Having spoken at over 40 events, conferences, and workshops, he has been an international speaker for the past six years, sharing his experiences and projects. He aims to build open-source solutions and deliver content that can help people achieve more value in what they do and promote best practices for practitioners.
Read more about Renaldi Gondosubroto