Lesson-06 : Interfacing of IR sensor with Arduino Uno
Updated: 3 days ago
Let us start with introduction of IR sensor and then will see interfacing of IR sensor with Arduino Uno.
IR sensor:
An infrared (IR) sensor is an electronic device that measures and detects infrared radiation in its surrounding environment.
There are two types of infrared sensors:
Active IR sensor
Passive IR sensor
Active infrared sensors both emit and detect infrared radiation. Active IR sensors have two parts: a light emitting diode (LED) and a receiver. When an object comes close to the sensor, the infrared light from the LED reflects off of the object and is detected by the receiver. Active IR sensors act as proximity sensors, and they are commonly used in obstacle detection systems (such as in robots).
Interfacing IR sensor with Arduino
Components Required:
Arduino Uno with usb cable
IR sensor
Jumper wires (Male to Male (3))
Breadboard (optional)
LCD (optional)
Connections of IR sensor with Arduino is explained in steps
Connect the VCC of the IR sensor to the +5v of Arduino
Connect the GND of the IR sensor to the GND of Arduino
Connect the OUT/Signal pin to the digital pin 2 of Arduino
Pre-coding Steps: -
Define the Pin Mode in the void Setup
Define the logic in the void Loop
Functions used in this example:
pinMode(Pin_Number, IN/OUT); to set the mode i.e. input or output for example pinMode(3,OUTPUT);
digitalWrite(Pin_Number,LOW/HIGH); to set the pin as High or low for example digitalWrite(3,LOW);
digitalRead(2); to read the status
delay(microseconds) to put a time delay between two instructions. For example delay(1000) i.e. 1 sec delay
Serial.println() or Serial.print() to display the value on the serial monitor.
Thank you guys that is it in this lesson. If you want to learn more about Arduino based projects do register for IoT course provided by Nation innovation.
Recent Posts
See AllLet us now understand basics of Relay and then will move on to the interfacing part of Relay with Arduino Uno. Relay A relay is an electrically operated switch. It consists of a set of input terminals
Firstly will look into the introduction of servo motor and it's working. Then we will study how to interface this servo motor with Arduino Uno. Description of Servo motor Positional rotation servo mot
Let us first understand what is Ultrasonic sensor and why, where it is used? Then will move to interfacing part. Ultrasonic sensor As shown below the HC-SR04 Ultrasonic (US) sensor is a 4 pin module,