Skip to content

Processing and the Arduino Uno

January 12, 2012

(For posterity and to aid others, as usual, so please excuse it if it’s too basic for whoever’s reading.)

Tuesday night at Splatspace’s Sparkfun visit I attempted to get my junky old Dell laptop to run the Mantis. (I was using my newer laptop to run Big Red.) So I documented the process carefully in case others have some difficulty.

(I neglected to document all the pitfalls the first time I did it- it’s easy to fall into the “open source crappy documentation” trap, which I complain about all the time- thus this post)

The Processing sketch “gctrl” is used to talk to grbl to jog the XYZ axes, zero the axes, and stream a gcode file, but Processing has some issues in talking to Arduino Uno’s on an Ubuntu machine. On the software page for MIT’s Snap mill ) it says:

Install Processing. If you’re using an Arduino Uno, you’ll also need to download Arduino and replace processing/libraries/serial/library/RXTXcomm.jar with arduino-0022/lib/RXTXcomm.jar.

I believe this must refer to an older version of  Processing, because that is NOT where that file is located now. In Processing 1.5.1, it is located and well-hidden in

Processing1.5.1/modes /java/libraries/ serial/ library

so go there and replace that .jar with the one from the Arduino download.

Then after downloading gctrl with:

git clone gctrl

you move the gctrl folder to the “Sketchbook” folder for ease of use (this makes it pop up in the “Sketchbook” entry on the Processing menu).

GIT NOTE:  if you don’t have git installed and you try downloading gctrl with the git command as above,  the terminal will prompt you with a suggested “sudo apt-get….” command to fix that. Go ahead and do it.

When running the gctrl.pde sketch, you first have to comment out the   line

String portname = null              by adding slashes like so:

//String portname = null

and then un-comment the line //String portname = “/dev/ttyUSB0” by removing the slashes and change it to

String portname = “/dev/ttyACM0”

ACM0 is the port for Uno’s running on Ubuntu. That last digit is a “zero,” not an “O.”

Make sure you save those changes to the sketch.

After all this, when you have your Uno (loaded with GRBL) attached to the USB port and you run the gctrl.pde Processing sketch, you should see the correct prompt show up in the Processing window, something like

“grbl  0.6

Type $ to dump current settings”

I can’t remember the message exactly, but that’s the gist. If you see that, Processing is talking to your Uno just fine and you should be able to jog the axes around and stream a gcode.

One last note: for some reason the sketch takes a moment to register a keypress. So if you for instance type a “g” to get the dialogue window to choose a gcode to stream, don’t just tap it; hold it down for a second. Otherwise the window will pop up, but not populate, and the whole thing will hang.

That’s it. If anyone reads this and something isn’t clear (or if it happened to save your butt) please let me know.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: