Wednesday, November 25, 2009

Design for Cat Toy Controller - IPC Final Project

This evening I worked on the design of the joystick controller for my cat toy project. I decided to put the laser joystick on the lower left-hand corner, underneath two status lights (the first is power status, the second is laser status), in the center I have placed the joystick for the arm, and the bird call buttons are on the right-hand side. I am still considering switching the location of the bird call buttons and the large joystick. C

Here are my design documents. I plan to start building the controller tomorrow.
Design for Cat Toy Joystick
Design for Cat Toy Joystick
Design for Cat Game Joystick Controller
There are still a few things that I need to sort out. First, I need to figure out a solution to hold the thumb joystick in place. Second, I need to find wire that is softer and more pliable than the 22-gauge wire that I am accustomed to using. Last, I need to determine whether the final design will include a solderless or soldered breadboard.

Tuesday, November 24, 2009

LED Sensor Matrix

Concept: Create an LED matrix that uses LEDs for light generation and touch sensing (light sensing actually). This is not a new concept. It is specifically inspired by this tool,which I recently found online.

Mechanisms: LEDs can be used as photodiodes. In other words, they can be used to sense as well as create light. Therefore, it is possible to create an LED-based device that can sense touch indirectly via changes in light (as shown in the example above). It is important to note that LEDs are not as sensitive as photodiodes, and are also less responsive. The sensitivity of LEDs to light varies by the LED color – red is the most sensitive one, blue is the least sensitive one.

The best code sample that I was able to find on this topic was from one of Mike Cook’s Arduino tutorials. Here is a link to this article. The trick to using an LED like a photodiode is to reverse the flow of electricity through the LED. The LED does not allow electricity to flow through it in this direction. That said, it is able to store some of the energy from this current. Then when this current is shut off the energy that was conserved is released into the circuit. The voltage that an LED can store is impacted by the amount of light that hits it.

Earlier today I tested three LEDs as light sensors. I tried using several code samples that I found on the web. However, the only one that worked for me is the one from Mike Cook that I mentioned above. Here is a brief overview of how the circuit and code works, check out Mike’s site for the code itself:

Attach the anode pin of your LEDs to digital pins on your Arduino, attach cathode pin of your LEDs to the analog pins on your Arduino (which are also digital pins 14 through 19). Set the anode pin mode to input and the cathode pin mode to output. Then set the anode pin to low and the cathode pin to high, in order to charge up the LED. Next, change the cathode pin mode to input and take an analog reading, this will be our baseline. After 20 – 40 milliseconds take a second reading, which will give us our final values. Last, switch the cathode mode back to output and set it to low.

Here are some important things to consider when working on a prototype for this device (collected from my readings around the web on this topic):
  • Small LEDs are better because they can hold less electricity and discharge faster
  • Clear LEDs work better because the light is not filtered through colored plastic
  • LEDs can only sense lights from spectrums that have shorter wavelengths

Monome-Inspired Modular Open Source Controllers

As if I haven’t posted enough related to the Monome recently, here is another entry inspired by this awesome little device. My recent fascination with the Monome has led me to wonder why are there no other controllers that share the same open source mindset to creating music coupled with a social and environmental conscious and minimalist esthetic. So here is an idea to fill this void:

Concept: Create modular open source control devices inspired by the Monome. These open source control modules would provide artists with new surfaces and possibilities to interface with their projects. All of the modules would feature minimalistic design, inspired by the Monome, and they would be produced in a socially and environmentally conscious manner.

Mechanics: All modules would work together and share consistent architecture. This architecture would encompass the communication protocol (which would likely be OSC), the chip and firmware selection, and the physical design esthetic and feel. As mentioned above, the hardware and software design would be open-source so that users can contribute new software and hardware hacks and improvements.

At the moment, I envision creating a line featuring several modules for this series: a rotary pot module would featuring 36 (6x6); a sliding pot module would feature 8 (8x1) pots; a force sensitive button module would feature 25 (5x5) buttons; a touchscreen module would feature a 10x10 inch touch surface.

One of my favorite elements of the Monome is that it can be used as a monochrome low-resolution display. Therefore, each module would feature similar display capabilities. In order to achieve this feat we would have to design our own rotary and sliding pots, force sensitive buttons, and touch displays.

Here is an example of an illuminated sliding pot from curious inventor. Unfortunately, these sliders are prohibitively expensive as they cost several hundreds of dollars each. A similar pot could be constructed using a softPot membrane potentiometer coupled with an LED lighting solution that I have not yet found.

Testing the Cat Toy Controller Components - IPC Final Project

Earlier today I received my first shipment from Sparkfun. It contained the joysticks and buttons that I included in my previous post. The motors that I ordered won’t arrive until next week. So I decided to start by testing out the components for my cat toy controller, all of which have arrived.



I started by soldering wires to all the buttons and joysticks. I used my trusty new soldering machine along with an impromptu helping hands device, fashioned out of pieces of a styrofoam-like material. Since I enjoy learning how to solder this was a great opportunity to practice.

After soldering the components I assembled them on a breadboard. This exercise made it clear to me that I will likely need to use both of my Arduinos in this project – one for the toy itself, the other for the controller. I hadn’t given it much thought but originally I had planned to use only one Arduino (I can always consider using a multiplexer). That said, I like how by using two Arduinos it will be easier to add wireless functionality to this toy in the future.

While hooking up the components I discovered that the arcade-like joystick uses switches rather than potentiometers. Therefore, it has a limited resolution that is digital-like, which can only differentiate between nine different orientations; unlike the potentiometer-based joysticks that can differentiate between thousands of precise positions. It was designed for games like pacman, with more limited input requirements. It should work fine for my project (if it doesn’t I have a second thumb joystick as a back-up).

In regards to the other joystick, I noticed after setting it up that Sparkfun sells an inexpensive breakout board. I am considering purchasing this component because it will make it easier for me to mount the joystick in the controller. It also reduces the number of pins to 5 (from 10), which will help me minimize the wiring complexity.

After setting up the circuit I developed a short Arduino sketch that tests each component. This simple application reads input from each button and joysticks and writes their current state to the serial port. I created this sketch mindfully so that it can serve as the foundation for the final code.

Here is a brief overview of the next steps I need to take:
Design the box for the controller
Check connection with infrared sensor
Find cat scratching post that can serve as basis for the toy
Look at gears to move laser and arm

My First Soldering Machine

Ok, I'll begin by owning up to the fact that I am a complete dork. I confirmed this fact when I became excited about having acquired my first ever soldering machine. My excitement was such that it inspired me to write a post on my journal and to take pictures of this new device.



I'll keep this short. As you can see from the pictures, I bought my "Digital Soldering Station" from Radio Shack - model number: 64-053. That said, it is actually manufactured by Madell (therefore, tips and other accessories are only available directly throught the Madell website).

Monday, November 23, 2009

Monome Build

This weekend my monome fever continued as I worked on putting together the monome kit that I recently purchased (link to previous post about monome madness). I spent over six hours soldering numerous components as dictated by the instructions from the monome website. I am happy to report that I made good progress, though I encountered issues when trying to set up the ribbon cable.

All-in-all I soldered 64 miniscule diodes and small LEDs, and several hundred other pins from chips, resistors, and capacitors. This was by far the most soldering I have ever done. I have to admit the experience was somewhat zen like. I have definitely taken my soldering skills to a whole new level. Here are some pictures from the build.



For the most part I did not encounter any issues, aside from the ribbon cable problem mentioned above. The problem is that I broke two connectors in my failed attempts to connect the ribbon cable. Therefore, I need to find two new connectors, and learn how to use them, in order to get my monome to work. I was silly to think that this would be the easiest part of the build process.

In preparation for this project I purchased a soldering machine from Radio Shack. I am really happy with my decision to get this iron - the standard tip was ideal for the type of work I was carrying out, it has a nice fine point. Since it is manufactured by Madell I can easily purchase new tips online.

More updates to come later this week and early next week, after I am able to get some new ribbon cable.

High Score List - Finally Solved

Over the past week I have been grappling with a simple problem: determining how to create a high score list for the Fangs Invader game. This seemingly simple problem gave me a complete mental block that took a week to thaw. I am happy to report that on Friday night I was finally able to solve this problem. Here is a simple sketch that displays the functionality that I created followed by an overview of my solution.



The Architecture
From an application architecture perspective, I decided to do most of the heavy lifting in Processing because I am know it better than PHP. Hence the PHP script only has two functions: (1) saving the high scores to a text file; (2) displaying the high scores from the text file. Processing takes care of the following functions: (1) Determining if current player’s score qualifies him to be added to the high score list; (2) capturing the player’s name, if he has a high score; (3) re-sorting the high score list to include the new score and name.

PHP Script
Two weeks ago I struggled with PHP to create a script that was able to read data from a query string and save that data to a text file, and read data from the same text file and display it appropriately. After much trial and error I successfully put together a short script that is able to accomplish this feat.

I found PHP to be a very temperamental language. I am not used to working with un-typed languages – I am not skilled enough to take advantage of the additional flexibility they provide while I seem to get caught up in many unknown and unexpected quirks and behaviors. Nonetheless, I have not been dissuaded from learning this language and hope to build my skills over the next three semesters.

Processing Sketch
Shortly after I finished the PHP script I started working on the Processing sketch. In no time I had the Processing application reading from and writing to the PHP script. I quickly lost steam when I tackled the sorting of the highscore list. This is not to say that this problem is particularly hard, however, in the road to solving it I encountered a major a blank.

At first the problem seemed simple, I created a short algorithm that seemed to work fine. I was actually very satisfied with myself for having solved this problem so quickly and simply. I had even started to integrate the solution into my fangs game.

So my solution did work fine unless there was more than one entry on the list with the same score. When this occurred the algorithm would select the name of one entry and apply that name to all others with the same score. Another issue was that the logic for the Fangs high score list is reversed - the better scores are the lower scores. Therefore, I needed to create an algorithm that is able to locate the lowest score that is above zero.

This is when I hit into a hard brick wall, head-on. The problem was back and I did not know where to even start. My attempts at writing pseudocode were totally unhelpful at first. My mind was so focused on integrating the functionality into the game and doing other things to the game that it just did not want to deal with this problem anymore.

In retrospect, I see how my initial approaches to this problem were overly complex (I won’t even try to explain it here). At first I had a hard refocusing and “seeing the forest from the trees” so that I could tackle the problem from a different perspective. It took me 6 days to figure out a different approach to solve this problem. Part of this process required that I stop working on this problem for a few days so that my mind could disassociate from it.

Here is a pseudocode-like overview of the solution that I developed for sorting the highs core list. All of the functionality outlined below is encapsulated in the changeList() function that is part of a class called PHPconnect. To support my algorithm I declared three array variables, each one holds eleven variables: a position for each from the current high score list and one position for the current player’s score.

The newLocation array is used to store the new location of each element on the top score list with references to their current location on the scoreList array, which holds the pre-sorted rank of each element on the old top ten list along with the new player’s score, saved in the eleventh position in the array. All elements in the newLocation array are initialized to -1 when the changeList() function is called. This is relevant because the newLocation array plays an important role in processing lists that feature multiple players with the same score.

The tempScore and tempName variables are used to temporarily hold the re-sorted top score and top name lists. At the end of the chageList() function the scoreList and nameList arrays updated by being assigned the values from these temporary arrays.

There are two other variables that play a crucial role in this function: locCounter and locCounter reverse. These two variables are used to determine the new location of each element on the top score list. These variables are incremented each time that a score is found which is lower than the current one being processed. The locCounter variable is used to hold the location of valid scores (any number higher than zero). This variable holds a score’s position from the first location in an array. The locCounterReverse variable is used to hold the location of invalid scores (0’s and -1’s). This variable holds a score’s position from the last location in the array.

Now let’s take a look at the algorithm. An outer loop cycles through 11 times to go through each score in the highscore array. A secondary embedded in the outer loop is used to compare each score with the others on the highscore list. The sketch determines the pre-liminary new location of each highscore list item by counting the number of scores that are greater than the current score.

Once the preliminary location is determined, the next step is to check if the current player’s score is repeated, and if so to adjust its position accordingly. To determine if a player has a repeated score we check the position “locCounter” in the newLocation array. If the position is not available (it is not equal to “-1”) then we loop through subsequent positions, using a while loop, until we find one that is available. This available position is then set as the new position for this list element in the newLocation array.

Once each position in the newLocation array has been assigned, a loop is used to input data into the tempName and tempScore arrays. Then these arrays are used to reset the scoreList and nameList arrays with the updated top score list.

Here is the code for the PHPconnect class that I created:
class PhpConnect {

  // variables that hold the top 10 list of scores. Each is 11 values long to help resorting when a new high score is added
  String [] completeList = new String [11];          // holds the name and score that are read from the file online
  String [] nameList = new String [11];              // holds the name of the players on top 10 list, the 11th spot holds the current player's player
  float [] scoreList = new float [11];               // holds the score of the players on top 10 list, the 11th spot holds the current player's score

  // base list URL
  String baseURL;                                    // holds the base URL that will be used to access the high score file online

  // data associated to current players' performance
  float playerScore;                              // score of current player
  float highScorePos;                             // holds the position of the player in top 10 list, or -1 if player did not reach high score list
  boolean highScore;                              // set to true if player sets a high score
  boolean setCaptureName;                         // set to true when Processing should capture a name from user
  String playerName;                              // holds the current players name (if they have a high score)
  int playerIndex;                                // holds the current letters location within the playerName string
  int nameLength = 6;                                 // holds the length of the name
  boolean ready2save;                             // set to true when Processing sends the new top score list to php application

  int [] newLocation = new int [11];              // holds the new location of each element on the top 10 list


  PhpConnect(String tURL) {
    baseURL = tURL;                               // set base URL to the parameter passed into object
    playerScore = 0;                              // score of current player
    highScorePos = -1;                            // holds the position of the player in top 10 list, or -1 if player did not reach high score list
    highScore = false;                            // set to true if player sets a high score
    setCaptureName = false;                       // holds when Processing should capture a name from user
    playerName = " ";                             // set player name to a space
    playerIndex = 0;                              // initialize the playerIndex variable
    ready2save = false;                           // holds when processing should send the new top score list to php application
  }


void loadList() {
  // create the URL used to make a high score list request
  String loadURL = baseURL + "?type=load";
  // load the top 10 list into the webPageArray (a name and score will be added to each position on the array)
  String [] webPageArray = loadStrings(loadURL);

  // loop each element in the array and breaks it down into separate name and score arrays
  for (int loadLoop = 0; loadLoop < completeList.length-1; loadLoop++) {
    // capture the top 10 elements of the webPageArray variable (in case any garbage is included at the end of the data received)
    completeList[loadLoop] = webPageArray[loadLoop];
    // split each element in the array into a name and score 
    String [] tListRecord = split(completeList[loadLoop], ' '); 

    // check if the tListRecord array has more than one element before initializing the nameList and scoreList arrays
    if (tListRecord.length > 1) {
      nameList[loadLoop] = tListRecord[0];             // save name to nameList array
      scoreList[loadLoop] = int(tListRecord[1]);       // save score to scoreList array
    }

    // DEBUG Statements
    print("name: ");
    print(nameList[loadLoop]);
    print(" - score: ");
    print(scoreList[loadLoop]);
    println();

  }   // close the for loop
}     // close the function loadList()



// to move the ARRAY count the number of figures that are larger or smaller than the current one
// checks if the current player's scores is in the top 10 and set highScore and setCaptureName to true
void checkList(float tPlayerScore){
  playerScore = tPlayerScore;                  // set player score variable
  setCaptureName = false;                      // initialize setCaptureName variable to false

  // loop through each element in the high score list to compare against current player's score
  for (int checkLoop = completeList.length-1; checkLoop >= 0; checkLoop--) {
    // tell application to capture the player's name if their score is better than the score of the player in the current array position, or if the current position is not set
    if ((playerScore < scoreList[checkLoop] && playerScore > 0) || scoreList[checkLoop] <= 0) {
      // set variable to tell application to capture name
      setCaptureName = true;
    } 
  }  
}     // close the checkList function



// function that captures the name of the user. The names for the list can be up to 5 characters long
// this function needs to be called from the keyPressed() function in the main sketch
void captureName() {
  // if current player has a high score as set by function checkList() then listen to keys
  if(setCaptureName) {
    // if delete or backspace are pressed
    if((key==char(8) || key==char(127))) {
      // and the location on the string is greater than 0
      if (playerIndex > 0) {
        playerName = playerName.substring(0, (playerName.length()-1));        // cut the last character from the name
        playerIndex--;                                                        // set the current location of the playerIndex
      } else {
       playerIndex = 0;                                                       // don't let current location get below 0
      } 
    // if return or enter keys are pressed
    } else if (key==char(10) || key==char(13)) {
      // don't do anything if the playerName variable does not contain information
      if (playerName.equals(" ") || playerName.equals("")){}
      // if the variable contains information then set highScore variable to true to notify application to sort highScore list
      else {
        setCaptureName = false;
        highScore = true;          // set high score to true
        playerIndex = 0;           // re-initialize the location on string to 0
      }
    // if a letter key is pressed then add it to the string
    } else if (key > char(48) && key < char(123)) {
      if (playerIndex == 0) {                          // if playerIndex equals 0 then initiate string
        playerName = str(key);
        playerIndex++;
      } else if (playerIndex < nameLength) {                    // only accept input if character location is lower than 5
        playerIndex++;
        playerName = playerName + str(key);
      }
    }    

  print("Capture Name - index number: ");
  print(playerIndex);
  print(" player name: ");
  print(playerName);
  println();
  }
  
}  


// function that re-sorts the top 10 list to include the new player's score
// this function should be called continuously in the draw loop
void changeList() {
  // loop through all of the elements on the list and change the values based on the change rate
  if (highScore) {
      float [] tempScore = new float [11];                                    // temporarily holds re-sorted score list 
      String [] tempName = new String [11];                                   // temporarily holds re-sorted name list
      int [] newLocation = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};     // holds the location in the current array of each element on the list
      int locCounter = 0;                                                     // temporarily holds a scores new location on the array
      int locCounterReverse = 10;
      scoreList[10] = playerScore;                                            // add current player's score as the last element on the list
      nameList[10] = playerName;                                              // add current player's name as the last element on the list

      // go through each item in the array to determine its new location
      for(int change = 0; change < scoreList.length; change++) {
          locCounter = 0;                                                     // initialize the locCounter variable
          locCounterReverse = 10;
          boolean locFound = false;                                           // declare and initialized the locFound variable
          
          // compare this item in the array with all other numbers in the array
          for(int subChange = 0; subChange < scoreList.length; subChange++) {
            // if this item in the array is greater than another then add one to locCounter variable
            if (scoreList[change] > scoreList[subChange] && scoreList[subChange] > 0) {
                  locCounter++;
            }
          }
        
        // loop to adjust the locCounter variable when dealing with scores that are repeated on the list
        // loop through following steps until the location is found
          if (scoreList[change] > 0) {
              while (locFound == false) {
                    // if the location at array index [locCounter] has not been assigned yet then set locFound to true
                    if (newLocation[locCounter] == -1) { 
                       locFound = true;
                    // else if the locCounter variable has exceeded the size of the array set locFound to true
                    } else if (locCounter > scoreList.length) {
                       locFound = true;
                    // otherwise add one to the locCounter variable
                    } else {
                       locCounter++;            
                    }
              }
              newLocation[locCounter] = change;

          } else {
              while (locFound == false) {
                  if (locCounterReverse <= 0) {
                       locFound = true;
                    // else if the locCounter variable has exceeded the size of the array set locFound to true
                    } else if (newLocation[locCounterReverse] == -1) { 
                       locFound = true;
                    // otherwise add one to the locCounter variable
                    } else {
                       locCounterReverse--;            
                    }                                
                }
                newLocation[locCounterReverse] = change;
           }
       
        // set this spot on the list to the entry at the "change" location on the current array 
      }

      // loop to set the new values into the array
      for (int update = 0; update < scoreList.length; update++) {
        tempScore[update] = scoreList[newLocation[update]];
        tempName[update] = nameList[newLocation[update]];
    }

    // set the scoreList and nameList array using the temporary arrays    
    scoreList = tempScore;
    nameList = tempName;
    // tell the application that it can save the information to the server
    ready2save = true;    
    // re-initialize the highScore variable to false
    highScore = false;
  }
}


// function that saves the new top 10 list to the server
// it should be called contiously in the draw loop
void saveList() {
 
  if (ready2save) {
    String saveURL = baseURL + "?type=save";

    // loop through all of the 10 elements of the list and add them to the URL
    for (int saveLoop = 0; saveLoop < 10; saveLoop++) {
      saveURL = saveURL + "&name_" + saveLoop + "=" + nameList[saveLoop] + "&score_" + saveLoop + "=" + str(scoreList[saveLoop]);
    }  
    // call URL in order to upload new data to php application
    String [] loadStringArray = loadStrings(saveURL);
  
    // DEBUG: debugging code to view status of application
    print("saveURL: ");
    print(saveURL);
    println();

    // reset all variables to their initial state
    playerName = " ";
    playerScore = 0;
    ready2save = false;
    highScorePos = -1;
  }
}

// function that initializes the scores on the server.
void initHighScores() {
   String initializeURL = baseURL + "?type=save";
   for (int saveLoop = 0; saveLoop < 10; saveLoop++) {
       initializeURL = initializeURL + "&name_" + saveLoop + "=" + " " + "&score_" + saveLoop + "=" + "-1";
    }  
    // call URL in order to upload new data to php application
    String [] loadStringArray = loadStrings(initializeURL);
}

}

Wholesome Harry - No Good Very Bad Day

Earlier today I worked with my team to edit and finalize our short movie for Comm Lab class. I am excited to report that Arturo, Eric, Tamar, and I have a finished our short movie – Wholesome Harry No Good Very Bad Day.



We have been working on this project for the past three weeks. During the first week we focused on coming up with an idea, developing a storyline and creating storyboards (regarding this part of the process). On our second week we produced and shot the footage at my wife’s school. Finally, this past week we focused on editing the footage into a short movie.

My focus in this post will be the activities from the past two weeks – the production of the shoot and the editing process.

Producing the Shoot
Once we finished the storyboards and shot list our focus shifted to finding a location, enlisting actors, and getting the on- and off-screen materials for the shoot. We started working right away because we did not know when we would be able to shoot, so we wanted to be ready at a moment’s notice.

The original location that we scouted for our movie was the TV studio on the 12th floor of the Tisch building at NYU. Unfortunately, we were not able to get the studio so we shifted to plan b – using my wife’s classroom at Grace Church School for the shoot. We felt this location was a good choice because a local access TV show for children could easily be filmed in a public school.

The props for the shoot were mostly easy to come by. Arturo has a large selection of costumes from his own performance works. Most of the other props were from ITP (the crew’s equipment) or found on location at the school.

From an equipment perspective, we experienced quite a few challenges. First we arrived at the Equipment Room to find all of the non-HD Panasonic DV cameras with broken firewire connections. As a consequence we used HD cameras instead. This is not a bad thing per se, however, none of us were familiar with these cameras and they had fewer manually controllable features.

Our second challenge occurred during the shoot. The M-Audio recorded that we were using was not working properly. Therefore, we had one less audio source to work with. This could have been a much bigger issue. Fortunately, for the most part we were able to get good audio from the cameras.

Here is our full equipment list – as you can see it is quite long and extremely heavy (the equipment, that is).
  • 2 cameras (DVX)
  • 2 DTE
  • Extra battery and/or plug-in for DTE
  • 2 firewires
  • 2 boom mics
  • shock mount
  • XLR cables
  • 2 tapes
  • 1 M-Audio
  • 1 bi-directional
  • 1 tri-pods
  • 1 lighting kit (3 lights, 3 tripods, 2-3 umbrellas, cables)
  • Headphone
  • Extension chords
The shoot lasted for about 5 hours. We arrived at the location around 4:30; it took us about an hour to prepare the room by moving furniture, hang the billboard and set-up the lights. The shoot itself lasted about 3 hours and then it took us 45 minutes to clean up. At the end of it all we had captured over an hour and fifteen minutes of footage. The quality of video was pretty good, though we noticed some continuity pitfalls that we needed to watch for during the editing process.

Eric and Tamar took the lead on the camera (though we all shot for at least a few minutes). Arturo and I took the lead in front of the camera. Arturo’s experience working with video came in handy. He has a good intuition for capturing small and unique shots that I would not have thought of until the editing phase (when it is too damn late).

Editing the Footage
The day after the shoot Arturo, Tamar and I transferred and logged the footage. We also took this opportunity to set-up a project in Final Cut in preparation for the work ahead of us. Since we had been forced to use the HD camera (and since we had an HD-philiac in our group) we decided to make an HD video.

During the week Arturo and Tamar put together a rough cut of the initial scenes. Then we all met on Sunday to finalize the rough cut and take out sandpaper to smoothen it out. The process of working in Final Cut with Arturo and Eric was great. They are both very knowledgeable about this tool and were eager to provide tips. I am currently working on another project in Final Cut and look forward to applying my new knowledge (soon to be transformed into skills).

Having worked with Final Cut 7 over the past two weeks I am impressed (negatively) at how complex it is to use. I guess I’ve become too accustomed to the ease of use offered by iMovie. The file import process and the difficulties associated to working with movie files with different formats have been quite frustrating. I understand the additional power that Final Cut provides – I am finally starting to be able to take advantage of it. That said, I think this tool could be simplified.

[Regarding Final Cut – I am currently working on a post regarding using Final Cut Pro, I’ll update this blog post with a link once it is ready.]

Friday, November 20, 2009

Energy Games

Concept: to create games that raise student’s awareness regarding energy usage and provide positive reinforcement for energy conservation practices. it different NYU dorms against one another in a competition where the winning dorm receives special privileges and awards.

Mechanics: Create a database with real time and over time energy consumption that enables students at different dorms to compare their energy usage per square feet. Develop several applications to visualize this data in actionable ways.

Develop visualizations that feature energy usage information and a scoreboard in easy to understand info-graphics. Display this information in common areas of the dorms and make it available on the internet. Provide students with access to tips and resources that enable them to learn how to reduce their energy usage, on a personal and community level.

Use outdoor projections on participating dorms to showcase the standing of each dorm at the end of each phase of the competition. Create events to engage students in a discussion about energy usage.

Credit: This idea was inspired by Josh Clayton’s final project in our Introduction to Computational Media class. The picture is licensed under Creative Commons and was taken by adrileb from flickr.

Thursday, November 19, 2009

Course Selection for Spring Semester

It is hard to believe that it is already time to register for next semester's classes. I have an appointment with my advisor this afternoon to discuss my initial course selection. In preparation for this meeting I selected my 10 course choices, which I have listed below.

The way the process works here at ITP is that each student selects their top 10 course choices. Once all students have received approval on their course requests from their advisors, the process is turned over to an evil or benign algorithm (depending on who you ask). This algorithm determines who gets into which class.

My Top 10 List
  1. Dataflow Audio Programming
  2. The Softness of Things
  3. Nature of Code
  4. Social Facts: Motivation
  5. Big Games
  6. If Products Could Tell Their Stories
  7. Design Expo
  8. Spatial Media
  9. Exhibit Design: NY Hall of Science
  10. Mechanisms and Things That Move
I am extremely excited about each one of these possibilities. It was hard to choose the 10 most appealing courses because the course offerings are diverse and amazing. I'm happy that I still have three semesters left to take advantage of many more course.

Building My First Arduino Shield

Yesterday I built my first Arduino shield. I've been wanting to put one of these together for a long time as I am tired of having the disconnect and re-connect wires individually whenever I want to swap my Arduino between projects.



It took me about an hour and half to solder all of the tiny little pieces together. As you can see from the pictures, I did a pretty good job of putting this little sucker together. Well, at least it looks good as I have not tested the shield yet to confirm it is actually working.

This was by far the best soldering practice I've had to date. Very timely considering that I will be working on the Monome build this weekend. Planning on purchasing another one of these soon.

Monome Madness


For a long time I have wanted a Monome (check out the Wikipedia entry here). Initially, my desire to own one of these devices was based on the functionality it provides and its minimalist look, which oozes cool. I was thrilled at the beginning of this semester when Paul Rothman, one of my colleagues at ITP, took the lead on organizing a group of students to build Monomes.

The initial excitement continued to increase during the past several weeks. It reached a highpoint this week with the recent arrival of the components and the gradual arrival of these devices on the floor. I can’t wait for my build session that is scheduled for Saturday. I will assemble a “40h” unit that is similar to the one described here, though it will feature a different case.

The other factor that has greatly heightened my anticipation for the build was tonight’s visit from the Monome creator, Brian Crabtree. Brian's partner in crime, Kelli Cain, was not able to join this session. Here is a short video from Brian’s visit. I’ve captured part of his talk along with two short demos of the Monome in action.



Learning about the motivation and creative process associated to the design of the device and the production process was inspiring. The product and process are both manifestations of the value and belief systems held by Brian and his partner Kelli Cain. First and foremost, this product was born out of the desire to provide new possibilities for creativity through freedom. That is why it is an open source platform that has no pre-defined functionality.

The designs and prototypes, and later the machinery required to manufacture these devices, were developed with no help from corporate organizations. Equally important, local production partners are used to manufacture the Monome, and selection of these partners has been guided by a socially and environmentally conscious philosophy.

In my opinion Brian and Kelly are true artists. They have brought (and continue to bring) into the world amazing new possibilities on many different dimensions – the product, the process, the freedom, and the passion. That’s enough praise since I know I am starting to sound cheesy (as if I that was not the case already). I'll just reiterate once again - I am officially inspired. I know that many of my future projects will include this little box as a key interface element.

Wednesday, November 18, 2009

Fangs Resurrected - ICM Final Project Idea


After much brainstorming and indecision I have finally settled on my final project for the Intro to Computational Media final. My project will be to create a tricked out (or pimped out) version of the fangs invaders game. Below you will find the fangs game in its current state.

Since I last shared it in class, and on this blog, I have made a few updates to this sketch. Namely, I have added functionality to calculate and display a score, which is shown on a new page at the end of the game. This is a very small improvement in comparison to the changes I will integrate over the next two weeks.



For this project there are a bunch of updates that I plan to make. Since I may not be able to implement all of the changes I have created a prioritized list to guide my work over the past several weeks:
  • Improve game scoring logic and add score to game play environment.
  • Create an online high-score database (or file) using PHP scripting.
  • Improve animation by adding wing movement, and making it more natural.
  • Develop group behavior for the bats so that they interact and flock occasionally.
  • Update look and feel of the game by adding back images and improving design.
  • Add multiple stages with increasing levels of difficulty.
[picture taken from flickr user furryscalyman - Creative Commons License ]

Project Idea: Virtual Possibility Cards

Project Goal: To help people tune in to new possibilities and perspectives that are available to them in an engaging manner. My inspiration stems from a desire to help people think laterally and explore new points of view. The concept itself is loosely based on angel and goddess guidance cards (tarot cards as well).

The Concept: The user interface for this project would be based on a physical deck of cards. The participant would take a card from a deck and place the card on a table that is styled like the table of a tarot card reader. A video camera above the table would capture a 2D barcode that is printed on the card.

In response, a computer display (ideally stylized to match the overall theme of this application) would show a card that features some wise guidance and new perspective for the participant to explore. The participant would also be able to print out his/her card to take home for further reflection.

Important Considerations: In order to make this experience as engaging as possible there needs to be a connection (or at least a perceived connection) between the physical interaction and the resulting guidance. I am randomly linking the physical and virtual cards, or using some types of sensors to determine how to map the 2D barcodes to the virtual card content. This is an area that will need to be explored further if I decide to pursue this project.

This idea could be embellished into a more immersive experience by exploring different possibilities for displaying content, including projected video and the use of sound. Lighting could also be used to enhance the experience. For example, changing the lighting of the room while the card is being read could give the sense that spirits are guiding the transformation. Management of people flow is another way to add gravitas to this experience. These embellishments assume that I take the project in a more tarot-like direction.

The last point I have to make is about the importance of the content itself to making this project a success. The content would need to offer sufficient breadth and quality to keep the audience engaged in this interaction.

Starting to Learn Max/MSP

Earlier today I attended a Max/MSP tutorial run by one of my colleagues at ITP, Matt Ganechau. This one-and-a-half hour session was awesome. We went through the basic concepts that serve as the foundation for this programming environment, and then we developed our first Max patch – a simple 8-step sequencer. Here I will provide a brief overview of the main concepts that we covered along with a short video that features the sequencer I created.



Max/MSP is an object-oriented dataflow programming environment that enables artists to quickly and easily create prototypes. This language was created over 20 years ago to facilitate the creation of sound and music. One of its coolest features is that it includes powerful help functions that enable inexperienced users to quickly get up and running once they understand the following base concepts.

Objects in Max encapsulate functionality that can be re-used easily. Examples include dials, sliders, counters, etc. As in other OOP languages, users can create their own objects (called patches) that encapsulate additional functionality. Objects are identified by a green border and can be easily added to a program using a drag and drop interface. Once an object is added to the program, the user types in the object name to assign the object the desired functionality.

Objects in Max have nodes that are inlets and outlets. These nodes enable objects to connect to other objects. Inlets accept input, while outlets deliver output. When a user hovers over a node the Max environment will show a list of the possible objects and actions that can be connected to that node.

Aside from objects, Max/MSP also features messages. Messages transmit information between objects in Max and they can be integer and float values (there may be other types of messages that I have not explored yet).

Another important concept in Max is the “bang”. Everything in Max operates in response to bangs. Bangs are similar to pulses in an electric circuit, such as the Arduino. When a bang is initiated it goes through the system and activates sound and other activities.

Patches (or programs) can be locked or unlocked. Locked patches are in their performance state. In this mode the user can only interact with the patch as an interface – for example they can interact with sliders, toggles, etc. When unlocked the patch can be edited like a computer program.

The inspector enables developers to change the parameters of objects and programs. For example, on a slider object the programmer can change the range, color, and many other attributes. As expected the attributes and options available differ from object to object.

Tuesday, November 17, 2009

Interactive Cat Toy - Defining Requirements - IPC Final Project

On last Thursday I had a brief meeting with Tom to talk about my final project. Per my previous posts on this subject, I have decided to create an interactive cat toy. Over the past several days I have been working on the design of this device so that I can identify what parts I need to order. Here is a brief update regarding my toy concept, the new solutions and problems have arisen, and what components I am considering for this project.

Updates to the Concept
For the most part my cat toy concept has remained unchanged. The focus of the design is still the situated interaction between a cat and human and the main components have remained unchanged - the human participant will use an arcade-like joystick to control the laser, the sound and the arm. The cat will interact with these three elements of the toy.

Here is a quick overview of the changes that are under consideration: first, I would like to add an auto mode to this device to enable a cat to interact with the toy without human participation. The toy’s arm would self-activate and move randomly anytime it senses motion within a 40-cm distance. Second, I would like to create a game for the human participant when s/he is engaged with the toy. This will be a much bigger challenge that will likely not be addressed in my initial prototype.

New Solutions and Problems
Switching between modes: I have made a conscious attempt to limit the number of virtual modes provided by this device. For example, I have attempted to design this toy so that each joystick controls only one element of the toy. That said, the following modes will still exist in my design:
  • On and off modes – as with most electronic gadgets, this cat toy will feature on and off modes that will be controlled by a rocker switch on the base of the toy.
  • Interactive and automatic modes – as discussed in the “updates to the concept” section above, this toy will feature a secondary operation mode where it will sense and react to a cat’s presence/proximity. Control will be governed by a switch on the joystick controller.
  • Game and freestyling modes – if a game-like element is added to the human participant’s interaction in the future, then we will want to provide the option for cat owners to select between a game and freestyle mode.
Controlling the sound: Earlier today Arturo, another cat lover from ITP, brought up an important consideration that I had previously ignored. Cats are sensitive to sound; this realization previously led to my decision to add bird sounds this device. However, I had not considered that the other side of this coin: cats are easily turned off or scared away by sounds. Therefore, I need to make sure to find a quiet motor for this toy so that it does not scare away cats.

Earlier today I carried out a small experiment to observe Sasha’s response to the servo motor’s sound. Check out the short video below for a quick overview of my observations.



Proximity sensing: In order to add the automatic mode that I envision for this device I need to find a proximity sensing solution. My main requirement is that this solution needs to enable the toy to identify when a cat passes a certain threshold so that the appropriate functionality can be activated. Per this description I only need a digital, rather than analog, solution.

Finding the Right Parts
Considering my goal is to have an initial working prototype by early next week, I have started to identify the specific components that I want to use on this project. Some of these items I have already ordered, while others will be ordered later this week once I decide what is the best option. Here is an overview of the selection process.

Movement and Motors
To move the arm and laser pointer I originally considered using servo motors. However, due to concerns regarding the sound generated by these types of components I am now leaning towards using stepper motors instead. I carried out a good bit of research to find a servo motor that is silent, unfortunately, this does not seem to be a coveted feature for these types of motors. Here are some of the best sources for servos that I found online – robotshop and servocity.

Another consideration regarding the movement of the arm and laser beam, is the need for a mechanism that supports both panning and tilting. I was able to find a few pan and tilt mechanisms for sale on the servocity website. These options seem robust and only a bit expensive. That said, since I have decided to use a stepper motor I will need to find other options or create my own.

Control and Switches
For the controller I have purchased the most important components – the joysticks and buttons. Where possible, I chose components that have an arcade-like or video game feel. Here is an overview of my selections:


This component has a great arcade like feel. It will be the main joystick on the controller and it will govern the movement of the arm with feathers. Cost and size considerations have led to my decision not to use this joystick for controlling the laser.



This small PS2-like joystick will be used to control the laser pointer. This joystick also incorporates a push button that will be used to turn on and off the laser device. The small size of this joystick denotes the secondary priority of this interaction element in comparison to the arm.

This light blue arcade-style button will be used to trigger the bird sounds. I have purchased 4 buttons in total, so that four separate sounds can be included in this prototype.

In regards to generating and controlling the sounds, I had originally planned to use one of the following two components: the WaveShield from Adafruit or the MP3 Trigger from Sparkfun. That said, based on advice from Tom (and my desire to minimize additional costs associated to building this prototype), I have decided to use my computer to generate the sound in the initial prototype. If all goes well with the user testing (or should I say cat testing) then I will likely add one of these components to the toy so that a computer does not need to be used.

To sense the cat’s presence/proximity I have decided to use a Sharp infrared range finder. This little component can sense ranges between 3 and 40 cm. It is ideal for my requirements because I plan to use this sensor for threshold detection within a small range only. It is much cheaper than the ultrasonic range finder options.

To turn the device on and off I plan to use a rocker switch similar to one pictured below from Sparkfun. To toggle between interactive and auto modes I will use a slide switch similar to the one from RadioShack that is featured in the picture below.

Additional Considerations
One additional consideration that I have not addressed is how to keep this cat toy “fresh”. Cats are extremely finicky animals and often grow tired of their toys after about 3 to 4 weeks. As I move forward with the design and development of my initial prototypes I will be looking for ideas on how to address this concern.

New Possibilities
In typical fashion, before I have even really gotten started with my current cat toy project I am already considering many improvements, updates, and related products. Here is a brief overview of two ideas I will consider incorporating into this or future projects (though not by finals time).

(1) I would like to use the toy as a medium for a game between the human and the cat. Initial ideas range from simple to complex. On the simple end we could add a counter to the proximity sensor and time the length of the cats presence in that proximity. We could also add a sensor to the arm so that it could sense when a cat is able to grab one of its feather. On the complex end we could use a video camera and together with a projector and the laser pointer, and have the human moving the laser beam around in an attempt to guide the cat to catch falling birds (which would be projected on the wall). The computer vision would be used to read images from the video camera to determine when the cat was able to catch the falling birds.

(2) Rather than have a cat toy that attempts to woe the cat, create a cat toy that can move around the room and is controlled via remote. I would still envision this cat toy having a remote controlled arm, though this arm would likely be designed differently (for example, it would have a 360-degrees motion since it would not be positioned against a wall).

Friday, November 13, 2009

IPC Class Notes, Communicating Wirelessly - November 11, 2009

In this week’s Introduction to Physical Computing class we had a brief discussion regarding microcontrollers, followed by and overview of how to use serial communications via wireless, then we briefly reviewed final project ideas.

Microcontrollers
When designing our final project Tom stressed the importance of taking into consideration the different form factors of Arduino and other microcontrollers available for our projects. These include:

The Arduino Family
There are several Arduino form factors available, and all are based on an AT Mega chip set. the Duenovemille is the standard unit that we have been using to date; the Nano is another standalone unit that features the same chip in a smaller form factor with a reduced number of pins; the Mini and Mini Pro are other small form factors that are designed to be mounted to a breadboard and features a chip with a bit less memory; the Mega is a larger unit that features considerably more memory and a large number of pins; lastly, the Lillypad is a chip designed for wearable computing projects.

Funnel IO and Gainer
Funnel IO (FIO) is an Arduiono clone that features an AT Mega and is integrated with an XBee on the back. Developed by Shigeru Kobayasho, FIO was created to work with Processing, ActionScripting, Max/MSP, Gainer and Wonderfl. Similar to the Arduino, FIO was created to enable artists and designers to integrate physical computing into their projects. Please note that the content on the Gainer website is mostly only available in Japanese – that said, it can be entertaining to use Google translation to read through it.

Illuminato X Machina
A new addition to the microcontroller offerings is the Illuminato X Machina. This chip attempts to add more capabilities and power to the world of microcontroller, without increasing the complexity of the development environment. This chip has an interesting design that is based on a cellular network. It allows users to increase the processing power by setting up networks of microcontrollers.

Serial Communications Using Wireless
Serial communication protocols are used by a large variety of components, including RFID, displays, motor and sensor controllers, to name a few. Wireless modules, such as the Xbee, connected to computers and Arduinos using serial.

To date, all of our explorations into serial protocols have focused on asynchronous types of communications. In order to use the XBee we need to use synchronous communications instead. Below is a brief refresher on these two concepts. It is important to note that many wired components also work with synchronous connections.

Asynchronous Communications
In asynchronous communications the connected devices each have their own clocks and send messages back and forward in an uncoordinated fashion, from a clock perspective. It is important to note that a programmer can use a coordination mechanism, such as call-and-response, to manage the communications.

Devices that are linked for asynchronous communications share three connections: two transmit and receive connections (each one set to an alternate direction), and a common ground.

Synchronous Communications
In synchronous communications the devices share a clock and send their messages in coordination with the clock pulses. Networks of devices that are connected synchronously, always feature a master and a set a slaves. The master is the device that sets the clock for all others.

Devices that are linked for synchronous communications share four connections: a Master In Slave Out (MISO) connection, a Master Out Slave In (MOSI) connection, a clock connection, and a common ground.

Components that can use synchronous serial communication have a pin called Chip Select. This pin enables the master device to connect to multiple devices using a single clock, MOSE and MISO pins, as long as it is directly connected to each slave chips Chip Select pins. In these types of circuits synchronous serial devices will only communicate on the MISO and MOSI pins if the status of the Chip Select pin is properly set.

Back to the Xbees
When setting up an Xbee on an Arduino you need to use the serial transmit (TX) and receive (RX) pins from each device. This will enable information to flow to and from both components. On the Arduino IO pins 0 and 1 are the RX and TX pins. It is important to disconnect the Xbee when uploading a program via serial to your Arduino. The reason being, if the Xbee is connected to the serial port then the Arduino can’t use this port to connect to the computer.

If multiple Xbees are connected to the same multimedia computer (or master) then each one of the chips will have its own address. Messages can be sent to a single address, or can be broadcast to all Xbee devices.

To set up an Xbee you first need to set it up using USB. For this you will need a USB to serial adapter for the Xbee, which converts data from traditional serial protocols (TTL and R-232) to the appropriate USB protocol. The most common adapter used for this task is the Xbee/USB breakout board (also called XB explorers).

Xbees use the AT Command Set, which was originally designed to drive modem communications. This protocol is widely known, and has been used for a long time. There are two different modes of communications used in the AT Command Set (and most similar protocols for that matter):
  • Command Mode: communications to the modem.
  • Data Mode: communications through the modem.
There are two different types of Xbees. They are not able to work together because they have a different stack above the AT Command Set.
  • Series 1 uses 802.14.5 command set. This protocol is more limited than the series 2 but it is also much simpler. It provides more than enough functionality for most types of uses and is the right way to go for most applications.
  • Series 2 uses a command set that supports mesh networking. It is much more complex to use than series 1. Mesh networks are made up of devices configured as “controllers” (c), “routers” (r), and “end-points” (e). The “routers” essentially act as post office boxes that hold and distribute messages to the end point. Since the end points don’t always have to stay on this is a more energy efficient system.
When you first connect an Xbee the device is in data mode. In order to enter into command mode you need to use a variation of the standard AT Command Set protocol: “+++” (rather than the protocol standard of “+++\r”). Here is an of the options that you need to set-up in order to get Xbees to start talking politely:
  • Address of Xbee chips (destination)
  • Address of multimedia computer (source)
  • Pan ID that enables to join Xbees into groups, so that different groups of Xbees don’t conflict with one another. Check out the pan ID list available on the Physical Computing website at ITP to select an unused port.
To get two Xbees to talk to one another without including an Xbee attached to a multimedia computer the Xbees need to be set to API mode. This mode uses a totally different protocol that is not based on the AT Command Set.

When using Xbees it is advisable to use a handshake (call-and-response) method so that we don’t encounter delays associated to buffer issues. When using multiple Xbees the handshake logic of the code is the same as the example we previously explored in class, for the most part. The difference is that we need to add logic on the receiving end to confirm where the data was sent from, and to determine where to send the next request.

Bluetooth
Bluetooth is another wireless protocol that is often used for wireless communication. However, Bluetooth only supports one to one communications, so all Bluetooth devices can be connected to a multimedia computer only and not to one another. Bluetooth also sets up sessions when they connect with a device, which requires a few seconds for initiation and closing a connection.

Playing with Motors IPC Lab (Continued)

Earlier this week I put together a short post regarding the motor lab for IPC. As I outlined in my post, I encountered a problem when working on the H-bridge lab. The Arduino was constantly switching off and on and when I moved the potentiometer to change the speed and direction of the motor. Therefore, yesterday I decided to re-do this part of the lab, adding a capacitor to the circuit to regulate the voltage during start up and moments where a lot of resistance is being placed on the motor.

I am happy to report that when I re-did the lab I was able to get everything working properly. As you can see in the video below I was able to get the potentiometer to control the motor smoothly while alternating speed and direction.



Considering that I will need to use motor to enable movement for two aspects of my final project, I enjoyed having the opportunity to practice building circuits that require diodes and capacitors (as I have little experience working with these components).

Wednesday, November 11, 2009

Interactive Cat Toy Initial Concept Ideas - IPC Final Project

As I outlined in my previous post, my final project for IPC will be an interactive cat toy. Before I share my initial concept I want to go over the considerations that guided my initial design choices. Over the next four weeks this design will evolve and change based on technical, esthetic, usability, and fun-factor considerations. Enough preamble, let's dive right in.

Inspiration for the Project
My main inspiration for this project comes from my cat, Sasha. That said, she can't take all the credit (or blame) because I've always liked cats even though I never owned one. Lauren's family's cat, Suzie, also deserves some of the responsibility. Since I've been hanging out with these two cats I've evolved from a cat-friendly to cat-obsessed. Here is a short video of Sasha, Suzie and a sickeningly cute kitten that we rescued three months ago, Little Scrappy.



Sasha is definitely the cat that will have the biggest influence on this project. My knowledge of her likes and dislikes guided my selection of the types of interaction that I want to integrate in this toy. For example the decision to include sound was driven by Sasha's reaction to bird sounds that my wife recently played at home.

Main Design Objectives and Considerations
My objective is to create a toy that deliver an experience that is fun for the cat and the human. All design decisions need to be made with this objective in mind. The main requirements that will also guide my decision are:
  • easy for the user and the cat to use - no instruction manual needed.
  • offer fun ways for the cat to play from both far away and near by. 
  • able to attract the cat's attention if the owner wants to initiate a play session.
  • esthetically pleasing enough to put in your NY studio or one-bedroom apt.
  • provide auto mode that plays with the cat while the owner is away.
  • make sure that toy is able to handle a lot of punishment because Sasha can dish it out.
  • focus on the situated interaction between cat and human to maximize connection. 
Here are some additional initial thoughts and considerations that guided my design:
  • consider using sound to attract cats (very effective for Sasha).
  • leverage video game buttons and joysticks to give the remote control a fun feel.
  • make sure all cables are cat safe, since they can be cable eaters.
  • use an power plug rather than battery to better support prolonged use of auto mode (maybe wrong decision from sustainability perspective?) 
  • keep in mind possible future upgrades (web connection with video feed and online controls, wireless remote control, etc).
The Initial Design
The concept for my interactive cat toy is a remote controlled device that contains: (a) a laser pointer, controllable by a joystick, to play with cats that are across the room; (b) several bird chirping sounds, controllable via buttons, to attract the cat over to the toy; (c) an arm with a hanging string and feathers, controllable by a joystick, to play with a cat that is near the toy.

I envision the toy having an L-shaped base which is meant to provide stability and can be secured to a wall. The arm protrudes from the top of the vertical leg of the L-shaped base. Next to the arm, a small ball-like object holds the laser pointer (I am considering using a mirror to move around the laser, as in the FroliCat Bolt toy). The motors and wiring are hidden in the base of the toy.

The remote control would have a old-school arcade video game feel, though I am considering to use PS joysticks. Though originally I planned to only use buttons for the bird sounds, I will likely needed to add a laser on/off button to the controller as well. I may choose to reduce the number of sounds down the three, so that I can keep the number of buttons on the remote to a minimum.

Here is my initial drawing of the cat entertainment center and remote:


Once the initial prototype is build I would like to extent this toy by creating a wireless remote and adding internet connectivity (both video feed and control). That said, the core of my concept is the situated interaction between the cat and human, so I will keep my focus here for the next four weeks. Then we can see whether it makes sense to extend this concept into these different areas of functionality.

Important Next Steps
Here is a brief overview of my next steps with this project:
  • Update toy design based on feedback from class
  • Determine dimensions of the toy
  • Design movement mechanisms for arm and laser
  • Identify the motor strength needed to move arm
  • Identify materials for building base and controller
  • Design circuit for controller and base
  • Purchase component parts

Interactive Cat Toy Competitive Research - IPC Final Project

Over the weekend I decided that my final project for the Introduction to Physical Computing class would be a cat toy. I have wanted to design cat toys and furniture since before I came to ITP; I will even admit that I am a cat video offender. Nonetheless, this is the perfect opportunity for me to stop talking about wanting to create a cat toy and start actually doing it.

To start off the design process I did a bit of research regarding cat toys, focusing my attention on any interactive electronic offering I could find. I started off by looking at several previous projects from ITP, then I looked at commercial toys. Here is an overview of what I found:

Previous Cat Toys from ITP

The Hanimustv by Aram Chang
The Hanimustv is a cat toy that was developed as a thesis project for last year. It is a “peek” and “hide” game that is controlled by a small remote control with arcade-style buttons. Small wooden cylinders are raised out of a box in response to button presses on the remote. The cylinders return to their original position once the button is released.

From a technology perspective, this cool toy uses an Arduino connected to buttons that controls a set of solenoids, which move the cylinders. Check out this cool user test video - the users testing the toy were of course cats, rather than humans.

Toy characteristics:
- Interactivity between cat and human
- Movement of physical objects for cat
- Physical controls for human

The Meowzer by Gordie and Emily
Another ITP cat toy that I discovered is called Meowzer; it was developed last spring semester by Gordie and Emily. Meowzer has a rotating top part that holds five arms. Four of these arms have dangling strings that hold small fluffy cat toys (one of which has a laser light). The fifth arm holds a small bunch of feathers and is the only one that can move up and down. The toy is controlled by an application that runs on a laptop computer.

From a technology perspective, this toy uses an Arduino that is connected to the following main components: DC motor that rotates the top part; Servo motor that moves the fifth arm up and down; and a laser light attached to one of the cat toys, in the mouth position. The application that controls the toy was developed in Processing.

Here is a link to the documentation about this project from Gordie’s blog. The documentation is comprehensive and features a nice video of the finished product.

Toy characteristics:
- Interactivity between cat and human
- Movement of physical objects and light for cat
- Virtual controls for human

Unnamed Toy by Patrick Proctor
The last ITP-developed cat toy that I found was developed by Patrick Proctor for our Introduction to Physical Computing class. This toy was designed to enable two cats to interact. It essentially features two separate toys that are connected. The first toy is a tennis ball on a metal spring that is secured to a wooden base; the cat plays with it by batting the ball around. The second toy is a laser pointer that moves from side to side; the cat plays with it by following the laser light reflection on walls. The movement of the laser pointer is partially governed by interactions with the tennis ball.

Here is a link to a blog post from Patrick where you can find pictures and an overview of his project.

Toy characteristics:
- Interactivity between cat and cat
- Movement of physical objects and light
- Physical controls for cat (or human)

Consumer Cat Toy Examples

Here I will focus my exploration on electronic cat toys only. That is not to say that old-school cat toys (such as plush toys, scratching pads, crinkly balls, laser pointers, shoe laces, etc) will not serve as part of my inspiration for this project. Ultimately, I want to create an electronic cat toy that rivals the interactivity provided by a stick with a piece of shoelace tied at the end, which to this day remains Sasha’s favorite toy.

Run Rascal
This is the only cat toy from the bunch that I have personally owned. It is a remote controlled mouse. My cat, Sasha, liked this toy well enough. The only problem we encountered was that the mouse is not able to run on carpets, which is where sasha likes to hang out the most. It is definitely the most interactive electronic cat toy that I have seen on the market.

Toy characteristics:
- Interactivity between cat and human
- Movement of physical object for cat
- Physical controls for human

The electronic toys listed below offer minimal or no interactivity. That is not to say that they are not much enjoyed by cats.

FroliCat Bolt
This is a relatively new cat toy that is relatively simple. It amounts to a laser light mounted in a well thought out container that moves the laser around a room. The laser moves based on the movement of a reflective mirror, rather than the movement of the light source itself. This toy offers an interesting mechanism, though it is not truly interactive (unless you hold it in your hand and use it like a traditional laser pointer).

Toy Characteristics:
- Movement of light for cat
- Limited interactivity provided

Mouse in the House
This is a cat toy that looks like a small diorama of a living room and features a track on which small toy mouse runs. The timing of the appearance of the small mouse can be programmed to enable the toy to entertain unattended cats for long periods of time. For the most part the toy seems to appeal to cats, though pet owners complain about the loud noise of the motor. Though this toy does not provide direct interactivity, it does offer the toy owner the ability to program the frequency of the mouse movement.

Toy Characteristics:
- Movement of physical object for cat
- Limited interactivity provided

