# ITP: Corrie Van Sice

## BLOG MOVED

This blog has been moved to my ITP site!

Written by cvansice

November 14, 2009 at 9:52 pm

Posted in Uncategorized

## Tests for group movements: Fish

Having some texture mapping issues I don’t quite understand yet, but the motion is ok:

Here’s the Processing code:

import processing.opengl.*;

// Sine Wave

//wave object
Wave[] wave = new Wave[50];
PVector orig;

void setup() {
size(screen.width, screen.height, OPENGL);
smooth();
// Initialize a wave with starting point, width

for (int i=0; i<wave.length; i++){

orig = new PVector (0, random(100, height-100));
wave[i] = new Wave(orig,100);
}
}

void draw() {
fill(255);
rect(0,0,width, height);

// Update and display waves
for (int i=0; i<wave.length; i++){
wave[i].calculate();
wave[i].display();
wave[i].update();
}
}

class Wave {

int xspacing = 8; // How far apart should each horizontal location be spaced
int w; // Width of entire wave
int maxwaves = 4;

int r = 20; //half the width of the rectangle
PImage fish;
float vel;

PVector origin; // Where does the wave's first point start
float theta = 0.0; // Start angle at 0
float[] amplitude = {25, 10, 12, 29}; // Height of wave
float[] period = {129, 74.5, 117.5, 101};
float[] dx = new float[maxwaves]; // Value for incrementing X, to be calculated as a function of period and xspacing
float[] yvalues; // Using an array to store height values for the wave (not entirely necessary)

Wave(PVector o, int w_){
origin = o.get();
w = w_;

for (int i = 0; i < maxwaves; i++) {
dx[i] = (TWO_PI / period[i]) * xspacing;
}

//vel = new PVector(random(1, 4),random(1, 4));
vel = random(0.5, 2);
yvalues = new float[w/xspacing];

}

void calculate() {
// Increment theta (try different values for 'angular velocity' here
theta += vel/10;

// Set all height values to zero
for (int i = 0; i < yvalues.length; i++) {
yvalues[i] = 0.0f;
}

// Accumulate wave height values
for (int j = 0; j < maxwaves; j++) {
float x = theta;
for (int i = 0; i < yvalues.length; i++) {
// Every other wave is cosine instead of sine
if (j % 2 == 0) yvalues[i] += sin(x)*amplitude[j];
else yvalues[i] += cos(x)*amplitude[j];
x+=dx[j];
}
}
}

void display() {
//pushMatrix();
//translate(mouseX,mouseY);
//rotate(frameCount / 50.0);

noStroke();
noFill();
//fill(255, 0, 0);
textureMode(NORMALIZED);
beginShape();
texture(fish);

// BOTTOM
for (int x = 0; x = 0; x–) {
vertex(origin.x+x*xspacing, origin.y+yvalues[x] -r, float(x)/yvalues.length, 0);
}

endShape();

/*for (int x = 0; x width){
origin.x = -100;
}
}
}

Written by cvansice

October 28, 2009 at 8:31 pm

## Tech Observation: Whole Foods Lines

Description:

Customers are instructed by small framed paper signs to choose a place at the end of the shortest line. Lines are deliniated by a color coding system: white, red, blue, green, gold. Color coded signs hang high from the ceiling and feature downward pointing arrows to indicate which line is associated with which color. A large screen dictates which line is active and which register is available (by number). Graphically the screen consists of 4-5 vertical colored rectangles which follow the coding system. As registers become available, the info screen cycles through the lines. For example, lines ordered white, red, blue, green, gold are cycled through in order, so the first available register goes to the customer at the beginning of the white line, then the next register available goes to the customer at the beginning of the red line, then the blue line, then the green, then the gold. Register numbers fall into the colored columns and are also verbally announced by a computer.

There are several isles of numbered registers, so registers 31-24 are on the left, 14-23 in the middle, 1-13 on the right. Also, there is a large section of lines and registers dedicated to express service (15 items or less) and a smaller section dedicated to regular service. There are five colored lines for each section with separate screens and even separate announcement voices. Express line instruction is delivered by a female voice, and regular line instruction is delivered by a male voice.

Observations:

Despite the relatively complicated description, the system is (for the most part) very efficient. People naturally desire to go to the shortest line. The color matching between lines and screens seems well understood, but visibility is an issue. Customers are constantly looking way up and often up and backwards to see the colored signs hanging from above. Also, when they are in line it is difficult for customers to recognize that they are say, the fourth line from the left, which maps to green. Still, by the time that the available register is announced, customers have usually figured it out.

Customers spend the most time trying to figure out where their assigned register is located. Is it on the left aisle? In the middle? on the left or right side of the aisle? Registers feature a nice visible numbered cubic sign which blinks when available, yet there are many registers. Poster-board style signs in front of the register aisles point to where 24-31 are located and where 14-23 are located, yet there seems to be either a difficulty in switching from color code organization to numbered organization or simply a general lower aptitude/efficiency with numbered organization.

If the lines are very busy, a couple of problems arise, most notably, the sense of being trapped. If you are in the middle of a line, and perhaps you’ve forgotten something, getting out of the line is VERY difficult. Black ribbons separate lines, which seem pretty permeable, but people are tightly packed together and they often have a grocery cart, basket, bag or food container which may or may not be sealed. Similarly, if two people are shopping together and one needs to get to the other who is either farther ahead in line or already at the register, getting through the organized crowd of people is a challenge. It seems like the latter scenario could be avoided if there were some kind of “breezeway” space.

If there are very few people checking out, a different problem arises. The system cycles through each color-coded line regardless of whether or not someone is waiting in that line. Perhaps there are only people in the red and green lines, yet no one in blue, white, or gold. The next available register is which person goes to the next available register if the register number is listed in the blue line? Usually people work this out based on our cultural standards for fairness, whoever got there first goes to the available register. Often though, people are not paying attention. One person is on their cell phone or listening to headphones or maybe just zoning out. If there is someone else waiting, they might waive to get the other’s attention or sort of stare indecisively and gesture timidly (which obviously doesn’t get the other’s attention). If there is only one absent minded person in line, the person working the register cannot get his/her attention to waive him over. The attendant has to continue sending a signal that the register is available until the graphics on screen show the register number in the appropriate colored column for the line that the person happens to be standing in.

Written by cvansice

October 20, 2009 at 4:42 pm

Posted in Physical Computing

## Stupid Pet Trick: Weather Control

This trick is an example of serial communication. Data is sent from a control wheel to an Ardiuno, and then finally to a Processing sketch on my computer.

View video of the silly trick in action:

and here’s a screen capture for more detail:

A 3-axis accelerometer and a photo-sensor are attached to the back of the control wheel. The photo-sensor is embedded into the piece of foamcore so that only a thin piece of paper diffuses light getting to the sensor. This way the sensor is hidden, yet it is still sending a good range of values to the Arduino.

Here you can see the circuit sending analog values into the Arduino controller. The photo-sensor only uses two leads for power and ground, and a 10K pull down resistor. It is connected to analog-in pin 0. The accelerometer uses 6 pins:
1) X-axis goes to analog-in pin 3
2) Y-axis goes to analog-in pin 2
3) Z-axis goes to analog-in pin 1
4) 5V
5) Ground
6) ST (i don’t use this one)

As I mentioned before, I am using both Arduino and Processing, so I have two sketches. Here is the Arduino program which I uploaded to the board. It is collecting 4 pieces of information: the x-axis tilt, the y-axis tilt, the z-axis tilt, and the value from the photo-sensor:

int xpin = 3; // x-axis of the accelerometer
int ypin = 2; // y-axis
int zpin = 1; // z-axis (only on 3-axis models)
int psensPin = 0; //photo-resistor

int x = 0;
int y = 0;
int z = 0;
int light = 0;

void setup()
{
// initialize the serial communications:
Serial.begin(9600);
}

void loop()
{

// print the sensor values:
Serial.print(x);
// print a tab between values:
Serial.print(“,”);
Serial.print(y);
// print a tab between values:
Serial.print(“,”);
Serial.print(z);
Serial.print(“,”);
Serial.print(light);
Serial.println();
}

This next sketch is the Processing program. Notice that it only uses the y-axis value and the photo-sensor value as variables in the sketch. The photo-sensor value controls both the darkness of the sky (via a variable for the blue in the background) and the quantity of rain drops on screen. The y-axis value controls wind direction and wind intensity. The values to be mapped from the photo-sensor must be adjusted according to light conditions in the environment. Also, the multiplier controlling the quantity of rain drops. In the relatively dark PhysComp workshop, I used a multiplier of 2.8, but in a brighter area I only needed to use a multiplier of 2:

Drop[] drops = new Drop[500];

import processing.serial.*; // import the Processing serial library
Serial myPort; // The serial port

float Bval;
float xspeed;
int amt;

void setup() {
println(Serial.list());
myPort = new Serial(this, Serial.list()[0], 9600);
// read bytes into a buffer until you get a linefeed (ASCII 10):
myPort.bufferUntil(‘\n’);

size(1024,768);
smooth();
noStroke();

for (int i = 0; i < drops.length; i++) {
drops[i] = new Drop(random(5),random(width),0,random(5, 10));
}
}

void draw() {
fill(164, 191, Bval, 60);
rect(0, 0, width, height);

for (int i = 0; i < 500-amt*2.8; i++) {
drops[i].move(xspeed);
drops[i].boundaryCheck();
drops[i].display();
}
}

void serialEvent(Serial myPort) {
// if you got any bytes other than the linefeed:
if (myString != null) {

myString = trim(myString);

// split the string at the commas
// and convert the sections into integers:
int sensors[] = int(split(myString, ','));

// print out the values you got:
for (int sensorNum = 0; sensorNum 1) {
Bval = map(sensors[3], 20,200,180,255);
xspeed = map(sensors[1], 420, 600, -3, 3);
amt = sensors[3];
}
}
}

class Drop {
float x;
float y;
float yspeed;
float d;

Drop(float tempD, float tempX, float tempY, float tempySpeed) {
d = tempD;
x = tempX;
y = tempY;
yspeed = tempySpeed;
}

void move(float xspeed) {
y = y + yspeed;
x = x + xspeed;

}

void display() {
fill(255);
ellipse(x,y,d,d);
}

void boundaryCheck() {
if (y > height+20) {
y = -20;
}
if (x > width+20) {
x = -20;
}
if (x < -20) {
x = width + 20;
}

}
}

Written by cvansice

October 20, 2009 at 2:31 am

## ITP PComp: Lab 6, Tones

This is a close up of the Arduino and breadboard set-up. The 8ohm speaker is cropped out, but the two wires leading upwards out of the image are connected to the speaker. I have replaced the three pressure sensors used in the lab with three photo-resistors, so I needed to tweak the sensitivity of the sensors to trigger notes. Also, my speaker was very quiet, so instead of using a 1K ohm resistor as the lab does, I used a 220 ohm resistor. The light sensors use 10K ohm pull-down resistors.

The tones don’t sound very stable, so I think I will play with this some more.

Here is a video, for the full effect:

Written by cvansice

October 10, 2009 at 10:22 pm

## ITP PComp: Lab 4 – Electronics

Voltage supplied to circuit: 5V
V across LED: 2V
3 LEDs in series: 3.3 mA

Setup:
6V supplied to breadboard via DC power.
Voltage regulator allows 5V into circuit.
5V is varied with a potentiometer and sent to 3 parallel LEDs.
One 220 ohm resistor is added between the LEDs and ground.

Written by cvansice

September 25, 2009 at 2:17 am

## PComp: Lab 3, Analog input

with one comment

I was hoping to do more experimentation with wacky forms of analog input, but the lab will have to suffice this week.

Written by cvansice

September 22, 2009 at 3:39 pm