Archive for September, 2009

Introduction to Physical Computing – 3rd Class

Wednesday, September 30th, 2009

Topics covered during class:

  • Question and answer session related to week’s assignment
  • Concepts and components related to electricity

Q&A from last week’s assignment
The only part of this week’s Q&A that I have captured here is a conversation regarding how to create a fluid experience when using analog input to control an action. Many of us in the class have realized that often when using analog sensors we are forced to deal with a lot of noise. So ultimately the question is “how do we reduce the noise to improve the interaction?”

To solve this problem, Tom recommends that we set-up a way to track the change in state that an analog sensor undergoes and use this difference to activate an action, rather than activating actions based on the absolute state of the sensor alone. This paradigm is used in several more advanced examples on the Physical Computing syllabus (this is just a general link to the syllabus as I have not looked for the specific examples yet). Some of the state change detection examples focus on digital input; however, the principle can be easily adapted for with analog inputs.

Back to Basics of Electricity
Resistors: Though we have discussed resistors several times in the past, we briefly reviewed a few important attributes before delving into new concepts: (a) Resistance – its ability to resist the flow of electricity (b) heat dissipation – its ability to convert electrical energy into heat, thus consuming voltage (aka potential); and (c) Impedance – its ability to resist changes in voltage.

Capacitors: Components that are able to store energy when it is available, or spikes. Then they are able to release the stored energy when it is no longer available. Most capacitors can work with electricity flowing in either direction, except for polarized ones that work better in one direction. Capacitors can usually hold energy for long time, though they are not able to hold much energy.

When do we use capacitors? Capacitors are often used like surge protectors to help stabilize energy since they collect charge when the charge spikes, and release it when it is low. Because of their impact on electric waves they also influence other waves such as sound – we will explore the consequences of this fact in future lectures.

Voltage Regulators: Most plugs have voltages that vary considerably above or below the recorded voltage. Voltage regulators are designed to minimize these spikes and keep voltage supply steady. All regulators have a minimum voltage/electricity requirement, if this minimum is not met then the regulator will not be able to output any voltage. Regulators are able to dissipate voltage by converting it to heat. This is why these components heat up when used for a long period of time (you will notice this if you touch a regulator that has been on for a while, then after burning yourself you will not make this same mistake again).

You should always use the lowest possible resistor for a given task because this is the most efficient solution (no need to use a 16v DC adaptor and resistor for 5v power delivery, if you have a 9v resistor available).

Parallel vs. serial circuits: There is an important distinction regarding how voltage and current flows through parallel and serial circuits. When two components are in parallel they divide the current but receive the same voltage. However, when two components are in serial order they divide the voltage while receiving the same current.

Pulse Width Modulation (PWM): PWM refers to the way in which microcontrollers, such as the Arduino, are able to emulate analog output via digital pins. This process entails sending electric currents that alternate between on and off in varying intervals to match the appropriate analog output level. Here is a link to a more in-depth description from wikipedia (image below taken from wikipedia post on this topic).

It is important to note that PWM needs to be calibrated based on the component that it is being used to control. For example, if we attach a motor to a PWM output then we need to calibrate the output setting to take into consideration the amount of time required to activate the motor.

Working with Complex Circuits: When creating complex circuits analyze each sub-circuit individually before trying to understand the overall circuit. Understanding the sub-circuits will enable you to understand the larger circuit that they create together.


Measuring Electricity Lab

Wednesday, September 30th, 2009

Last Friday I completed this week’s lab for Physical Computing. The objective of our assignment was to familiarize ourselves with how to use a multimeter to measure voltage, current, and continuity.

To prepare for this lab I set-up the breadboard so that it could be connected directly to a power source. This required that I set-up a voltage regulator to convert the 15v generated from the AC/DC converter to 5v. This was actually the hardest part of the lab for me because at first I was using another component that looked just like the voltage regulator. After almost burning my finger on the over-heated component (and enlarging a few of the wholes in my breadboard), I was able to get the breadboard set-up properly.

The video below captures the various voltage and current measurements that I executed. As expected, when we measured voltage the values across different components in the circuit always added up close to the full 5v. From a current perspective, we were able to verify that current is consistent throughout a circuit except in areas where there is a parallel circuit (in these instances the current is divided between the parallel components/paths).


Arduino Tic Tac Toe

Monday, September 28th, 2009

This weekend I spend some time building a simple game of tic tac toe using an Arduino and a variety of simple components, both analog and digital. Here is a video that takes you through the process of creating this game. You can download the code here. I have left all comments in the code so that you understand how it is built. I am sure there are many ways that this code can be improved and/or streamlined.

Tic Tac Toe Code


Thoughts on The Machine Stops by E.M. Forster

Monday, September 28th, 2009

I thoroughly enjoyed the short story The Machine Stops, by E.M. Forster. This tale tells the story about a future world where everyone lives a life secluded in private cells, all communications are mediated through a machine, all human needs are satisfied through this same machine, and first-hand experience of anything and everything is frowned down upon. Similar to the world depicted in Orwell’s classic 1984, humans in this world live like slaves though most choose not to recognize this reality.

The main sentiment Forster echoes in this short story is the fear that through technology we may loose our humanity (or in other word, technology may ultimately dehumanize our society). In The Machine Stops, the machine, rather than man, has become the measure for all things. Human beings have been relegated to lives without any direct contact with nature or one another. Original thought and experience are looked down upon, since they are not confined to the conventions upon which the machine is built.

Before I delve any further into Forster’s story, it is important for me to define what I think he means by technology. In one of my classes at ITP someone posited that we (as in humans) considered technology to be anything that was developed after we passed our early teenage years. Though this explanation is practical when talking to a younger person about devices such as computers and cellphones, it is not nearly broad enough. Technology ultimately refers to the making of things – that is why written language is a technology and so is religion, democracy, the wheel, man-made fire, books, bicycles, and of course iPhones.

One very interesting, and prescient element, about this story is how humans choose to imprison themselves by this machine of their own making. This contrasts with many more modern sci-fi stories – e.g. terminator and the matrix – where the machines gain consciousness and rise up against humans. This idea of humans choosing to imprison themselves is fascinating, especially when you view the many layers of technology through which we already mediate our experience of the world.

It brings to my mind how even the technology of language, especially when complemented by writing, often functions as lens through which humans experience the world rather than a set of tools to describe our experiences. As pointed out in Ong’s reading from last week, the birth of written language gave rise to much fear (as has the rise of computers in our modern age). In the end it was ironic how the people who were best able to verbalize their fearful emotions about the new technology of written language, embraced written language in their attempts to make cases against it.

The many conventions that we have created in language and that govern our experience of the world were mostly developed in response to one person’s (or many people’s) experience from a long time ago. The problem is that these conventions often remain in place long after the context in which they were created has vanished. Worst yet, these conventions are often held as truths that supersede a person’s conflicting direct experience of the world.

In the world created by Forster, technology is in many ways a dead relic from the past that keeps us from experiencing directly the world in which we are living right now. In his book Zen and the Art of Motorcycle Maintenance, Robert M. Pirsig offers another interesting perspective on technology, and our discontents with it: the source of our discontent with technology in Western society is caused by the dualistic thought that dominates our society. “The way to solve the conflict between human values and technological needs is not to run away from technology. That’s impossible. The way to resolve the conflict is to break down the barriers of dualistic thought that prevent a real understanding of what technology is-a fusion of nature and the human spirit into a new kind of creation that transcends both.” (p. 284).

As such, the problem with the technological progress in Western society, and the feeling of estrangement caused by it, could be ascribed to our focus on rational and considerations and subject-object dualism (the machine-side of man) and disregard for emotional considerations and a holistic understandings, which cannot be verified analytically.


Introduction to Computational Media – 2nd Class

Thursday, September 24th, 2009

Topics covered during our 2nd class:

  • Review homework and share learnings
  • Example or processing sketches for inspiration
  • Code basics and learning to make things move

Review homework and share learnings

We kicked off class by reviewing the homework from the first week. Here is an overview of the processing functions and tools were used by other people, and which I want to remember for my own applications/uses:

  • comments – there are two ways to add comments to your sketch:

// one line comments start with “//”
/* multiple line comments are bracketed by “*/” */

  • strokeWeight(weight) – sets the weight of the stroke on a line. Accepts one argument that is int or float input.
  • strokeCap(cap type) – change the style of line caps; options include SQUARE, ROUND, and PROJECT.
  • shape() – allows creation of shapes by joining lines and curves together. Accepts up to five arguments – shape datatype, x-coordinate, y-coordinate, width, and height.
  • vertex() and curveVertex() – draw straight and curved lines as part of a shape. There are many arguments that can be accepted by these functions, and they work slightly different so check out the reference for details.
  • colorMode() – allows changing range of each color argument. The default setting is a range of 255 for each color argument.

Made with Processing

To provide inspiration and help the class understand the potential of Processing, we reviewed many cool applications developed with this toolset. Here are a few of the sites that we visited during class:

Code Structure

Software is structured to be able to run forever. Therefore, it is helpful to think about software in two useful and distinct parts:

The first part defines what needs to happen at the beginning. This covers to the activities that take place in the set-up section, or block, of the sketch. This section of the code only runs once during the execution of a program.

setup() {
set-up code
}

The second part focus on describing what needs to happen continuously. In processing this is the draw section, often referred to as a loop section (as in the Arduino IDE). This block of code gets executed repeatedly as long as the application is running. This is the area of the sketch where you will add code to animate your creation.

draw () {
drawing code
}

Making Things Move

One of the easiest ways of making things move is using the mouseX and mouseY variables. These two variables track the location of the mouse on a screen at any given moment. With little coding you can make a shape follow the mouse around the screen.

To make things move in processing it is important to understand the concept of double buffering, as this is the process by which the screen is rendered. This means that processing first renders the screen in RAM, then once it is fully rendered it outputs the results on the display. Therefore, each time the draw function loops the display is only refreshed once.

Variables are crucial elements of programming language and refer to data storage units that are user-defined (except for a few useful system variables such as mouseX and mousey, discussed above). There are three steps involved in using a variable:

  • Declare the variable. This is when you define the type of variable and give it a name. Common variable types include int (integer or whole number), float (decimal number), Boolean (logical value), strings (text) and arrays (groups of variables). Variables can be defined globally or locally – local variables are only available within the function in which they are defined.
  • Initialize the variable. This refers to when we assign a value to the variable. Variable initialization can happen in many places depending on the use and scope of the variable. When possible it is good practice to initialize global variables in the set-up function. That said, global variables can also be initialized where they are declared.
  • Use the variable: There is no point to creating a variable if you are not going to use it. Now you can write the code that leverages the variable for your own purposes.

Conditionals are very important tools for adding movement and interactivity into a sketch. These functions enable the application to choose between alternate actions according to parameters that you define. They are always based on Boolean expressions, which are logical expressions that resolve to either true of false. Based on these logical expressions a block of code is either be executed or not. Note that it is usually good practice to separate the code written for logic and that written for drawing to screen (this is not always possible though).

When you start adding complexity to your sketch it is important to learn how to use debugging tools and strategies as these will save much hair pulling and potentially worse behavior. println() is one such function that enables the program to output information in the processing IDE (on the screen below the sketch code). The information visible through println() is only visible to the programmer.

Assignments

Start introducing some types of variables into your work so that it can be animated in some way. I have already done this assignment, here is a link to my blog post about it.

Miscellaneous

  • Tiny sketch competition going on from Rhizome. Build app with 200 characters or less. Check it out. Available on http://openprocessing.org website.
  • Class next semester about modeling natural systems and physics in processing. Talk to Dan about this class.
  • For data visualization books and examples built with processing look at Ben Fry’s data visualization books as a starting point.

Fangs is Back – Assignment for 2nd Week of ICM

Thursday, September 24th, 2009

For the second week of ICM we were tasked with creating a sketch that animates by leveraging conditional and loop statements, together with variables. I took this a few steps further by incorporating arrays, functions, objects, and (and even a photosensor computing sensor).