Tuesday, November 10, 2009

Switching High-Load Circuits Lab, Playing with Motors

Earlier this week I was finally able to get caught up on my lab work for Introduction to Physical Computing. The lab exercises for last week involved setting up two circuits using DC motors: (1) Transistor Lab - simple circuit that rotates the motor in one direction only; (2) H-Bridge Lab - more complex circuit that enables bi-directional rotation of the motor.

Below is a short video that features the final circuits that I set-up. This is followed by an overview of the issues that I encountered and the code for the Arduino that I developed.



Issues and Solutions
The first issue that I encountered on this lab was finding the right motor to test. Initially I wanted to test a motor with at least a 12v load. After spending some time at local Radio Shack stores, I decided against buying a new and larger motor (e.g. 12V). So I used the 3v-6v motor that came with my parts kit.

Once the motor had been selected I worked on setting up the uni-directional circuit. At first I attempted to run the circuit without soldering the wire to the motor; as expected this did not work. After soldering the wires to the motor the circuit was working fine.

Next up I moved to work on the bi-directional circuit. As outlined in my notes from class last week, in order for a motor to work in both directions we need to reverse the flow of electricity going through the motor. This is where the H-bridge comes in handy. It couples four darlington transistors in a small package specifically for this purpose. Setting up this circuit took no time.

That said, I did encounter an issue when I was playing around with the Arduino code after the circuit had been tested. The changes I made to the Arduino code included setting up a potentiometer to control the speed and direction of movement (code included below). When running this sketch my Arduino seems to disconnect and reconnect to the multimedia computer continuously.

My guess is that this may be caused by the Arduino is experiencing a brownout when the motor is pulls a lot of electricity from the circuit (e.g. on start-up and when faced with resistance). I plan to try adding some capacitors to the circuit to resolve this issue. If you have any suggestions please leave them in the comments section.


Arduino Code - Bi-Directional Motor
Here is the code that I created for the H-bridge lab. I used the sketch provided by Tom Igoe for this lab as the foundation for this code.

/* 
 * LAB - BI-DIRECTIONAL MOTOR 
 * code based on sketch from Tom Igoe
 * modified by Julio Terra
 */

  const int potPin = 1;       // Analog in 0 connected to the potentiometer
  const int motor1Pin = 3;    // H-bridge leg 1 (pin 2, 1A)
  const int motor2Pin = 4;    // H-bridge leg 2 (pin 7, 2A)
  const int enablePin = 9;    // H-bridge enable pin
  const int ledPin = 13;      // LED 

 int potValue = 0;            // value returned from the potentiometer
 int motorSpeed = 0;          // speed of the motor
 
 void setup() {

   // open serial port for debugging
   Serial.begin(9600);

    // set all the other pins you're using as outputs:
    pinMode(motor1Pin, OUTPUT); 
    pinMode(motor2Pin, OUTPUT); 
    pinMode(enablePin, OUTPUT);
    pinMode(ledPin, OUTPUT);

    // set enablePin high so that motor can turn on:
    digitalWrite(enablePin, HIGH); 

    // blink the LED 3 times. This should happen only once.
    // if you see the LED blink three times, it means that the module
    // reset itself,. probably because the motor caused a brownout
    // or a short.
    blink(ledPin, 3, 300);

 }

 void loop() {

   // read the potentiometer, convert it to 0 - 255:
   potValue = analogRead(potPin);
   
    // if the switch is high, motor will turn on one direction:
    if (potValue < 512) {
      digitalWrite(motor1Pin, LOW);   // set leg 1 of the H-bridge low
      digitalWrite(motor2Pin, HIGH);  // set leg 2 of the H-bridge high
      motorSpeed = map(potValue, 0, 511, 255, 100);  // set motor speed based on pot position
    } 
    // if the switch is low, motor will turn in the other direction:
    else {
      digitalWrite(motor1Pin, HIGH);  // set leg 1 of the H-bridge high
      digitalWrite(motor2Pin, LOW);   // set leg 2 of the H-bridge low
      motorSpeed = map(potValue, 512, 1023, 100, 255);  // set motor speed based on pot position
    }

   // set new motor speed using analog write on the enablePin
   analogWrite(enablePin, motorSpeed); 

   // de-bug by sending potValue through Serial
   Serial.print("potValue: ");
   Serial.print(potValue);
   Serial.println();  
 }

  /*
    blinks an LED
   */
  void blink(int whatPin, int howManyTimes, int milliSecs) {
    int i = 0;
    for ( i = 0; i < howManyTimes; i++) {
      digitalWrite(whatPin, HIGH);
      delay(milliSecs/2);
      digitalWrite(whatPin, LOW);
      delay(milliSecs/2);
    }
  }


IPC Class Notes, Controlling Motors - Oct 27, 2009

During last week’s Intro to Physical Computing Class we focused on learning how to control motors and other heavy-loads using relays and transistors. These two components enable circuits with small current and voltage to control larger ones. Here is an overview of how they work, and how to set them up:

Relays
Relays use inductance to enable small DC circuits to control larger DC or AC ones. Inductance refers to the phenomenon where electricity, which is running through a circuit, creates a magnetic field around the circuit.

Relays use these types of magnetic fields to close a physical switch that completes a larger circuit. The magnetic field is generated every time that electricity flows through the small load bearing circuit on the relay. From a physical perspective, a relay is essentially a coil that is wrapped around a reed switch. When electricity runs through the coil circuit it generates a magnetic fields that closes the switch.

Relays have at least 4 pins, 2 pins for the small circuit that generates the magnetic field, 2 pins for the larger circuit that is switched by the relay.

Due to the physical/mechanical nature of relay switches this solution can only support digital communications between circuits. The speed of the connection is also slow because. The main benefit of the relay is that you can control an AC current from a DC source.

Transistors
Transistors also enable small circuits to switch circuits with higher loads. Unlike the relays, these are non-mechanical switches. This means that they have a faster speed of reaction and are able to communicate analog data.

Transistors are made of different types of silicon. The arrangement of these silicon layers enable one lead, with a small current or voltage, to control the flow of electricity through two other leads, with larger current or voltage. If no electricity is provided to the controlling lead then no electricity will flow through the bigger circuit.

The leads on a transistor are referred to as: the base, which is connected to the microcontroller and accepts a small load, such as pulses from an output pin; the collector, which is connected to a higher voltage source; the emitter, which is connected to ground.

Motors and Solenoids
Motors work by having two magnets surrounded by coils. The electricity that goes through the motor creates an electric field that causes the magnets to spin. When the motor is turned off the magnets will continue to spin temporarily, this creates a current in the reverse direction.

When working with motors it is important to consider issues associated to its physicality and mechanical nature. First and foremost, the response time provide by motors differs considerably from electronic components such as LEDs. For example, to get a motor going it requires that sufficient power accumulate to overcome the initial inertia of the motor.

Motors create a reverse flow of electricity when they are stopping due to the phenomenon of inductance that is used to move the motors. This has some important repercussions when building circuits that include motors.

First, you often need to use diodes. As an example, when hooking up motors and transistors it is important to include a diode in circuits where a transistor is used to control a motor or solenoid. This diode is used to ensure that reverse electricity will not flow through the transistor, as this would ruin it. For this to work, the diode needs to enable electricity to flow in the direction from the emitter to the collector

Second, you need to use capacitors. Adding a capacitor between the voltage source and the microcontroller helps ensure that the microcontroller gets sufficient power, even if the motor reduces the overall amount of energy available in the circuit (as it does when it is first turned on is facing resistance). I encountered this problem when working on the motor movement lab earlier this week.

Controlling Motors
The direction in which a motor spins is controlled by the direction of the flow of electricity. To control motor direction we need to create a circuit that includes four transistors as outlined in the circuit diagram below.



H-Bridges simplify the creation of circuits like the one above. They contain a network of transistors that enable the controlling of motor direction and speed. These components can support two separate motors, and have multiple input and output pins for each motor. Check out the diagram below from this week’s lab, it provides an overview of all pins on an H-Bridge.