“The Dock,” A real-life Arduino-powered OSX dock
For my final project in Physical Computing, I’m making a real-life Mac OSX dock, with little Sculpey icons that you can use to open and close programs.
First some pictures: the outside, the inside and the icons.



It works by measuring the values of resistors that I glued on to my icons. Each pair of brass washers coming out of the box acts as a switch that can only be turned on by putting an Icon on top of it. Any icon can be placed on any spot in the dock, which completes the circuit. A wire leads to the analog inputs on the Arduino board, which reads the value and then sends out a character over the USB serial port. Each icon has a unique character for it being placed on the dock and for it being removed from the dock.
Reading those serial calls and having them control the applications was harder than I expected. My first plan was to use ASProxy, a program which runs different AppleScripts based on a character received over serial. Sounds perfect, but it didn’t work with how I had coded my handling of the circuit. It seems that to get good results from ASProxy, you have to write the character to the serial port often over many calls to Arduino’s loop() function. In my program, I only write to the serial port once, and I have a hefty delay between loops so that brief connection outages won’t produce odd results (for example, if someone knocks the icon off but then quickly places it back on. Magnets are going to be my next solution to this).
The next solution was to try and have Processing handle calling AppleScript functions. That led me to this Processing hack which doesn’t seem to work anymore. Processing didn’t like having to import that library - but there is a solution to this! Gotta love the Processing forums. You can call AppleScript by using shell scripts, as described here.
I still have a few problems to fix before this works perfectly. It seems that Processing is receiving serial calls even after I have placed and removed an icon. For example, if I place my iChat icon on and take it off, it works fine, but then will continue to open and close iChat. So I need to look into where those calls are coming from (using the extremely useful ZTerm, which has made many things in this process much easier). Also magnets would be a nice touch, so I will figure out a way to have them as well.