Though I had no experience writing software using an object oriented language, I had a theoretical understanding of this type of structure. In high school (longer ago then I care to remember), I wrote a paper about the principles of object oriented programming (OOP). This was during my senior year. I was happy to finally truly understand the power of this type of programming.

The latest version of the fangs sketch has the following features: a bat pointer follows the mouse around the screen. When that mouse button is pressed new bats are created. The right and left arrow keys enable the user to rotate the bats in either direction (though this feature is still not working perfectly). The eyes of the bats move around so that they are always looking towards the center. Finally, I created a sleep mode were all the bats perch themselves at the top of the window. The up and down buttons enable the user to enter and exit the sleep mode.

I encountered a lot of challenges when working on this project.

To be able to replicate the bats I defined a bat class that encapsulate all the attributes and behavior of the bat. Then I wrote code that creates individual instances of bats that are dynamically added to an array of bats (so that they can be easily managed). The bat class includes many methods/functions, including ones that randomly move the bat or move bat according to specific coordinates, that rotate bats in either direction, that transition bats into sleep mode, and that display all the bats.

To rotate the bats I had to learn how to use the pop/pushMatrix, translation, and rotation functions. This was one of the hardest obstacles I faced during the development of this sketch. However, once I learned how to use these capabilities I rewrote a lot of the code so that I could use them for all bat movements within my sketch (originally I considered using to pull of the rotation only).

The last tough challenge I had to overcome was associated to the sleep mode. Getting the bats to rotate properly and stop at the right location and rotation took some work. Originally I had planned to create only two states to govern this transition (sleep, awake), however, I realized that I need to create a third state (launch) so that the bats could properly rotate back to being right side up. I also had to find a solution to make the bats eyes closed once they had reached the top.

Check out my code on the openprocessing website. Let me know if you have any questions.


30 Minute Film Festival & 42 Seconds

Wednesday, September 23rd, 2009

Here is the one minute short video that I created with Patricia, Lisa, and Eric for Comm Lab. Our challenge was to make movie from ideation through final cut in 30 minutes (ok maybe it was more like 40 minutes). Here is the fruit of our labor:

We had a great time putting this movie together, not to say that we didn’t feel any stress as that was a key part of the challenge. Our process started with an open brainstorm session that focused on creating a list of individual words. Once we captured 40 words we reviewed them to pick out a few words or themes with which to build a story. This is what made it to the top of the list: car, racing, accident, hurt, 42 seconds.

Through conversation and negotiation we quickly reached an agreement on the overall storyline and began making a list of shots we needed. We then sprinted downstairs to shoot the footage. Then raced back upstairs to edit the movie. We were done just in the nick of time.


Analog Input Lab

Wednesday, September 23rd, 2009

Yesterday I set-up an analog input on the Arduino for the first time. I am happy to report that I did not encounter any major issues. The only roadblock was my own carelessness which caused me to initially connect the cables incorrectly.

The video below includes highlights from my set-up of a potentiometer and a photosensor. In both cases I used the analog switch to control the brightness of the LED light attached to the board.


The Memory Machine

Wednesday, September 23rd, 2009

The Memory Machine is a device that continuosly records locations, sights, sounds and smells. It then stores this information for a period of 72 hours.

The Memory Machine is controlled via gestures and a portable control device. Users can also access information using an application on a desktop/laptop computer. All information is time- and location-coded to facilitate retrieval. Data captured in different media is linked.

To capture data the machine uses a camera, a microphone, an olfactory sensor (which does not currently exist, to my knowledge) and a portable control device. The slides below provide a rough overview of this fantastic machine (note that I did not include the olfactory sensor in this sketch).


My New York From La Guardia to George Washington

Tuesday, September 22nd, 2009

After hiding from the sun for 15 minutes in a small sliver of shade, I boarded the M5 bus on the corner of Houston and La Guardia. It is 16:08 on a beautiful and sunny Saturday afternoon. This is an ideal day to transform a ride on an MTA bus into a scenic tour of my beloved and adopted hometown, New York.

During the 15 minutes before the bus arrived I had a frantic dialogue with my iPhone to curate the playlist that will serve as the soundtrack for this journey. I have always explored this city with a soundtrack. This addiction started when I first moved to New York and was working as a DJ. During this time I became compulsive about always leaving home with my portable music player and the latest draft of my demo.

