This was due mainly to a conversation at work, extolling the virtues of the Arduino and how simple it was to connect to the internet.
So after getting the hardware out of the box and overcoming all the library related issues with using the newer Arduino 1.00 instead of 022 I started to look for some code to use as the basis of my little project.
Firstly I found the Pachube example from the Arduino website here, this sketch gives you all the basics to upload a data stream to Pachube.
The code has sections at the top to setup your access information to Pachube so first you need to get an account with Pachube, it's free for a basic account.
#define APIKEY "YOUR API KEY GOES HERE" // replace your pachube api key here
#define FEEDID 00000 // replace your feed ID
- Visit www.pachube.com and signup for an account.
- Log into Pachube and setup a feed.
- Add a datastream, this will be you sensor data, type in "sensor1" to match the example sketch and save.
- Create a key for your feed using "My keys" on the right.
Now you can replace the APIKEY text in the sketch with the key you've generated on the Pachube site, FEEDID with the number you find on your edit feed page, near the bottom, just use the number after the /feeds/.
I used my feed title to replace USERAGENT.
I then loaded the sketch into the Arduino and off she went.
Log into your Pachube account to see if the data is updating. There is some useful help if it doesn't seem to work, on the right select the "Debug info" item and this takes you to a log of the data that Pachube is receiving.
You can see from the request body that I have some extra data added that's not part of the example sketch, this is temperature data from a DS18B20 temp sensor, I'll show the extra code to get this done in my next Blog post.
There are also lots of ways to view the data on the web: -
- On the Pachube website.
- Adding a graph to your own blog, see top right.
- Using the embedded graph code on your own website.
- Using a gadget on you iGoogle home page.
- Using an App on you Apple Ipod touch or Iphone.
- Using an App on you Android Phone.