Physical Computing

Deep Floor

December 9th, 2009  |  Published in Introduction to Computational Media, Physical Computing

A video of the floor in action:

Deep Floor demo from yin ho on Vimeo.

Joshua and I shied away from the mass sensor production necessary for making the physical floor, and wanted to learn more about camera vision.

Now that the actual floor was to be the projection surface, I changed my ICM final/abstract pattern/moving lights idea and went with a repeated projection of the floor on the floor. I liked the idea of creating a portal into an alternate universe of infinitely deeper floors beyond the one you’re on. I used pushMatrix and popMatrix to alter the size of the image depending on where the mouse/viewer is on the floor, and opacity/tint to give the illusion of shifting depth.

Joshua and I looked into camera vision/blob detection on the PComp (and ICM) side. Properly isolating a variable to track is an ongoing issue with using cameras as sensors. As the Processing sketch is moving, we couldn’t use movement. Ideally, you’d have a a black moving blob against a super bright white stationery surface, but that wasn’t our case. In the end, we went with finding the darkest point.

The code, using brightness tracking to find the darkest pixel, is below. We’re still trying to determine what measurement most accurately detects presence within the sketch, and what could be used to detect more than one person’s position on the floor.

import processing.video.*;
PImage floorimage;

Capture video;

void setup() {
size(screen.width, screen.height, P3D);
// Uses the default video input, see the reference if this causes an error
video = new Capture(this, width, height, 10);
floorimage = loadImage ("floor.jpg");
noStroke();
smooth();
}

void draw() {
if (video.available()) {
video.read();
// Display the video (or not)
// image(video, 0, 0, width, height);
int darkestX = 0; // X-coordinate of the darkest video pixel
int darkestY = 0; // Y-coordinate of the darkest video pixel
float darkestValue = 255; // Brightness of the darkest video pixel
// Search for the darkest pixel: For each row of pixels in the video image and
// for each pixel in the yth row, compute each pixel's index in the video
video.loadPixels();
int index = 0;
for (int y = 0; y < video.height; y++) {
for (int x = 0; x < video.width; x++) {
// Get the color stored in the pixel
int pixelValue = video.pixels[index];
// Determine the brightness of the pixel
float pixelBrightness = brightness(pixelValue);
// If that value is brighter than any previous, then store the
// brightness of that pixel, as well as its (x,y) location
if (pixelBrightness < darkestValue) {
darkestValue = pixelBrightness;
darkestY = y;
darkestX = x;
}
index++;
}
}

// Floor projection
background(0);
noStroke();
fill(255,200);
ellipse(darkestX, darkestY, 200, 200);//draw an ellipse to tell me where the darkest point is

for (int y = 0; y < height; y+=90) {
for (int x = 0; x < width; x+=90) {
pushMatrix();
float a = dist(x,y,darkestX,darkestY);
tint (200,a);
float d = dist(x,y,darkestX,darkestY);

translate(x,y,d);
image (floorimage, 0,0,120,90);

popMatrix();
}
}
}
}

Tags: , , ,

Moving Lights, cont’d

November 25th, 2009  |  Published in Introduction to Computational Media, Physical Computing

For my ICM final, I modified the ‘following a light’ sketch idea to displacing a projected abstract pattern: As a figure moves, the ground shifts. When an individual walks onto the floor, the surrounding sketch alters like this (use your mouse; from openprocessing):

The perspective shifting, illusory nature, and synthesis and articulation of planes of Op Art are influences in creating the projected pattern.

Without activation, the projection is still. Displacement will scrunch or widen shifting lines. While most the paintings are square or tiled, our projection will focus on the outline/line rather than the center (the grid as opposed to the squares).

For example, Victor Vasarely’s Vega:

Questions for ICM class feedback:

    How would I make the movement within the sketch realistic? For the simple sketch that allows the mouse to change the surrounding lines, translate, popMatrix, and pushMatrix are used.

On the Pcomp side, Joshua Clayton and I are using the physical computing/interactive aspect as our final in that class. We tested materials and methods to create a working sensor. Currently, we have a sensor made from wire mesh, and separated with 1/8 foam.

The next sensor will use wider foam strips so the area for closing the circuit will be smaller, as right now it’s very sensitive, and we’re likely to get false positives. Additionally, the plexiglass we’re considering using as the floor material is hard, and distributes its weight evenly across the sensor area. As a result, you have to apply quite a bit of pressure once the sensor is under a tile.

Sensor working when pressed:

Questions for class feedback:

    These tiles and underlying sensors have to be set up somehow with hidden wiring and Arduino. We’re considering a wooden box with cross bars for support. Thoughts or suggestions?
    Floor material. The floor is simultaneously the projection screen, the media controller, and the actual floor a person would stand on. Since we’re doing a scale model, we’re using our hands as our feet. Plexi looks great, but we’re finding it to require a good deal of pressure to give an ‘on’. Should we be considering softer materials?
