physical computing blog
Old code

Very simple test code that I wrote when I was using a DC motor:


int currentpos = 255;
int outputValue = 0;

int sensorPin = 0; //analog pin 0

int motorpin1 = 3; 
int motorpin2 = 4;


void setup(){
Serial.begin(9600);
pinMode(motorpin1,OUTPUT); 
pinMode(motorpin2,OUTPUT); 
}

void loop(){
int val = analogRead(sensorPin);
Serial.println(outputValue);


//Serial.println(currentpos - val);

outputValue = map(val, 11, 255, 1, 18);

//Serial.println(outputValue);


if (outputValue <= 3) {
digitalWrite(motorpin1, HIGH);
delay(80);
digitalWrite(motorpin1, LOW);
delay(60);
digitalWrite(motorpin2, HIGH);
delay(80);
digitalWrite(motorpin2, LOW);
delay(80);
}
else if (outputValue <= 9) {
digitalWrite(motorpin1, HIGH);
delay(120);
digitalWrite(motorpin1, LOW);
delay(60);
digitalWrite(motorpin2, HIGH);
delay(60);
digitalWrite(motorpin2, LOW);
delay(60);
}
else if (outputValue <= 16) {
digitalWrite(motorpin1, HIGH);
delay(200);
digitalWrite(motorpin1, LOW);
delay(100);
digitalWrite(motorpin2, HIGH);
delay(150);
digitalWrite(motorpin2, LOW);
delay(100);
}
else {
digitalWrite(motorpin1, HIGH);
delay(300);
digitalWrite(motorpin1, LOW);
delay(200);
digitalWrite(motorpin2, HIGH);
delay(300);
digitalWrite(motorpin2, LOW);
delay(200);
}


delay(400);

}

Final painting

Final painting

The final iteration, going down.

The problem with the servo motor is that you need to literally hold wires together in order to change direction. I wasn&#8217;t able to figure out a code way of doing so. This is resoldered wire

The problem with the servo motor is that you need to literally hold wires together in order to change direction. I wasn’t able to figure out a code way of doing so. This is resoldered wire

close up

close up

first iteration with lace and mason&#8217;s like. The latter was too thick.

first iteration with lace and mason’s like. The latter was too thick.

DC motor iteration&#8230; not so effective.

DC motor iteration… not so effective.

Final Proj documentation 1

This post has no photos because I only have access to an iPad right now. i’ll add photos and video tomorrow as well as more info on what I learned.

I set out to create an art project that looked at transgression by inviting people to interact with a painting— covered in wax and ribbon— that featured a friend’s face during orgasm. Basically, I was curious about what things are revered in our society and what things are cheapened: both art and sex are good examples of how the two often conflate. I also wanted a sense of slowness that is inherent in both but downplayed in favor of instant gratification. The idea was people would come near, be drawn in, and start touching and taking apart the painting. Over time, the original would appear.

I wanted to combine the idea with a physical computing component that was proximity based and therefore lured people in by virtue of its movement. Originally, I thought of swaying, dancing motions, then moved onto the process of undressing. The “curtain” would lift up, like a dress, as the person approached, but it would be gradual. Unfortunately, not everything went as planned; after many attempts to use a 360 servo, I ultimately could not figure out how to wire the servo’s original switches in order to produce back and forwards motions, and thus could not put it together with my ultrasonic sensor.

Physical computing is a field where I have had no prior experience. I’m only a beginner with code as well. So it may well be that I couldn’t figure out a simple solution. However, one solution I am proud of is my design for the enclosure. I wanted a certain type of draping, so I went with securing the fabric in place and weaving two moving strings that were secured at the end and would be pulled up. I inserted a dowel within a cardboard tube and attached the string to the dowels, then secured the other end to a servo. This servo rotated the dowel, as if on a spit, and the tube kept everything in place while providing structure. The enclosure took a lot of trial and error with several different types of configurations attempted and a lot of painful hacking away at strong cardboard.

I spent a lot of time trying to make the servo function the way I wanted it to, even switching at one point to a DC motor. However, the motor was way too weak and unstable. Then it broke irreparably. (Things breaking seemed to be a recurring theme.) I switched back to the stronger servo, but the switch, we found, could not be controlled by programming the Arduino the way I thought it would.

In order to map the servo’s rotation to the distance from the painting, we found an equation. The ultrasonic sensor I used from Maxbotix has a range of 11 to 255 inches. Thus we could assume it was the range of a person would be (256-12). The fabric panel was 9 feet long or 108 inches so I divided the fabric panel by the distance to the setup. Then this was all multiplied by .98; I experimentally measured the process took around 1:50, so 108/110. Positive values go forward, negative backwarda. Or so it should work, theoretically.

Here is the code:

#include

Servo myservo; // create servo object to control a servo

int potpin = 0; // analog pin used to connect the potentiometer
int green = 3;
int red = 5;


double c=255;


double newc;
double f=0;
boolean forwards=true;


void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
pinMode(green, OUTPUT);
pinMode(red, OUTPUT);

}

void loop()
{
newc= analogRead(potpin);
if(newc255){
newc=255;
}
double diff=c-newc; //farthest dist minus current location
int time;

//.98 inches per second
//inches of walking div inches per walking

if(diff>((256-12)/108)*.98){
diff=((256-12)/108)*.98;
time=1000;
}
else if(diff0){
forwards=true;
}
else{
forwards=false;
}

c=c-diff;
if(forwards=true){
digitalWrite(green, HIGH);
delay(time);
digitalWrite(green, LOW);
delay(1000-time);
}
else{
digitalWrite(red, HIGH);
delay(time);
digitalWrite(red, LOW);
delay(1000-time);
}
}

slowly hacking away at the final enclosure. feel like a lumberjack.

slowly hacking away at the final enclosure. feel like a lumberjack.

prototype draping