Project in progress
LDR Based Human Counter!

LDR Based Human Counter!

Count the number of people entering and leaving a room by this counter.

  • 61 views
  • 1 comment
  • 3 respects

Components and supplies

Necessary tools and machines

About this project

The mission of this project is to build an LDR based counting circuit, that counts the number of objects passing by it and also automate the room based on the count calculated using an ARDUINO.

The current project built is a prototype of the final model as it is built using Arduino and discrete components, the final build of this project is completely based on using discrete components. The total cost of implementing this project in real-time is around Six Hundred Rupees. As the price of the is significantly low, this can we widely used as a counter-based home automation system.

Two lasers are pointed on the LDR when a person walks by cutting the lasers, it happens in a sequence, this sequence of breaking the laser is detected and the count is calculated.

The circuit doesn't show any LASER. it is necessary for the count.

Code

Ldr based CounterArduino
#include <TM1637Display.h>

int F = A0;
int B = A1;
int count = 0;
int fan = 13;
int light = 12;

#define CLK 2
#define DIO 3

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   2000


TM1637Display display(CLK, DIO);

void setup() {
  Serial.begin(9600);
  pinMode(F,INPUT);
  pinMode(B,INPUT);
  pinMode(fan,OUTPUT);
  pinMode(light,OUTPUT);// put your setup code here, to run once:

}

void loop() {

  display.setBrightness(0x0f);
  Serial.print("f = ");
    Serial.println(analogRead(F));
  Serial.print("b = ");
    Serial.println(analogRead(B));
    
    if(analogRead(F)>1010)
    {
      for(int i=0;i<300;i++)
       {
          if(analogRead(B)>1010)
            {
              count++;
              Serial.println(count);
              break;
            }
        delay(1);
       }
    }

  else if(analogRead(B)>1010)
    {
      for(int i=0;i<300;i++)
       {
          if(analogRead(F)>1010)
            {
              count--;
              Serial.println(count);
              break;
            }
        delay(1);
       }
    }

    display.showNumberDec(count);
if(count>0)
    digitalWrite(light,HIGH);
else
  digitalWrite(light,LOW);


if(count<3)
      digitalWrite(fan,LOW);
    
else
      digitalWrite(fan,HIGH);
  // put your main code here, to run repeatedly:
}

Schematics

Ldr based Counter
ldr_m7hlt987DZ.ino
Ldr based Counter
2019 11 29 fmyskwsx7i

Comments

Similar projects you might like

GSM based Home Automation

Project tutorial by Team Brink.IO

  • 30,343 views
  • 51 comments
  • 67 respects

RFID and Keypad Based Door Lock Using Arduino

by Aqib

  • 14,951 views
  • 12 comments
  • 51 respects

Create a People Counter Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 7,338 views
  • 5 comments
  • 8 respects

Arduino UNO Library for a Sampling Scope & Counter

Project showcase by Veldekiaan

  • 4,993 views
  • 6 comments
  • 26 respects

Android Frequency Counter

Project tutorial by Projecter

  • 2,976 views
  • 0 comments
  • 5 respects
Add projectSign up / Login