Getting started with Pduino ([arduino])

Read this post if you already have Firmata on your board. If you don’t know how to upload it or if you’ve never heard about the Arduino IDE, please read this post first.

The point of Pduino is to have as much control as possible over the board and its inputs, by letting Pure Data control which inputs should be turned on (and more). This would normally require to update the Arduino sketch.

Pduino is two-fold : one half is the Arduino program called Firmata, and the other half is the [arduino] object in Pure Data. The first lets the later have full control over the board.

To install Pduino, you’ll need to :

  1. download the archive from Hans-Christoph Steiner’s website,
  2. extract the content of the archive to your Pd/Extra or Pd/Externals folder (it doesn’t actually matter as long as you know where it is),
  3. add a reference to the path to the Pduino folder in Pure Data by clicking on “File” -> “Path…” -> “New…” (if Pd doesn’t know where to look for it it won’t let you create the [arduino] object).

Now if you have uploaded Firmata onto your board, you can plug it and start discovering Pduino. A very good start is to open the [arduino-test] patch in the Pduino folder. It looks like this :

Test patch for the [arduino] object

The first thing to do after opening “arduino-test” is to open the connection with the board. This is done with the light green horizontal radio in the upper left corner. My board was on port 4, but yours may be on another one. You can monitor the success or failure of the connection by looking at the main Pd window. If it didn’t work you’ll an error message similar to :

Opening COM2
error: [comport]: could not open device COM2:
failure(2) ERROR_FILE_NOT_FOUND

Once you have opened the right port, you can set the pins you need with the pink grid to the right. Each pin on the board can be controlled from this grid. To build a footcontroller that works like any multi-effects guitar pedal, you’ll need only two kinds of pins : digital input pins (that takes on two values, 0 or 1) and analog input pins. The digital pins are those connected to a simple switch or button, and the analog pins are connected to potentiometers (to control the volume, or to make an expression pedal). Please note that an Arduino board has a few digital-only pins, and another set of pins that can be either analog or digital depending on your needs.

To open, say, Pin 2 in analog mode, click in the box at the intersection of the first column and the 4th row in the grid. You’ll see that this sends a message to the [arduino] object : “pinMode 2 analog”. You can actually open any pin by simply sending a message to the [arduino] object. “pinMode 4 input” will open Pin 4 for digital input, “pinMode 12 analog” will open Pin 12 for analog input, and so on. This will make your life easier when you make your own patch around the [arduino] object if you need to open several pins on startup.

If you have any button or pot connected to your board, you can open the relevant pins and look at the lower part of the “arduino-test” patch. The output of the analog pins is on the left-hand side of the patch. If you have connected a pot to your board, you should see the value change in one number box as you move the pot. The ouput of the digital pins is in the lower right corner of the patch. It concists of a set of toggle boxes. If you have connected a switch/button to your board, you should see a cross appear when you press the button and vanish when you release it (or the other way around depending on the wiring of the button).

You guessed it : if your pot and your button can change the values in a number box and a toggle box, you can control just about anything in any Pd patch with your Arduino board! Sweet. That was the easy part. Now go get your soldering iron and your drill and make a nice pedal with lots of buttons and pots to trigger even nicer effects for your guitar😉 .

This entry was posted in Interfacing Pd and tagged , , , , . Bookmark the permalink.

16 Responses to Getting started with Pduino ([arduino])

  1. Pingback: Installing the Arduino IDE | Guitar Extended

  2. Pingback: Arduino-based pedal ([pduino]) | Guitar Extended

  3. mhampton says:

    What platform (Mac, Windows, Linux) are you running this on? I am having trouble getting arduino-test to work. It looks like it requires cyclone, which I tried to install. It is trying to find “gate.pat” which isn’t in the Pduino download nor is it in the latest cyclone.

  4. Pingback: Raspberry Pi ทำเอฟเฟคกีต้าร์ | Raspberry Pi Thailand

  5. Pingback: Tonefreqhz DIY pedal. Update on build - Les Paul Forums

  6. Jonny S says:

    Hi,

    Im trying to get my Arduino to read a membrane potentiometer in PD and I’m having trouble uploading the Firmata onto my Mega 2560. I have replaced WProgram in all files but I am getting errors on everything and can’t upload. Any ideas?

    Thanks

    • Nope. Perhaps you should try with the latest version of the IDE : http://arduino.cc/en/Main/Software

      • Jonny S says:

        Hi I’ve sorted it, I put it in the wrong libraries folder. I can’t figure out how to amend the arduino code to have multiple analogue inputs though so they read through PD. I want to have 6 potentiometers running through the board and being read in PD. Haven’t the first clue where to start code-wise.

      • You need the firmata script loaded onto the Arduino board (available in the libraries in IDE). No coding is required on the Arduino, you’ll only have to worry about what happens in Pd.

  7. ricccdyu says:

    Hi How are you connecting the switches up I know you set the input mode, but how are you actually setting up the pins? Are you using one leg connected to 5v and the other to the corresponding digital pin?

  8. Guilherme says:

    Hi! First of all, thank you for sharing such an interesting project.

    I just didn’t understand very well how am I going to plug the wires that come from my guitar to my arduino, though. Could you explain it, please?

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s