DEV Community

Jacob Baker
Jacob Baker

Posted on

MQTT Use Cases

Each of these example projects use an mBed microcontroller and SIM5230 3G modem.

1. Remote Device, Single Sensor

This project requires a remote device send data from a single sensor over GPRS/3G. Data should be uploaded each minute to a remote server that does light processing on the data and displays it to the user.

2. Remote Device, Multiple Sensors, Bi-Directional Communications

This project is similar to Project A except it requires bi-directional communication. The settings on the device are periodically updated by administrators. Remote control of a relay is also required.

MQTT plays nicely in to this scenario because of its publish/subscribe architecture. Remote devices can initiate a persistent connection with a long keep-alive delay and periodically monitor a topic for messages from the server.

This method uses a smaller amount of bandwidth compared to traditional polling mechanisms as the keep-alive messages are a couple of bytes, and the device is not constantly checking for updates where none exist.

Having a persistent connection means that, unlike HTTPS, the TLS handshake does not happen each time a request is made as the connection is not being rebuilt each time.

3. Remote Device, Single Sensor, HD Images

Unlike the previous projects this project triggers a camera when a sensor’s threshold exceeds a given value. The image is then sent back to the remote server. This project is not suited to a pure MQTT implementation due to the requirement of HD images.

Discussion (0)