Usage of MQTT
In real world the MQTT is used in exchanging of data between MES manufacturing execution center SCADA system supervisory control and data acquisition. MQTT protocol can help anyone in monitoring infrastructure remotely.
Application required for virtual iot
Setup Virtual Sensor (Publisher)
Virtual Sensor is an easy way to generate sensor data in JSON format without having a real life sensor.
With the help of virtual sensor we can visualize real life iot and can get the data of the sensor with virtual sensor we can perform the real life iot experiment so that we can perform our experiment without any hardware. In this virtual sensor we get some options
To download and install virtual sensor just follow the link given below
Options in Virtual Sensor
Running virtual sensor
By default virtual-sensor send data to local MQTT server and publish data on “sensors/temperature/data”
Virtual sensor name and value can be customized using different options like –name, –min, –max.
Install Mosquitto service
Virtual sensor need a MQTT broker to send data. Which can be installed on localhost or any other server.
There are multiple MQTT broker service available on internet as well some applications also provide GUI interface with services.
Here we are going to use mosquitto service for MQTT broker for some reasons.
To install mosquitto service in Debian based system run the following command.
- apt-get install mosquitto
- Starting mosquitto service
- Service mosquitto start
Installation of MQTT Explorer
MQTT explorer is the GUI dashboard which can connect to MQTT broker and monitor the receiving sensor data.
To Download MQTT Explorer follow the below link.
Now go to assets and the appropriate file as per operating system. Here we will be downloading AppImage format.
after this your MQTT Explorer will be downloaded and to run this we need to make the file executable.
Now execute MQTT Explorer (./MQTT-EXPLORER-0.3.5.AppImage)
And finally you will have a GUI
Running Virtual-Sensor & Monitoring visualization:
Run virtual-sensor as a light sensor where –i represents the MQTT Broker IP Address
Now execute the following command
node virtual-sensor.js –name “light-sensor” –min=300 –max=500 –i “IP_ADDRESS”
it will make Virtual Sensor to connect with MQTT broker.
Now Connect MQTT Explorer to MQTT Broker and we can see all the sensor data coming to broker and visualize it.
Using the above technique we can make a whole IoT network. Our Cyber Range is a complete infrastructure with features like vulnerable IoT, Adversary Simulation , LMS (Learning Management System), Red and Blue Training