Want to know how IoT development works?


How IoT Works: Networking & Connectivity


Facebook Twitter Link

In this final installment of our “How IoT Works” series, we’re finally ready to tie everything together. We’ve built our IoT device, set up our AWS cloud back-end, and optimized our user-facing front-end for simplicity and ease of use. Now it’s time to connect the dots and see the true power of the Internet of Things.

At a high level, we’ve got a lot of different systems that need to talk to each other. These discrete parts each have their own requirements and constraints: they need to source data from different parts of the data pipeline, run their own calculations, provide varying degrees of fault-tolerance, and send messages to other devices.

CloudFlowchar_expanded (1)

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 also serving runtime information to a technician’s human-machine interface (HMI).

The main challenge, then, 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.

In many ways, the gateway wires together the parts of separate IoT stacks, making them indispensable to a successful IoT project.

IoT Gateway

Primarily, gateways connect devices to the cloud by reading signals coming in via streams such as Wi-Fi, Bluetooth, cellular, Ethernet, or a wired serial connection like I2C and then sending data over the internet on top of a TCP/IP stack.

However, gateways often also manage communications between devices, as well as offering a few other advantages.

Bandwidth and Latency

First, gateways save bandwidth and reduce latency. By aggregating, pre-processing, and filtering data, the gateway sends 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.

Gateways are also important from a security perspective; by acting as an intermediary between IoT devices and the internet, gateways are our first lines of defense.

Custom IoT Gateways


Very often builds customized gateways for our IoT technology, and it all starts with hardware. Our hardware team starts by thinking about the gateway’s requirements and then builds accordingly.

For instance, we might use a Raspberry Pi for a consumer IoT gateway with low compute requirements, while on the other side of the coin we could build a full-powered x86 server for an IIoT (industrial IoT) gateway that’s going to do a lot of heavy lifting.

With our hardware in place, it’s time to start coding. We generally write software for IoT gateways in three languages: Elixir, Python, and C.

Starting with our favorite, Elixir, this dynamic, functional programming language is 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 out the data pipeline that moves sensor data from the device to the cloud.

The other two languages are more well-known, and each have their own purpose. As a high-level programming language that’s well suited to data-intensive applications, Python shines when it comes to jobs like analytics and filtering.

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

We also employ some ready-made services that are built in these languages. One of our favorites is Tortoise, an Elixir-based MQTT client application that we use to publish information up to the cloud — don’t worry, we’re going to cover MQTT more in-depth soon.

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

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

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

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

Sign up for our newsletter

Join 10,000+ subscribers to get the latest IoT development news delivered to your inbox.

Communications Protocols


Between geographically dispersed devices, constrained network parameters, and the sheer number of systems that we need to link together in a full-fledged IoT solution, few things are more important than the right communication protocol.

That’s why Very uses MQTT as our IoT messaging protocol of choice.

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.

First, it’s lightweight and efficient. Second, it’s easy to scale up. Third, it’s reliable, even over unreliable networks.

Lastly, by using TLS encryption and client-side authentication, it’s secure.

Pub/Sub in MQTT

A key concept in MQTT is the publish/subscribe model, AKA pub/sub. This means that 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. 


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.


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

While 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.


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

Our cloud service, for instance, has exponentially more resources than an IoT device, allowing it to crunch big data sets and create valuable insights, but 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.

This concludes our “How IoT Works” series. Are you eager to learn more about how Very turns ambitious visions into reality? Check out our guide to IoT frameworks and best practices.

iot compliance guide