Category Archives: lab

MC Squared

MC Squared documentation thumbnails

Get it now! Detailed, full-color documentation of the famed MC Squared midterm project!

MC_Squared(fin).pdf (14.68 MB; sorry, it contains a couple of embedded videos)

We gave our presentation today, the thing mostly worked, and it wasn’t too embarrassing. And, unlike some people in the class, my group actually got two or three hours of precious, golden sleep the night—well, morning—before. (We closed down the floor at about 3:30 a.m., but a few of our classmates relocated to the library or some such place to keep working. Everybody seemed pretty crispy by 9:30 this morning.)

PhysComp midterm project, week 2: Rough prototype, sexed up

Our project is now all dressed up, NYC-style:

The black box: closed

Diego and/or Filippo cut all the squares out of black foamcore and set two of the infrared sensors into the sides. Then, when I rolled in after dinner, I taped the pieces together into a flat pattern and made velcro hinges to pull it together into a box:

The black box: interior

And then—my crowning achievement of the day—I devised a neat little latch for it.

The black box: closed latch

While Diego and Filippo were figuring out more deluxe ways to use Minim than what I had hashed together the day before, I set about making my breadboard setup a little more robust, so that it could stand being sloshed around a bit in the box. Because the wires that came with the IR sensors are multistranded and very fine, they’re difficult to poke into the holes in a breadboard, and then they don’t want to stay in once they’re there. So it seemed to me that they ought to be soldered to header pins, as shown in the soldering lab.

This is, of course, much more difficult than it looks—for me, at least. I present to you what I believe to be my ugliest soldering job yet:

Another bang-up soldering job

Hideous. Pathetic. Heartbreaking.

But soldered they were, and they were, in fact, slightly easier to plug into the breadboard. Once I, you know, straightened the pins out with pliers.

How are you supposed to do this? Is there some trick to soldering multistrand wire to a header pin? Was I just doing it all wrong, wrong, wrong? Is it a mess because (a) I can’t see in the shitty light of the lab, and (b) I can’t hold my hands steady? I hate this. Help!

PhysComp, week 6: Bride of Serial Out

This week’s lab was mostly uneventful, although it took me something like six hours to do—I started after our CommLab make-up class ended, around 4 pm, and stayed until nine or ten.

First I thought I’d use one of these nifty sensors I got from SparkFun,

PComp lab, week 5: Serial Out

but then I realized I have no idea how you’re supposed to hook them up. Stick the pins straight into the breadboard? Solder wires on? How long should the wires be? So instead I used the stupid knob again, plus one of the IRs I bought for our midterm project.

The thrill of the knob has totally worn off. Then I saw Jorge soldering wires to an ultrasonic range finder just like the one I have, and I thought maybe it was a good time to try out my own. Ha! Thus began one of my more frustrating soldering bouts so far.

Helping hands

It must have taken me forty-five minutes to solder three freaking wires onto this cookie . . . and then it took me another hour to realize that the reason it wasn’t working was that I’d soldered the yellow wire to the wrong hole. And then I couldn’t get it unsoldered to save my life, so I just attached a fourth wire.

Finally I got them all hooked up:

1 digital + 2 analog

And then, there was serial output:

Et cetera.

