OK, so now that we have learned how to send tweets from Max, now we can think about storing this data somewhere. I’ve been exploring the Pachube.com (pronounced “patchbay” ?) website. What is Pachube? From the website:
” Pachube essentially stores, retrieves and processes realtime and time-series data from devices, sensors, environments and web-based applications – so here we are using some short cuts to make use of off-the-shelf applications that can already make use of Pachube, so that you don’t have to build anything yourself.
The purpose is for you to understand what a Pachube feed is, how its datastreams get updated, and what you can use the datastreams for, without having to use the Pachube API“
Here is a screenshot of the website, so you can see for yourself:
Now, before proceeding further, please check out my 2 posts about “The Internet of Things”: Pachube Research Part 1 and Top 10 “Internet of Things” for 2010.
….. [Insert Wheel of Fortune music here] …
OK when you come back let’s get going!
PART 1 : TWITTER TO PACHUBE
- Set up a FREE Pachube account at http://Pachube.com. You will receive an activation link and you should be good to go.
- Create an Alternate Key. In your welcome mailer you will receive a Master API key, but we will create another key for use in this tutorial. When you Log In, there are a bunch of Menu options on the right-most column. Click on the “My Keys” link under ‘Secure sharing keys’ . You will see your Master API key in a box.
- At the bottom of the white box, click on <Create a new API key> and under ‘Permissions’ choose <get> and <put> (retrieve and update streams). Leave the rest blank and click on “Create New API Key”. The new key will appear in your list. To see it, click “Show Key”. Click on it and COPY the key text. You will need it soon.
- Log in to your Twitter account. We will be sending inputs to Pachube via twitter, but a sensor or remote device could also be sending the information.
- Create a Pachube Manual Feed. On the right column under “Feeds” click Create a Feed and then watch this video to complete the forms (take note of the FEED ID, ie. ‘pachube.com/feeds/1353’):
- Set up PachTweet as decribed here.
- Log into twitter, and follow @pachtweet by tweeting ‘follow pachtweet’.
- Then tweet ‘@pachtweet connect’
- You will receive a private message in a few short minutes to confirm it was a success. Wait for that confirmation before going to step #7
7. As a private message [DM] reply to patchtweet, send a message that contains the API key you copied earlier, so it should read ‘key [YOUR API KEY HERE]’
8. Let’s send some messages!
- Ok, so the format to send messages is: <set> <feed_id> <data> … so for every message you put “set [yourfeedID#] #,#,#,#” … and each datastream will be updated based on its location in the list of numbers after the feed id, so for example, set 20457 35,467,88.88
- Give it a try! Open up your feed page and from the twitter private message page, send some info. wait about 60-90 seconds and refresh your pachube feed page a few times. You should see the data update!
9. How will you use this data? Now it’s time for you to brainstorm! 🙂 What data will you log in Pachube? The world is your oyster.
**I’m investigeting how to set up “triggers’ in Pachube to send tweets to Max but it looks like that is in Beta-Testing mode. I’m hoping to hear back from Pachube soon on that one… but until then it’s really simple to get data from Pachube directly to Max!
PART 2 : PACHUBE TO MAX
It is quite easy to get data from Pachube to Max. I have modified a Patch offered on the Pachube site so that you can receive multiple Feeds and multiple data streams. The original was:
My modified version is:
This patch is available for download HERE. As it is updated, I will update the link for you.
But for now, the important things to look for in this patch are:
(1) Your Master API Key…. which can be found when you log into Pachube. On the right side column in the “Secure Sharing Keys” section, click on “My Keys” and then copy the key and paste it into every box that needs an API key in the Max patch.
(2) Choose a Feed… There are many feeds to choose from, but the most interesting for Max are the ones that are real-time and updated at least every few minutes. One that is particularly relevant for us in Tempe is the ASU Weather Tunnel Feed. Take a moment to check it out! https://pachube.com/feeds/26118. As you see the Feed ID = 26118, and the info is updated very often.
(3) Launch Max and open up the Patch you just downloaded.
(4) Add FEED ID + DATASTREAM # into Max… so for the case of the ASU Weather Tunnel feed, you would put in ‘26118’ as the Feed ID in Max, and then choose a DataStream. In this case there are 7 streams, numbered 0-6. So for example, let’s choose datastream 2 (humidity) and 5 (carbon monoxide). Enter your key, feed id, and respective stream numbers into the first two sections of the patch.
(5) When you turn on the toggle at the top, the metro will bang once a second and you should start seeing Output Values, that match the current values on the pachube page!
(6) Explore other Feeds on the Pachube site, and see what kind of interesting values are out there. You can figure out the ranges of the datastreams by changing the graphs to show either 1hour, 24hrs, 1week, 1 month, 6months, or a year. (this is on the right side of every datastream’s graph. More on that soon! 🙂