Arduino Forum

Using Arduino => Networking, Protocols, and Devices => Topic started by: mahmood_arduino on Feb 19, 2013, 10:04 am

Title: MQTT
Post by: mahmood_arduino on Feb 19, 2013, 10:04 am
Hello,

I am aiming to implement MQTT feature on my Arduino mega 2560 board connected to a GSM/GPRS module. I do not have an Ethernet shield or a Wifly shield. Is it possible to implement this feature with a GSM/GPRS module ? Where can i get the relevant library ?

Thank you.
Title: Re: MQTT
Post by: nickgammon on Feb 20, 2013, 03:00 am
Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Other thread deleted.

- Moderator
Title: Re: MQTT
Post by: mahmood_arduino on Feb 20, 2013, 07:45 am
I am extremely sorry for that. I am new to this forum. Will take care from next time.
Title: Re: MQTT
Post by: mahmood_arduino on Feb 26, 2013, 08:34 am
Any suggestion guys ?
Title: Re: MQTT
Post by: nickgammon on Feb 26, 2013, 09:36 am
http://www.lmgtfy.com/?q=mqtt+arduino
Title: Re: MQTT
Post by: arduidude on Jun 03, 2013, 01:43 am
Hmm, I'm looking to do this too. MQTT seems a bit thin on examples.

Shame the only response was "use google" :(
Title: Re: MQTT
Post by: nickgammon on Jun 03, 2013, 11:39 am
Evidently no-one here knows much about it. However Google has:

Quote

About 24,700 results (0.25 seconds)


How to use this forum (http://arduino.cc/forum/index.php/topic,148850.0.html)

The OP might have provided a link to explain what MQTT is. Personally I haven't heard of it.
Title: Re: MQTT
Post by: arduidude on Jun 03, 2013, 01:04 pm
Ah OK, well for people (like me) who are interested but know nothing about it in detail, Message Queuing Telemetry Transport (MQTT) is a protocol defined by IBM that enables simple, low overhead messaging to be passed around a network and uses publish/subscribe principles for communication. It has been cited as an ideal method for low powered devices (such as arduino) or mobile devices to communicate with a service to get some state information or to publish a device's state. Twitter, Google and other trendy apps use this method already for pushing presence status to a device.

Jonathan Oxer (he of freetronics and SuperHouseTV fame) has indicated he thinks it is the way forward for federated home automation...

To the original poster: I have found the following resources to be interesting to Arduino projects

http://knolleary.net/arduino-client-for-mqtt/ (http://knolleary.net/arduino-client-for-mqtt/)
http://blog.m2m.io/post/30048662088/a-simple-example-arduino-mqtt-m2m-io (http://blog.m2m.io/post/30048662088/a-simple-example-arduino-mqtt-m2m-io)

I hope that is of some help.
Title: Re: MQTT
Post by: arduidude on Jun 03, 2013, 01:05 pm
Of course for more information, you could use: http://lmgtfy.com/?q=mqtt (http://lmgtfy.com/?q=mqtt)
Title: Re: MQTT
Post by: nickgammon on Jun 03, 2013, 10:39 pm
Very amusing, however see reply #4. :P

As the "how to use this forum" link suggests, and I know not everyone reads it, if you are going to ask a question about "help with X" it helps to provide a link to X, rather than make people who are trying to help you do extra research to even get started.
Title: Re: MQTT
Post by: chrylarson on Feb 11, 2014, 12:21 am
I wrote an updated tutorial:
http://chrislarson.me/blog/using-mqtt-connect-arduino-internet-things
Title: Re: MQTT
Post by: nithinkurian on Jul 22, 2016, 07:23 am
Arduino MQTT Library for SIM800 GSM Modem is available at ElementzTechBlog (https://elementztechblog.wordpress.com/2016/07/18/arduino-mqtt-library-for-sim800-gsm-modem/), ElementzGithubRepository (https://github.com/elementzonline/SIM800_MQTT)

Functionalities:

Auto connect

- Automatically connect to TCP and to MQTT server.

connect function

- This function can be used to connect your client to MQTT broker.
- Use only if you do not use Auto connect functionality.
- Optionally  you can use username, password, WILL topic and WILL
  Message.

OnConnect CallBack function

- This call back function is called when MQTT connection is
  established.

- You can call subscription and publish functions inside it (according to your need).

publish function
- This function can be used to publish messages to different topics.  
 
- You can select  QoS levels and RETAIN flag according to your need.

subscribe function

- This function can be used to subscribe messages from different
  topics.

OnMessage CallBack function

- This callback function is called when messages are received from
  subscribed topics

- Topic, TopicLength, Message, MessageLength are the arguments of
  OnMessage callback function.

- Inside this, you can write your custom code.

unsubscribe function

- This function can be used to unsubscribe from a previously subscribed
  topic.

disconnect function

- This function can be used to disconnect your client from MQTT broker.

Keep Alive

- You can specify your KeepAlive duration while initializing.

- Ping requests are sent and received automatically.

Subscribe Publish examples are also provided.