After all that hair-pulling, the ultrasonic sensor was giving me really erratic readings (then again, so was the push-button switch: its value didn't change when I pushed the button, but it did when I touched the button). So I switched to two IR sensors, since I had so many lying around.

Then I got to the part about the handshake. Handshaking? Was not happening for me. I think it may have had something to do with this:

PhysComp homework, week 6: serial out 2: 15 PhysComp homework, week 6: serial out 2: 16

The Processing application was looking for the word "hello," but the Arduino didn't seem to be able to say the word without stuttering horribly. I tried for more than an hour, I think, to get them to talk to each other, but finally I had to just give up.

PhysComp midterm project, week 2: Rough prototype

A semi-working prototype!

Part 2 in the saga that began last week.

After spending about an hour playing with the Minim library in Processing, I went into the lab to see if I could get it to work with actual input from our IR sensors. This was basically a repeat of this week’s homework, which I’d done, for once, before the morning it was due, so the wiring part was uncharacteristically easy. I need to get some header pins, though; the stranded wire on the IR sensors is a pain to plug into a breadboard.

So our project—which I realize I didn’t explain last week—is going to be a cubeoid musical (or, at least, noisy) instrument with an infrared sensor set into each side, mounted corner-up (as demonstrated by Diego) on a camera tripod. One or more players can then use their hands or other body parts or utensils or pets to trigger different sounds from each side. We were thinking that for Phase One, i.e., this week, we’d have the sounds be synthesized tones, and that for Phase Two, the final version, we’d make it play various different loops.

It turned out, however, that it’s far easier—for me, at least—to get Minim to play loops than to synthesize sounds. And there are a lot of free sound clips out there in the world. I got mine from CanadianMusicArtists.com. This pre-prototype, therefore, has only two sensors, both of which trigger audio loops. It also has the beginnings of a lame-ass bouncing ball animation, but it doesn’t do what I want it to do, mostly because the signal’s changing too rapidly. Graphics were a tentative feature for Phase Two, so I’m not going to fuss with that part any more this week.

Here’s some crappy video of Filippo (left) and Diego (right) making the sensors generate noise. You can barely hear it, unfortunately—listen for the annoying rapid clicking sound, which I think is the hi-hat sound.

The beauty part? This doubles as my ICM homework.

Here’s the Arduino code:

/* Reads data from two analog sensors (IR sensors, in this specific example)
and outputs the values in a format that can be easily parsed in Processing.
*/

int ledPin = 7;
int irSensor0 = 0;
int irSensor1 = 1;
int sensorValue = 0;

void setup()
{
// Flash the LED three times to announce the start of program.
pinMode( 7, OUTPUT );
digitalWrite( 7, LOW );
delay( 300 );
digitalWrite( 7, HIGH );
delay( 300 );
digitalWrite( 7, LOW );
delay( 300 );
digitalWrite( 7, HIGH );
delay( 300 );
digitalWrite( 7, LOW );
delay( 300 );
digitalWrite( 7, HIGH );
delay( 300 );
digitalWrite( 7, LOW );

// Start serial port at 9600 bps:
Serial.begin( 9600 );
}

void loop()
{
if (Serial.available() > 0)
{
// Read the first (0) sensor:
sensorValue = analogRead( irSensor1 );

// print the results:
Serial.print( sensorValue, DEC );
Serial.print( "\t" );

// read the second (1) sensor:
sensorValue = analogRead( irSensor0 );
// print the results:
Serial.println( sensorValue, DEC );

// Follow the last sensor value with a println() so that
// each set of four readings prints on a line by itself:
Serial.println( sensorValue, DEC );
// delay ( 100 );
}
}

And here’s the Processing code, where most of the excitement takes place.

PhysComp, week 5: Serial Out

I was trying to figure out the math to make part of the graph show up as brown—i.e., earth—and then scatter flowers on top, but something wasn’t working out and I was running late, so I gave up.

Anyway, here are the progress shots:

Setup:
P1000190.JPG

Pot hooked up:
P1000199.JPG

Blinking LED:
P1000204.JPG

I also shot a fascinating movie of the program loading on the Arduino and starting up—you know, flickering yellow light, then blinking LED; hot stuff:

Final code on Arduino:

int potPin = 0;
int potValue = 0;
int ledPin = 2;

void setup()
{
// flash LED three times to announce start of program
pinMode( 2, OUTPUT );
digitalWrite( 2, LOW );
delay( 500 );
digitalWrite( 2, HIGH );
delay( 500 );
digitalWrite( 2, LOW );
delay( 500 );
digitalWrite( 2, HIGH );
delay( 500 );
digitalWrite( 2, LOW );
delay( 500 );
digitalWrite( 2, HIGH );
delay( 500 );
digitalWrite( 2, LOW );
delay( 500 );
digitalWrite( 2, HIGH );

// start serial port at 9600 bps:
Serial.begin( 9600 );
}

void loop()
{
// read analog input, divide by 4 to fit it in the range 0-255:
potValue = analogRead( potPin );
potValue = potValue / 4;
Serial.print( potValue, BYTE );
// pause for 10 milliseconds:
delay( 10 );
}

Final Processing applet

Servo

Two birds, one stone:

Sorry about the wobbles.

This is my video journal of the Servo lab for PhysComp, filmed for CommLab on a Sanyo Xacti 6MP digital movie camera.

I tried to edit this within the Xacti, but I ended up joining the clips together in the wrong order. It was way too much work to separate them again—it’s just a lousy way to edit—so then I dumped the mess into iMovie HD (an older version, recommended by Bre Pettis in his very fine Getting Started in Video series), recut and rearranged it, and added title frames from Photoshop (too bad they look like crap after compression) and CC-licensed music by the excellent Kristin Hersh. This was my first time using iMovie; I found it reasonably intuitive.

So, basically, it’s just the worst video for a Kristin Hersh song ever. Rock on.

PhysComp lab, week 3: Electronics

This week’s PhysComp lab looked pretty straightforward, but that’s only if you don’t take into account my singular gift for turning LEDs backward and mixing up power and ground on the breadboard.*

So, first, there was the obligatory soldering. It wasn’t quite so bad this time, I think, though I did manage to melt some of the plastic inside the jack.

Soldering the DC power jack

Then I had a lot of puzzlement over the high voltage readings I was getting. And there was a burning smell, even though I’d turned off the soldering iron ten minutes before. Hmm. Could there be something wrong with the—

Ice used after I made the mistake of touching the voltage regulator

Handy Tip: Voltage regulators get really fucking hot. Don’t touch them.

Finally, I found the wire that was going into ground instead of power and got the desired voltage reading. Then, I added a switch and an LED.

Breadboard with power jack, voltage regulator, push-button switch, and LED

And, again, wired the switch into ground instead of power. Got that sorted, and—

Pressing the switch to light the LED

Ta da!

The next step, putting two LEDs in series, went fine (with voltage readings of 2.11 for the red LED and 2.88 for the green), but when the instructions said to add a third . . . well, I’m not sure how you add a third LED in series. Is it like this—

How do you put three LEDs in series?

Probably not, since that wiring scheme works, while the instructions imply that adding a third LED makes them all go out. Comparing my voltage numbers here would probably tell me the answer to this question, but although I took lots of photos to record the multimeter readings, I can’t remember which reading was from which part of the circuit or taken at which step. Sigh. I should have just written them down.

Setting the LEDs in parallel was also pretty easy, but measuring the amperage across them was simply not happening. I tried it every which way, but I couldn’t get the circuit closed with the multimeter as part of it. After trying several interpretations of the written instructions and circuit diagram, I gave up and moved on to the pot part.

Breadboard with potentiometer and LED

Again, no problem wiring it. The voltage readings were 1.78 at about halfway and 2.89 at full blast.

This lab took me about four hours, sadly.

* The reason for the latter, in my defense, is that the breadboard in my kit has ground on the outside rows, while the breadboard in all the photos within the instructions has power on the outside. I always forget to check the color of the row, matching only the position. And sometimes I’m just not paying attention.