How to Make Ir Sensor Module

Hi guys i'm Manikant and today we are going to build our own ir sensor module .In this project i'm going to explain you how to make your own ir sensor and how to use it using arduino and also without arduino. I was building a line following and obstacle avoiding robot ,and i also had few ir leds lying around hence, i thought of building my own ir sensors for my project.So lets start : )

Supplies:

  • 1 x Ir transmitter ,receiver
  • 1 x 10k resister
  • 1 x 100ohm resistor
  • 1 x bc547/2n222a transistor
  • 1 x Arduino
  • visit this link to view the components required click here

Step 1: Hardware Connection:

  • connect the ir leds has given
  • Connect the anode of ir transmitter to 100 ohm resisitor
  • Connect the negative of ir receiver to 10k resistor
  • Connect both the ends of 10k and 100ohm resistor (this is the +ve pin , connect it to 5v)
  • Connect the anode and cathode of ir receiver and ir transmitter together(this is the -ve pin, connect it to ground)
  • Connect an another wire to anode of receiver (this is the signal pin)
  • You can identify the anode and cathode of led by lookind at the pins , the longer pin is anode and shorter is cathode
  • You can also identify anode and cathode by looking at the edge of led, the flat edge of led id cathode.
  • If you do not find 100 ohm resistor as i did you can use any other resistor nearer to 100 ohm.

Step 2: Obstacle Sensor Circuit Without Arduino:

obstacle sensor circuit without arduino:

Connect the components as shown in the above circuit to make obstacle sensor .

  1. Take the ir sensor which we built above , connect the signal pin of ir led to base of 2n222a/ bc547 transistor(add resistor to base if required)
  2. Connect emitter of transistor to ground and also connect gnd pin of ir sensor to ground
  3. Connect collector of transistor to cathode of led
  4. Connect the anode of led ,and ir sensor to 5v
  5. It's ready if tou place any object in front of it you can see the led glowing , you can also use buzzer instead of led for indication

Step 3: Obstacle Detector Using Arduino:

  1. Take your arduino board and ir transmitter and receiver.
  2. Connect transmitter anode to 100 ohm and to 5v and connect cathode to gnd
  3. Connect anode of receiver to cathode of transmitterConnect 10k resistor to ir receiver anode
  4. Connect both the resistor ends to 5v
  5. Connect the signal pin taken from receiver to A5 on arduino.

*Open the arduino ide and paste the code given below and upload it to the uno board.

Step 4: Code:

CODE WORKING:

  • Open serial monitor
  • You can see the values sent by the sensor
  • Now try to bring your hand near to the ir sensor
  • You will notice that the values keep on decreasing has you move your hand nearer to the ir sensor.
  • By these values you can find out how much far or the nearer is the obstacle .
  • In the next blog i'm going to make robot car using these sensors hence stay tuned until then bye :)
int inputpin = A5;

int sensor;

void setup( ) 

{

 Serial.begin(9600);

pinMode(inputpin , INPUT);

void loop()

{ sensor = analogRead(inputpin);

Serial.println(sensor);

 }
Sensors Contest

This is an entry in the
Sensors Contest

Share

    Recommendations

    • Paint Challenge

      Paint Challenge
    • Beauty Tips Contest

      Beauty Tips Contest
    • DIY Summer Camp Contest

      DIY Summer Camp Contest

    Discussions