Archive for September, 2008

Sweaty palms…

Wednesday, September 17th, 2008

Next project…attempt to have more fun. Sort-of achieved. I spent more time conceptualizing, however this proved to be at the exense of my construction time. I’ll have to find a balance….

So, the task was to create a type of “Love-o-meter”…inspired by the sort of device you’d find at a boardwalk or shopping mall…


Visualizing: Sound explored

Monday, September 15th, 2008

Taking the previous sketch a bit further. I’m still not satifisfied with this exploration and want to push it more. I adandoned the sonia library in favor of the minim libs, primarily for the ease of averaging the spectrum on a logarithmic scale.


Habitual music / sound survey

Monday, September 15th, 2008

1) Approximately how many of your waking hours each day are you listening to music? Of that number of hours, how much of the time is music you’ve chosen to listen to, and how much time is it music from speakers in a store, cafe, friend’s room, etc.?

I’ll have to measure, but I’m usually listening to my own music, either via portable device or speaker system (at home). Incidental will vary more as I don’t regularly go to shops et al, but may find myself out on a whim.

2) How much time each day do you spend listening specificially to a personal sound device of one sort or another? And how much of the time when you’ve got headphones on or earbuds in are you using the music to block out other sound like subways or something else you find annoying?

Much of the time. It happens often on the ITP floor when I need to get work done. When commuting by bicycle I generally avoid listening to music as I need to hear traffic, however when I’m on a long training ride I’ll keep it playing at a reasonably low level so I can still hear traffic.

3) How much time a week do you spend listening to music, either through a personal sound device or at a club/concert venue, which you feel could be loud enough to cause damage to your hearing?

Varies…I haven’t been to a show in a while. I do wear ear plugs at loud venues. When wearing headphones I do enjoy louder music, but have been consciously keeping the level down to just enough to block out unwanted noise. In a car I often listen to music too loudly.

4) How often in an average day, or week, do you spend actively seeking out silence? And how successful are you at finding a silent space if you do go looking for one?

I don’t often seek out silence…although I generally take note of it – rather, taking note of the absence of noise.

5) Do you think that the balance between sound and silence in your world is where you’d like it to be? Or would you like to change it toward more or less sound?

Haven’t thought about this balance. Silence only causes me to notice my tinnitus (however faint).

6) What’s the most powerful experience of silence you’ve ever had?

Lab: Breadboards redeux

Friday, September 12th, 2008

Finally got some breadboards and set them up with power regulators and all.

Then got to make some simple circuits. Yay electricity! (more…)

Visualizing: Revisualizing Sound

Saturday, September 6th, 2008

Progress on the sound sketch. I’m not satisfied with the sketch yet, but I’ve attached two screenshots of the result so far. The applet and source code are available.

Of the assignment description, the final sentences drew my attention:

“How would you explain it to someone who’s deaf. What is purpose of visualizing sound differently? Could you think of it as drawing with your voice?”

I happened to be sitting on Astor eating a sandwich after class and started thinking about these things. My initial notes:

Sound is time based…display the history (as a line, etc.)? Only show the immediate samples?

Sound is also layered and it is spatial. Think of a city street. There are sounds in all directions and distances. Is it the amplitude (volume) which is a clue to distance, or is it something like parallax?

Properties of digital sound: frequency, amplitude, sample rate, sample size, channels (stereo)

As a drawing tool: sound volume is really changes in pressure. An airbrush or paintbrush change the thickness of their strokes based on pressure. Can the drawing tool use sound amplitude in place of physical pressure?

How about opacity? Use the same technique? Have to hum lightly to make any mark at all?

What about color? Map a range of frequencies to a spectrum of color? Human voice, piano, etc? This is less useful in a noisy environment with many overlapping sounds.

I have started to create a drawing tool, but in the iterative process I have gone to a representation of the microphone’s sound in horizontal rows. Amplitude determines the height of each vertical line, the pitch of the loudest sample determines the hue. I have an alternate version using opacity to represent pitch. There’s much more experimentation to do.

Aspects of Physics - Qq47
Aspects of Physics – Qq47

Visualization of Aspects of Physics - Piano Pill
Aspects of Physics – Piano Pill

Physical Computing: Digital In/Out

Saturday, September 6th, 2008

I’ve worked with the Arduino before, but still enjoy the wonderful moment when an LED blinks to life. I have a lot to learn about building circuits, proper wiring and clean / efficient code structure. A lot of what I do amounts to hacks to get a desired functionality. Of course, this builds complexity which breeds bugs and insecurity. Nevertheless, this is a learning process and I’m getting better with each attempt and iteration.

So, off to creating the switch. I routinely get confused with the proper wiring schematic for a pull-down switch. I keep messing it up; it’s incredibly frustrating that I can remember so much but trip up on such a basic circuit. I looked at the schematic, then wired it incorrectly; then looked at someone else’s and wired it incorrectly again. Finally I got it right, but the code didn’t upload successfully (despite the message to the contrary in the Arduino console) which led me to believe that I still didn’t wire it correctly and started over. Eventually, the firmware uploaded and the wiring was right so it worked.

Basic Switch with a pull-down resistor.

LED illuminated when switch is depressed.

Tom mentioned creating a combination lock…so I took up that challenge. Unfortunately, in hindsight after working through this first version of the project I realize that I ignored his first direction (paraphrased): “Start with the physical reactions rather than the technical details.” So, now I have a four button combination lock that looks like other, commercial devices; what’s unique or interesting about that?  How does that expand the human experience?

Regardless, I was able outline a problem and devise the hardware and software to achieve the functionality desired. Namely:
-Multiple buttons
-Arbitrary pattern (hard coded to four presses currently)
-Visual feedback for incorrect code attempt, but only after an entire code has been entered
-Visual feedback for successful unlock
-Relocking with any button press while in an unlocked state
-User entry of a new arbitrary code, but only if in a previously unlocked state
-Visual feedback for the New Code Set state.
-Timeout for partial code entry to return to the initial locked state.
-Packaged in a clean housing. (although the Arduino+prototype shield just BARELY fits in the housing. It’s a bit sloppy)

I don’t have a proper breadboard yet, so I did this work on the cramped prototype shield on my Arduino. This doesn’t have the common power and ground rails that larger breadboards have so it made wiring more difficult, and a bit messy. Eventually I got four surface mount switches on there and an LED to indicate the lock status.

Combination lock prototype.

After the initial rounds of code testing I felt ready to make a more presentable unit. First change was to swap the switches for something friendlier to touch.

New switches. The leads ended up too long and I had to trim them to fit inside the enclosure.

There was a perfect plastic enclosure on the junk shelf in the pcom lab, which resembled security alarm panels I encountered before. Some quick mockups with marker and a bit of Dremel work later I had the switches all ready to go. I also added an new, recessed switch on the back of the housing for entering a new code.

Arduino wired to the switches and unlock LED.

I added a second LED to indicate that the unit is ready to accept a new code. I need to rethink the experience here. The red LED flashes when an incorrect code is entered, and goes solid lit when the correct code is entered. If the unit is already unlocked (red LED is lit) and the reset code button is pressed, the green LED will also turn on (both are on). The next four button presses will become the new code. Pressing the reset button while already in a reset or locked state has no effect. I wonder if users will be confused that the red LED going solid indicates unlock, rather than green. Maybe red solid would indicate locked, green solid would be unlocked and both on would be a reset state. I could still flash the red LED to indicate an incorrect attempt. Hmm…

Here is the “finished” enclosure.

Combination lock v1.0

Arduino code below. I really need to clean it up. I compartmentalized many functions to avoid overlapping code, but my logic is a bit sloppy. I had many issues initially with multiple button presses and switch debouncing. I subsequently added serial output to aid in debugging.

UPDATE: I changed the code to illuminate the red LED when the device is locked, illuminate the green LED when it’s unlocked, and both when in a reset code state. The below code has been updated for this functionality.

#include <SoftwareSerial.h>

// Combination lock
// 3.9.2008 robert carlsen

// have a series of buttons
// press the buttons in the correct sequence - light the LED

// incorrect sequence will flash the LED once and reset, waiting for input

// enable the user to create their own sequence and store it

// set up constants for the pinouts
int button0 = 2;
int button1 = 3;
int button2 = 4;
int button3 = 5;

int buttonSet = 6;

int ledUnlock = 11;
int ledLock = 12;

// need to only record once per press, not while it's held down
int firstPress = 1;

// remember the state of the lock
// 0 = locked, 1 = unlocked, 2 = set mode
int lockState = 0;

long timeout = 5000;
long lasttime = 0;

long debounce = 200;
long lastpress = 0;

// array will store the button sequence
// and set the initial code
// is there a way to store the code across reboots?
int code[4] = {

// store the users input
int entry[4];

// use a counter to track the progress of the combination entry
int counter = 0;

void setup(){
  // configure the buttons
  pinMode(button0, INPUT);
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  pinMode(buttonSet, INPUT);

  // configure the LEDs
  pinMode(ledUnlock, OUTPUT);
  pinMode(ledLock, OUTPUT);

  // for debugging

  //initially lock

void loop() {
  int pressCount = 0;
  int pressedButton;

  int state0 = digitalRead(button0);
  int state1 = digitalRead(button1);
  int state2 = digitalRead(button2);
  int state3 = digitalRead(button3);

  if(state0 == HIGH && firstPress) {
    pressedButton = button0;
    lasttime = millis();

    Serial.print("button 0 pressed n");
  if(state1 == HIGH && firstPress) {
    pressedButton = button1;
    lasttime = millis();
    Serial.print("button 1 pressed n");
  if(state2 == HIGH && firstPress) {
    pressedButton = button2;
    lasttime = millis();
    Serial.print("button 2 pressed n");
  if(state3 == HIGH && firstPress) {
    pressedButton = button3;
    lasttime = millis();
    Serial.print("button 3 pressed n");

  if(digitalRead(buttonSet) == HIGH && lockState == 1){

  // only allow one press at a time
  if(pressCount > 1){

  else if(pressCount == 1 && firstPress == 1 && millis() - lastpress > debounce) {
    Serial.print("lockState: ");
    case 0: // locked

      //if four presses have happened then we've rolled over by now
      if(counter >= 4) {
        boolean state = testUnlock();
        else {
    case 1: // unlocked
    case 2: // set new code
      //if four presses have happened then we've rolled over by now
      if(counter >= 4) {

    firstPress = 0;
    lastpress = millis();

  // reset the firstPress variable one all the buttons have been released
  if(state0 == LOW && state1 == LOW && state2 == LOW && state3 == LOW){
    firstPress = 1;

  // timeout if the code has only been partially entered
  if(millis() - lasttime > timeout && lockState == 0 && counter > 0){
    Serial.print("timeout: ");
    Serial.println(" ms");
    lasttime = millis();


  //  delay(100);

void addPress(int currentPress) {
  Serial.print("counter: ");
  if(lockState == 0) {
    entry[counter] = currentPress;
  else {
    code[counter] = currentPress;


boolean testUnlock() {
  // compare the entry and code arrays
  for(int i=0;i<4;i++){
    if(code[i] != entry[i]){
      // only one mismatched entry will fail
      return 0;
  // if all have passed then the combination must be correct
  return 1;

void lock() {
  // turn off the unlock light (and flash the lock light
  digitalWrite(ledLock, HIGH);

  lockState = 0;

  // clear the users input

  // reset the counter
  counter = 0;

  Serial.print("locked n");

void unlock() {
  // turn on the unlock light, turn off the lock light
  digitalWrite(ledLock, LOW);

  lockState = 1;

  // clear the user input

  //reset the counter
  counter = 0;

  Serial.print("unlocked n");

void setNewCode() {
  Serial.println("Setting new code mode");

  // illuminate both lights
  digitalWrite(ledLock, HIGH);
  digitalWrite(ledUnlock, HIGH);
  lockState = 2;

void blinkLed(int led) {

fully committed to the cloud…

Thursday, September 4th, 2008

what a long strange trip it’s been?

i wrote “sold out” on the face of my first mobile (erm, cell) phone. i’ve always been interested in technology, but the pervasiveness of cell phones turned me off…and like EZ Pass i wanted to have nothing do with them.

now as an avid iPhone owner (and before that several Nokia, Sony Eriksson, and iPaq smart phones and PDAs) i think i have to admit submission to the allure of the cloud lifestyle.

my personal data is becoming more accessible online…there is danger in that to be sure…but the promise of ubiquitious access is too much to ignore. i’m busier that i’ve been in years and don’t have the time to manually move and synchronize data across several disparate devices.

over the air sync = awesome. as long as i have access to the cloud i have access to my data. our devices are becoming most valuable as portals to data. they still have usefulness in and of themselves, to be sure…for example i’m writing this on a laptop while waiting for motion graphics to render in the background. i don’t need to be connected to the cloud to create work, although i did need to access the studio computer to grab the most recent version of the art files, and when the render is complete i’ll upload the clip to my server awaiting delivery to the client 100 miles away.

i can be anywhere yet everywhere at once as long as i have a solid and fast connection to the cloud. it’s futile to resist…and liberating to embrace.

Lab: Breadboards

Wednesday, September 3rd, 2008

First physical computing lab: working with breadboards. I have a prototyping shield on my arduino and am going to set that up for the first assignment. However, I should get a full size breadboard anyway for future projects.

Nevertheless, I’ll update this shortly with the actual breadboard work.