Connected devices, real-time push and the Web of Things

October 23, 2014

The EVRYTHNG platform is well-known for connecting FMCGs and other non-electronic objects (aka “dumb products“). While this is a market we’ve deployed a number of applications in, we’re also quite active on the other side of the IoT spectrum: connected devices.

To illustrate how the EVRYTHNG cloud can be used as a platform of choice for connected devices use-cases, I’m going to describe a prototype that we’ve created. It is based on our existing services as well as on one our latest components: THNG-push.

How to create a smart Street Lamp

The challenge behind the Smart Street Lamp prototype is simple:

  • Cities have thousands of street lamps, and these need to be managed.
  • Embedding IoT devices into these lamps streamlines their management, and creates a city-wide network of sensors.

Step 1: Creating Identities for the Street Lamps

Create Active Digital Identities with EVRYTHNG, connected devices, street lamps

The first step is to create identities for the street lamps. This is the core of the EVRYTHNG platform: giving every object a unique, crypto-secure identity in the form of a short URL that gets resolved by our scalable platform.

These identities can be encoded in QR codes, NFC tags or even in images but they can also be written into the memory of embedded devices.

This is precisely what we do for our prototype. Each embedded device attached to a lamp is created as a Thng in the EVRYTHNG Engine, and is assigned its own unique identity. The result of this first step is a nice inventory dashboard, giving us both a global and detailed view of the lamps we’re managing.

Step 2: Real-time Sensing

The next step is to add sensors to the embedded device in each lamp, and stream the environment data they register to the EVRYTHNG cloud.

As a Web of Things company, we love Web standards – so all our APIs speak REST over HTTP, the architecture of the Web. The big advantage of this approach to integrating real-world objects is the ability to directly communicate with protocols that all Web languages and tools “understand” via HTTP, thus greatly facilitating the creation of IoT applications.

However, the request-response nature of HTTP is often cited as one of the limitations for IoT use cases, as it does not necessarily match the event-driven nature of services provided by some things like wireless sensor networks. In the IoT world many use cases require the ability for things to push events while other things and apps passively listen for them. This type of communication is often referred to as pub/sub.

To overcome this shortcoming we created THNG-push. THNG-push is a multi-protocols broker that lets you use common real-time IoT protocols such as MQTT or the CoAP observer pattern, and translates them into Web protocols like HTTP (REST) and HTML5 Websockets.

In essence this means the EVRYTHNG platform understands the most widespread IoT pub/sub protocols and can deliver messages to other things on any of these protocols. Furthermore, we keep a focus on Web integration, by systematically translating these pub/sub protocols into REST and Websockets messages, enabling Web apps to talk to things without the need for further conversions. We act as an IoT interpreter: every thing can talk to every other thing and be understood in whichever language it chooses.

For this prototype, we used embedded devices (an OpenPicus Flyport and and an Arduino) to send regular updates of its sensory readings (temperature, light, pollution) to THNG-push over MQTT. In the EVRYTHNG world, these types of temporal values are best modelled as Properties; so all we have to do is to push an MQTT update to the corresponding properties. To update the value for the street lamp, we simply send an MQTT message to the /thngs/{thngId}/properties/light topic, POST a CoAP message to the resource coap:///thngs/{thngId}/properties/light or, for REST, POST an HTTP request to /thngs/{thngId}/properties/light.

Our own Dashboard (dashboard.evrythng.com, currently in public beta) subscribes to the /thngs/{thngId}/properties/light Websocket topic to get the updates, which can be seen in real time.

Notice how the light’s Property address (URI) remains the same across all protocols; so do the message content and authentication mechanisms. This allows for very seamless usage of cross-protocol communication.

Step 3: Real-time Actuation

With a similar technique, we can actuate the real-world and turn the lamp on or off by sending commands to the embedded device over MQTT or CoAP. To model these commands, the EVRYTHNG API provides Action resources, which can be customised to match your business domain. Just as for Properties, real-world objects can subscribe to Action updates via MQTT, CoAP or Websockets; or pull them via REST.

In the case of our prototype, we create a “_power” Action that can take “on” or “off” as a state, and subscribe the embedded device to it using an MQTT or CoAP subscription to the Action.

Step 4: The Web App

Creating an IoT Web App with the EVRYTHNG Engine, connected devices, street lamps

Finally, let’s imagine we want to create a Web app to enable citizens to view live sensor data (like temperature) or report that the lamp is faulty or broken.

As you know, the core proposition of EVRYTHNG is to offer an identity in the form of a URL and Web API for all things, so implementing this is very easy.

We first make the Web identity of the lamp machine readable by writing it in a QR code, and setting up a redirector for the lamp’s URL to our Web App. Both steps can easily be done programatically or through our Dashboard interface.

Setting up an IoT Web App with EVRYTHNG, connected devices, street lamps

When a citizen uses their mobile phone to scan the QR code or NFC tag we’ve placed on each lamp, the EVRYTHNG Engine will redirect her to the right Web app, and will communicate to the Web app the identity of the lamp (i.e. the Thng) that was scanned. The Web app can then use this identity to fetch real-time data about the lamp via Websockets.

What’s more, the Web app can send commands to the lamp (for example, turning it on or off) via REST, thanks to the EVRYTHNG Engine’s ability to translate these requests into MQTT or CoAP requests that the embedded device in the lamp listens for.

And that’s it: we’ve shown how the EVRYTHNG platform facilitates M2M communication as well as Web of Things use cases, where Web apps communicate with the people, physical world and the virtual world in a seamless manner.

EVRYTHNG's smart street lamp prototype, connected devices

It’s worth noting that all the elements used in this prototype are available for free for individual developers, so register for your EVRYTHNG developer account today! THNG-push is currently in private beta; please contact us if you’re interested in using it for your projects.

ABOUT THE AUTHOR: Dominique Guinard

Dominique Guinard

Additional Legacy Content

RECENT NEWS

Smart Recycling Propels Consumer Goods Industry into the Circular Economy
Learn More
RECENT NEWS

GS1 Digital Link Tools
Learn More
RECENT NEWS

EVRYTHNG’s Support for the GS1 Digital Link (a.k.a. the only barcode you’ll ever need)
Learn More
RECENT NEWS

August 15, 2018

Upgrading the Barcode to the Web: GS1 Digital Link
Learn More
RECENT NEWS

The Ledger of Every Thing: a report on blockchain & IoT
Learn More
RECENT NEWS

EVRYTHNG Brings the Power of Product Digitization to Asia
Learn More
RECENT NEWS

EVRYTHNG… Pioneering the Way for Consumer Product Brands
Learn More
RECENT NEWS

Supply Chain Transparency and Cryptocurrency Rewards with Every Drink
Learn More
RECENT NEWS

Introducing the EVRYTHNG Blockchain Integration Hub
Learn More
RECENT NEWS

Machine Learning, Connected Devices, and Drinking too much Coffee
Learn More
RECENT NEWS

EVRYTHNG – Origin Trail Integration: Adding Trust to Product Authenticity
Learn More
RECENT NEWS

Carrefour Tests Smart Recycling Powered by EVRYTHNG & recycl3R
Learn More