Monday 21 July 2014

The beginning...

I'm writing this blog as founder of DIoTY.co, a cloud based platform to help you experiment faster with your IoT projects.  
DIoTY currently provides you with two services, an MQTT broker and a Node-RED development tool.  I'll start with explaining what they are and what you can do with them.


MQ Telemetry Transport (MQTT) is a lightweight broker-based publish/subscribe messaging protocol.  MQTT was originally developed by IBM but is currently standardised by OASIS and is both free and royalty free.  It is rapidly becoming one of the standards for IoT/M2M.  

MQTT is a lightweight broker-based publish/subscribe messaging protocol:

  • Clients (sensors, mobile apps,...) connect to a broker.
  • Clients communicate by sending and receiving messages to/from the broker.  For the broker, a messages is just a chuck of data.
  • A client publishes a message to a topic (eg: /home/livingroom/temperature).
  • A client can subscribe to many topics.  It will then start receiving all messages send to those topic(s).

As you can easily see, an MQTT broker as provided by DIoTY can remove the need to run your own web server at home.  Your sensors publish to the MQTT broker, your mobile app subscribes to the topics of interest and you're done...

Node-RED is a visual tool for wiring the internet of things.  Node-RED is a creation of IBM emerging technologies, open source licensed under Apache 2.0.

With the Node-RED tool provided by DIoTY you can subscribe and publish to the MQTT broker.  You can alter the messages by applying functions to it (eg: subscribe to /home/livingroom/temperature/c ; convert the temperature from Celsius to Fahrenheit and then publish again to the topic /home/livingroom/temperature/f ).

You can also interact over other protocols like http, websockets,... to retreive for example weather information from the bbc website and push it to your mobile application.

Finally, with the twitter node, building your own twittering house becomes as easy as pie.


10 comments:

  1. Excellent project!! Works really well. Will you continue to develop the mobile apps? Mike

    ReplyDelete
  2. yes, sure !

    What would you like to see next ?

    ReplyDelete
  3. Fan-friggin-tastic! dioty.co + the adafruit huzzah esp8266 breakout + your ios app + your tutorials has made the (seemingly endless) task of figuring out the MQTT puzzle actually easy. (well, easier) I'll be using your sample code (with full credit, of course) in an "IOT on the cheap!" presentation at our local code camp coming up in March. (http://boisecodecamp.com/)

    I was wondering, however, if I'm doing something wrong. My publish and subscribe code from the esp8266 is working great when viewed via http://www.dioty.co/mydioty, and subscription updates from the ios app are making it to the esp8266 just fine. However, the publish value from the esp8266 to the ios app doesn't seem to be making it through. It shows in the mydioty log, but the ios "read only" field never changes/updates.

    I've tried deleting/re-adding the readonly field several times, but no luck. The subscribe address in the ios app matches what I've got in the arduino code. That is: "/username/motion"

    Thoughts? Thanks!
    -aaron backer

    ReplyDelete
    Replies
    1. I see now that others are having similar issues.
      Curiouser and curiouser ... I tried the tying a subscribe slider to the publish value...and the publish value updated in the ios app with the slider value.

      I then detached the two...and the publish value STILL updated (with the original values) in the ios app.

      Delete
    2. Try publishing a retained message from your esp8266 and you should see the mobile app will pick it up.
      There are many MQTT libraries available but with the one I use from @knolleary you make a message retained by adding a 'true' to the publish statement.
      Eg: client.publish(topic, msg, true);

      Delete
    3. Few more things:
      the slider will have published a retained value. So even if you remove the slider, that value is there. If you publish a different non-retained value to the topic, a new subscriber will still see the retained value...
      If you want to remove a retained publication you need to publish an empty retained message to the topic. eg: client.publish(topic, '', true);

      Delete
    4. so, what you're telling me is...I need to learn something about the tech I'm trying to use? ;-D

      Seriously, though ~ thank you. I did discover some of the weirdness was in mis-parsing subscription responses but other pieces are likely due to not understanding the concept of retained messages.

      Delete
    5. Guess you figured it out by now, but for the sake of others reading this:
      When you publish a non-retained message only existing subscribers will receive it. Anyone subscribing after the message was published will not get it.
      When publishing a retained message that message will be available for new subscribers as soon as they subscribe. A certain topic can only have one retained message, so publishing a new retained message will overwrite the existing retained message.
      Note that when publish a retained message followed by one or more non-retained messages a new subscriber will only get the "old" retained message.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete