« December 2007 | Main | February 2008 »

January 30, 2008

Pudding Cup reader

For the first assignment in Networked Objects, I made a cup lined with photosensors that reports on the amount of pudding remaining in the cup.

pudding cup

The system works - as the pudding is consumed, more light reaches the photosensors, and the Arduino sends this information to a Processing app which updates a bar-chart on the laptop with the amount of pudding remaining.

I had a number of challenges with this:

1) I forgot to wire the photocells as voltage dividers (ie one leg to power, the other to ground via a resistor, and also to the Arduino analog input).

2) Problems with the Simple Message System library for Arduino - it just didn't work, so I ended up writing my own serial comms handler.

3) Problems with various versions of Processing. It turns out that the version of Processing *with* Java included and the version *without* Java are actually really different. The Java-included one uses a rather old, and modified, version of Java (which is also incompatible with Eclipse). The one *without* Java uses whatever Java JVM is installed on your system, so it will be compatible with Ecllipse, but some Processing extensions won't work.

4) Finally, something is not working with my code. I am doing some basic error checking to make sure that the strings coming from the Arduino are correctly formed, and about 10% of them are not.