Arduino Questions and Answers – IR Sensor

This set of Arduino Multiple Choice Questions & Answers (MCQs) focuses on “IR Sensor”.

1. What is the use of the IR Sensor?
a) Object Detection
b) Humidity Detection
c) Image Processing
d) GPS
View Answer

Answer: a
Explanation: The IR Sensor is used for calculating the distance between the sensor and the object. It is mostly used for calculating the acceleration, velocity and position of the sensor attached to the device. It basically has two terminals which emit an IR Signal and receive the emitted IR Signal. The time difference between these two gives us the required data for such calculations.

2. How many pins are present in the IR Sensor?
a) 1
b) 3
c) 2
d) 4
View Answer

Answer: b
Explanation: The pins that are present on the IR Sensor include, the Ground, the Vcc and the Signal pins. The role of the Ground and the Vcc is to power the sensor. The Vcc accepts a maximum voltage of approximately 5V. The signal pin is present to convey the data from the sensor to the microcontroller or the microprocessor.

3. What mode should we put the Arduino pin to, for object detection to work with the IR Sensor?
a) Analog
b) Digital
c) PCM
d) TDM
View Answer

Answer: b
Explanation: Having the input pin to digital on the Arduino, will give us a HIGH signal from the sensor whenever an object is detected to be in range of the sensor thus fulfilling its need. So, for object detection we can attain the required data simply by a digital HIGH or LOW signal.
advertisement
advertisement

4. What will happen if we supply a voltage of 25V to the Vcc of the IR sensor?
a) Damage is caused
b) Sensor will work fine
c) Sensor will not respond for the time the voltage is applied
d) Sensor will function normally
View Answer

Answer: a
Explanation: The IR Sensors are mostly built to work on a voltage range of approximately 3.3V to 5V. Any voltage lower than that and the sensor will not be able to power on, but however any voltage significantly above that and the sensor may suffer permanent damage.

5. If 1 means an object is detected and 0 meaning no object is detected, then considering the sensor is stationary, what can be said about the movement of the object if the output by the sensor is 1010101?
a) Object is stationary
b) Object is oscillating side by side
c) Object is continuously moving away
d) Object is continuously moving closer
View Answer

Answer: b
Explanation: The only explanation for such output from the sensor would be if the object is moving in such a path, that makes it within the range of the sensor and vice versa after each specified amount of time and this continuously happens along a deterministic path so that we know that the only way this can happen is that if the object is oscillating between two given points.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. What will the output of the code be if the object is continuously moving away from the sensor?

int op = 7;
int isObstacle = HIGH;
void setup() {
    pinMode(op, INPUT);
    Serial.begin(9600);
} 
void loop() { 
    isObstacle = digitalRead(op);
    if (isObstacle == LOW) { 
        Serial.println("1+"); 
    } 
    else {
        Serial.print("clear+"); 
    } 
    delay(200);
}

a) clear+clear+1+1
b) 1+1+clear+clear
c) clear+clear+clear+clear
d) 1+1+clear+1
View Answer

Answer: b
Explanation: If the object is moving continuously away then within the four cycles of the given output, the first half of the set sees the object within range so printing a “1+”, while within the second half of the code, the object has already moved beyond the range of the sensor so it gives the “clear+” signal.
advertisement

7. What will the output of the code be if the object is continuously moving towards the sensor?

advertisement
int op = 6;
int isObstacle = HIGH;
void setup() {
    pinMode(op, INPUT);
    Serial.begin(9600);
} 
void loop() { 
    isObstacle = digitalRead(op);
    if (isObstacle == LOW) { 
        Serial.println("1+"); 
    } 
    else {
        Serial.print("clear+"); 
    } 
    delay(200);
}

a) clear+clear+1+1
b) 1+1+clear+clear
c) clear+clear+clear+clear
d) 1+1+clear+1
View Answer

Answer: a
Explanation: If the object is moving continuously towards the sensor, then within the four cycles of the given output, the first half of the set sees the object beyond the range so it will print a “clear+”, while within the second half of the code, the object has already moved inside the range of the sensor so it gives the “1+” signal.

8. If 1 means an object is detected and 0 meaning no object is detected, then considering the sensor is stationary, what can be said about the movement of the object if the output by the sensor is 111000?
a) Object is stationary
b) Object is oscillating side by side
c) Object is continuously moving away
d) Object is continuously moving closer
View Answer

Answer: c
Explanation: The only explanation for such output from the sensor would be if the object is moving in such a path, that after a few cycles, the object becomes out of range of the sensor, thus implying that it is moving away continuously from the sensor.

9. What will the output of the code be if the relative velocity between the object and the sensor is 0, and it is within the range of the sensor for the entire time both are moving?

int op = 6;
int isObstacle = HIGH;
void setup() {
    pinMode(op, INPUT);
    Serial.begin(9600);
} 
void loop() { 
    isObstacle = digitalRead(op);
    if (isObstacle == LOW) { 
        Serial.println("1+"); 
    } 
    else {
        Serial.print("clear+"); 
    } 
    delay(200);
}

a) clear+clear+1+1
b) 1+1+clear+clear
c) clear+clear+clear+clear
d) 1+1+1+1
View Answer

Answer: d
Explanation: If the relative velocity of the sensor with respect to the object is 0, then effectively it means that the object is stationary when compared to the sensor, so in that movement, since the object is within the sensor’s range, the sensor detects that the object is continuously within range hence the output will be continuously “1+”.

10. What kind of waves does the IR Sensor work on?
a) Infrared
b) Indigo
c) Ultrasonic
d) Infrasonic
View Answer

Answer: a
Explanation: The IR Sensor works on Infrared waves. These waves have a longer wavelength than visible light and are a form of electromagnetic radiation. Usually Infrared can be felt as heat when incident on humans, but the sensor’s intensity is too small to be felt usually.

Sanfoundry Global Education & Learning Series – Arduino.

To practice all areas of Arduino, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.