Archive for January, 2011

AMUP original [Physical Prototype Development]

Thursday, January 13th, 2011

It has been a long time since I updated my journal with documentation regarding Air-Mashup, the new DJ tool I designed as part of NIME. The development process for this project was challenging, sometimes frustrating, and ultimately very fulfilling. It was by far the most complex physical computing device I have ever built. It forced me to stretch my abilities in realms of physical prototyping and software development.

Today I will focus on the iterative prototyping process I used to develop this project. Between the early October and mid-December I developed 5 different sets of physical prototypes and too many iterations of the code to count. Here is an overview of all my prototypes along with an outline of the software development challenges I encountered.

Prototype V0.1
The first prototype focused on testing the design of the structure that holds the proximity sensor and was constructed out of hand-cut pieces of foam core. It featured the proximity sensor and a laser light. In this phase of the design process I was able to identify the appropriate height for the “barrier” that ensures one’s hands do not come to close to the proximity sensor. This is important because the sensors effective range starts a few inches away from the sensor itself.

Prototype V0.2
The second prototype focused on testing the design of the control panel that enables users to control clips, loops, headphone monitoring, and filter sends. This prototype was developed using laser-cut pieces of foam core. This phase of the design process enabled me to identify several issues with the placement of the buttons. It also led me to re-evaluate the overall design of the piece, since I was unhappy with the large and clunky feel of this box.

Prototype V0.3
The third prototype was an utter failure. My focus at this stage was on testing a new approach for the design of control panel and the encasing for the proximity sensor. I decided to create this prototype using wood since I had a plank of basswood lying around. This was a mistake, I realized that it is always better to continue prototyping using easier to handle materials until the design is more developed. This piece went straight from the laser cut machine to the garbage.

Prototype V0.4
With the fourth prototype I was able to get back on track. My focus at this stage was still on testing a new approach for the design of the control panel and the encasing for the proximity sensor. This prototype was constructed out of laser cut watercolor board. This material is made of cardboard-like paper that is thicker and harder then foam core. This build helped me identify the final tweaks I needed to incorporate into the design of the control panel. It also led me to the inspiration to merge all of the control panels but to separate out components that hold each individual the proximity sensors.

Prototype V1.0
The final prototype is by far more complex than any of my previous builds. I went from working on a single control panel/proximity sensor combo to building out four integrated control panel/proximity sensor components. At this point in time I needed to finalize the physical prototype so that I could start preparing for the NIME performance. It took me several weeks to build this prototype: I had to order over 100 components and solder them (and often re-solder them) together to build the circuits; then I had to laser cut over 50 pieces of wood and plexi to construct the boxes. As can be expected, it took me much longer to build this prototype than any of the others. Here is a slideshow features pictures of the final prototypes and the build process.


ITP WC: The System Is Alive

Wednesday, January 12th, 2011

ITPWC is a phytoremediation device based on the Eco-Machine systems developed by Dr. John Todd* and research done by the ITPWC team on aquaponics systems. Built in the men’s bathroom on the ITP floor, our inspiration for this project was to create a system that made a positive impact on air quality while also improving the overall ambiance of the space.

Aquaponics is the combination of aquaculture and hydroponics. Aquaponic systems are designed to grow plants and fish symbiotically in one integrated system. The fish waste provides a food source for the growing plants and the plants provide a natural filter for the water that the fish live in.

A large scale aquaponic system build on the Eco-Machine paradigm has been designed to filter human-created wastes from water, so that water can be recycled for human usage. This system lives at the Omega Center in upstate New York. Two members of ITPWC team had an opportunity to visit Omega, and get a tour of this new inspirational creation.

To track the impact that this system had on the air quality in the men’s room, we installed sensors that measure changes in the level of methane and solvent vapors. These sensors were attached to an Arduino that uploaded average readings every five minutes to data feed on Pachube.

Here is an overview of how the different components in this system work together to create a symbiotic ecosystem and to remediate the water:

  1. Aquaculture: The fish living in this component excrete waste and ammonia into the water, which will act as fertilizer for the plants. Water is pumped up to the grow bed and then gravity does the rest to keep things moving.
  2. Phytoremediation: These plants remove chemical vapors from the air, as well as help rid the water of pollutants. They absorb nutrients from the nitrate-rich water and produce oxygen at a high rate. Plants used include dresden, boston fern, golden pathos, english ivy, peace lily.
  3. Aquaticremediation: Aquatic plant roots provide habitat for waste eating microbes. Filter feeders, like the clams in this system, help remove algae and other toxic particulates from the water. Plants used include penny worts, banana plant, freshwater plant, freshwater flat clams, and duckweed.
  4. Bio-Filter: The bio-filter is an anaerobic environment (no oxygen) where micro-organisms and bacteria strip any excess ammonia, nitrates, nitrites and phosphorus that remain in the water. The mud used to inoculate the system comes from Prospect Park lake in Brooklyn.

I want to thank the ITP WC team for all the hard that they devoted in building this system. We all wore many hats on this project but I want to give credit where it is due. Macaulay took the lead on the physical design and production of this living system, while Adib became our resident aquaponic/eco-machine expert, and Marko led the way in creating the communications for to system.

Here are some pictures from the installation itself:


Regular Expressions: Patterns & Rules

Tuesday, January 11th, 2011

Image from AJ Brustein, used under CC license

Over the past week I’ve become acquainted with Regular Expressions, also known as regex by those familiar with this powerful tool. I have only begun to scratch the surface but I am already blown away by the power of this text parsing engine. Here I will provide a brief tutorial of how to use this tool with Processing, and share some useful resources for anyone who is interested in learning more about it.

What is Regex?
According to wikipedia’s definition regex is a formal language that “provides a concise and flexible means for matching strings of text, such as particular characters, words, or patterns of characters… A regular expression can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.

In other words, regex provides a set of rules that enables users to search for and extract pieces of text from a larger text source (be it a file or a data variable). I used regex to extract specific bits of information – such as dates, titles and body copy - from over 300 posts to one of my blogs.

Regex has been incorporated into many different computer languages. Php, ruby, c++, python, and java all offer regex in slightly different flavors. For my project I used the regex functionality that is available in Processing.

Learning Regex
Now I’ll dive into a few technical examples to show you how it works. Here is a link to a good quick start guide that helped me get started, the information I will cover below all comes from this site. The way regex works is that you define a search pattern that i used by the regex engine as a query. Here is an overview of the most common elements of a regex pattern:

  • Literal Characters: these are the simplest type of regex patterns, they provide a straightforward match. For example, the pattern “cat” will match any instance of “cat” whether standalone or in words such as “catalog”, and “catastrophe”.
  • Character Classes: these patterns will match only one out of several characters. Character classes are identified by square parentheses. For example, the pattern “[bc]at” will match any instance of “cat” or “bat” whether standalone or in words such as “battery”, and “catalog”.
  • Shorthand Character Classes: these characters will match one character of a specified type, such as digits “\d”, word characters “\w”, or space characters “\s”. Using a capital letter, such as “\D”, creates a negated match that matches any character that is not of the specified type.
  • Non-Printable Characters: these characters enable you to add non-printable characters to your regex pattern. For example, “\n” specifies a new line feed while “\r” identifies a carriage return. Regex also supports the syntax “\xFF” to use a hexadecimal numbers to specify an ascii character.
  • The Caret: creates negated matches when used within square brackets. Similar to the way that capital letters function for the shorthand character classes, the caret allows the specification of characters that should not be matched. For example, “[^b]at” will match sequences that contain the characters “at” preceded by any character other than “b”.
  • The Dot: matches any character except line breaks. For example, the pattern “.at” will match any instance of “at” that is preceded by a non-line break character. It is important to note that this pattern will not match “at” all by itself.  The dot is very powerful and can easily cause unwanted matches if not used sparingly.
  • Anchors: these characters specify a location within a text source. The “^” specifies the beginning of a text source or line of text (depending on the regex mode), while “$” specifies the end of a text source or line of text. You can also use the “^” and “$” characters to only match characters that are placed at the beginning or end of words.
  • Alternations: the “|” character provides the equivalent of a logical “or” functionality. It is used to identify multiple different potential patterns for  a match. For example, “bat|cat” will match either bat or cat.
  • Optional: enables you to specify optional characters for a given match. For example, “c?at” has an optional “c” so it will match the pattern “at” or “cat” whether standalone or within a bigger word.
  • Repetition: the “*” and “+” characters can be used to enable a patterns to be matched repeatedly. They differ in that “*” matches a character 0 or many times, while the “+” character matches 1 or many times. For example, the pattern “ca*t” will match “ct”, “cat”, or “caat” while the pattern “ca+t” will match “cat” or “caat” but not “ct”.
  • Greedy and Lazy Patterns: the difference between greedy or lazy patterns is that greedy patterns (which are the standard) will expand the match as much as possible, while lazy patterns will keep the match as short as possible. Using the “?” character will make a match lazy. For example, for the string “cathat” the pattern “c[a-z]+t” will match “cathat” while the pattern ”c[a-z]+?t” will only match “cat”.
  • Groups: by using “()” we can specify groups. This is useful because we can apply quantifiers to these groups, and many regex-based functions are able to return the values of these groups separately (this was very useful for my sketch).
  • Lookarounds: these patterns are similar to anchors in that they enable you to find a position that is defined by a pattern without including this pattern in the overall match. For example, “(?=c)at” will match the “at” in cat but it will not match a standalone “at” because it looks for the “c” as an anchor.

Here is a link to the Regex Pal, this is a great tool to test out regex patterns.

Regex and Processing
Regex can be used with several functions within Processing. The two functions that I used to extract and clean text from the web page were:

string.matchAll(“regex”): this function takes the regex pattern and returns a two-dimensional array with the matching patterns and sub-patterns. For example, if applied to the text “cat cat hat” the pattern “[ch](at)” would return the following array: [0][0] “cat” and [0][1]“at”, [1][0] “cat” and [1][1]“at”, [2][0] “hat” and [2][1]“at”.

string.replace(“regex old text”, “new text”): this function takes a regex pattern as a first argument, and replaces the instances of this pattern with the new text provided as a second argument.

[image taken from AJ Brustein, used under CC license]


Inspiration: The Middle Passage by James Hollis

Sunday, January 9th, 2011

I am 35 years old. By most accounts this means that I have officially reached “middle age.” I had never really thought about reaching “middle age,” and what that would entail, or mean. I assumed, as most people do, that “middle age” was something that was primarily related to my age. As a consequence, I tended to lean towards the viewpoint that reaching this phase of my life was a negative thing.

Part and parcel with “middle age” is the dreaded “mid-life crisis”. This is another event frequently stereotyped in our pop culture. The first thing that comes to mind are the judgmental images of old men with a sports cars, motor bikes or young lovers (from a female perspective I think of the housewife shows on TV). No wonder most people get depressed thinking about reaching this point of their lives. I’m not one to easily succumb to many of the negative stereotypes that abound in our modern consumer culture; though that is not to say that I am immune the negativity that is often prevalent.

I was recently introduced to a very empowering perspective regarding “middle age” through the work of a Jungian psychologist named James Hollis. In his book “The Middle Passage” Hollis examines how this important moment in our lives can provide a powerful opportunity to redefine and reorient our lives; and to investigate who we are apart from our history, the roles we often play, and the unconscious patterns of actions that often govern our lives.

Over the past couple of years I have been making a lot changes in my life and dealing with a good deal of emotional upheaval. I notice how these events and experiences are part of my personal voyage through this “middle passage”. This book has served a call to action for me to continue to embrace the hard work that I have started. At the same time is has provided me with an empowering set of perspectives and frameworks. As they say, a book will find you when the time is right – I don’t know who “they” are, but in this case they are definitely right.

What is the Middle Passage?
Though it will be hard to do justice to the concepts and ideas from Hollis’ book in a few short paragraphs, I will do my best. Please note that the numbers in [brackets] refer to pages from Hollis’ book.

To understand the Middle Passage it is important to briefly consider the phases of identity that lead up to this part of our personal journey, namely childhood and first adulthood. During childhood we adopt many unconscious responses that continue to play an important role in determining our adult personality. “Out of the wounding of childhood… the adult personality is less a series of choices than a reflexive response to the earlier experiences and traumata of life.”

