IoT and the MQTT protocol

Emulating Internet of Things devices

IoT devices in Simumatik can be any component that uses the MQTT communication driver. In this course, we will take a look at a simplified home automation setup and make some modifications.

Install an MQTT broker

The first step is to install Mosquitto. Mosquitto is an MQTT broker that will be handling the communication between all of our IoT devices. After installation, Mosquitto will be running in the background as a service.

Emulate IoT devices in Simumatik

Now open the system “Showcase: MQTT” in Simumatik. This system includes a couple of IoT enabled devices. The sensor is set up to communicate with the lamp, and the wall switch communicates with one of the sockets (to which the fan is connected).

Let’s start by testing the system to make sure everything works. Remember to connect the gateway, this allows the components in Simumatik to send messages to the MQTT broker we just installed.

Now start the emulation and drop a product from the product_entry, the IoT_Lamp should light up (yellow). Then try pressing the switch, the fan should turn on.

The devices in this system are communicating by publishing and subscribing to topics. Right now the setup is very simple. The IoT_Lamp subscribes directly to the topic that the IoT_Sensor is publishing to, and the same thing between the IoT_Wall_switch and the IoT_Socket.