Introduction

If you have an Arduino and a Danger Shield, and you are reading this page, you already have enough to start posting sensor readings to a webpage and sharing them with the world. You can also access those readings yourself, on the web, wherever you go.

How? With the help of Pachube!

Get familiar with Pachube

What does all this mean? It means that someone has done the hard work of setting up a webserver to store and display sensor readings of all kinds, and also allow you to control things remotely over the web. They say they want it to be the YouTube of the sensor world!

As I write this, Pachube (pronounced "patchbay") is still in beta (that means they are still getting the kinks out before they open it to the public). But you can request a login code so you can try it out now.

Sign up for a Pachube Account

In the top half of the page, you see three points, that explain how to request a beta login code that will let you send information to Pachube (Inputs) and request information from other Pachube users (Outputs).

Scan the rest of the page. If you start stressing out when you see "HTTP Get commands" and "EEML" (like I do), DON'T WORRY!

The folks who run Pachube are big Arduino fans, and they have posted excellent tutorials that walk you step-by-step through the process of setting up an Arduino to work with Pachube. Adding a Danger Shield for sensors is easy!

Check out the Arduino tutorials

At the bottom of that page there are links to two ways of making your first connection. One thing that you'll run into very quickly is Processing. If you haven't worked with Processing before, read the next section…

Do I need to know Processing?

When you are playing with Arduinos, you need the "Arduino" program in order to upload sketches to the Arduino itself. If you are working with the Danger Shield, you already know about this - you use "Arduino" to upload the firmwares (another word for the sketches) to the Arduino microcontroller. The sketches are first loaded into a Java window (the "environment") on your computer, then compiled and then uploaded. Sometimes the language and framework for all this is called Wiring. Okay so far?

Processing is another, related programming language. But it runs in a little window on your computer and talks to the Arduino. To do some things with the Arduino, you will need to run both programming windows: Arduino to program your microcontroller, and Processing to help you see what is happening or to let the Arduino control a graphic display on your computer.

As with the Arduino sketches for the Danger Shield, you don't really need to know how to program - other people have written both Wiring and Processing sketches for you, and you only have to know how to upload or run them.

Some of the Pachube tutorials use both the Arduino and the Processing sketches. Here is where to get those tools:

So How Does the Danger Shield Fit In?

Just mount it on top of the Arduino. You will have to modify the Processing sketch to look at the right pins for the Light and Temperature sensors. But you'll see that explained in the next section on this page.

And when you get to the Ethernet example below - surprise! It works without any modification of the pin assignments, although there is a bit of editing to configure the ethernet board to your network settings. That is also explained below.

Tips for setting up Pachube with Arduino and Danger Shield

The easiest way to connect with Pachube is through the manual update method. Find that in the Pachube tutorials and read the instructions carefully. You upload a standard Firmata firmaware to the Arduino and run a slightly modified Processing sketch to connect with Pachube and provide sensor updates. As mentioned above, besides entering your Pachube key and your feed ID, you will need to change one section of code to work with the Danger Shield sensor pins:

Farther down in the tutorial you see a section of code that invites you to put your code there.

// then put your code here, you can access remote sensor values// by using the remoteSensor float array, e.g.: analogWrite(3, (int)remoteSensor[3] * 10); // remoteSensor is a floatanalogWrite(5, (int)remoteSensor[1]);
// you can have code that is time sensitive (e.g. using 'delay'), but// be aware that it will be affected by a short pause during connecting// to and reading from ethernet (approx. 0.5 to 1 sec).// e.g. this code should carry on flashing regularly, with brief pauses// every few seconds during Pachube update.

For the purposes of getting started and getting a feed working, you don't need to do anything - just leave this section as it is.

Another way, and another board - Ethernet!

When you first set up Arduino with Pachube following the manual update method above, you used your computer or laptop to program the Arduino and to run the Processing sketch. Everything talked over USB, and then your computer connected to the Internet and sent the sensor readings.

But if you have another shield for the Arduino, called the "official" Ethernet shield, you can leave the sensor hardware on its own to communicate with Pachube, no computer necessary!

There are other ethernet shields, but the Pachube folks have settled on this version as the easiest and most reliable to work with. I've tried other ways and I agree.

How does it fit together? You make a nice Arduino sandwich - Arduino on the bottom (remember the black tape on the USB connector!), Ethernet shield next (make sure to put more black tape on the ethernet connector!), AND FINALLY THE DANGER SHIELD!

(photos to come)

Hook up your USB cable between the computer and the Arduino, and an ethernet cable between the ethernet board and your network (usually right into your router), and you are ready to set things up and test them. Later, you will remove the USB cable and power the sandwich another way!

Now, go back to the Pachube tutorial. You'll notice that there is no Processing sketch needed for this setup - only an Arduino sketch that is modified to configure the ethernet shield to match your network, and to set the ID of your new Pachube feed and your Pachube key. Once all that is set properly, it can be compiled and uploaded to the Arduino, and can eventually run without having the computer connected.

The instructions for changing the code to work for your setup are clear enough in most cases. But I had trouble with a few things, which I will explain.

The instructions in the Pachube tutorial are clear concerning the share feed ID, the remote feed ID, datastreams, API, and intervals. What may be confusing is the byte mac, and byte ip setting. Those two entries (MAC address and IP address) can be set as any number you like as long as

The MAC address is not duplicated on your network (and follows the format shown), and

The IP address falls in the range that your router normally assigns. You'll need to check whether that range is a 192.168.0.x number or a 10.0.1.x number. Those are the most common ranges.

If you have any questions that the Pachube tutorial (or my instructions) can't answer, go to the Pachube community forum. The response to questions there is quick and thorough. You will need a separate login for the community side of the site from the one you got when you signed up to be part of the beta test.

Here it is, working on the web

You can see my Pachube page, with graphs of sensors and sliders, here: