masthead

“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.

My First AIR App!

Wines of the World has been a great class. Go to school, drink wine, boom. Done. But don’t be fooled - it is a serious class with serious projects. For my final project, I decided to have a crack at AIR and make something wine-related in the process - an RSS reader that takes Wine Spectator’s Daily Editor’s Picks feed and presents today’s wines of choice. Last night, armed with Matt’s extremely useful book and my free educational copy of Flex Builder, I began my first AIR app.

Of course, though, I ran into my share of problems, so I thought I would share what I learned here in case anyone else has the same problem.

  • Custom Chrome: As you can tell from my comp above, I required my app to be free of the OS’s default chrome. There are countless tutorials out there about how to do this, and after reading all of them I still had not yet realized that you had to remove the comments around the <initialWindow> tag in Flex’s app.xml file. That was dumb on my part, but seriously, of the three video tutorials Adobe put up on the exact same subject, not one mentions it.
  • Embedding Fonts: I found this very useful if you want to embed a PostScript font into your project.
  • Publishing: It took me quite a while to find out that I don’t actually have to pay to have my AIR app published with a signed certificate, and that you can just make one yourself. Instructions on how to do that are here.

Over the course of this project, I have definitely grown to like the wild HTML/CSS/ActionScript fusion that is Flex and AIR. I think that with some more practice, I can get quite comfortable with it. And if you want to download a copy of my app, you can get it here. It’s missing a few features and details, but I think it’s a nice start. I feel like I should add that I am in no way associated with Wine Spectator magazine, they just happened to have the nicest RSS feed available.

Arduino Beer Theft Prevention Device

Ah, Physical Computing and tight deadlines. Nothing gets my creative krausen frothier. Which is why I am now able to present to you this monstrosity of a contraption, the Beer Theft Prevention Deviceā„¢.

It would truly be a travesty if someone at a party were to ask, “hey, which of these beers is mine?” and then pick up YOUR beer by accident. So that everybody knows which beer is yours, I strapped a bunch of electronics to a beer bottle. Problem solved.

To complete the requirements of the assignment, however, I had to make those electronics do something. So here’s how it works: There’s a switch on the side of the bottle. When it is disengaged, nothing happens, and you can drink your beer normally. When the switch is engaged, it turns on an ultrasonic rangefinder that checks the distance of any would-be beer thief’s lips from the mouth of your bottle. If he gets too close, it tells a solenoid to let go of its hitherto magnetically-attracted rod. As the thief tilts the bottle up to take a sip, gravity takes over and the rod falls in their face, hitting them right on the nose.

Crisis averted!!

Sensophoria

For the past 4 months now, I have been working on Sensophoria, my final team project at RIT. I invite you to check out that project’s blog here. I will start to post more about it on this blog once the project is done - time is of the essence right now!

Bill Cosby Sweater Musical Generator

My next project for Physical Computing was to make something wearable, so I chose a poncho which, when worn over a Bill Cosby-esque sweater, would turn the colors of the sweater into music. It was composed of three parts: The color sensor, an amplifier and the innards of a delay pedal. The color sensor works quite simply, by flashing a red, green or blue LED at a photoresistor and measuring the resistance. That circuit looked like this:

The code just turned each LED on individually and measured the value coming back into the input pin. It could be calibrated to make one tone for each three LEDs, but it sounded more fun just having each flash generate a tone.

I picked up the delay pedal, a DOD DFX91, off of craigslist. The switch was broken, which was fixed after a little soldering. After running the sound through the delay pedal, though, the volume had been lowered considerably. In my travels for an amplifier, I came across the Little Gem, which worked beautifully (after a few missteps with my amateur soldering abilities).

Finally, I picked up a cheap plastic poncho, and with the help of some duct-tape reinforcement, attached everything together. Here’s a picture of me looking quite silly it. I have started to take it apart again for the next project, but I’ll take a sound clip of it in action and upload that soon.

Portfolio Reminder

For those coming in to the blog, please do stop by my portfolio site: Sam Brenner, New Media Design Portfolio

Photoresistor Color Sensor with Arduino

As a part of my next Physical Computing assignment (more on that later), I need to build a little module that will read the color of whatever it is pointed at. I’ve been using this site as a starting point, which is very helpful. What happens is that three LEDs - one red, one green and one blue - light up in sequence and the reflected light is measured by the photoresistor. Those three values can be combined into one RGB color which the computer can display. Pretty nifty!

In the example, they have a integrated circuit powering the cycle of the lights. I took a look at the documentation for the counter circuit we have in the lab and it was totally over my head, so I decided to use the Arduino to take care of the cycling. This limits how many color sensors I can have running in total, but the LEDs are pretty pricey, so it’s probably for the better.

My next steps with the color sensor are to calibrate the LEDs by getting their values against something white and something black. Then I should be able to map the values in the range of 0-255 and have Processing produce a color. I’m having problems with my Wordpress uploads permissions, so I will post pictures later.

TwitShit

My first project for Physical Computing was to find a creative way to turn an LED on and off using Arduino. A while ago, I said that the only way I’ll use Twitter (which I think is beyond pointless) was if I could hook it up to our cat’s litterbox and have it “Tweet” every time the cat takes a poop. An LED would light up to signal “the litterbox is occupied” or start flashing to signal “warning: it may smell awful.” And that’s exactly what I did!

I had first planned to install an ultrasonic sound emitter inside the litterbox to detect if there was something inside. When I went to Jason to look through his box-o-sensors, however, I found the flex sensor which was not only much easier to use than the ultrasonic emitter, but it would be much easier to code for as well. The flex sensor outputs a number which tells me if it is bending one way or another.

p3170089

Once I had wired up the board, I took to writing the code. The Arduino code checks three times a second to get the value of the sensor. If it is bending into the litterbox, it signals the LED to turn on. If it is bending out of the litterbox, it tells the LED to flash for a few minutes. The Processing code is responsible for posting the Twitter updates, which works like this: the Arduino board is able to broadcast information via the USB port back up to the computer, which Processing listens for — this is called a serial event. Depending on what the event parameters are, I can tell which direction the sensor is flexed in and post the appropriate tweet using a nifty library called JTwitter. Here’s a screenshot of the programs running on my laptop (technically, Arduino doesn’t have to be open for it to work, but it looks cool with them both there):

screenshot1

And here is a picture of the installed “device:”

p3170090

If you’re interested, you can follow our beloved cat Reptar on Twitter here.

New Portfolio Site! sjbrenner.com

Go check it out! A brief bit about the site: It’s built in AS3 and XML; I also used swffit so I could use the browser’s scroll bar instead of making one in AS3 (see how the height changes on each page! I think that’s pretty slick). There are a few bugs and missing features (a way to display progress work, a more integrated way to view still image projects) and those changes will be made soon. I’ll also be moving this blog over to the new domain sometime this week.

Of course, now I have to bump that page up in Google for my name to maintain my hard-earned number one spot: Sam Brenner New Media Design Portfolio.

Sankey Diagram Generator, Final Print

sankey_final_01

UPDATE: I released the code, get it here.

It was more fun than I thought to read through the entire stimulus bill, and even more so to do it again, with a different version, when the bill was signed into law. Fortunately, I stumbled across the website stimuluswiki.com, which made the second readthrough considerably easier. After turning all the numbers into XML, I ran it through Processing, fixed whatever errors I had (including an extremely perplexing error involving Processing not liking my XML file generated in FlashDevelop, but having no problem with the exact same code copied and pasted into Dreamweaver) and went to the printers. I’ll take a picture of the print itself later, but for now you can click on the image above for the whole thing or see some actual-size details below.

sankey_final_02

sankey_final_03