Skip to main content

Featured

RELAY

RELAY A relay is like a switch that can be controlled electronically. Relays are very simple devices and can be used to control devices with higher loads(Like AC controlled devices and devices that require heavy voltages to operate). Relay modules can be used mainly in IOT projects and home automation. Relays can be used to make useful hobby projects.  A two channel relay. *Dealing with high voltages may cause injuries or even death, please use relays with utmost care. Working of Relays. Relays work like electromagnets, when a voltage is applied the coil,  the coil gets charged and acts like an electromagnet and moves the switch to the desired position. In simple terms, relays act as magnets when a signal is applied or removed. Basic circuit of a relay Connections. +5V of Arduino-  5V of relay module. GND of Arduino- GND of relay module. Pin no. 8 of Arduino- In1 of relay module. Basic connection of a relay module CODE void setup() { pinMode(8, OUTPUT); } void loop() { digitalWrite(8,

PIR SENSOR, EVERYTHING A BEGINNER NEEDS TO KNOW.

PIR Sensor

PIR sensor basically means passive infrared sensor i.e. Detector of infrared radiation. We can use a PIR sensor in various ways. Most of the hall sensors and motion detectors use these type of sensors.
These sensors have various applications, they are used in security devices, alarm systems, motion sensing lights, IOT, and many more such devices. The basic working principle of the sensor is to map the change in IR radiation recieved and put it in useful numbers. Note that we use analog inputs in this sensor for finer details.
 Today I will be showing you a simple project on using this sensor during your quarantine😄.
Standard PIR sensor.


How does it work?

A PIR sensor can be broken down in three fundamental blocks
1. The Fresnel lens.
2.The BISS0001 IC.
3.The PIR sensing transistor(Pyroelectric sensing transistor).

The Fresnel lens

This is a converging lens but has a special quality to converge all the infrared radiations to the opening on the PIR sensing transistor's window.
The Fresnel lens.

The BISS0001 IC

This IC is a cheap and effective decoder IC. It helps us decode the signals from the pyroelectric sensing device, following is an link to the data sheet of PIR sensor and the pinout of the IC.
👇


BISS001 IC 

PIR sensing device

This device works on accepting passive infrared signals and checking if there is a change in the infrared signals applied. It basically has two windows to do the job. The fist window checks if there's an Ir signal emitter and the second one checks if there have been any changes or fluctuations in the IR signal transferred. So, the first window produces a positive voltage change if it detects IR and the second window creates a negative change if it detects any IR emitter.(emitter can be human or animal or anything that leaves heat signatures).
Pyroelectric sensor.

Basic working of the pyroelectric sensor.

Connections

*Pro-tip: place sensor as shown in the image below before connecting.


Basic layout of PIR sensor HC-SR051.
1. +5V of PIR sensor to 3.3V of Arduino.
2. Ground(GND) to GND of Arduino.
3. Digital Out to PIN number 13 on Arduino.
4. Longer end of active Piezo  to pin 12.
5. Shorter end of active Piezo to GND pin.

Code

#include <Servo.h>
int sensor = 13;
int state = LOW;
int val = 0;
void setup() {
pinMode(sensor, INPUT);
pinMode(12,OUTPUT);
Serial.begin(9600);
}
void loop()
{
val = digitalRead(sensor);
if (val == HIGH)
{
if (state == LOW)
{
Serial.println("Motion detected!");
state = HIGH;
for(int i=0;i&lt;10;i++)
{
digitalWrite(12,HIGH);
delay(100);
digitalWrite(12,LOW);
delay(100);
delay(200);
}
for(int j=0;j&lt;10;j++)
{
digitalWrite(12,HIGH);
delay(100);
digitalWrite(12,LOW);
delay(100);

delay(100);
}
digitalWrite(12,HIGH);
delay(2000);
}
}
else {
if (state == HIGH){
Serial.println("Motion stopped");
state = LOW;
digitalWrite(12,LOW);
}
}
}
NOTE: We can use the sensor in always active or always dormant mode, We have used it in always dormant mode.

Comments

Popular Posts