Object Counter Using IR Sensor and Arduino
Mini Project Report
Name: Vikas R
Course: B.E. Electrical and Electronics Engineering, 3rd Year
Institution: Anna University Regional Campus Coimbatore
Abstract
This project demonstrates a basic object counter using an IR sensor and Arduino Uno. The sensor detects
objects passing in front of it and increments a counter which is displayed on a 16x2 LCD. The system can be
used in gates, production counters, or people monitoring systems.
Circuit Diagram
Working Principle
When an object passes in front of the IR sensor, it blocks the IR beam, causing a voltage drop that is
detected by the Arduino. Each detection triggers an increment in the counter, and the updated count is
displayed on the LCD. A debounce mechanism ensures reliable counting.
Page 1
Object Counter Using IR Sensor and Arduino
Applications
- Entry counting systems
- Production line object counters
- Smart attendance systems
- People monitoring in malls or offices
Appendix A: Arduino Code
#include <LiquidCrystal.h>
LiquidCrystal lcd(5, 6, 7, 8, 9, 10);
int irPin = 2;
int count = 0;
boolean state = true;
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);
pinMode(irPin, INPUT);
lcd.setCursor(0, 0);
lcd.print("Count No : ");
}
void loop() {
if (!digitalRead(irPin) && state) {
count++;
state = false;
Serial.print("Count: ");
Serial.println(count);
lcd.setCursor(12, 0);
lcd.print(count);
delay(100);
}
if (digitalRead(irPin)) {
state = true;
delay(100);
}
}
Page 2