What is IR Sensors?
A little bit of background for Infrared sensors,these are sensors that transmits infrared radiation to detect and measure the obstacles,motion and temperature on its surroundings. There are two types of infrared sensors the Active and
Passive IR.So for this tutorial i am going to teach you how to use an Active sensor, Obstacle IR Sensor.
Materials Needed
- Arduino Uno R3
- Obstacle IR Sensor (I'm Selling for 2 SBD - free shipping on Metro Manila and other provinces Only)
- Dupoint Wires M to F Wire
Obstacle IR Senor Module Operational Concepts
So basically, the operation of this sensor is first transmit signal using the Transmitter LED then when the light radiation bounce back, the receiver will received the radiation and the module will output a LOW Pulse in the Out pin.Module Pins and Other Components
For this Module there are 3 Pins available the GND,VCC and OUT pin. The VCC and GND pin is for the 5V Logic Supply of the module, and the OUT PIN is for the Sensor Output.
You will also notice that there is this potentiometer in the module, this potentiometer will be used for the calibration how near/far will the sensor sense the obstacle.
Lets place it on Arduino
Note: Out - Pin 2, VCC - 5V pin , GND - GND Pin
Lets Code it!
So we already identified and placed the pins in our arduino code now, its time for the coding.
Setup()
In line 7, Output pin was set to pinmode input and pin was defaulted to HIGH using the mode INPUT_PULLUP.
In Line 8, Serial has been initiated set to 9600. This will be used for debugging purposes.
loop()
The pin value was check timely every 1 second if the pin value was equals to low then if it is equal, arduino will transmit message "IR Detected" in our serial monitor.
Let's Test it!
So Upon blocking the IR Sensor with my hands the arudino respond with "IR Detected" on Serial monitor.
So there! that's how the IR sensor is used. BTW sorry for my bad grammar :)If you have any question,comments or suggestions(for my next How to Post), feel free to use the reply box.
Promote or Upvote will be so much appreciated! :) Follow me if you want more 3d Printing ,Programming and Electronics updates!
Thank you!