Showing posts with label Infrared Sensor. Show all posts
Showing posts with label Infrared Sensor. Show all posts

Tuesday, May 25, 2021

Room Automation using IR Sensor

 

Automatic Light using IR Sensor

Things Required:

·         IR (Infrared) Sensor

·         5V Relay Module

·         Arduino (Uno or Nano)

·         Jumper Wires

Connections:

 


 

 

 

Code for Arduino:

int pbutton=8;

int led=3;

 

int val=0;

int ledon=0;

int pushed=0;

 

void setup()

{

  Serial.begin(9600);

  pinMode(pbutton, INPUT_PULLUP);

  pinMode(led, OUTPUT);

 

}

 

void loop()

{

  val=digitalRead(pbutton);

  if(val==HIGH && ledon==LOW)

  {

    pushed=1-pushed;

    delay(100);

  }

 

  ledon=val;

  if(pushed==HIGH)

  {

    Serial.println("led on");

    digitalWrite(led, LOW);

  }

 

  else

  {

    Serial.println("led off");

    digitalWrite(led, HIGH);

 

 

  } 

}

 

You can use this as an automatic room light.

If you are facing a problem making this, contact me at rizwanmahad606@gmail.com

Stay tuned.

Bye.

 

Tuesday, May 4, 2021

Infrared Sensor: Explained.

 



Infrared (IR) Sensor:

In this blog, I am going to explain IR sensors. First, we will see its structure, and then we will see it working. So let’s begin.

Structure:

          If you see the picture above, this is a very common type of IR sensor. There are more types as well. But this type is the main focus here.

Working of LEDs:

This sensor consists of a white LED as well as a Black Led. One LED sends signals while the other one receives them.

Range:

The range of this sensor is not very long. It is usually about 10-12 cm.

Potentiometer:

 When you see on the top of it, you will notice a blue potentiometer from which its range can be adjusted by rotating the screw-type



thing with a screwdriver.

Lights:

There are two lights next to the potentiometer. One light is to display that the module is powered on while the other is to show that this sensor is detecting something. Its working is not very difficult.

Pins:

There are three pins next to the lights. The first pin is OUT. This pin sends signals to the component connected to it. Next to it, there is a GND pin which is negative. Next to it, the VCC pic is a positive pin where we can give 5v from Arduino or any other power supply.

Scanners: Explained.

 Introduction:           If you need a copy of a document that is sitting on your table. For this, with your PC, you use your flatbed scan...