In this tutorial we will show how to use EasyIoT server MQTT client driver. MQTT client allows to connect EasyIoT server to different sensors with standard MQTT protocol.

MQTT is a machine-to-machine (M2M)/"Internet of Things" connectivity protocol. It was designed as an extremely lightweight publish/subscribe messaging transport. These characteristics make it ideal for use in constrained environments, for example, but not limited to:

  • Where the network is expensive, has low bandwidth or is unreliable
  • When run on an embedded device with limited processor or memory resources

In this example we will configure MQTT client driver to connect to public MQTT broker and then create one publish and one subscribe topic in EasyIoT server. In user interface we will change one topic (publish) and see if we receive change to subscribed topic and see change in EasyIoT server WEB interface. In real word this scenario makes no sense and it is shown just to learn how to configure MQTT client driver. Usually we subscribe and connect to sensors or some other software which implement MQTT broker.

 

First login to EasyIoT server interface and go to Configure->Driver->MQTT client driver and enable driver.

Add MQTT connection

Then add connection to MQTT broker (button Add connection). In our example we will connect to public MQTT broker available at broker.mqttdashboard.com. In your case you can use any other MQTT broker. Our broker does not require authentication so we leave username and password blank.

Next we will add MQTT publisher. Press button Add Node. This will add EasIoT server generic node. Select MQTT connection related to MQTT node. In our case we will select connection #1  broker.mqttdashboard.com. Then press add property to add property to this node. Name property "Sensor.DigitalValue" and add publisher topic in our case "mqttdotnet/subtest/pubtest1". Node property is now linked with publish topic. Change property to suits your sensor type and topic to suits your need. "Sensor.DigitalValue" is property suitable for Digital output node type. At the end press button Add node. Now we add one EasyIoT server node with one publish topic.

MQTT publisher

Next we will add one more EasyIoT server node subscribed to the same topic to display value of topic. We again press button Add Node and Add property and select same connection #1  broker.mqttdashboard.com. Name property "Sensor.DoorWindow" and enter subscribe topic "mqttdotnet/subtest/pubtest1". Node property is now subscriped to topic. At the end press button Add Node to add node to EasyIoT server.

MQTT subscriber

Now we added two nodes one with publish topic and one with subscribe topic. Next we add MQTT group and add newly created nodes. At the end we change node types. By default MQTT client drivers nodes are Generic types. We change this types to Digital output and Door/window sensor type. 

We can test our MQTT client driver. Switch on and off digital switch in EasyIoT server WEB interface and see if door/window status is changing. 

 

Forum discussion about MQTT client driver http://iot-playground.com/forum/mqtt-client-driver

 

See more tutorials at ​http://iot-playground.com/build

Buying guide

To support this site and EasyIoT framework development please buy in our store.

 

RASPBERRY PI 3 - Model B. 1GB RAM

New Raspberry Pi 3

Raspberry Pi 512MB Model B +

Raspberry Pi Model B+, ARM1176JZF-S Running at 700MHz, 512MB RAM.

Raspberry Pi 3 Ultimate Starter Kit - Wifi, HDMI, Breadboard, SD Card

Everything you need to build basic EasyIoT server on Raspberry Pi platform.

MICRO SD 64GB 32GB 16GB MEMORY CARD

USB STICK SIM Modem 7.2MBPS 3G Wireless USB Dongle

To control EasyIoT server by SMS message.

Acrylic Case Clear Transparent Shell Enclosure Computer Box Kit For Raspberry Pi

Acrylic Case Shell Enclosure for Raspberry Pi B+

Raspberry Pi to NRF24l01+ Shield EasyIoT server compatibile

Raspberry Pi to NRF24l01+ Shield EasyIoT server compatibile, Raspberry Pi, Raspberry PI B, Raspberry Pi 2

Prototyping Shield Module For Raspberry Pi

To build custom sensors and NRF24L01 transmitter/receiver on Raspberry Pi.

NRF24L01+PA+LNA SMA Antenna Wireless Transceiver communication module 2.4G

5V 2A Charger Micro USB

For Raspberry Pi or sensor modules, cheap and easy power solution.

USB Wifi Dongle Adapter 802.11n for for Raspberry Pi Model B+ B

No need for network cables on EasyIoT server. Use WiFI USB dongle.

 


Comments   

+1 #4 mustafa 2015-08-24 18:51
Quoting Super User:
Quoting mustafa:
No MQTT client driver in the server program v0.8.

How to add ?


MQTT driver is in v0.9 beta

http://iot-playground.com/forum/beta-release/329-beta-v0-9bx

Thanks
+2 #3 Super User 2015-08-24 16:17
Quoting mustafa:
No MQTT client driver in the server program v0.8.

How to add ?


MQTT driver is in v0.9 beta

iot-playground.com/forum/beta-release/329-beta-v0-9bx
+1 #2 Raj Badri 2015-08-21 20:06
works perfectly thanks
+1 #1 mustafa 2015-08-21 14:11
No MQTT client driver in the server program v0.8.

How to add ?

You have no rights to post comments

Forum latest

  • No posts to display.