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

Realizing Wireless Sensor Networks within Smart Spaces

Wireless sensor networks (WSNs) consist of small, low-powered devices equipped with sensors, microcontrollers, and wireless communication capabilities. They consist of tiny sensor nodes that can communicate with each other and exchange data. These devices are usually deployed in large numbers to monitor a myriad of physical or environmental conditions, such as humidity, air, and sound. Once information has been obtained from the environment, the nodes then send it to a base station, which in turn sends the data to a wired network or performs an action, depending on the thresholds that have been set.

These networks use air as their transmission medium as part of wireless transmission. Compared to traditional wired sensor networks, they offer many benefits, such as cost-effectiveness and flexibility in deployment. Furthermore, they can nearly replicate the performance of wired networks, particularly with standards such as IEEE...

Technical requirements

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

  • ESP32-CAM
  • Single channel relay
  • 1 1k ohm resistor
  • Push button switch
  • Jumper cables
  • Breadboard
  • Mobile charger 5V/1A to use as a power supply
  • iPhone/Android phone (to run the Blynk app)

Here’s the list of software you’ll need for this chapter:

  • Blynk app
  • Arduino IDE

The Blynk app

Blynk is a platform that allows users to build graphical user interfaces (GUIs) with ease, which allows them to monitor and control IoT devices. It provides a wide number of widgets, such as buttons, sliders, or gauges, that can be added to the GUI and have specific actions linked to them or data points on the device. It can be downloaded as an app on iOS or Android and can serve as a bridge between the GUI and the device, allowing users to remotely control and monitor the device from the convenience of their smartphone or tablet.

We will...

Choosing between different sensor technologies

Choosing from the numerous existing sensor technologies to build the networks we have in mind can be quite a daunting task. In this section, we will show you how to use patterns and information from different technologies to better select which ones to use, as well as how to create more effective deployments as part of the networks that you create.

Classes of sensor networks

With the continued development of WSNs, a variety of solutions have been tailored to a variety of applications. This creates many types of network designs, where there are protocols for different layers that are put in place as part of the network. Here, we’ll discuss some of the main differences between various WSNs.

Data sink

One of the defining characteristics of a sensor network is how the data sink is provisioned. A data sink is a device that has the responsibility of collecting and storing the data generated by sensor nodes within a network...

Managing APIs

APIs are very important within WSNs as they help different components of the network communicate with each other. It operates within the application layer, allowing the layer to access the functions of the operating system, such as power management and data collection.

How they integrate within the system

APIs for WSNs can be provided at different levels, including the operating system level and the network level. An example of such an integration is how TinyOS provides an API that allows the application layer to access the functions that are provided by the operating system. At a network level, an API can provide an interface for the application layer to access the routing table, enabling it to find the best path for data transmission to be done. This can be implemented by different standard protocols such as MQTT or CoAP, two application protocols that we discussed in Chapter 3, Integrating Application Protocols.

APIs allow different software components to...

Evaluating WSNs

As mentioned multiple times in this chapter and throughout this book, one of the most imperative aspects of implementing a network is to understand how it can be best optimized. There are several key ways in which this can be done; one of them is through understanding metrics that are related to such networks and how we can apply them when we’re examining networks that we encounter. We will discuss these metrics and how you can use them to evaluate your WSN deployment, as well as other deployments that you come across to better understand how to optimize your own as well.

Metrics

In this section, we’ll look at different metrics that have to be considered when building WSNs:

  • Energy consumption: This metric measures the amount of energy that is used up by the WSN and is used to assess the energy efficiency of the network.
  • Network lifetime: This is a metric that measures the amount of time the WSN can operate before the batteries are depleted...

Practical scenario – step-by-step smart energy monitoring and management system

In this practical project, we will build a monitoring device to monitor the electricity usage of certain electrical devices (we’ll use a power distribution outlet connected to multiple electrical devices to monitor its electrical usage parameters). To monitor these electrical parameters, we will use the Peacefair PZEM-004T V3 energy monitor. The PZEM-004T module is a mains-powered module that measures the voltage, current, power, frequency, and power factor. It provides these values over a serial interface.

Important note

This project involves a direct connection to electrical lines. Please be aware that you’re exposing yourself to electrical hazards that can cause fire or be fatal. If you have no experience in doing this, then you’ll need to seek help from someone who has experience and understands the risks of connecting to electrical lines.

Requirements

You will...

Summary

In this chapter, we learned about the characteristics of WSNs and how we can architect them while incorporating best practices and considerations for ensuring that they can be well positioned to handle the different unique challenges that are posed by their setup compared to other networks, alongside the environment that they are deployed in. We learned more about commonly used APIs within protocol communication with IoT, such as the REST API. Then, we learned how to evaluate WSNs through metrics and understood the different models that can contribute to saving on power consumption within these systems. We took a deeper look into all this by getting hands-on and building our own WSN. We did this by creating a smart energy monitoring and management system based on what we have learned and applying Blynk as an associated IoT platform.

In the next chapter, we will further our understanding of network building by discussing building networks on the edge.

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 €14.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