These reflexive responses, termed complexes by Jung, are both unavoidable and natural. “The problem is not that we have complexes but that complexes have us.” [13] These forces are born in our unconscious, and as long as they remain unconscious they have the power to wreak havoc on our lives. The development of these complexes is closely associated to the process of socialization, together these processes drive the development of our acquired personality.

As our personality solidifies (and our attachment to it grows) we become increasingly estranged from a natural sense of self. “The transit of the Middle Passage occurs in the fearsome clash between the acquired personality and the demands of the Self… Thus, the Middle Passage represents a summons from within to move from the provisional life to true adulthood, from the false self to authenticity.” [15]

Changes in Perspective
The Middle Passage is characterized by several important changes in one’s perspective regarding life.

A new kind of thinking is required as a response to a collapse of one’s tacit contract with the universe. Here I refer to the belief that if we act “correctly” and do the “right” thing then our life will work out the way we want it to. In short, we do not have a “reciprocity” agreement with the universe. [41]

Our sense of time changes with the realization that we are mortal and that “there is no way [we] will ever accomplish all that the heart longs for and pursues.” [32] The ego-centered hopes from our youth for personal grandiosity, and perfection in our relationships are challenged by these realizations. This is a painful experience since these external pursuits were viewed as important sources of happiness and fulfillment.

Together these changes reflect a collapse of the assumptions by which one has lived his/her life, and which have served as the basis for the development of one’s personality. They create a tremendous amount of emotional upheaval often leading a person to withdraw from others and act “crazy”; in other words, it leads to a strong experience neurosis.

Taking Responsibility
These changes are ultimately a call for one to take a greater responsibility in one’s own life. Here are some of the challenges that must be faced when one chooses to answer this call.

One must bring to consciousness and withdraw the projections that have played an important role in our life. Projections, like complexes, are expressions of our unconscious. Career and marriage are prime vehicles for our projections, often viewed as potential external sources of meaning, fulfillment, and even transcendence. During this passage our projections are eroded tearing down the hopes and expectations they embodied.

To establish a new equilibrium between our roles in society (e.g. personas) and our authentic self we have to reintegrate parts of ourselves that we have repressed. Labelled by Jung as the shadow, these repressed parts of our inner being contain things that are identified as problematic on a personal and societal level. Creating a dialogue between one’s persona and shadow is the only way to bring the shadow out of the unconscious so that it can add new possibilities to one’s life.

“When we recognize and withdraw the projections that money and power represent, then we are obliged to ask in a radical form: ‘What am I called to do?’” This question is an important step in the path to finding one’s vocation. While a job is focused on meeting economic needs, a vocation “is a requisite part of our individuation to feel that we are productive.” [72]

Ultimately, these challenges “mean finally confronting one’s dependencies, complexes and fears without the mediation of others. [They] require that we relinquish blaming others for our lot and to take full responsibility for our physical, emotional and spiritual well-being.” Our task at this moment in life is to “make our fears our agenda.” [43]

Can Technology Help?
Ok, you should have known that this was coming. As I gear up for my thesis I can’t help but wonder how technology could be used to help empower and guide individuals through this phase of their lives. This area of exploration has officially been added to my short list of potential topics for thesis.


MoodyJULIO: Mood Tracker Technical Details

Thursday, January 6th, 2011

Now that the semester is over I finally have time to document the hardware and software solution that I designed to capture data for my MoodyJulio project. This covers only the first phase of this project as I am still working on designing the data processing and visualization components.

Before I dive into the weeds let me quickly recap the inspiration for this project. Over the last year I have become more conscious regarding my health (both mental and physical). This project was designed to provide me insights regarding how different activities, people, and places affect my emotions and moods. Here are links to several journal entries that provide a conceptual overview of this project.

  1. Investigating My Physiological and Emotional States
  2. Excited, Emotional and Moody

Designing the Mood Tracker
Designing the mood tracker involved more than just finding a solution to fit all components into a wearable package (though that was a big challenge), it also required figuring out the process for interacting with the user in explicit and non-explicit ways. The design of these interactions had an impact in the physical and virtual (code) aspects of this project.

You may be wondering what the hell do I mean by explicit and non-explicit interactions. The explicit interactions included capturing data from the user regarding their emotions, and enabling the user to easily transfer data between the device and their computer or the internet. The non-explicit interactions refers to the data captured by the various sensors. I refer to these as non-explicit because my goal was for the user to forget that these sensor readings were even taking place so that I could minimize the impact of these interactions on user behavior.

To arrive at the final process, which is outlined in my previous journal entry (Investigating My Physiological and Emotional States), I tested several different approaches. My goal was to achieve an objective-subjectivity, which is the most I could hope for since my focus was on emotion tracking, considering that emotions are such a subjective phenomena.

From this testing I came up with a few important process improvements that helped me get closer to the objectivity that I was looking for:

  1. To ensure that I was capturing emotional data in an objective manner I ultimately made the mood tracker responsible for identifying the times of day when I needed to record how I was feeling. During the testing phase I would record this type of information whenever I felt like it. This tended to skew the data because I would only input data when I was feeling strong positive or negative emotions – rarely when I was bored or focused on an activity.
  2. To help me analyze how I was feeling I created a long list of positive and negative emotions that I used for my mood journal posts. I know how hard it is to reduce what we feel to a single emotion (especially now that I have been doing this for several weeks);  I often feel multiple and even conflicting emotions. Nonetheless, after much thought I decided that if I did not take this approach the data would be too qualitative/subjective and therefore hard to use in the analysis phase. I plan to re-examine this choice when in future mood tracking efforts.

The Physical Build
Over the length of the semester I created three (3) different prototypes before settling on the design for the final version of the mood tracker. Here is a list of the components I used for the final tracker followed by a brief  overview of the function of the most important ones. I’ve also included pictures of the most important elements.

  1. Arduino Lilypad: the Lilypad functions as the main microcontroller for this device. All other components are controlled by this nifty little piece of technology. This Arduino is responsible for capturing data from all sensors, storing the data on the SD card, identifying when to page the user for input regarding the emotions and moods, and then capturing the input via the two push buttons.
  2. Heart Rate Monitor Interface: the Heart Rate Monitor Interface connects to the Polar Heart Rate transmitter, together these devices capture the user’s heart rate and provide that data to the Lilypad. The Heart Rate Monitor also features four (4) input pins. I used three of these pins to attach the accelerometer to this device, rather than linking it directly to the Arduino. This component is connected to the Arduino using I2C protocol.
  3. GPS Module: the GPS module is only used here for time keeping. This project did not include a location-based element (though I considered it). However, since I was capturing data via multiple different platforms it was crucial to have all input time stamped so that it could be matched together during the analysis and visualization phase (by itself the Arduino can only provide milliseconds from startup). This component is connected to the Arduino using serial protocol.
  4. microSD Card Logger: the OpenLog logger enables the Lilypad to log the data it captures from the sensors. This logger uses a micro SD card (the type commonly used in many cell phones) to log information. It is easy to set-up and records all data that the Arduino sends out via the serial port.
  5. Electrodes & 10K Resistor: the electrodes and resistor were used for sensing Galvanic Skin Response (GSR). GSR can be sensed by using two electrodes to measure conductivity changes in our skin. The best place to measure GSR is your fingers. I won’t get into details here about GSR sensing, here are three links that will give you some guidance: (1)Che-Wei Wang’s Arduino and Processing code for sensing and graphing GSR; (2) Mustafa Bagdatli’s overview of different materials used to sense GSR; (3) Sean Montegomery’s Truth Wristband that uses GSR technology.
  6. Vibration Motor, Momentary Push Buttons & LED: This motor and LED are used to notify/page the user whenever it is time to post data about emotions. When input is requested, the push buttons can be used by the user to input whether they are feeling positive or negative. Notes regarding the motor: since the motor uses up a lot of power I made sure to minimized its use. I used a small motor that was different from this one but I decided to feature this one as I think it would have worked even better.
  7. 3-Axis Accelerometer: the accelerometer I used for this project was an older version of this component. The purpose of this element is to measure how much physical activity is taking place. I decided to connect this component to the Heart Rate Monitor Interface (rather than directly to the Arduino). Unfortunately, my accelerometer (which was already quiet old) stopped working a few days after I finished assembling the mood tracker – so I ended up not using it.
  8. Icebreaker Sours Box: this is the box for one of my favorite candies (Icebreaker Sours – Berries). It also happens to be a good little enclosure for projects such as this one.

Writing the Code
It took me a long time and many iterations to write the code for this project. This was by far the most complicated Arduino project that I have done to date. On a positive note I really enjoyed learning how to take my wiring skills to the next level (and this practice came in really handy for my NIME project). Here is a link to the current version of the code, I won’t post the code here because I don’t want this blog post to become too long.

In the end I structured my code primarily based on functionality. I did not use object oriented coding methods as much as I would have liked to – this was in large part due to the fact that I am still learning how to use object oriented programming with Arduino’s wiring code platform. So when I say that I structure the code based on functionality, I mean that I distributed the functions that perform different functionalities into separate tabs (or .pde files). Here is the breakdown:

  1. Mood Mapping Main Functions: this is where you will find wiring’s core setup and loop functions, along with the high-level definition of the gpsConnect class (the only object-oriented class in this sketch).
  2. GPS Class Functions: features all the functionality associated to connecting and communicating with the GPS unit. I used the NewSoftSerial library here since I needed to use the standard serial port to connect to the data logger.
  3. Read Data Functions: here you will find all functions responsible for reading data from the various sensors.
  4. Serial Output Functions: this is where you will find functions that print data to the serial port for logging.
  5. Physical Output Functions: features functions that govern the physical output via vibration motor and LED.
  6. Wire HRMI Functions: includes functions that use the wire library to communicate with the Heart Rate Monitor Interface, which is connected to the Arduino via I2C.
  7. Sketch Notes: here you will find exactly what you would expect, notes about this sketch.
  8. Deprecated Functions: this is where you will find functions that are no longer in use.

Processing and Posterous: Authenticated HTTP Requests

Tuesday, January 4th, 2011

Over the past couple of weeks I have been working to aggregate all the data for the MoodyJulio project into a single database. This process has been rather painful so I am happy to report that I’ve been able to make a lot of progress on this project over the past week.

My first success was achieved last week, when I finished reading and processing a few million lines of data captured via my mobile tracker. All told I have upload over 4 million data entries into my project database. These entries feature my heart rate, galvanic skin response, along with basic information about my mood/emotion and a timestamp.

My latest success was in figuring out how to use the Processing and the Posterous API to download data from my personal mood journal. Though the Posterous API is quite simple, I have little experience working with web service APIs and the documentation available online is skimpy at best. Also, the Posterous API requires http authentication, which took me a while to sort our.

After a lot of research and hard work I was able to get Processing and Posterous to play nice together. To help other inexperienced Processing developers who want to use web APIs that require http authentication, I have put together a simple Processing sketch that makes this an easy task. Below is the code the I developed for this very purpose.


MoodyJULIO: Still Moody

Tuesday, January 4th, 2011

Though this is a post about my final project presentation, MoodyJULIO is in no way finished. Last week I shared with class an update regarding the current state of my project MoodyJULIO. I have plans to continue working on this project through next semester and over the winter break (I have been making some good progress with my code over the past week).

Unfortunately, over the last two weeks of the semester I suffered several setbacks in this project. First, one of my LiPo batteries exploded while it was being charged – since then I have refused to use my LiPo chargers for fear of any additional fireworks. Secondly, I’m swimming in a sea of data and I have encountered a lot of issues uploading all of my data into a database. This is in large part due to my lack of experience working with databases and string parsing.

Though I have not been able to glean insights from my data yet, I have encountered a few questions regarding emotions and our investigation of them. First, to what extent are we responsible for our own emotions? How do our language and culture impact our experience of emotions? And lastly, to be or not to be a cyborg? To what extent do we want to embrace this type of augmentation (where are the limits).

Without further the delay here are the slides from my final presentation.