I board the bus, pay the fare and find a forward-facing seat on the left side of the aisle. I set the playlist to shuffle and press play as the bus pushes away from the curb, synchronizing the start of the first track with our departure. The soundtrack starts with the song Heartbeat, which is an energetic vocal house track by the British band the Knife. I switch my focus back to the outside world and my assignment.

Over the previous couple of days I had given much thought to this assignment: What perspective did I want to take? What tools did I need to bring? I decided that my piece would be personal, that a soundtrack would enhance the experience, and that I needed a way to capture my thoughts. The iPhone took care of items two and three while I was left with the tougher challenge of defining writing a personal account of the tour. This is what was going through my mind as the tour began.

As we reach the corner of Houston and Sullivan I notice a small Italian shop called Rafetto’s . I used to frequent this store when I lived on Thompson Street . It is one of the few businesses that have survived from the days when this little corner of SOHO was primarily a simple Italian neighborhood. More recently, the Italian businesses left in the neighborhood are mostly high-end brand shops from brands such as Dolce & Gabbana, and Prada.

We turn onto 6th Avenue and head north past one of my favorite Italian restaurants, Bellavitae , which is located on Mineta Lane off 6th. A few blocks north we pass the famous Gray’s Papaya , where I’ve consumed many hot dogs. Next I spot the location of the old Balducci’s deli , where I used to savor delicious freshly-baked amaretto cookies.

My New York Memory Map

View Memories Houston to George Washington Bridge in a larger map

For many years I walked the stretch of pavement between Spring and 23rd Streets on a daily basis. This walk, coupled with a loud dose of electronic music, functioned as the caffeine fix that kick-started my days. This is why I would subject myself to this mode of transportation in the summer, fall, winter, and spring, rain, shine, or snow.

Despite the many good memories that I have from this area of the city, the visual landscape from the area between Houston to 17th street is not very appealing. It is dominated primarily by uninspired post-war developments populated by chain restaurant and retail brands, with some notable exceptions such as the Jefferson Market Library.

The architecture between 17th and 21st streets is a sharp contrast to the preceeding and following blocks. The buildings in this small enclave were originally constructed as luxurious department stores. Like much of New York, this area fell into a state of decay for several decades until being restored to its current well-maintained state during the last 15 years.

When we arrive at the corner of 20th street I examine my old office building . I notice that the Barnes & Nobles on the ground floor has closed. The storefront, which was once filled with a colorful selection of media and the recognizable faces of colleagues of mine on break, now looked like a dark and deserted void.

It was only 6 years ago that I stopped working here. I have many memories from eating and drinking at local restaurant and bars that have been replaced by new, and usually more upscale, establishments. This is a testament to the speed of urban renewal during the last decade in New York. In contrast, the presence of a few notable unoccupied retail spaces demonstrates the impact of the current economic crisis on the city’s ability to renew itself.

Once we cross 23rd street the buildings become less memorable and my personal stories and memories are less numerous. For many years I rarely crossed the 23rd street divide, which how this area came to be known amongst my friends.

The slice of 6th Avenue between 23rd and 34th is one of its least attractive parts. New cookie-cutter residential buildings dot this stretch, which is mostly lined with drab and grey post-war buildings. Aside from a few shinny new supermarkets and coffee houses, the commerce here is dominated by Indian clothing and jewelry wholesalers, and plants retailers.

As we approach the Manhattan Mall and Macy’s the crowd on the street swells exponentially. The weekend closure of Broadway above 34th has attracted a sea of people on this beautiful day. Looking at this spectacle I am reminded of my visit to Shibuya in Tokyo earlier this summer.

I look down at my iPhone to continue capturing my stream of consciousness and realize that I may run out of battery before the end of the trip. This realization leads me to think about my dependence on energy. I wonder how much energy it takes to keep this whole city “alive”, or even just one city block. The number is too high for me to even imagine. How long can we keep this up? What changes do I need to make in my life to help our society avoid a rude awakening?

I refocus on the world outside as we head into the garment district. Here the landscape changes to taller, though still mostly drab and grey, corporate-looking office towers. The commerce in this area is mostly fashion-related, as the name of neighborhood suggests. Bryan Park provides a breadth of fresh air in this boring midtown district. I worked just a few blocks away from this small oasis and enjoyed many lunch breaks sitting on one of its grassy patches.

Our arrival at Bryant Park is synched to the opening chords of the song My Beau, this is one of my favorite tracks from an LA-based artist called Daedelus. I feel like I am in that old VW Jetta commercial where the world around the car moves in synch to the beat of the music in the car.

We cross 42nd Street and the corporate office buildings quickly morph into imposing towers that exude a sense of power. This area through 55th street is a nucleus of banks, insurance companies, law offices, and multinational corporations. From the bus, the towers seem to be looking down at me with a hard and muscular stare. I feel very small in comparison; I enjoy the feeling.

When we reach 46th Street I begin to crave delicacies from a nearby Brazilian goods store called Buzios . This small shop, hidden on the second floor of a dilapidated building, is my favorite source for cooking supplies, cheeses, chocolates, and soft drinks from Brazil. On my first visits to New York in the nineties this strip of the city was overrun by Brazilian businesses. Now, Buzios is one of the few remaining Brazilian-owned businesses in this area that is still known as little Brazil.

At 55th street the row of towers comes to an end. A mix of residences, hotels and themed eating establishments line the few remaining blocks south of the park. I lived in this area during my first six months in New York, though I have spent little time here since I moved downtown.

While following along the southern edge of Central Park my view was limited to the south side of the street. The buildings lining this edge of the park are old luxury condominiums and hotels that are all in need of a good makeover. Especially when contrasted to the city’s newest and most luxurious shopping mall complex, which is located next door in Columbus Circle.

We reach Columbus Circle and take a right onto Broadway to cut diagonally across the island. The ten blocks above the Circle are home to many New York City treasures, including Lincoln Center and one of my favorite pizzas, at Fiorello’s . Broadway is lined with high-end residential complexes and big brand name stores. The buildings are less imposing and provide more visual breathing room than the power corridor we passed on upper 6th Ave.

We take a left and head towards the Hudson on an ugly stretch of 72nd street. When we reach Riverside drive I am struck by my view of the lush park and river. This is one of the few parts of the city that I had never visited; I can’t imagine a better day to acquaint myself with it. The song “Brother Love” from Animal Collective picks up slowly providing the perfect musical accompaniment.

The side of the street opposite the park is lined with beautiful upscale residential buildings. From 72nd through 120th there are strollers and kids parading down the sidewalk. This is by far the most family-friendly street on the tour. From my vantage point, the overall aura of the neighborhood makes me feel as though I have been transported to Brooklyn Heights.

After 60 blocks of river views the bus takes 135th Street over to Broadway for the final leg of our ascent to the George Washington Bridge. The contrast between Riverside Drive and this stretch of Broadway is severe. This section of Harlem is noticeably lower income than all of the other neighborhoods we visited along our route.

Most businesses in this area are locally owned with signage primarily in Spanish, with the exception of a few fast food restaurants and cell phone provider outposts. The sights, sounds and smells of the neighborhood are strongly Hispanic. The cash checking stores, phone card vendors, and abundance of Latin restaurants and grocery shops are part of the visible support structure for to this large community of immigrants.

When we reach 165th street and are in view of the George Washington Bridge we are forced to transfer buses. I take the opportunity to soak up some sun and I start to think about what I’ve witnessed so far. A new bus arrives within five minutes, and our tour ends only a few minutes thereafter when I step off the bus across the street from the GW Bridge.

On the subway ride back home, still listening to my soundtrack, I think about the diversity that exists within the 200 city blocks that I traveled today. I enjoyed the opportunity to consciously survey the physical manifestations of this diversity in the buildings and streets of the city. I also realize how the diverse cultures and values that were manifest in the streets outside the bus, were equally reflected in the bus riders themselves. This pattern of reflection reminds me how the unparalleled diversity offered by New York is one of main reasons I call this city my home.

The Tour Playlist