Tags: , ,

Media Controller: Beat Feet

November 5th, 2009  |  Published in Physical Computing

Eric Mika, Arturo Vidich, and I finalized our mid-term media controller project. We made shoes that can produce music, or in this case, a combination of sounds written by the wearer’s dance steps.

Eric’s blog does a notably excellent and very thorough job documenting our progress:
Shoe Music

We ended up with a pair of shoes with four FSRs on the bottom of each. We mapped each FSR to a sound that would play when triggered, its volume dependent on the velocity with which it was hit.

The hat gives the user the ability to record, play back the recorded sound in a loop, and reset.

The interface was made initially to record which sensor was working, etc. It’s become another controller of sorts where the sensitivity threshold can be adjusted (e.g., how hard a sensor must be pressed in order to hear a sound) and where we can switch between all our fun libraries (twinkling, bubbles, piano, percussion, and noise samples).

A video demonstration:

The code is here: Beat Feet Code

Tags: , ,

Moving Lights

October 28th, 2009  |  Published in Introduction to Computational Media, Physical Computing

The larger idea for this project is to project this sketch of moving light patterns/force lines that shift in pattern depending on your movement.

Roughly:
MovingLights

On the Physical Computing side, Joshua Clayton and I discussed using FSR sensors on the floor to determine the locations of individuals.

For the sake of showing this optimally in class, we’ve chosen to make a scale model of the work, using models to trigger the sensors to interact with the sketch.

On the ICM side (subject, and guaranteed, to change):
I broke this down into testing the movement of the light using the position of the mouse as the input. Using the dist function, I have two thresholds to determine the light’s direction, one if the distance is greater than 40 pixels, and another where it is less than 20 to mimic moving forward and backwards. I don’t know if this finally is the best method as there’s some delay, and logically there are holes where the spotlight must stand still because it is between thresholds, but it should be fine since there is some room between the thresholds.

I’d like to increase this to several lights within the room, and to work on their movement when they intersect one another.

Another example (by Dan) where the light follows the mouse quite closely until the mouse reverses direction. Then, it runs away. I’m looking to inverse this. This uses mouse – pMouse to determine the direction.

Tags: , , ,

Subway ticket machine

October 21st, 2009  |  Published in Physical Computing

I observed individuals using the subway ticket machine at the Hoyt-Schemmerhorn station in Brooklyn.

For several individuals, figuring out which kind of subway ticket they required, and how to obtain it, seemed confusing.  One person, flustered by how long the transaction was taking, allowed the next person in line to go ahead, and then tried again once there was no one behind them.

The issue for these people seemed to be lack of understanding of the choices offered.  What is a Regualar versus Unlimited card?  Also, it takes time to consider purchasing the most efficient card for your needs.  That time is difficult to take in a queue setting.

The size and placement of the onscreen choices seem somewhat arbitrary.  Why is Pay $8 Get 4 Rides so much larger than Metrocard and SingleRide when an individual begins the transaction?  The landscape placement of choices means the 1 Day Fun Pass is directly above the 30 day.  There’s some hunt and search, and actually reading involved.

Tags:

Stupid Pet Trick: Chime Light

October 7th, 2009  |  Published in Physical Computing

This is a take on the analog output lab with the analog input provided by the vibrations of the chime.  A Piezo sensor (the gold disc shown below) converts the vibrations of the chime, or simply beating on the wooden base, into current.

IMG_4630

The electricity produced is low in amperage, but has the possibility to spike in voltage.  To protect my Arduino from frying, I used a 5v Zener diode to allow only up to 5v of current into the microcontroller.  My input from the chime was between 40-255, so I used a Map function in the Arduino program to see 40 as a 0 in order to limit flickering when off.

The setup, including output to LEDs (the one on the right for off, the left for off):

Setup

I put the entire project into a lace box to highlight the lights.  I’d like to expand this project using different tones for different lights.

The entire setup:

Chime sensor

The box:

Box

The code:

int potPin = 0; // Analog input pin that the potentiometer is attached to

int potValue = 0; // value read from the pot

int led = 9; // PWM pin that the LED is on. n.b. PWM 0 is on digital pin 9

int led2 = 10; //pwm pin for LED off

void setup() {

// initialize serial communications at 9600 bps:

Serial.begin(9600);

// declare the led pin as an output:

pinMode(led, OUTPUT);

pinMode(led2, OUTPUT);

}

void loop() {

potValue = analogRead(potPin); // read the pot value

potValue = constrain(potValue, 40, 255);

potValue = map(potValue, 40, 255, 0, 255);

analogWrite(led, potValue); // PWM the LED with the pot value

analogWrite(led2, 255-potValue); //PWM the LED with pot value when off

Serial.println(potValue); // print the pot value back to the debugger pane

delay(10); // wait 10 milliseconds before the next loop

}

Light example

The finished product wasn’t exactly what I was looking for….I’d like to see the fading in and out intensify. As the light on the right comes on at a brightness dependent on the strength of the chime’s vibration, it’s on is less striking than the constant ‘Off’ light on the left (it acts as the inverse depending on the input).

Box and chime

int potPin = 0;    // Analog input pin that the potentiometer is attached to
int potValue = 0;   // value read from the pot
int led = 9;    // PWM pin that the LED is on.  n.b. PWM 0 is on digital pin 9
int led2 = 10; //pwm pin for LED off
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
// declare the led pin as an output:
pinMode(led, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
potValue = analogRead(potPin); // read the pot value
potValue = constrain(potValue, 40, 255);
potValue = map(potValue, 40, 255, 0, 255);
analogWrite(led, potValue);  // PWM the LED with the pot value
analogWrite(led2, 255-potValue); //PWM the LED with pot value when off
Serial.println(potValue);      // print the pot value back to the debugger pane
delay(10);                     // wait 10 milliseconds before the next loop
}

Tags: , , ,

Reading: The Bandwidth of Consciousness

September 30th, 2009  |  Published in Physical Computing

In Chapter 6 of Norretranders’ The User Illusion, he illustrates the limitations and filtration present in human consciousness.  In order to reach consciousness, millions of bits of information are discarded in order to make sense of and note bits that do permeate through.  This awareness is fluid – another configuration of under forty (really, closer to 16) bits can be the everchanging object of your consciousness.  To note that moment, or object, is to recognize its temporality, and that it has passed.  Intelligence, then, stems from utilizing this consciousness in an adaptive, macro-view manner: “to see which macrostates best combine all the microstates.”

Language is a format to express what we’re conscious of; however, we cannot account for much of what our senses actually take in.  Can language as a system be an adequate container for description?  Here, Norretranders goes into lying. As a semantic paradox, lies can exist precisely because of the relative few bits present in our consciousness.  Unconsciously, the lie is impossible – though I don’t quite see this argument quite clearly – because the body will not allow itself (?) Or, perhaps it’s because language (which is the foundation of the possibility of the lie – its formal negation in a linguistic system) is limited to only conscious description.

Tags:

Fantasy Device: Thy Will Be Done

September 30th, 2009  |  Published in Physical Computing

I scrapped my fantasy device from last week after seeing class presentations. I’m pretty sure the ‘Basics Needs’ wristwatch I’d devised to order food, find bathrooms, and partners is an iPhone app.  I’ve had a flu bug/cold thing since the weekend, so I’ve been dreaming of a Runny Nose Annihilator, but I think it might already exist.

This is the Twibdee, for TWBD (Thy Will Be Done).  Based on your voice instruction, it can pull together a reality based on your will.  Palm sized, in a durable hemp wrapper with a microphone on one end (mis-labeled ’speaker’ in the illustration), it can also be used as a hand warmer in colder weather.

With one squeeze, you can verify if your request is in sync with your gut by checking the Intuition Sensor (Yellow for In Sync, and Red for Out of Sync).

Two squeezes activates the Moral Hazard/ Universal Equilibrium check.  This actually is automatically activated with the initial command.  The Twibdee will abort any request that constitutes a unalterable rift in the space-time continuum, or is morally repugnant.  You might want to check! (2 blinks of the yellow = Proceed; 2 blinks Red = Abort).

Finally, squeeze three times for thy will to be done (depending on the result of the MH/UE check).

I’m going to take another image of the illustration later, but for now:

Thy Will Be Done

Tags: , , ,

Analog In with Arduino

September 21st, 2009  |  Published in Physical Computing

In this lab, we used analog input to dim and brighten the LED.  Read this picture like this: black to ground, red to 5v, and blue for input/output.

To begin, I connected power and ground, and ran power to both sides of the breadboard. I set a digital output at pin 9 to tell the LED to respond to the analog input, and tempered the voltage (or is it amperes?) with a 220-ohm resistor. I connected the potentiometer to analog at pin 0 (blue wire to same row to feed input, and red to power, black to ground).  The potentiometer acts a resistor, altering the resistance from less to greater via turning the knob.

I ran the Arduino program using the code provided; essentially, it sets the LED to turn on and off very quickly, and decrease and increase the power sent to the LED by the varying resistance controlled by the potentiometer knob.

It worked!  Here ’tis:

turn up turn down

Tags:

First Arduino Program

September 16th, 2009  |  Published in Physical Computing

I set up the Arduino and breadboard, connecting power to ground:Setting up the breadboard

Red wires go to 5v.  Blue wire is my black, and goes to ground.  Once the Arduino is plugged into a source, 5 volts of power will travel through the red wire to the breadboard to the row where that wire ends, and down the positive bus rows on either side.   

The switch setup:

Switch setup

Downloaded the Arduino software, and cut and pasted the Button code.  The setup should work…however, I lost the wire connecting the switch in transit from my locker.  Pics of the blinking light will be posted after class.

Tags: