26 November 2014

The Marble Sorter

Outdated logo? Yes.
My shortlist of Things I am Still Not Over reads something like this:
  1. All the arguments I've ever lost
  2. The 2012 Republican Presidential Primary
  3. The Marble Sorter
For those blessedly unaware, the marble sorter is an assignment in the Project Lead The Way pre-engineering program. Small teams of students are tasked with designing, building, and testing a system to sort marbles based on color. The project format has changed a number of times, including the materials (we used fischertechniks, I believe Vex is now standard), plus the many tweaks teachers make to fit their resources. But that's inconsequential.

What matters is how badly my partner and I failed, and why.

In the end, we never did get a decent performance. The criteria specified that all the marbles would be dropped into the machine at once, and then sorted by color into three categories. (Marbles came in blue, black, and clear. Extra credit was available if it could distinguish between dark blue and black marbles.) In the end, ours could distinguish between clear and opaque marbles, under the right conditions, if they were loaded one by one. On a project worth a huge percentage of the semester grade, we got around fifty percent.

And we had to fight for that. We came in early, and stayed late. Principles of Engineering was right before lunch, and I missed a few meals for that project. It inhabited my dreams (I know, I was keeping a journal for Psychology). I fantasized about tearing it apart and starting afresh, and over four years later I'm still thinking about it.

But that wouldn't have made a difference, because Nathan and I weren't using good engineering practice.

There's a programming proverb: "resist the urge to code." In engineering, this applies to both the software and the hardware. It strikes me as odd the Principles of Engineering curriculum didn't mention it. Maybe it did and the lesson just didn't stick. Regardless, we ignored any cautionary impulse, and began building with only an excuse for a plan. We drop the marbles into a hopper, they roll down a chute, a door lets one out, the photosensor tells us its color, put the bins on a track that moves back and forth, and another door opens to drop the marble into the appropriate bin. What could go wrong?

Quite a lot, it turns out.

I could go into many, many details, but (fortunately for you, readers) I've forgotten most of them. I still have my notebooks lying around somewhere, but our slack documentation would have gotten us fired from any worthwhile company. This itself was another bad practice, which hamstrung our ability to replicate more successful approaches and identify what wasn't working.

One of those things was our approach to the materials. I'd experienced fischertechniks in middle school at a PTLW-sponsored summer program, and really should have understood just how stubborn they are. Yet we blundered ahead as if they were modelling clay, and burnt through huge chunks of our limited time trying to make them bend to our will.

A particular instance that sticks out in my memory: the mess we made trying to build and secure one of the doors. What's worse, though, was trying to reconstruct it after taking it apart. In retrospect, the situation was ridiculous. The whole system was elevated for no good reason. We had to build ridiculous struts and cantilevers, when we could have just attached the motor cleanly if we'd had the sense to set the system on a lower platform.

Unnecessary elevation brings us to our next point: ignoring basic scientific principles.

For a system driven largely by gravity, you would think doing some physics would occur to us. Then again, I'd only had the briefest introduction.

In the final days of the project (when we'd already missed the deadline and were fighting for completion points) we had several recurring frustrations. First, our chute, hopper, and bin systems didn't work very well at containing the marbles. They had an annoying tendency to bounce right out of the marble sorter altogether. The reason for this was very simple: elevating the system gave the marbles too much potential energy.

Potential energy was also the root cause of our second problem. No matter how much time we spent tweaking, we never could figure out the precise time the doors needed to open and close. We'd run several tests with an individual marble, then find all our measurements useless when we dumped the whole load in.

We had some clue at the time that it was the marbles' collective weight pushing on the marble, which usually resulted in two or three getting through. With my current knowledge of physics, I realize it's an application of weight and Newton's Third Law.

Weight  = mass * gravitational acceleration
Force = mass * acceleration

In the first equation, mass refers to that of the marbles altogether. In the second, it's the mass of an individual marble. Stated symbolically:

mload * accelgrav = massmarble * accelmarble

For the non-STEM people out there, this means the accelerationspeed a marble goes through the gate is related to the number that have already gone through. Later marbles go through slower than earlier ones.

We spent hours trying to find the right gate time, instead of taking a more sophisticated approach--either varying the gate time, or redesigning the hopper and chute to eliminate the gravitational effect.

Our final problem was more technical than scientific, because we knew the principle at play here. How do you measure slight differences in pigment when the ambient light is so variable? The obvious answer is to fully enclose, to the greatest degree possible, the area where pigment measurements are taken. We did this, but only with considerable reluctance and didn't do a very good job of it, because we still had some trouble.

The already flawed design, which we waited too late to modify, had a lot to do with it. We didn't know about sunk costs--yet another reason engineers need to learn economics. We had this problem in the first place, because we didn't consider external factors in developing our design.

At the time, the marble sorter almost drove me to a mental breakdown. Failure after failure had me seriously doubting the validity of reason (the unstated assumption was that I was operating rationally). I think it should now be clear this was not the case. After five years, the lessons are sinking in, and I'm finally get some closure. If only the other two items on the list were so easy.