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