ThingSpeak GraphUpdate 2014-11-16: You should read my Twine Update if you are considering the purchase of a Twine.

Twine is great. Out of the box, it’s easy to send email and SMS messages, but to really unleash this device’s potential, one needs to explore the HTTP Request action. This makes the Twine a node on the Internet of Things (IoT) and offers a lot of flexibility as to what can happen based on physical input. I’ve written about this before in my First Twine Project, in which I had a Twine and an Arduino talking through a quick and dirty “web service”. This was a fun proof of concept, but calling the PHP I wrote in 10 minutes a web service is a stretch. So, I’ve been looking for a more substantial web service that can be used by the Twine. Twine won’t work with many web services such as cosm (f.k.a. Pachube) or Open Sense, but it does work with at least one: ThingSpeak.

ThingSpeak is quick to set up and offers a fair amount of flexibility. One can read & write data and integrate with other services such as a Twitter or Twilio. ThingSpeak also has the added bonus of being open source, so you can set it up on your own server, if you wish. In my case, I just wanted to do some temperature logging. If you’re interested in how I did it, keep reading, the instructions are after the break.

You’ll need a Twine and a ThingSpeak account. Assuming you have both of those things, the first thing to do is set up the ThingSpeak side of things. You’ll need to create a new channel on ThingSpeak, this is where your Twine will write the data. Once your channel is created, click on the API Keys tab of your newly created channel. Copy the Write API key, this is the longish (~15 characters) string. Twine will need to use this key to write data to the channel.

Now it’s time to set up some rules on the Twine, which will feed data to the ThingSpeak channel. In this case, I want temperature logging, so I want to send the current temperature to the ThingSpeak channel whenever it changes*. Unfortunately, Twine’s temperature events only trigger when the temperature rises above or falls below the value you specify. However, since more than one rule can be set up, one can cover a range of temperatures by defining two rules for each degree in the temperature range being monitored. Yes, this is a kludge, but it’s what we have to work with right now. To set up the rule, you’ll need the URL for your ThingSpeak channel, it should look something like this:

http://api.thingspeak.com/update?key=**Write API Key**&field1=[temperature]

Make sure you replace **Write API Key** with the Write API key for your channel (created above). As for the optional parameters (trigger and reset after), I left those at 0.1 and 60 seconds.

Once you upload these rules to your Twine, go check your ThingSpeak channel. You should see at least one entry in your the log. A screenshot of my log from overnight appears above. So far, I’ve found that the Twine can be a bit flaky about sending out updates, even as compared to the current temperature shown on the Twine site. For my purposes, this is fine. So long as I get a reading every couple hours, I’m happy. For more precise measurements, this might not be the device for you. I do hope that the accuracy of Twine increases as they release later versions of the software.

* It would be nice if Twine supported an “on change” event, but it doesn’t–not at this time anyway. Creating a bunch of rules to track the temperature isn’t that big of deal when logging temperatures within a fairly narrow range. Doing the same for a wider temperature range of 20 or 50 degrees would just be ridiculous; I wouldn’t recommend it. Let’s hope that the Supermechanical team adds an on change event or something similar in the near future.

4 thoughts on “Temperature Logging with Twine and ThingSpeak

  1. Thanks for your post on the Twine integration with ThingSpeak.com. I was able to implement it as you described. Have you suggested the “on change” event reporting to the Supermechanical team?

    Best, Tom

  2. Thanks for the article.
    Still, me too still looking for the real logging feature. The ‘on change’ and ‘timer’ functionality are an unacceptable miss in the twine.
    I cannot setup a polling service to trigger the Twine, so I am still hoping that someone has a clever workaround?
    Did you find anything in the mean time, since this article is a few months old???

  3. I haven’t seen any updates from Supermechanical that would allow for better tempurature logging. I also found the logging to be a bit flakey (e.g. not reporting for long periods of time, even though the temperature has changed).

    If you look around, you’ll see that some people have been able to get information from the Twine site directly. But, that might be more than you want to get involved with.

    My Twine is now gathering dust, which is a shame since its such a nice little device. At this point, a better route might be a Rasberry Pi, a cheap wifi module and a little elbow grease :)

Leave a Reply

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