Tuesday, April 16, 2013

Music of the Light, Part II: A Crash Course in Critical Components

After our long brainstorming session last class, on Friday we got together to work through some key components of the light-based music box.  We first built and troubleshooted a works-like model of the music-feeding component (which turned a scroll to move the music along toward the light sensors).
We started by building the scroll base, made of a Lego axle with five small wheels:

We then added a motor (connected to a SciBorg motherboard, connected to a computer running PicoBlocks) to turn the scroll:
We initially affixed the paper to the axle with a paper clip, and later with a complicated series of holes and washers.  Neither method worked well, due to imperfect straightness of rolling (it was difficult to perfectly align the paper) and an uneven radius of the scroll's base (which caused jerking).
The initial paperclip attachment:

Setup for testing the first scroll roll:

Peg setup for second scroll roll:

We noticed that we were automatically adjusting for imperfections in the rolling by holding the other scroll more tightly.  The final machine would ideally have the scrolls free-standing, so we built a base out of Legos to test this mechanism:
(The scroll paper was deliberately unwound in this picture to show the rough Lego structure.)  We added the bar just behind the non-motor scroll to maintain some tension, to help keep the scroll from unwinding by itself.

Another view of the structure:

We noticed a few imperfections of this design.  It had a tendency to get stuck:

Also, the paper unrolled unevenly--the motor pulled at a constant rate (as set in PicoBlocks), but the scroll unrolled in a series of jerks:
We think the jerkiness was caused by the tape linkage of our paper (we initially taped together two shorter pieces of paper to make a sheet long enough for a scroll), and also because the way our pegs attached caused the radius of the scroll base to vary.  Hannah braved the huge paper cutter in the library and we decided to try taping a long roll of paper onto the scroll base, to keep an even radius and eliminate any tape-joint-jerking problems.

A list of our setbacks before testing the final iteration:

The long roll of paper taped to each scroll base:

The final test:


Ahhhh...beautiful!


After this success, we moved on to the beginnings of an actual music-reading program.  We hooked up the photo cells to the SciBorg motherboard and started testing readings.

Our final staff paper should look something like this:
Only four lines are necessary, since we have only eight photo cells; that's plenty to generate a full octave, however.  Each photo cell will read a specific region of the staff; if it senses darkness (i.e., the black dot of a notehead), it will play a certain pitch.

 Our test palette for sensing contrast with the photo cells:
We had initially hoped to change rhythms depending on color; this may or may not be possible, depending on our time available to increase the complexity of our final program.  There is a large difference between the  photo cells' readings for white paper versus a dot of black marker (about 100 units, though this is smaller depending on the shadows).

 We tested photo cell sensitivity with PicoBlocks:
 We used a program similar to this one which made a "chirp" noise (out of an attached speaker) when the photo cell read a value over 530 units.  After a number of iterations and some consulting with the illustrious Professor Berg, we generated a text program to control each photo cell individually:

(The final line is simply present as a syntax guide.)

While I worked on the programming, my trusty team built a works-like Lego model of the photo cell housing.  After testing confirmed that shadows were a major source of uncertainty in the light reading, we decided to attach an LED to the photo cell array.  We also noted that shading the photo cells reduced variability in their readings, so we used Legos to isolate the photo cells from light that might be coming in sideways--we blocked the sides of the photo cells, so they could read only directly beneath the sensors.

The top of the first array:
Adding in the LED:

Sensing with the LED: 
This design proved much more effective than sensing without an additional light source--there was a much greater difference in photo cell values when held over a black marker dot versus the white paper.

 The photo cell assembly, hooked up to the SciBorg motherboard (plugged in to a computer running PicoBlocks):
We added some more blocks to better isolate the photo cells from light not directly beneath the sensors.

The note-reading program in action:

Appropriate darkness detection was music to our ears!


By the end of class, we made a lot of progress on the two major components of our light-based music box.  We had some definitive goals and a plan of action for next time:

We tucked away all our technology and eagerly awaited the next class!

No comments:

Post a Comment