Table of contents

<< Previous

Next >>

Introduction :


In this post I will provide Step by step guide for communicating your BBB/Pi with Airvantage over MQTT.

I have used Paho - Open Source messaging for M2M , this guide to install Paho Python MQTT Client on My Raspberry Pi B+. As have not received my BBB so far. I am very much sure that the same steps will also work with BBB.


DIY Guide :


Step1 : Setup System with MQTT Support on Airvantage M2M cloud..


I have used this guide to setup System with MQTT Support on Airvantage Cloud.


Step2 : Test the system using MQTT Client..

I have used MQTTLens Google Chrome extension as easy to use MQTT Client for Test my system on Airvantage cloud from


here is screenshot of connection setup to Airvantage system on MQTTLens... Here username is system serial no and Password is system password...



First subscribe to <username>/messages/json topic then send json string with data....



here is screen shot of my System working on Airvantage cloud..


once airvabtage start responding to your MQTT pulish message then move to next step...


Step3 : install paho MQTT Python client on your Pi... from this guide

once installed creat new python file with your system credential...


import paho.mqtt.client as paho


def on_connect(pahoClient, obj, rc):
# Once connected, publish message
        print "Connected Code = %d"%(rc)
        client.publish("<username>/messages/json", "{\"machine.temperature\": 23.2, \"machine.humidity\": 70}", 0)

def on_log(pahoClient, obj, level, string):
        print string

def on_publish(pahoClient, packet, mid):
# Once published, disconnect
        print "Published"

def on_disconnect(pahoClient, obj, rc):
        print "Disconnected"

# Create a client instance

# Register callbacks
client.on_connect = on_connect
client.on_log = on_log
client.on_publish = on_publish
client.on_disconnnect = on_disconnect

#Set userid and password
client.username_pw_set(<userID>, <password>)

x = client.connect(host, port, 60)



name this file say or any thing of ur this file by command



U will see update on Airvantage cloud with your latest data....


In next post I will explore Airvantage API and creat real time python appilication on RaspberryPi with external inputs ... and will show this data on Airvantage cloud...