MQTT Setup

Message Queuing Telemetry Transport

The MQTT protocol enables a publish/subscribe messaging model in an extremely lightweight way. It is useful for connections with remote locations where a small code footprint is required and/or network bandwidth is at a premium.

Steps to follow Paho-MQTT on x86 using python :

Step1: Make sure python & Internet -Enabled in your PC.

Step2: Create Folder(paho-mqtt) and copy the source : iot_pub.py ,iot_sub.py and other dependency files.

Step3: Terminal-1: python iot_pub.py Terminal-2:python iot_sub.py //First - Model

Step4: Install “MYMQTT “ App in your Android Mobile and configure like. (a) Open App and goto settings and fill the broker name with : https://m2m.eclipse.org and remaining blanks are optional and Save it. (b) Open App and select subscribe fill with topic : phytec/iot/temp/mv (Ref:iot_pub.py )

Step5: Run :python iot_pub.py and verify the Data on your MQTT- App @ Dashboard.

Compilation Guide for paho-MQTT on x86 using C :

1.Extract the folder mqtt by following command: tar -xvf mqtt.tar.gz

2.Now enter the below make command, make

3. Wait for the compilation to be finished, compiled output binary files will be available in below path: cd build/output/samples/

4. cd mqtt/paho.mqtt.c_x86/src/samples is the path for your mqtt publish.c and subscribe.c if u have any changes copy your mqtt publish.c and subscribe.c file in above path

5. compile again, make

6.gopal@phytec:~/Work/mqtt/paho.mqtt.c_x86/build/output/samples$ ./MQTTAsync_subscribe (Terminal-1)

7. gopal@phytec:~/Work/mqtt/paho.mqtt.c_x86/build/output/samples$ ./MQTTAsync_publish (Terminal-2)

MQTTAsync_publish.c

MQTTAsync_subscribe.c

Compilation Guide for paho-MQTT on ruggedBoard:

Steps for configure MQTT:

1. Extract the folder mqtt by following command: tar -xvf mqtt.tar.gz

2.Run the env.sh script for arm-cortexa8 compiler.

3.Go to following location: cd mqtt/openssl/openssl-1.0.0j_arm/include/openssl/

4.Enter command 'pwd' and copy the path given by this command.

5.Now come back to the main folder and enter below path: cd mqtt/paho.mqtt.c_arm/ open the ReadmE file and paste the copied path of pwd above, save.

6.Now enter the below make command, by putting the copied path in step 4: make

7.Wait for the compilation to be finished, compiled output binary files will be available in below path: cd build/output/samples/

8.cd mqtt/paho.mqtt.c_arm/src/samples is the path for your mqtt publish.c and subscribe.c if u have any changes copy your mqtt publish.c and subscribe.c file in above path .

9.compile again, make

10.Copy the Binary (MQTTAsync_publish) into home folder of ruggedBoard .

11.ruggedBoard# ./ MQTTAsync_publish.

12. view the Data on MQTT-App //Make sure to subscribe fill with Topic-Name.

---------Enjoy the MQTT Cloud experience-------

Last updated