ruggedBOARD
Tutorial Using Python
Tutorial Using Python
  • Overview
  • Quick Start with RB
    • Pre-Requisite
      • Required Hardware and Software Components
      • Host Setup
      • Linux Commands
    • Power Up your RB
    • Fiddle with RB Command-line
  • Lib-Mraa & UPM Sensor Libraries (Python)
    • First Python Program
    • Know Your Libraries
      • LibMRAA
        • Python Programming using MRAA (SPI)
        • Python Programming using MRAA (PWM)
        • Python Programming using MRAA (gpio_blink)
        • Python Programming using MRAA (Aio)
      • LibUPM
    • Example Programs for Sensors
      • Procedure to interface phyNODE with RB
      • Accelerometer
      • Temperature Sensor
      • Pressure Sensor
      • Humidity Sensor
      • Magnetometer
      • PIR Sensor
      • Ultrasonic Sensor
      • Gas Sensor (MQ5)
    • mikroBUS UPM Sensor
    • Example programs for Communication Protocols
      • GPIO
      • I2C
      • UART
  • Hello World in C language
    • Setting up Environment
    • Transferring Files from Host to Board
    • Write your first C program
  • IoT Implementation
    • What is IoT?
    • IoT Protocols
    • MQTT Setup
  • Peripherals Functionality Testing using C Language
    • Interfaces
      • GPIO(General purpose Input/Output):
      • UART(Universal Asynchronous Receiver-Transmitter)
      • RS232
      • RS485
      • CAN
      • MikroBUS
      • mPCIe
  • Advance RB
    • Preparing SD card in case of OS failure
Powered by GitBook
On this page
  • Steps to follow Paho-MQTT on x86 using python :
  • Compilation Guide for paho-MQTT on x86 using C :
  • Compilation Guide for paho-MQTT on ruggedBoard:

Was this helpful?

  1. IoT Implementation

MQTT Setup

Message Queuing Telemetry Transport

PreviousIoT ProtocolsNextInterfaces

Last updated 6 years ago

Was this helpful?

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 : 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-------

https://m2m.eclipse.org