During the third recitation, we were asked to pick a sensor, build a circuit that integrates this sensor with our Arduino and use the input from the sensor to drive an output.
Infrared Distance Sensor:
For the first circuit we choose the infrared distance sensor
Materials:
From Arduino Kit:
1 * Arduino Uno
1 * USB A to B cable
1 * LED
1 * 10k ohm resistors
1 * breadboard
A few wires
From cart:
1 * Infrared Distance Sensor
Diagram of the circuit
The circuit itself is not complicated, therefore, when we were building the circuit, we built the complete circuit without encountering with any problem. Yet, when we initiated the program in Arduino, two problems took place.
The first one was that we didn’t know what this distance measured by the sensor was. Therefore, we asked Professor Parren for help. Then we understood that this distance was between the object above the sensor and the sensor. Another thing we didn’t understand was that a number always pumped out. I didn’t remember that exact number, but I did remember that this number was about 416 cm, which was impossible distance to reach. Professor Parren explained that this resulted from the limited range of distance that the sensor could measure. So whenever that distance was out of this range , this number would automatically show up.
The second problem was that when the distance between the sensor and our hand changed, the lightness of the LED didn’t change accordingly, but could only be turned on and off.
After Professor Parren examining it, he pointed out that the first mistake was that we connected the LED to pin 13, which is not a PMW pin. So the LED could either be high or low. We wrote “digitalWrite” instead of “analogWrite”. “digitalWrite” could only switch on or off the LED.
After solving the problems mentioned above, the circuit and the code was right. And we got the result that the LED could change its brightness accordingly with the distance.
Question 1
My partner and I intended to build a circuit in which that the LED could change its brightness accordingly with the change of the distance between the sensor and the object above it. If it is for practical purpose, I suppose it could be used as indicator in your car that shows the distance between an object and your car. When your car and the object approaches to each other, the brightness would light up, alarming you that the distance was too close.
Question 2
Following a recipe and a tutorial requires a person to follow the steps exactly as he was told. Code is something similar to a recipe and a tutorial in essence because it also requires the computer to process the exact steps shown in the code.
Question 3
As computers are pervading worldwide, they have become an essential part in human’s life. From my perspective, computers has greatly changed the way that humans interact with each other, the way to solve problems worldwide and changed the interactions between many things in the world, connected and associated digitally with each other.