I thought I’d start with a definition so I searched the web only to find many but similar phrases. I even went to the IEEE and OMG both of which are in the process of developing standards for IoT. For RAILS I’m using AT&T’s introduction sentence to their IoT website “The Internet of Things links together networks, devices, and data” Just as there are multiple definitions there are several different protocols that are used to move the data between the devices. One of the more common protocols is Message Queue Telemetry Transport (MQTT) v5
MQTT is a simple and lightweight messaging protocol. It is a publish/subscribe architecture that designed to be open and easy to implement, with up to thousands of remote clients capable of being supported by a single server. Equally as important there a multiple implementations of the open source client software that are available for micro controllers such as TI-Tiva, Arduino and Raspberry PI. The following describes the high level features:
- Publish/subscribe: The MQTT protocol is based on the principle of publishing messages and subscribing to topics, which is typically referred to as a publish/subscribe model or sometimes abbreviated to pub/sub. Clients can subscribe to topics that are relevant to them. Then those clients only receive messages that are published to those topics. Alternatively, clients can publish messages to topics, which in turn makes them available to all subscribers of those topics.
- Quality of service levels: MQTT defines three quality of service (QoS) levels for message delivery, with each level providing a higher level of assurance the message gets delivered. However higher QoS levels are likely to consume more network bandwidth or subject the message to delays.
- Retained messages: With MQTT, the server keeps the message even after sending it to all current subscribers. If a new subscription is submitted for the same topic, any retained messages are then sent to the new subscribing client.
- Clean sessions and durable connections: When an MQTT client connects to the server, it sets the clean session flag . If the flag is set to true, all of the client’s subscriptions are removed when it disconnects from the server. If the flag is set to false, the connection is treated as durable, and the client’s subscriptions remain in effect after any disconnection. In this event, subsequent messages that arrive carrying a high QoS designation are stored for delivery after the connection is reestablished. Using the clean session flag is optional.
- Wills: When a client connects to a server, it can inform the server that it has a will , or a message, that should be published to a specific topic or topics in the event of an unexpected disconnection. A will is particularly useful in alarm or security settings where system managers must know immediately when a remote sensor has lost contact with the network.
The figure below shows my preliminary setup for implementing RAILS using IoT with TI-Tiva and ESP8266 micro-controllers.