Monday, January 14, 2013

Alternatives to Cosm (Pachube), Part 3

Found another one to try out.  The site thingspeak.com has apparently been around a couple of years, but didn't turn up on any of my searches.  I stumbled across it today and had to go try it out.  After a number of false starts and some serious reading, I managed to create a data store and put some data in it.  Then began the laborious task of modifying my House Controller to send data to it.

You'd think I'd be getting pretty good at this by now, but I tried for two hours to get data to upload to the site with zero success.  Then, in typical form, I went back to beginning, found my silly mistake and got it to work.  This site works like Cosm.com in that you construct a POST and include the data to send it.  They use fixed field names field1, field2, etc. instead of numbers and the data doesn't have to be constructed in a JSON format, just named as parameters.  I'm using something on the order of:

("field1=%d&field2=0.%d&field3=%d.%02d&field4=%d.%02d&field5=%d&field6=%d")

to send the data (hope you understand printf).  This is actually easy to understand and could work quite nicely.  Yes, they have embeddable charts.  Here is a daily chart of my power usage with their facilities:


The extremely cool thing about their charts is that, if you set them up for it, they are dynamic.  That means new dots will appear in the chart as my house updates the data on their site.  If you put your mouse on the chart and move it around, each of the datapoints will be highlited and the actual data will be shown.  This is really a nice way to chart the data. They don't have the ability to zoom in on the data or subset it by manipulating scrollbars or highliting areas, but the ease of making charts if phenomenal.

There are a number of other features to play with.  They even let you record a status for the data being sent. This is a text field that can be retrieved and displayed.  So, I could display, "Currently Offline" on a feed that was having trouble if I wanted to.  There's also an API for location data for things that move and an interface to twitter for people that like that kind of thing.  I haven't found any use for a twitter interface at all, but someone must like it since it turns up all over the place.

The site supports JSON data retrieval so it can be used in a plugin.  This is different from the emoncms.org site.  Security of one's data is a serious concern, but it's not much use to put data out there if you can't get it back to be used.  That's the most serious problem I ran into with emoncms.  The fact that you can get the most recent data back gives you the ability to do this:
This is an iframe that contains an AJAX query that fills in the value for a SteelSeries gauge.  I have this on a cloud server so that I can use it anywhere by just pointing to it.  The site, thingspeak.com, takes care of automatically updating it, so this is updated periodically with the data my house sends up.  I could (relatively) easily construct a AJAX query that would feed into the Google chart API and produce one of their great charts with zoom and everything.  That is currently left as an exercise for the student.  Wait long enough and I'll probably do it.

So, I've researched and actually set up data stores on several of the repositories out there.  They each have something unique to offer and seem to do the job of holding, displaying, and supplying data.

Try them out and have fun.

Part 2 of this effort <link>
Part 1 of this effort <link>

2 comments:

  1. The word "field" can be eliminated in the post syntax and just the field number used, e.g. "1=nnn&2=nnn&3=nnn"

    ReplyDelete
  2. I did not know that. Thanks Jack.

    ReplyDelete