ARDUINO IR motion proximity detecting relay control

This tutorial will show you how to build a ARDUINO IR motion proximity detecting relay control.

click on video below for full tutorial..

 

Parts List:

ARDUINO Board

IR LED

IR Transistor

resistors

relay

bread board

jumper wires

Schematic:

ARDUINO CODE:
#define relay 6
int val;
void setup() {
Serial.begin(9600);
pinMode(relay,OUTPUT);

}

void loop() {
val=analogRead(A5);
Serial.println(val);
if (val>=55)
{
digitalWrite(relay,HIGH);
}
if (val<55)
{
digitalWrite(relay,LOW);
}
delay(1000);

}