Interaction Lab Recitation 03

Peter Wang

Marcela Godoy

INTM-SHU  101 002

20 February 2018

W3 Documentation for Lab 6

Part A

Partner: Yutong Zeng

Material Used:

  • Breadboard *1
  • Arduiono *1
  • Infrared distance sensor *1
  • Buzzer *1
  • Jumper wires
  • LED *2
  • 220 ohm resistor *2


Inspired by car parking alarm in the garage which produces large noise when the distance between the car and the sensor gets too close, we decided to use a buzzer, an infrared distance sensor, and two LEDs (one green and one red, to tell visually if the distance is too close or not).

When we first got the distance sensor, we did not know how to program it to make it work. Anyway, we decided to make the circuit first and then we could worry about coding and here is the schematic plot:

and this is the circuit we made:

One thing we encountered when connecting the circuit is that I did not know how to connect the infrared distance sensor and we sought help from the lab assistant Nick. We then knew that red wire being connected to the power source and black wire being connected to the ground is usually the case in connecting any device to the circuit, which is truly helpful (thank you, Nick!).

Then, we referred to the instruction page of W3 recitation and clicked on the wiki page of this specific sensor: there we found the code. After a slight change in the parameter, we copied and pasted the code, which was officially provided by the producer, into Arduino IDE, although I’m not sure if we have to cite the source… Anyway, after that, another problem arose: the code worked well by itself, but if we added the code we write to run the whole circuit, we could no longer get the sensor value. Again, we turned to the lab assistant. After going over our code, Luis told us that the problem is too complicated for us to understand but there was a simple solution to it. As a result, we added a new variable that gets value from the sensor value so that we can avoid directly using the sensor value, which will create the problem we met.

Everything should be find since then but soon we found that the buzzer in the Arduino kit didn’t work in the same way as those provided by the school. We consulted the lab assistant for the third time (this time Rudi) and figure out the correct coding for the buzzer.

Then, things worked pretty fine. We failed to record the final product but I can describe it. Basically, when something is too close to the sensor (closer than 10 cm in our case), then the red LED will lit up and the buzzer will make noise; otherwise, the green LED will lit up, indicating that everything is within safe distance. One interesting thing in this alarm is that when the buzzer starts working, the pitch of it will vary as the distance between the object and the sensor changes. This tiny trick was told by Rudi when he was teaching us how to program the buzzer.

If I were to continue experimenting, I believe I would start testing the practical use of this device. For example, I would like to collect data about what distance can be considered “unsafe” or “too close” when parking or what should the pitch and volume be so that driver in the car can hear the alarm when it is triggered.

My takeaways from this week recitation are;

  • how to connect a device you’ve never seen before to the circuit on first sight (but always refer to the instruction if possible)
  • how to use infrared distance sensors and buzzers
  • be creative and have fun with coding!!!


Part B

Q1: How is writing code similar to making dumplings?

Ummmm…. I don’t find writing code similar to making dumplings. Running code is. When the code is being run, one can compare the process of it with a team making dumpling. There is CPU, or the chef, making all the decisions; there is memory, or plates, where one can store/place value/ingredients…

Q2: As Manovich describes in the Language of New Media, the influence of computers on new media is clear. In what ways do you believe the computer influences our human behaviors?

I believe the most substantial influence computer brought is on how we human process information. Although I forgot where I saw it, there was a study on how modern people process information given to them differently from people in the past. The study showed that people nowadays are less efficient in memorizing concrete knowledge but they can usually remember methods through which or places where they can find the exact same pieces of information. In this way, modern humans are equipped with brain that can deal with vast amount of information. Also, creativity is more and more important as computer can do the repetitive job for us.

//connect gp2d120x to A1
#define pin A1
const int safe = 8;
const int unsafe = 9;
void setup () {
Serial.begin (9600);
pinMode(pin, INPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
void loop () {
uint16_t value = analogRead (pin);
double distance = get_IR (value); //Convert the analog voltage to the distance
Serial.println (value);                 //Print the data to the arduino serial monitor
Serial.print (distance);
Serial.println (” cm”);
Serial.println ();
delay (40);
if(distance <= 10){
digitalWrite(safe, LOW);
digitalWrite(unsafe, HIGH);
tone(9, 1000*distance, 40);
digitalWrite(safe, HIGH);
digitalWrite(unsafe, LOW);
//return distance (cm)
double get_IR (uint16_t value) {
if (value < 16)  value = 16;
return 2076.0 / (value – 11.0);

One thought on “Interaction Lab Recitation 03

  1. the first question has to do with the fact that when you write code, you write instructions for the computer to execute a certain task following different steps. Same way if you make dumplings you need to follow certain steps, in a certain order. Make the dough, make the filling, put the filling on the dough, fold the dough, etc…

    your last answers reminded me this article:

Leave a Reply