Recitation 3. Sensors by Frances (Fan Yuan)

Instructor: Marcela

Circuit:

Components:

Arduino Uno, USB A to B cable, breadboard, LED, 220-ohm resistor, jumper cables

Infrared Distance Sensor: The sensor detects the straight-line distance by sending infrared light and it gives analog output.

Process:

First, we built the circuit below and ran it with the sample code to test the sensor’s output range. We moved the sensor back and forth from an object and looked at the serial monitor. We found out that when we moved the sensor further away the number gets smaller and the range is around 2 to 500.

Then, we decided to make a circuit with an LED, that when we get close to the sensor at a certain distance, the light will turn on. To adjust the value to LED’s range, we first add the map function to change the range to 0 to 255. Then, we add an if condition to set the light on when the value is bigger than a certain number. After we tested it, we found out that it reacted to moving really slow and it won’t turn off when we moved away. So, with the help from fellows, we made a few changes to the code. We add an else condition to give it instructions to turn off, change to delay time and adjust the determining value to 220, which performed well in our test.

After we complete that circuit, we made more changes. We replaced digitalWrite with analogWrite. In this way, the LED can change its brightness according to the distance the sensor detected.

References:

https://www.dfrobot.com/wiki/index.php/SHARP_GP2Y0A41SK0F_IR_ranger_sensor_(4-30cm)_SKU:SEN0143

 

Question 1:

We intended to assemble a circuit that could give signals, like turning on LED or making sounds, when an object moves close to the sensor. As for pragmatic purpose, it could be used at convenience stores as a part of automatic doors. When someone walks closer to the door, the sensor will sense him/her, and then the speaker plays melody and door opens.

Question 2:

People follow recipe or tutorial step by step and will know what to do. Code is similar, but only teaches computer instead of human. Computer follows the instructions written in the code line by line. It runs from the first line till the last, and will only move on to the next line when the previous one is finished or when it is given orders.

Question 3:

Computer influences our human behaviors in many ways. It changes the way we communicate and connects the world together. We have access to much more information, and it affects how we think and thus affects our behaviors. Moreover, it does a lot of computation work for us and frees us from repetitive tasks.

Leave a Reply