Introduction: Simplest Object Counter & Room Electricity Controller Using Arduino and IR Sensors

About: I am not interested to talk much keep watching.....

It is quite simplest and C00L...Object_Counter, which counts objects. which are coming inside from door into the room and going outside from the door. This is a multi-purpose project this works as a object counter as well as room electricity controller which will be use for saving electricity automatically.

Apparatus required in that project-

1-Arduino UNO

2- 2x Infrared Sensors(IR sensors)

3- 6x Jumpers

Step-1 SENSOR CONNECTION

Firstly we'll connect the 2x IR senors with arduino uno board as shown in the ISIS professional snap in which the 1st IR sensor is connected to the A1 Analog pin of arduino uno and the second one is connected through A2 pin of arduino uno board.

Step-2 LED for indication

In the second step you have to connect a led for indication, if any one enter in the room the LED glows until every one getting out from the room. so you can connect the led across 11th digital pin of arduino and GND pin.

Step-3 Coding of arduino


#define sensor1 A1//IR SENSOR -1
#define sensor2 A2//IR SENSOR -2

void setup()

{

pinMode(11,OUTPUT);// connect LED

pinMode(sensor1,INPUT);

pinMode(sensor2,INPUT);

Serial.begin(9600);

}

int count=0;

void loop()

{

const int s2=analogRead(sensor1);//TAKE INPUT FROM THE ANALOG PIN WHICH IS CONNECTED TO //SENSOR-1

const int s3=analogRead(sensor2);// " TAKE INPUT FROM THE ANALOG PIN WHICH IS CONNECTED TO //SENSORS-2

Serial.print(s2);

Serial.print(" ");

Serial.print(s3);

Serial.println();

if(s2<200)// Adjust MIN Value of sensor-1 value according to your sensors

{

delay(700); // Remain same

count++;

}

if(s3<200)// " Adjust MIN Value of sensor-2 value according to your sensors

{

count=count-1;

delay(700);

}

if(count!=0)

{

digitalWrite(11,HIGH);

}

else

{

digitalWrite(11,LOW);

}

Serial.print(" ");

Serial.print(count);

Serial.println();

}