IR Sensor by Using LED For Arduino
IR Sensor by Using LED For Arduino
IR Sensor by Using LED For Arduino
ELECTIVE I
ASSIGNMENT NO: 01
Outcomes:
Theory:
Introduction To Arduino
Arduino is an open-source platform used for building electronics projects. Arduino consists of both a
physical programmable circuit board (often referred to as a microcontroller) and a piece of software,
or IDE (Integrated Development Environment) that runs on your computer, used to write and upload
computer code to the physical board. Accepts analog and digital signals as input and gives desired
output.
LED
Device ATmega328 Pin Arduino Pin Description
LED1 PB2 10 Common Cathode
LED
LED2 PB3 11 Common Cathode
LED
LED3 PB4 12 Common Cathode
LED
LED4 PB5 13 Common Cathode
LED
IR Sensor
An infrared proximity sensor or IR Sensor is an electronic device that emits infrared lights to
sense some aspect of the surroundings and can be employed to detect the motion of an object. As
this is a passive sensor, it can only measure infrared radiation.
Features of IR sensor
Consisting of three pins, a potentiometer, and two LEDs, the IR sensor is an electronic device
that emits radiations in order to get a sense of the surrounding. IR sensor has the capability to
measure the heat of the object and can also detect motion. Such types of sensors that get the
sense of the surrounding by only detecting/receiving or absorbing IR radiations rather than
emitting IR radiations are passive IR sensors.
The human eye cannot detect IR radiations but to IR sensor these radiations are visible. At the
end of the module, there are two LEDs. One is RED led which performs the function of the
emitter and the other one is photodiode which works as a receiver. The emitter emits infrared
radiations which after hitting some object receives by the detector photodiode is sensitive only to
the radiations of the infrared region. When the emitted IR radiations fall on the photodiode, it
produces resistance and voltage which is in proportion to the radiations fell upon.
IR Sensor Pinout
The IR sensor has a 3-pin connector that interfaces it to the outside world. The connections are as follows:
VCC is the power supply pin for the IR sensor which we connect to the 5V pin on the Arduino.
OUT pin is a 5V TTL logic output. LOW indicates no motion is detected; HIGH means motion is detected.
GND Should be connected to the ground of the Arduino.
This sensor has three pins two of which are power pins leveled VCC and GND and the other one is the
sense/data pin which is shown in the diagram above. It has an onboard power LED and a signal LED the power
LED turns on when power is applied to the board the signal LED turns on when the circuit is triggered. This
board also has a comparator Op-amp that is responsible for converting the incoming analog signal from the
photodiode to a digital signal. We also have a sensitivity adjustment potentiometer; with that, we can adjust the
sensitivity of the device. Last and finally, we have the photodiode and the IR emitting LED pair which all
together make the total IR Proximity Sensor Module.
Program
Write down code which we have implemented in practical and paste screenshot which we have done
in practical.
Input/Output Functions:
The arduino pins can be configured to act as input or output pins using the pinMode() function
Void setup ()
{
pinMode (pin , mode);
}
Pin- pin number on the Arduino board Mode- INPUT/OUTPUT
digitalWrite() : Writes a HIGH or LOW value to a digital pin
analogRead() : Reads from the analog input pin i.e., voltage applied across the pin
Character functions such as isdigit(), isalpha(), isalnum(), isxdigit(), islower(), isupper(), isspace()
return 1(true) or 0(false)
Delay() function is one of the most common time manipulation function used to provide a delay of
specified time. It accepts integer value (time in miliseconds)
Program
Write down code which we have implemented in practical and paste screenshot which we have done
in practical.