5. The MQTT Protocol

NodeRED supports many network protocols, such as UDP, TCP, HTTP, and MQTT. The MQTT protocol is very popular in IoT devices because it is lightweight and easy to use. For example, the MQTT protocol allows controlling actuators over the Internet or reading the values of remote sensors.

5.1 Publish / Subscribe

Unlike HTTP with its request/response method, MQTT implements a publish/subscribe architecture. In HTTP, a point-to-point connection with request and response is common. The transmission in MQTT works differently: devices that have something to report simply send their data to the broker (central server in the IoT system), that is, they publish their messages. The broker forwards these messages to other devices that have subscribed to these messages.

Devices that can be networked with MQTT include:

All devices connected to an MQTT broker are also referred to as MQTT clients. An MQTT network thus consists of several MQTT clients and one MQTT broker.

5.2 Example in the Local Network

It is not always necessary for the data to be accessible on the Internet. For example, if you only need sensor signals within your own home, networking in the local network is sufficient.

A local MQTT broker runs in the dollhouse. This is only accessible within the same network (in this case, the IoTB WLAN).

 

5.2.1 Investigating the Flow

5.2.2 Heating Control Task

Now it's your turn! Get the temperature control running!