Arduino + Processing + Pachube

Hi, I'm a complete beginner with the Arduino but I like the idea of being able to share data online. I'd like to tinker and make a thermometer, GPS locator, home energy meter etc. (basics, but that's where I'd like to start until I find my feet).

I found a tutorial (here) which links up the Arduino with Processing and sends the data collected to Pachube.

I have followed the instructions in part one to the letter.

The problem is the console in Processing is showing continuous values of 0.0, rather than changing values according to light on the LDR. I tested the simple circuit was working by following the Analogue Read Serial tutorial on this site on my Arduino - the values changed whenever the light in the room changed. So if the circuit works, I've downloaded and installed the library, uploaded Firmata to my Arduino, put the code as written in the tutorial into Processing (and tried changing the port value, to see if that does anything, which it didn't)... what am I doing wrong that the values won't change in Processing like they do in Arduino?

I'm running a Mac OSX and using an Arduino Uno, if this helps. Hope this all makes sense!

I have no idea if my board is broken or what. Please help :frowning:

I would be willing to pay for an arduino tutor via Skype, if anyone is interested.

EDIT: PM me if you are interested :slight_smile:

I have followed the instructions in part one to the letter.

Please post the code you use (use the # button to provide code tags) there can allways be an error/typo.

If you want real flexibility and be able to manipulate data on your PC and build real good programs you should go straight to study Processing, Visual Basic or any other language with Serial Communication capability. You will be in control writing the code for what you need not using already written code that might not fit your application the way you want. When I began with this I wasted a lot of time until I found that Processing was the tool I needed (other people prefer VB, etc) to do almost anything I wanted with Arduino and a PC. Not very easy for a beginner though; but after you learn it you will appreciate this advise.
You will be able to write really complex programs in your PC which will do almost anything you can think of and through Arduino you will be able to interact with the outside world from the PC. In my project I just send orders to Arduino from the PC when I need something to be done and receive data back from it; but it controls the outside process on its own. There are applications that Arduino can handle by itself; but I like the idea of having a full computer with screen, keyboard, hard drive, etc as the main control unit from where I interact with the system. It makes any design extremely flexible and powerful.

I am trying this out on a new computer (using Ubuntu) - but before we get to the problem I had before, there is ANOTHER problem (they don't make it easy, do they?).

From the tutorial I mentioned in the first post, I used the following code in Processing:

import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
float myValue;

void setup()
{
println(Arduino.list());
arduino = new Arduino(this, Arduino.list()[0], 115200);
}

void draw()
{
myValue = arduino.analogRead(0);
println(myValue);
}

And when I click 'Run', I get the following error:

WARNING:  RXTX Version mismatch
	Jar version = RXTX-2.2pre1
	native lib Version = RXTX-2.2pre2
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 2
	at sketch_apr24a.setup(sketch_apr24a.java:32)
	at processing.core.PApplet.handleDraw(Unknown Source)
	at processing.core.PApplet.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:662)

The warning you can ignore. The array out of bounds exception occurs because you are probably accessing the first element in an empty list. The fact that there are no serial ports listed (by the println() call) means that Processing is not seeing your Arduino's serial port.

So what do I do?

So what do I do?

I am trying this out on a new computer (using Ubuntu)

Install Windows...

Are you able to program the Arduino on the new computer?

I ran the example blink sketch and it worked.

So you're saying there is no (relatively uncomplicated) way to get Arduino communicating with Processing on Linux?

So you're saying there is no (relatively uncomplicated) way to get Arduino communicating with Processing on Linux?

The Processing and Arduino IDEs use the same process for determining what serial ports are available, as far as I know. If the Arduino IDE can see the serial port, to upload the sketch, then Processing should be able to see it. I'm not a Linux user, so I don't know what all you need to do to get Processing to talk to the same serial port that the Arduino IDE talks to. I thought that "nothing" was sufficient.

I will try to set it up with fedora, some time today. I believe its not that big of an issue.

about the warning thing: I am not sure if you can actually ignore that. I remember having an the same or a similar issue which I had to resolve before I was able to do stuff via a serial connection. I had that very same issue using ubuntu - however its about 3 years ago, and I dont remember the details.

anyway. I did some googling for you:

http://groups.google.com/group/makerbot/browse_thread/thread/7cf23fb1a360b1b3?pli=1

just as starting points. You might want to ask in the processing forum too...

If you add

println(Serial.list());

before

println(Arduino.list());

does your Arduino port get listed?