How Does an IR Motion Sensor Module Work?
There are only two main components of the IR sensor module: the IR transmitter section and the IR receiver section. You will get the output after signal processing and conditioning after using an IR led in the transmitter section and a photodiode in the receiver section.
Parts of the IR Motion Sensor Module
This sensor is commonly used in Arduino projects for detecting proximity or for obstacle avoidance. Due to its low power consumption, low cost, rugged design, and wide sensing range that may be trimmed to adjust sensitivity, this sensor is popular among beginners.
Three pins have been provided on this sensor, two of which are power pins, leveled VCC and GND, and the third pin is a sense/data pin, which is shown in the diagram above. We also have a sensitivity adjustment potentiometer; with that, we can adjust the device's sensitivity. Our last component is an IR Proximity Sensor Module which is composed of a photodiode and a pair of LEDs that emit IR light.
Components Required
- Arduino UNO
- IR sensor module
- LED
- 220- ohm resistor
- Breadboard
- Jumper wires
Connections from IR sensor to Arduino Uno
Source Code
int SensorPin = 10;
int LEDPin = 13;
void setup() {
pinMode(OutputPin, OUTPUT);
pinMode(SensorPin, INPUT);
Serial.begin(9600);
}
void loop() {
int SensorValue = digitalRead(SensorPin);
Serial.print("SensorPin Value: ");
Serial.println(SensorValue);
delay(1000);
if (SensorValue==LOW){ // LOW MEANS Object Detected
digitalWrite(LEDPin, HIGH);
}
else
{
digitalWrite(OutputPin, LOW);
}
}
You should see your LED turn ON, when a object comes in the range of the IR Sensor. If you cannot see the desired output, ensure the circuit has been properly assembled, and verified and uploaded the code to your board. When 'Value = 0' there is an object in front of the sensor.
Real-World Applications
- Make automated Light system that will ON presence of object in the range of IR Sensor.
- You can make smart street light using IR Sensor with Arduino.
Written by Deenadarrshan Sathiyamoorthi
Comments
Post a Comment