Another post on Pachube and how easy it is to get setup and going. This post will cover the basic steps on how to get some sensors online! I will be using my project of two light sensors as an example. The status of my light sensors are viewable at http://www.pachube.com/feeds/2145
Pachube + Arduino from Morgellon on Vimeo.
STEP ONE: GET A PACHUBE ACCOUNT!
Head over to the Pachube website and see various sensors from all over the world and view their status. Be sure to view the ABOUT page, this describes INPUTs and OUTPUTs, along with ways to interface with Pachube and your sensors. The QUICKSTART page has the details to get started and how to use your API. Pachube is still in beta, so you’ll need to get an invite code… but no worries, Pachube has an email address on the QUICKSTART page. Just send them and email asking for an invite and what you would like to do. If they let me in… they will let anyone in!
STEP TWO: PREPARE ARDUINO!
The Arduino can be interfaced with Pachube two ways: 1. With an Ethernet shield OR 2. Via USB connected to a PC running Processing… which is the way used in this tutorial… as I feel it is an easy and inexpensive way. You can learn more about each way at the Pachube Arduino page.
To prep the Arduino, you need to connect the sensors you will be using and verify that they are working correctly! Once the sensors are good, then upload the “Standard Firmata” to the Arduino. Now the Arduino is prepped for Pachube! Leave the Arduino connected to the PC.
STEP THREE: PREPARE PROCESSING!
To have Processing communicate easily with Pachube, you will need to add a few libraries. They are the Pachuino, Arduino and EEML libraries, they are available and there is more info at the PACHUINO page. Download, unzip and move them to the libraries folder, in your sketchbook folder. Now Processing is ready!
STEP FOUR: PREPARE INPUT FEED!
Once you have a Pachube account and your API key, go ahead and set up a new feed for your sensors. Since I have light sensors, I started a new INPUT FEED. I chose to make my feed “manual” (as this is easier for me) which means Pachube gets updates only when I send them. Instead of Pachube connecting directly to my PC to pull the info.
STEP FIVE: PREPARE CODE FOR PROCESSING!
Once you have the libraries in the folder, you are ready to start Processing and start coding. Below is the code I used for my light sensor. This was taken from the sample code and stripped to make it more simple. I added a LED on pin 11 to light up (to let me know when my Arduino was running) and a delay(1500).
Be sure to add you API Key, and the URL of your INPUT FEED!
import processing.serial.*;
import cc.arduino.*;
import eeml.*;
import pachuino.*;
Pachuino p;
Arduino arduino;
int ledPin = 11;
void setup(){
p = new Pachuino(this, Arduino.list()[0], 115200);
p.manualUpdate(“http://www.pachube.com/api/2145.xml”); // change URL — this is the feed you want to update
p.setKey(“—YOUR API KEY HERE—”);
// local sensors
p.addLocalSensor(“analog”, 0,”Light Sensor Inside”);
p.addLocalSensor(“analog”, 1,”Light Sensor Outside”);
}
void draw(){
//p.debug();
p.digitalWrite(ledPin, Arduino.HIGH);
delay(1500);
}
// you don’t need to change any of these
void onReceiveEEML(DataIn d){
p.updateRemoteSensors(d);
}
STEP SIX: LAUNCH CODE AND COLLECT DATA!
Make sure that:
Now run your program and begin collecting data and sharing it on the web!! Check your feed to make sure you data is being transmitted. Have fun and happy tinkering!
–Morgellon OUT!
1-13-2010 @ 18:50
[...] This is a video of Morgellon’s first Pachube project. There are two light sensors to an Arduino. One sensor measure light levels in his room, the other measures light levels outside. The Arduino is connected to a computer running Processing, and it forwards the sensor data to Pachube. View the sensor data at pachube.com/feeds/2145 Find out more details at dailyduino.com/archives/616 [...]
4-22-2010 @ 16:34
Hey,
Thanks for this post I was having a bit of trouble getting processing to talk to Pachube and its working now (http://www.pachube.com/feeds/6936). But the “Standard Firmata” is not sending the analog values to processing. I’m using Arduino 17, Processing 1.0.9 and I have installed the three libraries. Is this definitely the correct processing Arduino Library: “processing-arduino-0017.zip (Updated 22 Sept. 2009)”. I got it from the link on the Pachube website.
Any help would be greatly appreciated!
Thanks.
9-6-2010 @ 06:54
Hey there, enquiring about details on how to set up my code to request data from a sql server. I have my database continously storing energy values, and now need to link this database to pachube to view the real time energy usage graphs. Will really appreciate any help you could offer me.
Kind Regards
Ajay
9-7-2010 @ 20:47
Hi, thanks for the tutorial! Was quick and fairly easy to get it running.. I was banging my head on the keyboard for about 20 minutes trying to figure out while it wouldn’t work at first.
The example you provided has a Serial speed of 115200, where the Standard Firmata example in the Arduino IDE starts at 57600.
Just a heads up for anyone trying to use this and running into problems!
Other than that, had it up and running in no time. Thanks for the tutorial!:D