As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Wednesday, December 11, 2019

Z Bench


DESIGN 325 Physical Computing- Z bench Arduino Project
By Chris Hong and Julia Chao


-What is the situation you are detecting? Why?
Nobody likes getting wet, and it is unusual to sit on a chair that is wet and damp. Public benches and seats that do not dry fast are creating inconvenience for people. What if there is a bench that is available for use right after the rain stops? 


-What does your device do?
Z bench has a water sensor, ultrasonic sensor, a motor and a rotating belt embedded inside the chair. When it is raining the water sensor detects the water and it tells the motor to rotate backward. After it stops raining and the water sensor cannot detect any more water, the code tells the motor to rotate forward. Also, the bench is not supposed to rotate when a person is sitting on it, so we the help of an ultrasonic sensor we are able to detect that a person is close to the body of the bench and stops all motions.


-What features allow this sensing/actuation? (how is it doing it? but not overly technical)


By using the ultrasonic sensor, it can detect the object that is present in front of the bench. In this situation with the placement of the sensor, it will sense people’s legs when they sit down. The water sensor can sense if there is water present on the sensor. We placed it on a slope, so the water won’t accumulate on the sensor.
We use a slow spinning motor with high torque to rotate the bench. The motor connects to the bench through a pulley and a belt connects to the wooden rod that brings the seating to rotate.



Code 


/*bench state is to determine the position of the bench. When bench is in a different position, the process will be different.
*/
int benchState = 1;             //benchstate 1 means the bench is in sitting position
        //benchstate  0 means the bench is in rain avoiding position
int waterSensor = 0; 
int distance;
long duration;
const int trigPin = 9;
const int echoPin = 10;


const int enA = 11;
const int in1 = 6;
const int in2 = 7;
const int respin = A5; 


void setup() {
pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication


pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
}


// when bench is in sitting position, it should detect if there is anything sitting on the bench, after it knows the bench is empty, then it will sense if it is raining. On the other hand, when the bench is in rain-avoiding position, it will sense if the rain stop, and rotate back to sitting position.


void loop(){
  if (benchState == 1){
    if(people() == 0){
      if(water() == 1){
        rotateBack();
        benchState = 0;  //after it rotates, the bench record it’s position
      }
    }
  }else{
    if(water() == 0){   //when the water sensor sense no water
      rotateForward();  //bench rotate back to sitting position 
      benchState = 1;   //record the bench position 
    }
  }
  
}


// the method water tells if there is water present on the sensor. 
int water() {
  waterSensor = analogRead(respin);
   if(waterSensor < 10){
    return 0;
  }else{
    return 1;
  }
}


// the method people sense if there is people present near the bench. By using the ultrasonic sensor, it can detect the object that is present in front of the bench. In this situation with the placement of the sensor, it will sense people’s leg when they sit down.
// method returns an integer, 1 means people present, 0 means no people around.


int people(){  
 digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
  if(distance > 50){           // 50cm is the distance that we determine if there is an object present
    return 0;
  }else{
    return 1;
  } 
}


//by changing the voltage of the output, we can achieve rotating the bench both forward and backward.
void rotateBack(){
  Serial.println("rotF"); 
  digitalWrite(in1, LOW);
  digitalWrite(in2,HIGH);
  delay (10000);
  digitalWrite(in2,LOW);
  Serial.println("done"); 
}


void rotateForward(){
  Serial.println("rotB"); 
  digitalWrite(in2, LOW);
  digitalWrite(in1,HIGH);
  delay (10000);
  digitalWrite(in1,LOW);
  Serial.println("done"); 
}

Photos:







No comments:

Post a Comment