4 Replies Latest reply on Apr 22, 2015 2:50 PM by AdamPippert

    MQTT Client Library not working on Edison/Galileo

    Pb1

      I'm trying to use the Edison as a sensor node connecting to an MQTT broker.

      I'm using the PubSubClient library for Arduino. Worked perfectly with my trusty Arduino Mega. When I tried the same on the Edison it compiled but never manage to connect to the MQTT broker. Tried with the Galileo and got the same result. I'm at a lost on how to debug this.

      Has any one tried this library on Edison or Galileo? Any luck?

      The MQTT client library can be found here: https://github.com/knolleary/pubsubclient

        • 1. Re: MQTT Client Library not working on Edison/Galileo
          CMata_Intel

          Hi Pb1;

           

          The reason of your problem is that you are using an Arduino library, even if you are using the Arduino expansion board for the Edison is not the same that an Arduino so your library is not working as it should be. You can try using Node.js.Take a look of these links, you will find interesting information:

          http://www.cloudmqtt.com/docs-nodejs.html

          https://github.com/adamvr/MQTT.js

          Or with the XDKIoT edition, take a look of this other link and check the documentation.

           

          Regards;

          CMata

          • 2. Re: MQTT Client Library not working on Edison/Galileo
            Pb1

            Thanks for the links.

            Intel should maintain a document on what Arduino library would work with Edison and what won't.

            Save people time trying to debug something that is known not to work with Edison.

            • 3. Re: MQTT Client Library not working on Edison/Galileo
              CMata_Intel

              Hi Pb1;

               

              New documentation is going to be available in the Software and Documentation section in the moment that the edition and revision processes finishes. You also could check in your PC the directories related to your IDE in order to know which libraries are available and how they work. The path it has to be something like this:

              >C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\cores

              >C:\arduino-1.5.3-Intel.1.0.4\hardware\arduino\edison\libraries

               

              Another useful document is the Shields Report, in there you'll see some tests and results with different shields using Galileo and Edison Boards.

               

              Regards;

              CMata

              • 4. Re: MQTT Client Library not working on Edison/Galileo
                AdamPippert

                Perhaps I can give some more specific information on what's going on with the PubSubClient library, as I've used it for demos, and have modified it to use on an Edison for my own needs.

                 

                It is NOT officially supported as of now on the Edison because the library, as it comes, contains a function specific to Arduino boards and their architecture.  However, it is possible to compile sketches which use the library as long as the following is done.

                 

                -unzip the files into an appropriate library location

                -Remove function called "publish_P" from the PubSubClient.h file

                -Remove the function definition for "publish_P" from the PubSubClient.cpp file

                 

                Close and reopen the Arduino IDE to reload the changes, and your sketch using PubSubClient should now compile.  Hopefully this will help.  Of course, this type of change isn't going to work for all unsupported Arduino libraries, because many have functions which specifically reference the memory architecture of AVR microcontrollers, which do not work the same way an x86 does.  If you don't need those particular functions, though, this hack might be useful.

                1 of 1 people found this helpful