↑ Return to Tutorials

Print this Page

Introduction to IoT – Posting Data to Xively using LabVIEW, Part 2/2

Remember the last post of IoT (Internet of Things)?. If you got the idea, then lets construct a simple application that stores our “thing” data into a Cloud Service.  For that purpose I will use Xively Cloud Storage Service. xively

Figure 1.  Xively Logo.  Xively is a company that offers user friendly framework for IoT applications.

Xively as a Cloud Storage Service is used basically to store the data that we need to store.  With the use of this platform we don’t need to worry about web programming, services, or hire a experienced programmer to start our application to the cloud and focus on our embedded device.

For trigger events, i will use Xively trigger commands in conjunction with Zapier.

Zapier

 

Figure 2.  Zapier Logo.  Zapier is service that could interact with Xively triggers making actions with other web services.

Of course, we could do more than only “put” something into this service.  For this example i will use LabVIEW transforming our PC as our “thing” device, just an example to make a demonstration how to interact with Xively and finally make hook ups that trigger other events via HTTP POST with Zapier like send an email to Gmail or a Tweet via Twitter.

For this purpose I created several accounts that you could use and are settled to this purpose

  • A Xively account: IoTInternetOfThing/comm.123
  • A Gmail account: comm.acc.profile@gmail.com/comm.123
  • A Twitter account: IoTInternetOfTh/comm.123
  • A Zapier account: IoTInternetOfThing/comm.123

 LabVIEW Xively Front PanelFigure 3.  LabVIEW Front Panel.  Example of feeding data to Xively.

If you see the front Panel, there are two variables that looks strange.  This FeedID and the API Key are uniques for this device.   We created a Thermometer and a boolean indicator that waits a elapsed time of 5 seconds to update data via HTTP PUT to Xively.

LabVIEW Xively G Language PageFigure 4.  Xively Feed for simulated temperature.

The figure above shows how easy is to feed a Xively IoT device using HTTP Vis.  If you run it you will se the Xively IoT Application change the window current value as shown in the figure below.

 Xively Temperature

Figure 5.  Xively Data Graph.  Feeding every five (5) seconds to Xively random data of temperature.

I also have made a few triggers for too cold, too hot that sends an email, to the Gmail Account and and a aditional trigger to make a tweet for a tweeter account.


Xively Triggers Zapier Web HooksZapier TwitterFigure 6.  Xively triggers, Zapier triggers/zaps and Twitter status update with the current temperature.

Finally, recapitulizing, the IoT is an very good example of what monitoring and control could be done.  Information in realtime (or try to be realtime) made available to you.  If you worked in a utility or industrial company it is very similar approach to the SCADA, which is a combination of hardware and software and is a scalable system.

The Internet of Things is a new horizon for those people that wants to learn, manage or make their new revolutionary application to the real world.

Finally i will post here the LabVIEW code that is allocated on Github.

 

Permanent link to this article: http://cerescontrols.com/tutorials-3/introduction-to-iot-posting-data-to-xively-using-labview-part-22/

8 comments

Skip to comment form

  1. mesut

    hi…i m new to xively..
    i m currently using labview interface with arduino to store the data (sensor) onto the web, and i need to get the message(sms) to my mobile phone as any alert.

    may i know is it xively can used for this application?..and how to obtain the feed id and API key?

    thanks in advance..

    1. Rangel Alvarado

      Of course you can, you can do it with temboo or zapper. I think temboo is more “what-you-want” oriented.

      feed id and API key are in your xively account when you create an intelligent node. Everything for a newcomer is on the xively website. You can do the test drive example here to understand basics. https://xively.com/testdrive/

      Hope this helps

      1. mesut

        by using temboo /zapper, is it needed to use GSM module too?

        1. Rangel Alvarado

          Not really. If you want to do push notifications to your cell phone use temboo with twilio.

          Use your wifi and the cloud account, there are guides how to do that. Google, Adafruit.

          Here is: https://learn.adafruit.com/sending-an-sms-with-temboo/

  2. cris

    and what happend with the input string(search and replace string) LABVIEW
    according to your comment and use your example I just need write
    or I need other thing

    1. Rangel Alvarado

      The most simply way is…

      1 – Replace the input string with:
      {“datastreams”:[{“id”:”Temperature”,”current_value”:”“},{“id” : “humidity”,”current_value” : },{“id” : “altitude”,”current_value” : }]}
      2 – clone the “Search and Replace String” function with the two others:
      2.a – insert a new “Search and Replace String” after the last “Search and Replace String”
      2.b – the new input string will be the result of the temperature replaced string
      2.c – instead of searching temperature, use
      2.d – in the “replace string” use your data value
      2.e – repeat the 2.a to 2.d value for
      2.f – connect the last result string to the HTTP PUT method.

      Hope this helps.

  3. cris

    could you tell me why you write this like a constant
    application/json, text/javascript, */*; q=0.01
    for what use q=0.01

    and what if I want to show other value in xively how can I get it
    in labview what have to add


    {“datastreams”:[{“id”:”Temperature”,”current_value”:””}]}

    thanks in advance

    1. Rangel Alvarado

      I think i was testing something and i miss to delete it in my tests, really don’t remember why right now.

      For write multiple datapoints you could view xively write to multiple points:
      https://xively.com/dev/docs/api/data/write/multiple_datapoints_to_multiple_data_streams/

      basically is:

      {
      “version”:”1.0.0″,
      “datastreams” : [ {
      “id” : “temperature”,
      “current_value” : “30.02”
      },
      {
      “id” : “humidity”,
      “current_value” : “60.10”
      },
      {
      “id” : “altitude”,
      “current_value” : “25.30”
      }
      ]
      }

Leave a Reply

Your email address will not be published. Required fields are marked *