Physical Computing, Final Project

For my final project in my Physical Computing class, I chose to build a small robotic piano-like instrument. Building upon the ideas I had for my previous project (a sort of robotic lap steel), I decided to add dampers and ditch the string bending to try to keep things simpler. Besides the dampers, I wanted to figure out how to control many more digital outputs than are available in the arduino.

I decided on using the 74HC595 shift registger to expand my outputs. Since I wasn't too worried about having PWM to control solenoids, I figured this would work fine. There's also a good tutorial about using them with an arduino, so it was pretty easy to get going.

One thing that I didn't like however, was the way you had to interface with the shift register code-wise, and I didn't feel like the examples were abstracted enough, so I wrote a couple functions to make it seem more MIDI like:

void noteOn(int noteGroup, int input, long dur) {

  notes[noteGroup][input] = 1;
  durations[noteGroup][input] = currentTime + dur;
  char result = 0;
  for (int i = 0; i < 8; i++) {
    if (notes[noteGroup][i]) {
      result |= 1 << (7 - i);
    }
  }

  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, result);
  digitalWrite(latchPin, 1);
}  
void noteOff(int input) {
  notes[noteGroup][input] = 0;
  char result = 0;
  for (int i = 0; i < 8; i++) {
    if (notes[noteGroup][i]) {
      result |= 1 << (7 - i);
    }
  }

  digitalWrite(latchPin, 0);
  shiftOut(dataPin, clockPin, result);
  digitalWrite(latchPin, 1);
}  

Basically, you have an array of "notes" and the noteOn function flips the bit for which ever input you tell it to, and then it passes the binary to the shift register. This works well when using one shift register, but I'll need to come up with a way make this method scale with multiple shift registers in series.

I used the same push solenoids as before:

And I decided to try these pull solenoids for the dampers:

Luckily I was able to cut off part of the mounting bracket so I could mount it above the string like so:

One thing that I wanted to do with this project was come up with DIY tuners so I didn't have to mess with using guitar tuners. After hours of searching hardware stores for parts that would work, I eventually came up with this:

Inspired by the tuners used for Portuguese Guitars:

It works quite well really. Because I forgot to reinforce the middle of the board holding the tuners, its a little unreliable right now as the board bends with increased tension, but I'm sure it'd be fine if I stuck a couple bolts in the middle.

I stuck with using guitar strings since its so easy to do string-through bodies, but I decided on using a couple of red oak boards for the bridge/nut. Once the string slots were filed, it sounded good and had less buzz/noise than aluminum.

For the brains, I used the arduino pro mini, two 595 shift registers, and two opto-isolator boards to drive the solenoids.

I ended up making this little board to help interface the shift registers with the arduino/opto-isolator boards:

Once I got everything together, there were a few problems. My last project I used a 1" string height, and I remember thinking I could go higher next time. I did 1 1/2" this time, and it made my gluestick-on-the-solenoid-armature trick difficult. Its hard enought to get it on straight normally, but when the gluestick part has to be that long, it tends to sag, which makes it a pretty lame acuator! Although it was clever at first, I feel like I have to come up with a better way to do this. Perhaps something properly attached with a set-screw.

Next I discovered that although my pull solenoids are 12v-24v, their throw seems to be shortened at 12v, so I had to place the damper board too close to the strings, causing them to slam down and actually make more sound than they dampen. They are also pretty noisey on their own, so once I get a proper power supply, I'm going to have to look into putting something in there to soften the pull.

Here's a short video that demonstrates this:

So overall, its a big improvement, but still a lot of refining that needs to be done. I'm planning on working on the code a bit more so that I can throw together sketches quickly. I'd like to be able to focus more on musical code problems than bit shifting and assigning outputs.

more code?

Do you have any more code. i'm trying to do a very similar thing and your approached to triggering notes is more effecteive than the typical use for the 595, ie 7-segment displays.

how do you then sequence this, is it connected to midi from the computer or just running a looped sequence.

thanks,

t