loading

Hi there!
Today I write about MQTT and Edison. MQTT (Message Queue Telemetry Transport) consists in a M2M (Machine to Machine) communication protocol used for reporting events to another machines around the Internet (or in a local network). According to its architecture, it´s possible to have only one publisher and a lot (no limit reported) of subscribers.

One of the greatest highlights of this protocol is that MQTT is a lightweight messaging protocol (in processing, memory use and bandwhich), what makes it perfect for mobile devices and embbeded devices. For more details, please access this website: http://mqtt.org/

Here in this example I´ll show how to make Intel Edison writes on a LCD a message received from MQTT

Step 1: Setting Up Intel Edison for MQTT

Before setting up Edison for MQTT, please make sure your Intel Edison is up-to-date, and that pip is correctly installed and that there´s a repository configured.

To setting up Intel Edison, please follow these instructions:

- Get Mosquitto library for python typing this at console:
pip install paho-mqtt

Now, if everything is ok, you´re ready for make it real!

Step 2: Sending/receiving Messages

In this instructable, Intel Edison will work as a subscriber and a ready-2-go publisher will be used for sending messages to Intel Edison.

I used this online publisher(MQTTLens): https://chrome.google.com/webstore/detail/mqttlens...

It is a free online Google Chrome application for Subscribe ou Publish MQTT. For this example, set up the configurations like is shown below:

Hostname: test.mosquitto.org (choose tcp:// on left combobox)
Port: 1883
Topic: MQTTEdison

Now, execute the attached Python script in Intel Edison´s (it is full of comments, really easy to understand) and send messages in MQTTLens. Your message will be shown in LCD!

Here, there´s a video of a application for MQTT and Edison. In this case, I wrote a webpage that connects to websocket of Mosquitto, so I can publish messages using a simple Browser in a computer, smartphone, tablet, etc.

Link of the video: https://www.youtube.com/watch?v=-UeEbfzOYrw

Hi,<br>Great post.<br>This is a request for guidance.<br>My ESP8266 module connects to &ldquo;test.mosquitto.org&rdquo; and subscribes to a topic say &ldquo;b1&rdquo;. What ever is published to &ldquo;b1&rdquo;, it can read it immediately.<br>Problem happens when my second ESP8266 module subscribes to &ldquo;test.mosquitto.org&rdquo; to &ldquo;b1&rdquo;. It continuously returns :<br><br>WiFi connected<br>IP address:<br>192.168.0.9<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected<br>Message arrived [b1] 0<br>Attempting MQTT connection&hellip;connected<br><br>Could you kindly suggest what might be going wrong. I look forward to your advice.
Hi siddhc.<br><br>First of all, thank you for reading the post!<br>Based on your situation's description, it seems to me that both ESP8266 have the same deviceid / mqttid. Every broker has a rule: two clients with the same device id cannot communicate at the same time. So, the connection of one of them is immediately dropped (and considering your ESP8266 is programmed to retry MQTT broker connection, it goes into this &quot;loop of death&quot;).<br>I suggest you change the device id of one of your ESP8266. It may work.<br><br><br>Best regards,<br>Pedro Bertoleti.

About This Instructable

2,461views

16favorites

License:

More by phfbertoleti:On-line Radio Receiver in Linux MQTT and Intel Edison - Intro Intel Edison - Creating Socket TCP program using GCC and Linux 
Add instructable to: