MQTT

Back                  << Index >>

MQTT = Message Queuing Telemetry Transport


Installation


Simple publisher / subscriber app

We need a broker ( here we consider on the RPI ) :

mqtt_1

                                                  RPI Side

command lines

PC Side
RPI Side

python programs

PC Side
RPI Side

MQTT sensor app

terminal display

mqtt_2

PC Side RPI Side

adding GPIO Led Control

mqtt_3

PC Side RPI Side

web browser display : MQTT + socket io



SOURCE CODE

web browser can’t support MQTT ; we can make a bridge between our MQTT socket and a websocket.
Here is an example with nodejs:

mqtt_4

Raspberry PI Side

In a first terminal :

In a 2nd terminal :

PC Side

Open a web browser and write “192.168.0.2:8080”


Adding Security

Authentification

TLS Encryption

cf server_ssl_tls.html


MQTT on Pycom board (micropython)

Installations

On atom, install Pymakr package.

Application



SOURCE CODE

We suppose mosquitto broker is at address “192.168.200.179”.

main.py

Once the program is running on pycom, in a terminal :


Back                  << Index >>