Recitation 3: Sensors

Recitation 3: Sensors

In today’s recitation, I learned how does a sensor work in Arduino. I chose an Infrared Distance Sensor which measures the distance with infrared as the input and a buzzer as the output.

When the distance between the object and the sensor is changing, the frequency of the buzzer changes accordingly as the video shows.

 

Video

Code

//connect gp2d120x to A1
#define pin A1
int buzzer=9;

void setup () {
        Serial.begin (9600);
        pinMode(pin, INPUT);
        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 (500);  //Delay 0.5s
        
        map(distance,0,1023,200,5000);

        tone(buzzer,distance,100);
        delay(100);
}

//return distance (cm)
double get_IR (uint16_t value) {
        if (value < 16)  value = 16;
        return 2076.0 / (value - 11.0);
}

/******** end code ********/

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?

I intended to assemble the Infrared Distance Sensor as the input and a buzzer as the output in today’s recitation exercise. Since my combination can reflect the distance between the object and the sensor, it can be used as a reminder in real life. For example, it can play a role in cars as a backup buzzer. When the car driver is backing a car, he can’t see the distance in the back clearly. So he can feel the distance by listening to the buzzer, which facilitates drivers’ convenient access to drive cars.

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

A recipe or tutorial teaches human beings how to work out something step by step. Similarly, the code teaches the computer how to work on a program. The computer doesn’t understand human languages so we need to write codes which computers understand.  Also, the code has to be well-organized and logical or the computer doesn’t know what to do. For example, we have to add a coma behind each sentence of code to tell computers that the sentence is completed and they can act the next line.

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?

Firstly, computers change our physical behaviors. We send emails instead of face-to-face communication. We type instead of hand-writing. We sit a lot in front of the computers for a long time. These all affect our daily lives.

Secondly, we tend to rely on computers. If we encounter a problem, we no longer search for it in books, it is for more convenient to search online and there will be huge amounts of information for us to choose from. Also, we use machines equipped with computers much more frequently. With the help of them, we can improve our working efficiency. Computers also give individuals access to work out a program by themselves like us using Arduino to realize our ideas.

Leave a Reply

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