LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Xively PUT data

I have several Type-K thermocouples reading into LabVIEW through ADAM 4018 and Digi PortServer TS 4 MEI via ethernet . I would like to start sending the data every minute to Xively.com feed. I am just now starting to build a .vi in LabVIEW 2011. Has anyone else attemped this and had success?

0 Kudos
Message 1 of 9
(3,075 Views)

XIVELY1.jpgI was able to do a successful manual put with this setup. now to break it appart and make it to where I can have varibles in the data.

Message 2 of 9
(3,050 Views)

Ok updated again. feed id, api_key, feed title, datastreams data package seperated. I belive this will become a sub.vi to the main that will structure the datastream package of data.

 

 

 

Xively2.jpg

0 Kudos
Message 3 of 9
(3,019 Views)

If you're using LabVIEW 2013, there is a flatten to JSON function which will accept a cluster and produce a correctly formatted JSON string for body data. Really handy for working with web services!

 

You might need to play around with it a bit but I think in your case, a cluster containing the following should work:

id - string

tags - array of strings?

unit - cluster of symbol (string), label (string)

current_value - numeric


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 9
(2,988 Views)

Yes if I had LabVIEW 2013 that would be nice to use but as I stated earlier I have LabVIEW 2011 that I am using.

0 Kudos
Message 5 of 9
(2,957 Views)

Ok so I have it putting the data from one line onto Xively no prob. going to work out how to format miltiple strings. here is what the Main VI looks like. I turned the vi from above into a subvi that is called every 30sec to PUT data on Xively.

 

Xively3.jpg

0 Kudos
Message 6 of 9
(2,956 Views)
Apologies, I didn't see that you had posted which LV version you were using.

You can use format into string with multiple input parameters - if you use a format string such as "{%s, %.2f, %d}" and expand the input of the format into string function to have multiple inputs you can wire a string, double and integer and they'll be replaced in the format string.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 9
(2,919 Views)

I did start getting a fun error if the internet ichups on the server.

XivelyError.jpg

 

I would like to make something that if it errors like this it will not stop the vi and automaticly continue.

0 Kudos
Message 8 of 9
(2,892 Views)
To do that - you need to handle the errors coming out of the PUT VI. LabvIEW has automatic error handling which means that if an error occurs and the error out terminal is not connected it will show the error dialogue that you're seeing.

The simplest solution is just to wire the error out terminals in your VIs to the edge of a structure or use the "Clear Errors" VI to ignore the errors. You can also turn off the automatic error handling in the VI Properties.

Of course...in reality you may want to do something more sophisticated like display the error status (so you can see if the connection is OK) or log the errors.

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 9 of 9
(2,869 Views)