Recitation 3: Sensors

Answers to the Questions

Question 1: What did you intend to assemble in the recitation exercise? If your sensor/actuator combination were to be used for pragmatic purposes, who would use it, why would they use it, and how could it be used?

Joystick Module:

 

I intended to assemble an interactive device, including the Joystick Module, that can reflect data of x-axis and y-axis to locate the stick as I move it. With a pragmatic purpose, if the Joystick module is connected to an electric wheelchair, it can be used to control the wheelchair. The data of the stick’s movement will be transferred to the center and then will be used to turn the wheels. Disabled people or elders can easily use the stick to adjust the wheel to move without rolling the wheels with a lot of strength. 

 
void setup()
{
    Serial.begin(9600);
}
 
void loop()
{
    int sensorValue1 = analogRead(A0);
    int sensorValue2 = analogRead(A1);
 
    Serial.print("The X and Y coordinate is:");
    Serial.print(sensorValue1, DEC);
    Serial.print(",");
    Serial.println(sensorValue2, DEC);
    Serial.println(" ");
    delay(200);
}

 
 
 Ultrasonic Ranger

I hoped I could build a circuit that can show the distance between an object and this sensor. In real life, I think it can be set on the street and then be used to measure the speed of a vehicle to secure traffic safety. Since the ultrasonic range can show the distance so it’s easy to get the velocity if we know the time.

// this constant won't change. It's the pin number of the sensor's output:
const int pingPin = 7;

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

void loop() {
  // establish variables for duration of the ping, and the distance result
  // in inches and centimeters:
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH pulse
  // whose duration is the time (in microseconds) from the sending of the ping
  // to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();

  delay(100);
}

long microsecondsToInches(long microseconds) {
  // According to Parallax's datasheet for the PING))), there are 73.746
  // microseconds per inch (i.e. sound travels at 1130 feet per second).
  // This gives the distance travelled by the ping, outbound and return,
  // so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the object we
  // take half of the distance travelled.
  return microseconds / 29 / 2;
}

 

Question 2: Code is often compared to following a recipe or tutorial.  Why do you think that is?

On a personal level, I think for a computer, code is like a tutorial that instructs it to reach a task step by step, a way of us telling it what to do. For example, we let the LED “blink” or I may say to turn it on for a second and then turn it off for one second, repeatedly, in our previous seminar class. The code makes the computer first set a digital pin as an output,  puts a high voltage on the LED, then rests, puts a low voltage, rests again. The computer does what the “blink” code says and makes spark repeatedly.

Question 3: In Language of New Media, Manovich describes the influence of computers on new media. In what ways do you believe the computer influences our human behaviors?

Computers mainly play the role as “helpers”. So firstly, it let us go out less, since we can get things done remotely by computers, especially when we have the Internet, which is really convenient. Secondly, with keyboard, we type rather than hand-writing. Thirdly, it brought out many other things like the Internet and AI, so that they boost economic growth, military development, etc. Those are the three ways that I think of now, there are certainly a lot more influences.

Leave a Reply

Your email address will not be published. Required fields are marked *