How to interface Sensors

knk;dn
This content provide you Experience

In this content you learn how to interface sensors to an microcontrollers, Here we are using an Arduino UNO microcontroller and PIR sensor.
In the previous Blog we understood about the sensor and its types . If you didn’t read that content yet first go through that Blog then come to this content. So in this blog we are going to built a project so that you can able to easily understand the application of sensor in our day to day life and after reading this you will also be able to play with using different sensors as well because concepts used there are remains same.

Introduction:

Whenever we go to the washroom ,we often forgot to turn OFF the lights while leaving and due to this a large amount of electricity gets wasted and which shouldn’t be happen.
But now this problem can be easily sort out by using just few basic components and through basic concepts which I already had discussed in the previous videos so just go through that for once.

So basically we are going to automate our washroom in order to prevent wastage of electricity.

For this we required few components which I have mentioned here like:

So here we are gonna to perform some steps for making our project:

  • So firstly connect PIR VVC to the 5v of Arduino,
    GND to GND,
    Output pin to any GPIO pin of Arduino.
  • Now before jumping to our program lets build the basic understanding of PIR sensor and Relay module.
  • PIR sensor or passive infrared radiation sensor :
  • Basically all warm bodies radiate Infrared radiation,
    so likewise all humans and animals too have thermal energy which continuously releases Infrared radiation.
    So whenever a person or animal passes through or even comes in contact with this sensor, it can detect and check the difference
    in the level of thermal energy and generates Electric signal.
  • Once it generates signal we will read the signal with the help of our microcontroller board
    and turn ON the light but the problem is
    we can connect to get only 5V as the maximum output from our Arduino and
    with this amount of voltage we can only able to control the low power led but what if we want to control
    high voltage lights and led bulbs?
  • Also we cannot connect 220V appliances to our controller directly as
    controller will gets burst out. So in order to avoid this , we would required Relay module.
  • Basically relay module consist of two parts i.e. Input and output part.
    At the output side there is three pin namely Common , Normally open and Normally closed.
  • So here we will connect our 220V supply with external load in series with Normally open and Common terminal.
    When signal come in input terminal , electromagnet gets activated and it will make Normally open circuit to Normally close circuit because of mechanical electromagnet switch which pulls the terminal from Normally close to Normally open side.
    And due to this our load gets 220V supply to turn ON.
    So in this way we are able to control 220V appliances through 5V signal supply and this is because of using Relay module. So now you all understand the importance of this small Relay module.
  • Likewise there is also numbers of application of PIR sensor in our day to day life
    like in security system and etc.
  • Recently, as we all have gone through this corona pandemic where we
    all have seen Smart sanitizer door , so there also PIR sensor has used where we have noticed that
    whenever any person passes
    through the door, the sensor gets activated and it turns ON the Relay sanitizer mist which fall on our body.

So now lets move to Coding part. which you people find it very easy and will be able to implement it in no time😃.So let’s start…

CODE

int sen= 5;
int relay=4;
void setup() {
// put your setup code here, to run once:
pinMode(sen,INPUT);
pinMode(relay,OUTPUT);
Serial.begin(115200);
}

void loop() {
// put your main code here, to run repeatedly:
int val = digitalRead(sen);
Serial.println(val);

if (val==1)
{
digitalWrite(relay,HIGH);
Serial.println(“LED On”);
}

else
{
digitalWrite(relay,LOW);
Serial.println(“LED OFF”);
}
delay(100);
}

In this content you learn how to interface Sensors to an Microcontrollers and use to take input from these sensors.

Leave a Comment

Your email address will not be published. Required fields are marked *

Related post