IoT

How to develop an IoT solution with PubNub

How to IoT solution

IoT solutions are all about connectivity & data streaming at scale and PubNub enables you to get your IoT devices connected and globally communicating.  We provide you with a simple and flexible API and take away your infrastructure concerns, so all you need to worry about is gathering data. 

There are certain aspects that every IoT solution has in common:

  • Provision devices: Provide power to your device, get the device connected to a network, and securely configured. 

  • Acquire data: You commonly think of hardware sensors gathering data connected to an Arduino or similar but you can collect data from anywhere.

  • Distribute data: All endpoints that are acquiring data will distribute that data securely over the internet using WAN or WiFi.

  • Display data: Everyone loves a good dashboard, this is where all of the gathered data comes together to be presented.

  • Take action on the data: Especially with a large number of sensors, the amount of data can get overwhelming, and often all you care about are anomalies or unexpected readings. 


PubNub can help at every stage of your IoT solution but it is not an ‘IoT platform’.  PubNub provides publish/subscribe connectivity at a global scale with serverless functions, giving you a robust backbone for the data distribution, display, and action for any IoT solution.

Where to get started?

If you are new to PubNub, learn about how you can incorporate API mapping or check out our tour to help you understand the basics, including how to publish and subscribe to channels. 

To give you an idea of the sort of IoT application you could develop with PubNub, please check out our IoT dashboard demo:

IoT demo

The demo simulates moving sensors publishing data to PubNub and the dashboard allows you to communicate with those sensors, for example, to update a device’s firmware.

Once you have your devices provisioned and connected to the internet, PubNub offers a variety of SDKs that target common languages used in IoT solutions.  For a full list please check out our SDK docs page but we support POSIX C/C++, Python, Java, and MQTT (more later)

Communicating with your IoT devices

PubNub is based on publishing and subscribing to messages distributed via channels.  Communication is bidirectional, so your IoT devices can be remotely controlled and managed whilst at the same time, all reported data can be combined efficiently at a single point (like the dashboard) using the Stream controller.

There is no single recommendation to architect your channels but the diagram below shows how the demo handled communication between the dashboard and devices:

IoT demo channel topology

Our technical team can help you tailor an architecture to meet the exact needs of your app.

Why choose PubNub for your IoT solution?

  • Serverless Processing: PubNub Functions allow you to process, smooth, or take action on your data without any infrastructure.

  • Event-based Actions: Want to take action on a specific event, for example, if a temperature sensor gets too hot or a motion sensor detects movement then PubNub can trigger a webhook.

  • Reliability: PubNub offers 99.999% uptime for your critical IoT solution with low latency and high availability.

  • Flexibility: Major cloud vendor IoT solutions are designed to keep your data within their four walls.  PubNub allows you to easily and securely transfer data anywhere, including other cloud vendors. 

  • SDK support: Data can be produced by a huge variety of endpoints without complex setup and maintenance considerations.

MQTT support

The MQTT protocol is ubiquitous for IoT solutions.  If you are unfamiliar with MQTT then please see our MQTT Use Cases but in summary, it is a lightweight communications protocol designed to consume minimal power and bandwidth.

MQTT has a publish and subscribe communications protocol similar to PubNub, where clients subscribe to ‘topics’ and all communications go through a central server, referred to as a “broker”:


MQTT architecture high level

It is trivial to interface between an MQTT-based client and PubNub. 

We offer a custom MQTT broker that runs in our infrastructure, the ‘PubNub MQTT bridge’, which allows the PubNub SDK and any MQTT SDK to communicate with each other.  Your IoT client communicates with the PubNub MQTT bridge through standard MQTT APIs and the bridge is then responsible for communicating with the rest of the PubNub network.

This gives you the scalability and low latency of PubNub, combined with the power and data efficiency of MQTT.

Want to implement an IoT Solution?

A great place to start is our IoT Dashboard tutorial, which will walk you through:

  • The basic concepts of PubNub and building the demo application on your machine

  • How the application fits together and the chosen channel architecture

  • MQTT in IOT devices can interface with the dashboard

If you have a particular chipset then you can also check out our blogs on the NodeMCU 1.0 dev board, NodeMCU-32S dev board, or the MKR1000 dev board 

Want to discuss things further?  Talk to a technical sales representative.

Questions for the developer relations team?  Contact devrel@pubnub.com.