How IoT Networks Work: A Comprehensive Overview

Very
How IoT Networks Work A Comprehensive Overview

IoT networks are complex ecosystems with multiple systems that need to communicate with each other seamlessly. These discrete parts have requirements and constraints. But how do IoT networks work? They each need to source data from different parts of the data pipeline, run calculations, provide varying degrees of fault tolerance, and send messages to other devices.

For instance, we may want to enable machine-to-machine (M2M) communications on a smart factory floor while simultaneously sending aggregated diagnostic reports to the cloud and serving runtime information to a technician’s human-machine interface (HMI).

The main challenge becomes creating a fluid, real-time communications ecosystem that keeps every part in sync.

While it’s possible for certain use cases to set up a direct channel between devices or between a device and the cloud, we usually choose to use an IoT gateway as a communications bridge.

The Role of IoT Gateways

IoT gateways are crucial in connecting devices to the cloud by utilizing various communication streams like Wi-Fi, Bluetooth, LoRa, cellular, Ethernet, or wired serial connections like I2C. They enable the transfer of data over the internet using the TCP/IP stack, ensuring reliable connectivity.

However, gateways often also manage communications between devices and offer a few other advantages.

Bandwidth and Latency

First, gateways save bandwidth and reduce latency. By aggregating, pre-processing, and filtering data, gateways send much less data to the cloud than individual devices would.

And, since the gateway sits much closer to the devices, often as part of the same LAN, they are ideal for applications that require real-time control or offline functionality.

From a security perspective, gateways act as the first line of defense by serving as intermediaries between IoT devices and the internet, enhancing overall system security.

Custom IoT Gateways: Tailored for Success

Some companies opt to build customized gateways for their IoT technology, and it all starts with hardware. When doing so, it’s important to remember to start by thinking about the gateway’s requirements and then build accordingly.

For instance, you might use a Raspberry Pi for a consumer IoT gateway with low compute requirements, while you could build a full-powered x86 server for an IIoT (industrial IoT) gateway that does a lot of heavy lifting.

Software for IoT Gateways

With your hardware in place, it’s time to start coding. Generally, you can write software for IoT gateways in three languages: Elixir, Python, and C.

Elixir is a dynamic, functional programming language tailor-made for IoT development. Its concision, fault tolerance, and concurrency are perfect traits for remote devices that don’t get much user interaction.

On the gateway specifically, Elixir factors into building the data pipeline that moves sensor data from the device to the cloud.

The other two languages are more well-known, and each has its purpose. As a high-level programming language well suited to data-intensive applications, Python shines in jobs like analytics and filtering.

Note: While Elixir can’t fully compete with Python for data-intensive applications at this time, it’s made huge strides in the last year, and it’s catching up fast.

On the other end of the spectrum, C is a low-level language that can give you more direct access to compute resources like CPU and RAM without requiring tons of processing power.

Ready-Made Services

Some companies also employ some ready-made services that are built into these languages such as Tortoise, an Elixir-based MQTT client application that can be used to publish information to the cloud.

Another common Elixir service is Phoenix, a web framework that lets you serve APIs and webpages locally while also providing a user interface for administrators to monitor and configure their IoT fleet.

Edge Computing

The last piece of the puzzle for most gateways is edge computing.

Let’s say, for example, that you’ve been using sensor data from an IIoT machine to train a machine learning (ML) algorithm for predictive maintenance to know when that machine is likely to break so that you can fix it beforehand.

Once you’ve trained that model, you can ship it to the gateway and use embedded GPUs to run it.

IoT Communication Protocols

When it comes to communication protocols, choosing the right one is crucial due to geographically dispersed devices, network constraints, and the need to connect numerous systems.

As with many situations in IoT development, the right decision depends on the use case. While there are numerous options for communication protocols used in IoT, we rely most often on MQTT. 

The MQTT Communication Protocol

Benefits of MQTT

Originally developed by IBM for communicating between oil pipelines and satellites, in recent years the MQTT protocol has become the de-facto standard for IoT messaging for a few reasons:

  1. It’s lightweight and efficient.
  2. It’s easy to scale up.
  3. It’s reliable, even over unreliable networks.

Another selling point of the MQTT protocol for IoT networks is the security it offers by using TLS encryption and client-side authentication.

Pub/Sub in MQTT

A key concept in MQTT is the publish/subscribe model, AKA “pub/sub”. This means clients, such as individual devices or gateways, publish their data to a centralized MQTT broker like Eclipse Mosquitto or AWS IoT Core.

The broker then sends that data to subscribed clients, depending on the data’s “topic.” For example, if a thermometer publishes the temperature, then a mobile app, a cloud database, and a smart thermostat could subscribe to that topic, causing the broker to send it their way once it receives the data. 

MQTT Features: QoS and More

Other useful MQTT features include quality of service (QoS), which gives a client the ability to choose a service level befitting the network’s reliability and application logic; retained messages, which give newly-subscribed clients an immediate status update after subscribing to a topic; and the Last Will and Testament feature, which automatically publishes a message if a client suddenly disconnects due to causes such as mechanical or network failure.

The HTTPS Communication Protocol

Besides MQTT, IoT solutions sometimes use HTTPS, the same protocol that fuels the internet by sending document-centric data between web browsers and websites.

HTTPS doesn’t have all the IoT-specific benefits of MQTT and testing shows that it’s 22% less energy efficient and 15% slower than MQTT. It often works for user-facing applications like web UIs and mobile apps.

Final Thoughts

A complete IoT network solution bears more resemblance to a community than a standalone product. Each member brings their strengths to the table, excelling at certain tasks and depending on other members.

Our cloud service, for instance, has exponentially more resources than an IoT device, allowing it to crunch big data sets and create valuable insights. Still, it relies on that device to generate data in the first place and then put its derived knowledge into practice.

That’s why connectivity is so crucial. By facilitating data flow between every corner of an IoT ecosystem, a robust connectivity framework brings the community together to achieve great things.

Author
Very
Very
Very is an IoT technology firm led by expert problem-solvers to create efficient, scalable solutions that move commercial, industrial and consumer IoT projects from pilot to production in record time. From smart products in homes and businesse...
Very is an IoT technology firm led by expert problem-solvers to create efficient, scalable solutions that move commercial, industrial and consumer IoT projects from pilot to production in record time. From smart products in homes and businesse...